Files
gnommoplayer/dist/vendor/glitch/glitch_gallery/assets/index-CEeZxcxj.js
T
2026-04-11 09:21:22 +02:00

4032 lines
1.1 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B1PtMIUq.js","assets/index-DOIp2aoq.css","assets/index-CMvlyyxu.js","assets/index-Bdi24PkQ.css","assets/index-CwQ-ysLn.js","assets/index-BoeEa7xH.css","assets/index-CRhmqMwz.js","assets/index-B7Erow2S.css","assets/index-BOUPxVBe.js","assets/index-WVFKiT6G.css","assets/index-DOdpM0HQ.js","assets/index-hWn6tbl7.css","assets/index-MgCr_Urj.js","assets/index-D0SeHWP2.css","assets/index-Be41ZfS7.js","assets/index-C2PFO5cD.css","assets/index-DnqmHVBx.js","assets/index-mpZwhQDb.css"])))=>i.map(i=>d[i]);
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).observe(document,{childList:!0,subtree:!0});function t(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function n(s){if(s.ep)return;s.ep=!0;const u=t(s);fetch(s.href,u)}})();function py(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var I_={exports:{}},Lp={};var jS;function $A(){if(jS)return Lp;jS=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,s,u){var f=null;if(u!==void 0&&(f=""+u),s.key!==void 0&&(f=""+s.key),"key"in s){u={};for(var h in s)h!=="key"&&(u[h]=s[h])}else u=s;return s=u.ref,{$$typeof:r,type:n,key:f,ref:s!==void 0?s:null,props:u}}return Lp.Fragment=e,Lp.jsx=t,Lp.jsxs=t,Lp}var YS;function ew(){return YS||(YS=1,I_.exports=$A()),I_.exports}var he=ew(),O_={exports:{}},Up={},P_={exports:{}},z_={};var ZS;function tw(){return ZS||(ZS=1,(function(r){function e(Y,q){var ne=Y.length;Y.push(q);e:for(;0<ne;){var be=ne-1>>>1,Ne=Y[be];if(0<s(Ne,q))Y[be]=q,Y[ne]=Ne,ne=be;else break e}}function t(Y){return Y.length===0?null:Y[0]}function n(Y){if(Y.length===0)return null;var q=Y[0],ne=Y.pop();if(ne!==q){Y[0]=ne;e:for(var be=0,Ne=Y.length,X=Ne>>>1;be<X;){var oe=2*(be+1)-1,Ae=Y[oe],Fe=oe+1,lt=Y[Fe];if(0>s(Ae,ne))Fe<Ne&&0>s(lt,Ae)?(Y[be]=lt,Y[Fe]=ne,be=Fe):(Y[be]=Ae,Y[oe]=ne,be=oe);else if(Fe<Ne&&0>s(lt,ne))Y[be]=lt,Y[Fe]=ne,be=Fe;else break e}}return q}function s(Y,q){var ne=Y.sortIndex-q.sortIndex;return ne!==0?ne:Y.id-q.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;r.unstable_now=function(){return u.now()}}else{var f=Date,h=f.now();r.unstable_now=function(){return f.now()-h}}var m=[],g=[],_=1,x=null,b=3,M=!1,A=!1,R=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function U(Y){for(var q=t(g);q!==null;){if(q.callback===null)n(g);else if(q.startTime<=Y)n(g),q.sortIndex=q.expirationTime,e(m,q);else break;q=t(g)}}function B(Y){if(R=!1,U(Y),!A)if(t(m)!==null)A=!0,z||(z=!0,se());else{var q=t(g);q!==null&&pe(B,q.startTime-Y)}}var z=!1,H=-1,W=5,I=-1;function P(){return w?!0:!(r.unstable_now()-I<W)}function Z(){if(w=!1,z){var Y=r.unstable_now();I=Y;var q=!0;try{e:{A=!1,R&&(R=!1,N(H),H=-1),M=!0;var ne=b;try{t:{for(U(Y),x=t(m);x!==null&&!(x.expirationTime>Y&&P());){var be=x.callback;if(typeof be=="function"){x.callback=null,b=x.priorityLevel;var Ne=be(x.expirationTime<=Y);if(Y=r.unstable_now(),typeof Ne=="function"){x.callback=Ne,U(Y),q=!0;break t}x===t(m)&&n(m),U(Y)}else n(m);x=t(m)}if(x!==null)q=!0;else{var X=t(g);X!==null&&pe(B,X.startTime-Y),q=!1}}break e}finally{x=null,b=ne,M=!1}q=void 0}}finally{q?se():z=!1}}}var se;if(typeof D=="function")se=function(){D(Z)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,fe=te.port2;te.port1.onmessage=Z,se=function(){fe.postMessage(null)}}else se=function(){E(Z,0)};function pe(Y,q){H=E(function(){Y(r.unstable_now())},q)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return b},r.unstable_next=function(Y){switch(b){case 1:case 2:case 3:var q=3;break;default:q=b}var ne=b;b=q;try{return Y()}finally{b=ne}},r.unstable_requestPaint=function(){w=!0},r.unstable_runWithPriority=function(Y,q){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ne=b;b=Y;try{return q()}finally{b=ne}},r.unstable_scheduleCallback=function(Y,q,ne){var be=r.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?be+ne:be):ne=be,Y){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=ne+Ne,Y={id:_++,callback:q,priorityLevel:Y,startTime:ne,expirationTime:Ne,sortIndex:-1},ne>be?(Y.sortIndex=ne,e(g,Y),t(m)===null&&Y===t(g)&&(R?(N(H),H=-1):R=!0,pe(B,ne-be))):(Y.sortIndex=Ne,e(m,Y),A||M||(A=!0,z||(z=!0,se()))),Y},r.unstable_shouldYield=P,r.unstable_wrapCallback=function(Y){var q=b;return function(){var ne=b;b=q;try{return Y.apply(this,arguments)}finally{b=ne}}}})(z_)),z_}var QS;function nE(){return QS||(QS=1,P_.exports=tw()),P_.exports}var B_={exports:{}},Qt={};var KS;function nw(){if(KS)return Qt;KS=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function M(X){return X===null||typeof X!="object"?null:(X=b&&X[b]||X["@@iterator"],typeof X=="function"?X:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,w={};function E(X,oe,Ae){this.props=X,this.context=oe,this.refs=w,this.updater=Ae||A}E.prototype.isReactComponent={},E.prototype.setState=function(X,oe){if(typeof X!="object"&&typeof X!="function"&&X!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,oe,"setState")},E.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function N(){}N.prototype=E.prototype;function D(X,oe,Ae){this.props=X,this.context=oe,this.refs=w,this.updater=Ae||A}var U=D.prototype=new N;U.constructor=D,R(U,E.prototype),U.isPureReactComponent=!0;var B=Array.isArray;function z(){}var H={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function I(X,oe,Ae){var Fe=Ae.ref;return{$$typeof:r,type:X,key:oe,ref:Fe!==void 0?Fe:null,props:Ae}}function P(X,oe){return I(X.type,oe,X.props)}function Z(X){return typeof X=="object"&&X!==null&&X.$$typeof===r}function se(X){var oe={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(Ae){return oe[Ae]})}var te=/\/+/g;function fe(X,oe){return typeof X=="object"&&X!==null&&X.key!=null?se(""+X.key):oe.toString(36)}function pe(X){switch(X.status){case"fulfilled":return X.value;case"rejected":throw X.reason;default:switch(typeof X.status=="string"?X.then(z,z):(X.status="pending",X.then(function(oe){X.status==="pending"&&(X.status="fulfilled",X.value=oe)},function(oe){X.status==="pending"&&(X.status="rejected",X.reason=oe)})),X.status){case"fulfilled":return X.value;case"rejected":throw X.reason}}throw X}function Y(X,oe,Ae,Fe,lt){var de=typeof X;(de==="undefined"||de==="boolean")&&(X=null);var Re=!1;if(X===null)Re=!0;else switch(de){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(X.$$typeof){case r:case e:Re=!0;break;case _:return Re=X._init,Y(Re(X._payload),oe,Ae,Fe,lt)}}if(Re)return lt=lt(X),Re=Fe===""?"."+fe(X,0):Fe,B(lt)?(Ae="",Re!=null&&(Ae=Re.replace(te,"$&/")+"/"),Y(lt,oe,Ae,"",function(ht){return ht})):lt!=null&&(Z(lt)&&(lt=P(lt,Ae+(lt.key==null||X&&X.key===lt.key?"":(""+lt.key).replace(te,"$&/")+"/")+Re)),oe.push(lt)),1;Re=0;var tt=Fe===""?".":Fe+":";if(B(X))for(var st=0;st<X.length;st++)Fe=X[st],de=tt+fe(Fe,st),Re+=Y(Fe,oe,Ae,de,lt);else if(st=M(X),typeof st=="function")for(X=st.call(X),st=0;!(Fe=X.next()).done;)Fe=Fe.value,de=tt+fe(Fe,st++),Re+=Y(Fe,oe,Ae,de,lt);else if(de==="object"){if(typeof X.then=="function")return Y(pe(X),oe,Ae,Fe,lt);throw oe=String(X),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(X).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return Re}function q(X,oe,Ae){if(X==null)return X;var Fe=[],lt=0;return Y(X,Fe,"","",function(de){return oe.call(Ae,de,lt++)}),Fe}function ne(X){if(X._status===-1){var oe=X._result;oe=oe(),oe.then(function(Ae){(X._status===0||X._status===-1)&&(X._status=1,X._result=Ae)},function(Ae){(X._status===0||X._status===-1)&&(X._status=2,X._result=Ae)}),X._status===-1&&(X._status=0,X._result=oe)}if(X._status===1)return X._result.default;throw X._result}var be=typeof reportError=="function"?reportError:function(X){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var oe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof X=="object"&&X!==null&&typeof X.message=="string"?String(X.message):String(X),error:X});if(!window.dispatchEvent(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",X);return}console.error(X)},Ne={map:q,forEach:function(X,oe,Ae){q(X,function(){oe.apply(this,arguments)},Ae)},count:function(X){var oe=0;return q(X,function(){oe++}),oe},toArray:function(X){return q(X,function(oe){return oe})||[]},only:function(X){if(!Z(X))throw Error("React.Children.only expected to receive a single React element child.");return X}};return Qt.Activity=x,Qt.Children=Ne,Qt.Component=E,Qt.Fragment=t,Qt.Profiler=s,Qt.PureComponent=D,Qt.StrictMode=n,Qt.Suspense=m,Qt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,Qt.__COMPILER_RUNTIME={__proto__:null,c:function(X){return H.H.useMemoCache(X)}},Qt.cache=function(X){return function(){return X.apply(null,arguments)}},Qt.cacheSignal=function(){return null},Qt.cloneElement=function(X,oe,Ae){if(X==null)throw Error("The argument must be a React element, but you passed "+X+".");var Fe=R({},X.props),lt=X.key;if(oe!=null)for(de in oe.key!==void 0&&(lt=""+oe.key),oe)!W.call(oe,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&oe.ref===void 0||(Fe[de]=oe[de]);var de=arguments.length-2;if(de===1)Fe.children=Ae;else if(1<de){for(var Re=Array(de),tt=0;tt<de;tt++)Re[tt]=arguments[tt+2];Fe.children=Re}return I(X.type,lt,Fe)},Qt.createContext=function(X){return X={$$typeof:f,_currentValue:X,_currentValue2:X,_threadCount:0,Provider:null,Consumer:null},X.Provider=X,X.Consumer={$$typeof:u,_context:X},X},Qt.createElement=function(X,oe,Ae){var Fe,lt={},de=null;if(oe!=null)for(Fe in oe.key!==void 0&&(de=""+oe.key),oe)W.call(oe,Fe)&&Fe!=="key"&&Fe!=="__self"&&Fe!=="__source"&&(lt[Fe]=oe[Fe]);var Re=arguments.length-2;if(Re===1)lt.children=Ae;else if(1<Re){for(var tt=Array(Re),st=0;st<Re;st++)tt[st]=arguments[st+2];lt.children=tt}if(X&&X.defaultProps)for(Fe in Re=X.defaultProps,Re)lt[Fe]===void 0&&(lt[Fe]=Re[Fe]);return I(X,de,lt)},Qt.createRef=function(){return{current:null}},Qt.forwardRef=function(X){return{$$typeof:h,render:X}},Qt.isValidElement=Z,Qt.lazy=function(X){return{$$typeof:_,_payload:{_status:-1,_result:X},_init:ne}},Qt.memo=function(X,oe){return{$$typeof:g,type:X,compare:oe===void 0?null:oe}},Qt.startTransition=function(X){var oe=H.T,Ae={};H.T=Ae;try{var Fe=X(),lt=H.S;lt!==null&&lt(Ae,Fe),typeof Fe=="object"&&Fe!==null&&typeof Fe.then=="function"&&Fe.then(z,be)}catch(de){be(de)}finally{oe!==null&&Ae.types!==null&&(oe.types=Ae.types),H.T=oe}},Qt.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},Qt.use=function(X){return H.H.use(X)},Qt.useActionState=function(X,oe,Ae){return H.H.useActionState(X,oe,Ae)},Qt.useCallback=function(X,oe){return H.H.useCallback(X,oe)},Qt.useContext=function(X){return H.H.useContext(X)},Qt.useDebugValue=function(){},Qt.useDeferredValue=function(X,oe){return H.H.useDeferredValue(X,oe)},Qt.useEffect=function(X,oe){return H.H.useEffect(X,oe)},Qt.useEffectEvent=function(X){return H.H.useEffectEvent(X)},Qt.useId=function(){return H.H.useId()},Qt.useImperativeHandle=function(X,oe,Ae){return H.H.useImperativeHandle(X,oe,Ae)},Qt.useInsertionEffect=function(X,oe){return H.H.useInsertionEffect(X,oe)},Qt.useLayoutEffect=function(X,oe){return H.H.useLayoutEffect(X,oe)},Qt.useMemo=function(X,oe){return H.H.useMemo(X,oe)},Qt.useOptimistic=function(X,oe){return H.H.useOptimistic(X,oe)},Qt.useReducer=function(X,oe,Ae){return H.H.useReducer(X,oe,Ae)},Qt.useRef=function(X){return H.H.useRef(X)},Qt.useState=function(X){return H.H.useState(X)},Qt.useSyncExternalStore=function(X,oe,Ae){return H.H.useSyncExternalStore(X,oe,Ae)},Qt.useTransition=function(){return H.H.useTransition()},Qt.version="19.2.4",Qt}var JS;function Tm(){return JS||(JS=1,B_.exports=nw()),B_.exports}var F_={exports:{}},Na={};var $S;function iw(){if($S)return Na;$S=1;var r=Tm();function e(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)g+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var n={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},s=Symbol.for("react.portal");function u(m,g,_){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:x==null?null:""+x,children:m,containerInfo:g,implementation:_}}var f=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Na.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Na.createPortal=function(m,g){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return u(m,g,null,_)},Na.flushSync=function(m){var g=f.T,_=n.p;try{if(f.T=null,n.p=2,m)return m()}finally{f.T=g,n.p=_,n.d.f()}},Na.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,n.d.C(m,g))},Na.prefetchDNS=function(m){typeof m=="string"&&n.d.D(m)},Na.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var _=g.as,x=h(_,g.crossOrigin),b=typeof g.integrity=="string"?g.integrity:void 0,M=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;_==="style"?n.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:M}):_==="script"&&n.d.X(m,{crossOrigin:x,integrity:b,fetchPriority:M,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Na.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var _=h(g.as,g.crossOrigin);n.d.M(m,{crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&n.d.M(m)},Na.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var _=g.as,x=h(_,g.crossOrigin);n.d.L(m,_,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Na.preloadModule=function(m,g){if(typeof m=="string")if(g){var _=h(g.as,g.crossOrigin);n.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else n.d.m(m)},Na.requestFormReset=function(m){n.d.r(m)},Na.unstable_batchedUpdates=function(m,g){return m(g)},Na.useFormState=function(m,g,_){return f.H.useFormState(m,g,_)},Na.useFormStatus=function(){return f.H.useHostTransitionStatus()},Na.version="19.2.4",Na}var eM;function aw(){if(eM)return F_.exports;eM=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),F_.exports=iw(),F_.exports}var tM;function sw(){if(tM)return Up;tM=1;var r=nE(),e=Tm(),t=aw();function n(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function u(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function f(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function h(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function m(i){if(u(i)!==i)throw Error(n(188))}function g(i){var a=i.alternate;if(!a){if(a=u(i),a===null)throw Error(n(188));return a!==i?null:i}for(var c=i,d=a;;){var y=c.return;if(y===null)break;var S=y.alternate;if(S===null){if(d=y.return,d!==null){c=d;continue}break}if(y.child===S.child){for(S=y.child;S;){if(S===c)return m(y),i;if(S===d)return m(y),a;S=S.sibling}throw Error(n(188))}if(c.return!==d.return)c=y,d=S;else{for(var L=!1,V=y.child;V;){if(V===c){L=!0,c=y,d=S;break}if(V===d){L=!0,d=y,c=S;break}V=V.sibling}if(!L){for(V=S.child;V;){if(V===c){L=!0,c=S,d=y;break}if(V===d){L=!0,d=S,c=y;break}V=V.sibling}if(!L)throw Error(n(189))}}if(c.alternate!==d)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?i:a}function _(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=_(i),a!==null)return a;i=i.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),D=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function se(i){return i===null||typeof i!="object"?null:(i=Z&&i[Z]||i["@@iterator"],typeof i=="function"?i:null)}var te=Symbol.for("react.client.reference");function fe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===te?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case R:return"Fragment";case E:return"Profiler";case w:return"StrictMode";case B:return"Suspense";case z:return"SuspenseList";case I:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case A:return"Portal";case D:return i.displayName||"Context";case N:return(i._context.displayName||"Context")+".Consumer";case U:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case H:return a=i.displayName||null,a!==null?a:fe(i.type)||"Memo";case W:a=i._payload,i=i._init;try{return fe(i(a))}catch{}}return null}var pe=Array.isArray,Y=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},be=[],Ne=-1;function X(i){return{current:i}}function oe(i){0>Ne||(i.current=be[Ne],be[Ne]=null,Ne--)}function Ae(i,a){Ne++,be[Ne]=i.current,i.current=a}var Fe=X(null),lt=X(null),de=X(null),Re=X(null);function tt(i,a){switch(Ae(de,a),Ae(lt,i),Ae(Fe,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?gS(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=gS(a),i=vS(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}oe(Fe),Ae(Fe,i)}function st(){oe(Fe),oe(lt),oe(de)}function ht(i){i.memoizedState!==null&&Ae(Re,i);var a=Fe.current,c=vS(a,i.type);a!==c&&(Ae(lt,i),Ae(Fe,c))}function jt(i){lt.current===i&&(oe(Fe),oe(lt)),Re.current===i&&(oe(Re),Cp._currentValue=ne)}var tn,Nt;function Le(i){if(tn===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);tn=a&&a[1]||"",Nt=-1<c.stack.indexOf(`
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
`+tn+i+Nt}var He=!1;function Oe(i,a){if(!i||He)return"";He=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var Be=function(){throw Error()};if(Object.defineProperty(Be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Be,[])}catch(Ce){var xe=Ce}Reflect.construct(i,[],Be)}else{try{Be.call()}catch(Ce){xe=Ce}i.call(Be.prototype)}}else{try{throw Error()}catch(Ce){xe=Ce}(Be=i())&&typeof Be.catch=="function"&&Be.catch(function(){})}}catch(Ce){if(Ce&&xe&&typeof Ce.stack=="string")return[Ce.stack,xe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=d.DetermineComponentFrameRoot(),L=S[0],V=S[1];if(L&&V){var $=L.split(`
`),ve=V.split(`
`);for(y=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ve.length&&!ve[y].includes("DetermineComponentFrameRoot");)y++;if(d===$.length||y===ve.length)for(d=$.length-1,y=ve.length-1;1<=d&&0<=y&&$[d]!==ve[y];)y--;for(;1<=d&&0<=y;d--,y--)if($[d]!==ve[y]){if(d!==1||y!==1)do if(d--,y--,0>y||$[d]!==ve[y]){var De=`
`+$[d].replace(" at new "," at ");return i.displayName&&De.includes("<anonymous>")&&(De=De.replace("<anonymous>",i.displayName)),De}while(1<=d&&0<=y);break}}}finally{He=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Le(c):""}function nt(i,a){switch(i.tag){case 26:case 27:case 5:return Le(i.type);case 16:return Le("Lazy");case 13:return i.child!==a&&a!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return Oe(i.type,!1);case 11:return Oe(i.type.render,!1);case 1:return Oe(i.type,!0);case 31:return Le("Activity");default:return""}}function Q(i){try{var a="",c=null;do a+=nt(i,c),c=i,i=i.return;while(i);return a}catch(d){return`
Error generating stack: `+d.message+`
`+d.stack}}var Et=Object.prototype.hasOwnProperty,ot=r.unstable_scheduleCallback,Tt=r.unstable_cancelCallback,Qe=r.unstable_shouldYield,G=r.unstable_requestPaint,O=r.unstable_now,ae=r.unstable_getCurrentPriorityLevel,Te=r.unstable_ImmediatePriority,Ie=r.unstable_UserBlockingPriority,Ee=r.unstable_NormalPriority,dt=r.unstable_LowPriority,Ke=r.unstable_IdlePriority,vt=r.log,Dt=r.unstable_setDisableYieldValue,Ve=null,Ze=null;function ct(i){if(typeof vt=="function"&&Dt(i),Ze&&typeof Ze.setStrictMode=="function")try{Ze.setStrictMode(Ve,i)}catch{}}var K=Math.clz32?Math.clz32:J,me=Math.log,et=Math.LN2;function J(i){return i>>>=0,i===0?32:31-(me(i)/et|0)|0}var je=256,Ge=262144,at=4194304;function Xe(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Ue(i,a,c){var d=i.pendingLanes;if(d===0)return 0;var y=0,S=i.suspendedLanes,L=i.pingedLanes;i=i.warmLanes;var V=d&134217727;return V!==0?(d=V&~S,d!==0?y=Xe(d):(L&=V,L!==0?y=Xe(L):c||(c=V&~i,c!==0&&(y=Xe(c))))):(V=d&~S,V!==0?y=Xe(V):L!==0?y=Xe(L):c||(c=d&~i,c!==0&&(y=Xe(c)))),y===0?0:a!==0&&a!==y&&(a&S)===0&&(S=y&-y,c=a&-a,S>=c||S===32&&(c&4194048)!==0)?a:y}function Ye(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function Ct(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Jt(){var i=at;return at<<=1,(at&62914560)===0&&(at=4194304),i}function nn(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Jn(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Ci(i,a,c,d,y,S){var L=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var V=i.entanglements,$=i.expirationTimes,ve=i.hiddenUpdates;for(c=L&~c;0<c;){var De=31-K(c),Be=1<<De;V[De]=0,$[De]=-1;var xe=ve[De];if(xe!==null)for(ve[De]=null,De=0;De<xe.length;De++){var Ce=xe[De];Ce!==null&&(Ce.lane&=-536870913)}c&=~Be}d!==0&&Qr(i,d,0),S!==0&&y===0&&i.tag!==0&&(i.suspendedLanes|=S&~(L&~a))}function Qr(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var d=31-K(a);i.entangledLanes|=a,i.entanglements[d]=i.entanglements[d]|1073741824|c&261930}function Kr(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var d=31-K(c),y=1<<d;y&a|i[d]&a&&(i[d]|=a),c&=~y}}function Ho(i,a){var c=a&-a;return c=(c&42)!==0?1:Jr(c),(c&(i.suspendedLanes|a))!==0?0:c}function Jr(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function xr(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Go(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:kS(i.type))}function na(i,a){var c=q.p;try{return q.p=i,a()}finally{q.p=c}}var Fa=Math.random().toString(36).slice(2),$n="__reactFiber$"+Fa,Ri="__reactProps$"+Fa,ka="__reactContainer$"+Fa,Va="__reactEvents$"+Fa,Ha="__reactListeners$"+Fa,$r="__reactHandles$"+Fa,Xo="__reactResources$"+Fa,Ds="__reactMarker$"+Fa;function br(i){delete i[$n],delete i[Ri],delete i[Va],delete i[Ha],delete i[$r]}function Sr(i){var a=i[$n];if(a)return a;for(var c=i.parentNode;c;){if(a=c[ka]||c[$n]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=ES(i);i!==null;){if(c=i[$n])return c;i=ES(i)}return a}i=c,c=i.parentNode}return null}function Mr(i){if(i=i[$n]||i[ka]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function eo(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(n(33))}function Xs(i){var a=i[Xo];return a||(a=i[Xo]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function k(i){i[Ds]=!0}var re=new Set,Se={};function ye(i,a){ue(i,a),ue(i+"Capture",a)}function ue(i,a){for(Se[i]=a,i=0;i<a.length;i++)re.add(a[i])}var Je=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),mt={},qe={};function _t(i){return Et.call(qe,i)?!0:Et.call(mt,i)?!1:Je.test(i)?qe[i]=!0:(mt[i]=!0,!1)}function xt(i,a,c){if(_t(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function Lt(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function St(i,a,c,d){if(d===null)i.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+d)}}function Pt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Mn(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Bn(i,a,c){var d=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,S=d.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return y.call(this)},set:function(L){c=""+L,S.call(this,L)}}),Object.defineProperty(i,a,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(L){c=""+L},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function In(i){if(!i._valueTracker){var a=Mn(i)?"checked":"value";i._valueTracker=Bn(i,a,""+i[a])}}function Wt(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),d="";return i&&(d=Mn(i)?i.checked?"true":"false":i.value),i=d,i!==c?(a.setValue(i),!0):!1}function ut(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var _n=/[\n"\\]/g;function Ft(i){return i.replace(_n,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function xi(i,a,c,d,y,S,L,V){i.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?i.type=L:i.removeAttribute("type"),a!=null?L==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+Pt(a)):i.value!==""+Pt(a)&&(i.value=""+Pt(a)):L!=="submit"&&L!=="reset"||i.removeAttribute("value"),a!=null?Wn(i,L,Pt(a)):c!=null?Wn(i,L,Pt(c)):d!=null&&i.removeAttribute("value"),y==null&&S!=null&&(i.defaultChecked=!!S),y!=null&&(i.checked=y&&typeof y!="function"&&typeof y!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?i.name=""+Pt(V):i.removeAttribute("name")}function Ls(i,a,c,d,y,S,L,V){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(i.type=S),a!=null||c!=null){if(!(S!=="submit"&&S!=="reset"||a!=null)){In(i);return}c=c!=null?""+Pt(c):"",a=a!=null?""+Pt(a):c,V||a===i.value||(i.value=a),i.defaultValue=a}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,i.checked=V?i.checked:!!d,i.defaultChecked=!!d,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(i.name=L),In(i)}function Wn(i,a,c){a==="number"&&ut(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function la(i,a,c,d){if(i=i.options,a){a={};for(var y=0;y<c.length;y++)a["$"+c[y]]=!0;for(c=0;c<i.length;c++)y=a.hasOwnProperty("$"+i[c].value),i[c].selected!==y&&(i[c].selected=y),y&&d&&(i[c].defaultSelected=!0)}else{for(c=""+Pt(c),a=null,y=0;y<i.length;y++){if(i[y].value===c){i[y].selected=!0,d&&(i[y].defaultSelected=!0);return}a!==null||i[y].disabled||(a=i[y])}a!==null&&(a.selected=!0)}}function An(i,a,c){if(a!=null&&(a=""+Pt(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+Pt(c):""}function Ni(i,a,c,d){if(a==null){if(d!=null){if(c!=null)throw Error(n(92));if(pe(d)){if(1<d.length)throw Error(n(93));d=d[0]}c=d}c==null&&(c=""),a=c}c=Pt(a),i.defaultValue=c,d=i.textContent,d===c&&d!==""&&d!==null&&(i.value=d),In(i)}function bi(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var Fi=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ki(i,a,c){var d=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":d?i.setProperty(a,c):typeof c!="number"||c===0||Fi.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function Wo(i,a,c){if(a!=null&&typeof a!="object")throw Error(n(62));if(i=i.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?i.setProperty(d,""):d==="float"?i.cssFloat="":i[d]="");for(var y in a)d=a[y],a.hasOwnProperty(y)&&c[y]!==d&&ki(i,y,d)}else for(var S in a)a.hasOwnProperty(S)&&ki(i,S,a[S])}function rs(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Pm=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ld=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xu(i){return ld.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Er(){}var ff=null;function hf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var qo=null,to=null;function ud(i){var a=Mr(i);if(a&&(i=a.stateNode)){var c=i[Ri]||null;e:switch(i=a.stateNode,a.type){case"input":if(xi(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Ft(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var d=c[a];if(d!==i&&d.form===i.form){var y=d[Ri]||null;if(!y)throw Error(n(90));xi(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<c.length;a++)d=c[a],d.form===i.form&&Wt(d)}break e;case"textarea":An(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&la(i,!!c.multiple,a,!1)}}}var df=!1;function cd(i,a,c){if(df)return i(a,c);df=!0;try{var d=i(a);return d}finally{if(df=!1,(qo!==null||to!==null)&&(zs(),qo&&(a=qo,i=to,to=qo=null,ud(a),i)))for(a=0;a<i.length;a++)ud(i[a])}}function Il(i,a){var c=i.stateNode;if(c===null)return null;var d=c[Ri]||null;if(d===null)return null;c=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(n(231,a,typeof c));return c}var Ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fd=!1;if(Ws)try{var Ol={};Object.defineProperty(Ol,"passive",{get:function(){fd=!0}}),window.addEventListener("test",Ol,Ol),window.removeEventListener("test",Ol,Ol)}catch{fd=!1}var Ga=null,pf=null,jo=null;function Wu(){if(jo)return jo;var i,a=pf,c=a.length,d,y="value"in Ga?Ga.value:Ga.textContent,S=y.length;for(i=0;i<c&&a[i]===y[i];i++);var L=c-i;for(d=1;d<=L&&a[c-d]===y[S-d];d++);return jo=y.slice(i,1<d?1-d:void 0)}function qu(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Pl(){return!0}function zm(){return!1}function ua(i){function a(c,d,y,S,L){this._reactName=c,this._targetInst=y,this.type=d,this.nativeEvent=S,this.target=L,this.currentTarget=null;for(var V in i)i.hasOwnProperty(V)&&(c=i[V],this[V]=c?c(S):S[V]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Pl:zm,this.isPropagationStopped=zm,this}return x(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Pl)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Pl)},persist:function(){},isPersistent:Pl}),a}var no={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ju=ua(no),zl=x({},no,{view:0,detail:0}),Bm=ua(zl),Yu,mf,Bl,Fl=x({},zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_f,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Bl&&(Bl&&i.type==="mousemove"?(Yu=i.screenX-Bl.screenX,mf=i.screenY-Bl.screenY):mf=Yu=0,Bl=i),Yu)},movementY:function(i){return"movementY"in i?i.movementY:mf}}),hd=ua(Fl),Fm=x({},Fl,{dataTransfer:0}),km=ua(Fm),dd=x({},zl,{relatedTarget:0}),gf=ua(dd),Vm=x({},no,{animationName:0,elapsedTime:0,pseudoElement:0}),e_=ua(Vm),t_=x({},no,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Hm=ua(t_),Zu=x({},no,{data:0}),vf=ua(Zu),yf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gm={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Xm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pd(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=Xm[i])?!!a[i]:!1}function _f(){return pd}var Wm=x({},zl,{key:function(i){if(i.key){var a=yf[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=qu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Gm[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_f,charCode:function(i){return i.type==="keypress"?qu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?qu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Yo=ua(Wm),xf=x({},Fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),md=ua(xf),gd=x({},zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_f}),qm=ua(gd),jm=x({},no,{propertyName:0,elapsedTime:0,pseudoElement:0}),n_=ua(jm),Zi=x({},Fl,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Ym=ua(Zi),Zm=x({},no,{newState:0,oldState:0}),Qm=ua(Zm),Km=[9,13,27,32],Zo=Ws&&"CompositionEvent"in window,kl=null;Ws&&"documentMode"in document&&(kl=document.documentMode);var bf=Ws&&"TextEvent"in window&&!kl,vd=Ws&&(!Zo||kl&&8<kl&&11>=kl),Jm=" ",Qu=!1;function Sf(i,a){switch(i){case"keyup":return Km.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yd(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Qo=!1;function $m(i,a){switch(i){case"compositionend":return yd(a);case"keypress":return a.which!==32?null:(Qu=!0,Jm);case"textInput":return i=a.data,i===Jm&&Qu?null:i;default:return null}}function _d(i,a){if(Qo)return i==="compositionend"||!Zo&&Sf(i,a)?(i=Wu(),jo=pf=Ga=null,Qo=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return vd&&a.locale!=="ko"?null:a.data;default:return null}}var xd={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 bd(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!xd[i.type]:a==="textarea"}function Mf(i,a,c,d){qo?to?to.push(d):to=[d]:qo=d,a=a0(a,"onChange"),0<a.length&&(c=new ju("onChange","change",null,c,d),i.push({event:c,listeners:a}))}var io=null,Ko=null;function eg(i){cS(i,0)}function Vl(i){var a=eo(i);if(Wt(a))return i}function Sd(i,a){if(i==="change")return a}var qs=!1;if(Ws){var Ku;if(Ws){var Md="oninput"in document;if(!Md){var Ed=document.createElement("div");Ed.setAttribute("oninput","return;"),Md=typeof Ed.oninput=="function"}Ku=Md}else Ku=!1;qs=Ku&&(!document.documentMode||9<document.documentMode)}function os(){io&&(io.detachEvent("onpropertychange",Ju),Ko=io=null)}function Ju(i){if(i.propertyName==="value"&&Vl(Ko)){var a=[];Mf(a,Ko,i,hf(i)),cd(eg,a)}}function tg(i,a,c){i==="focusin"?(os(),io=a,Ko=c,io.attachEvent("onpropertychange",Ju)):i==="focusout"&&os()}function Td(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Vl(Ko)}function ng(i,a){if(i==="click")return Vl(a)}function ig(i,a){if(i==="input"||i==="change")return Vl(a)}function Ad(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var ca=typeof Object.is=="function"?Object.is:Ad;function Hl(i,a){if(ca(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),d=Object.keys(a);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var y=c[d];if(!Et.call(a,y)||!ca(i[y],a[y]))return!1}return!0}function $u(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Gl(i,a){var c=$u(i);i=0;for(var d;c;){if(c.nodeType===3){if(d=i+c.textContent.length,i<=a&&d>=a)return{node:c,offset:a-i};i=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=$u(c)}}function Fn(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Fn(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function ag(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=ut(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=ut(i.document)}return a}function wd(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var sg=Ws&&"documentMode"in document&&11>=document.documentMode,js=null,Ys=null,Xl=null,Ef=!1;function Wl(i,a,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ef||js==null||js!==ut(d)||(d=js,"selectionStart"in d&&wd(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Xl&&Hl(Xl,d)||(Xl=d,d=a0(Ys,"onSelect"),0<d.length&&(a=new ju("onSelect","select",null,a,c),i.push({event:a,listeners:d}),a.target=js)))}function ia(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var Jo={animationend:ia("Animation","AnimationEnd"),animationiteration:ia("Animation","AnimationIteration"),animationstart:ia("Animation","AnimationStart"),transitionrun:ia("Transition","TransitionRun"),transitionstart:ia("Transition","TransitionStart"),transitioncancel:ia("Transition","TransitionCancel"),transitionend:ia("Transition","TransitionEnd")},ec={},Cd={};Ws&&(Cd=document.createElement("div").style,"AnimationEvent"in window||(delete Jo.animationend.animation,delete Jo.animationiteration.animation,delete Jo.animationstart.animation),"TransitionEvent"in window||delete Jo.transitionend.transition);function Tr(i){if(ec[i])return ec[i];if(!Jo[i])return i;var a=Jo[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in Cd)return ec[i]=a[c];return i}var Tf=Tr("animationend"),tc=Tr("animationiteration"),Rd=Tr("animationstart"),rg=Tr("transitionrun"),i_=Tr("transitionstart"),og=Tr("transitioncancel"),Nd=Tr("transitionend"),ls=new Map,nc="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 toggle touchMove waiting wheel".split(" ");nc.push("scrollEnd");function us(i,a){ls.set(i,a),ye(a,[i])}var ic=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},cs=[],Ar=0,Vi=0;function ac(){for(var i=Ar,a=Vi=Ar=0;a<i;){var c=cs[a];cs[a++]=null;var d=cs[a];cs[a++]=null;var y=cs[a];cs[a++]=null;var S=cs[a];if(cs[a++]=null,d!==null&&y!==null){var L=d.pending;L===null?y.next=y:(y.next=L.next,L.next=y),d.pending=y}S!==0&&ao(c,y,S)}}function Hi(i,a,c,d){cs[Ar++]=i,cs[Ar++]=a,cs[Ar++]=c,cs[Ar++]=d,Vi|=d,i.lanes|=d,i=i.alternate,i!==null&&(i.lanes|=d)}function Af(i,a,c,d){return Hi(i,a,c,d),fs(i)}function fa(i,a){return Hi(i,null,null,a),fs(i)}function ao(i,a,c){i.lanes|=c;var d=i.alternate;d!==null&&(d.lanes|=c);for(var y=!1,S=i.return;S!==null;)S.childLanes|=c,d=S.alternate,d!==null&&(d.childLanes|=c),S.tag===22&&(i=S.stateNode,i===null||i._visibility&1||(y=!0)),i=S,S=S.return;return i.tag===3?(S=i.stateNode,y&&a!==null&&(y=31-K(c),i=S.hiddenUpdates,d=i[y],d===null?i[y]=[a]:d.push(a),a.lane=c|536870912),S):null}function fs(i){if(50<Eo)throw Eo=0,vl=null,Error(n(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var so={};function Dd(i,a,c,d){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ei(i,a,c,d){return new Dd(i,a,c,d)}function wf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function xa(i,a){var c=i.alternate;return c===null?(c=ei(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function ql(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function Zs(i,a,c,d,y,S){var L=0;if(d=i,typeof i=="function")wf(i)&&(L=1);else if(typeof i=="string")L=VA(i,c,Fe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case I:return i=ei(31,c,a,y),i.elementType=I,i.lanes=S,i;case R:return ro(c.children,y,S,a);case w:L=8,y|=24;break;case E:return i=ei(12,c,a,y|2),i.elementType=E,i.lanes=S,i;case B:return i=ei(13,c,a,y),i.elementType=B,i.lanes=S,i;case z:return i=ei(19,c,a,y),i.elementType=z,i.lanes=S,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case D:L=10;break e;case N:L=9;break e;case U:L=11;break e;case H:L=14;break e;case W:L=16,d=null;break e}L=29,c=Error(n(130,i===null?"null":typeof i,"")),d=null}return a=ei(L,c,a,y),a.elementType=i,a.type=d,a.lanes=S,a}function ro(i,a,c,d){return i=ei(7,i,d,a),i.lanes=c,i}function Cf(i,a,c){return i=ei(6,i,null,a),i.lanes=c,i}function jl(i){var a=ei(18,null,null,0);return a.stateNode=i,a}function Rf(i,a,c){return a=ei(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var sc=new WeakMap;function Xa(i,a){if(typeof i=="object"&&i!==null){var c=sc.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Q(a)},sc.set(i,a),a)}return{value:i,source:a,stack:Q(a)}}var oo=[],lo=0,Yl=null,Zl=0,ba=[],Yn=0,wr=null,ti=1,Us="";function Qs(i,a){oo[lo++]=Zl,oo[lo++]=Yl,Yl=i,Zl=a}function lg(i,a,c){ba[Yn++]=ti,ba[Yn++]=Us,ba[Yn++]=wr,wr=i;var d=ti;i=Us;var y=32-K(d)-1;d&=~(1<<y),c+=1;var S=32-K(a)+y;if(30<S){var L=y-y%5;S=(d&(1<<L)-1).toString(32),d>>=L,y-=L,ti=1<<32-K(a)+y|c<<y|d,Us=S+i}else ti=1<<S|c<<y|d,Us=i}function Ks(i){i.return!==null&&(Qs(i,1),lg(i,1,0))}function Nf(i){for(;i===Yl;)Yl=oo[--lo],oo[lo]=null,Zl=oo[--lo],oo[lo]=null;for(;i===wr;)wr=ba[--Yn],ba[Yn]=null,Us=ba[--Yn],ba[Yn]=null,ti=ba[--Yn],ba[Yn]=null}function Df(i,a){ba[Yn++]=ti,ba[Yn++]=Us,ba[Yn++]=wr,ti=a.id,Us=a.overflow,wr=i}var li=null,kn=null,mn=!1,Cr=null,Wa=!1,Ql=Error(n(519));function Js(i){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $s(Xa(a,i)),Ql}function ug(i){var a=i.stateNode,c=i.type,d=i.memoizedProps;switch(a[$n]=i,a[Ri]=d,c){case"dialog":yn("cancel",a),yn("close",a);break;case"iframe":case"object":case"embed":yn("load",a);break;case"video":case"audio":for(c=0;c<Es.length;c++)yn(Es[c],a);break;case"source":yn("error",a);break;case"img":case"image":case"link":yn("error",a),yn("load",a);break;case"details":yn("toggle",a);break;case"input":yn("invalid",a),Ls(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":yn("invalid",a);break;case"textarea":yn("invalid",a),Ni(a,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||d.suppressHydrationWarning===!0||pS(a.textContent,c)?(d.popover!=null&&(yn("beforetoggle",a),yn("toggle",a)),d.onScroll!=null&&yn("scroll",a),d.onScrollEnd!=null&&yn("scrollend",a),d.onClick!=null&&(a.onclick=Er),a=!0):a=!1,a||Js(i,!0)}function cg(i){for(li=i.return;li;)switch(li.tag){case 5:case 31:case 13:Wa=!1;return;case 27:case 3:Wa=!0;return;default:li=li.return}}function Kl(i){if(i!==li)return!1;if(!mn)return cg(i),mn=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||__(i.type,i.memoizedProps)),c=!c),c&&kn&&Js(i),cg(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));kn=MS(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));kn=MS(i)}else a===27?(a=kn,vu(i.type)?(i=E_,E_=null,kn=i):kn=a):kn=li?dr(i.stateNode.nextSibling):null;return!0}function uo(){kn=li=null,mn=!1}function Lf(){var i=Cr;return i!==null&&(ci===null?ci=i:ci.push.apply(ci,i),Cr=null),i}function $s(i){Cr===null?Cr=[i]:Cr.push(i)}var Jl=X(null),co=null,er=null;function Rr(i,a,c){Ae(Jl,a._currentValue),a._currentValue=c}function tr(i){i._currentValue=Jl.current,oe(Jl)}function Uf(i,a,c){for(;i!==null;){var d=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),i===c)break;i=i.return}}function If(i,a,c,d){var y=i.child;for(y!==null&&(y.return=i);y!==null;){var S=y.dependencies;if(S!==null){var L=y.child;S=S.firstContext;e:for(;S!==null;){var V=S;S=y;for(var $=0;$<a.length;$++)if(V.context===a[$]){S.lanes|=c,V=S.alternate,V!==null&&(V.lanes|=c),Uf(S.return,c,i),d||(L=null);break e}S=V.next}}else if(y.tag===18){if(L=y.return,L===null)throw Error(n(341));L.lanes|=c,S=L.alternate,S!==null&&(S.lanes|=c),Uf(L,c,i),L=null}else L=y.child;if(L!==null)L.return=y;else for(L=y;L!==null;){if(L===i){L=null;break}if(y=L.sibling,y!==null){y.return=L.return,L=y;break}L=L.return}y=L}}function nr(i,a,c,d){i=null;for(var y=a,S=!1;y!==null;){if(!S){if((y.flags&524288)!==0)S=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var L=y.alternate;if(L===null)throw Error(n(387));if(L=L.memoizedProps,L!==null){var V=y.type;ca(y.pendingProps.value,L.value)||(i!==null?i.push(V):i=[V])}}else if(y===Re.current){if(L=y.alternate,L===null)throw Error(n(387));L.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(i!==null?i.push(Cp):i=[Cp])}y=y.return}i!==null&&If(a,i,c,d),a.flags|=262144}function rc(i){for(i=i.firstContext;i!==null;){if(!ca(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function fo(i){co=i,er=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Vt(i){return fg(co,i)}function $l(i,a){return co===null&&fo(i),fg(i,a)}function fg(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},er===null){if(i===null)throw Error(n(308));er=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else er=er.next=a;return c}var hg=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,d){i.push(d)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},a_=r.unstable_scheduleCallback,s_=r.unstable_NormalPriority,Si={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ld(){return{controller:new hg,data:new Map,refCount:0}}function $o(i){i.refCount--,i.refCount===0&&a_(s_,function(){i.controller.abort()})}var qa=null,Of=0,Nr=0,hs=null;function Ud(i,a){if(qa===null){var c=qa=[];Of=0,Nr=Me(),hs={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Of++,a.then(Id,Id),a}function Id(){if(--Of===0&&qa!==null){hs!==null&&(hs.status="fulfilled");var i=qa;qa=null,Nr=0,hs=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function Od(i,a){var c=[],d={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return i.then(function(){d.status="fulfilled",d.value=a;for(var y=0;y<c.length;y++)(0,c[y])(a)},function(y){for(d.status="rejected",d.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),d}var dg=Y.S;Y.S=function(i,a){Sp=O(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Ud(i,a),dg!==null&&dg(i,a)};var ho=X(null);function Pf(){var i=ho.current;return i!==null?i:Gt.pooledCache}function oc(i,a){a===null?Ae(ho,ho.current):Ae(ho,a.pool)}function Pd(){var i=Pf();return i===null?null:{parent:Si._currentValue,pool:i}}var el=Error(n(460)),lc=Error(n(474)),an=Error(n(542)),zf={then:function(){}};function Sa(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Bf(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Er,Er),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,il(i),i;default:if(typeof a.status=="string")a.then(Er,Er);else{if(i=Gt,i!==null&&100<i.shellSuspendCounter)throw Error(n(482));i=a,i.status="pending",i.then(function(d){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=d}},function(d){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,il(i),i}throw ir=a,el}}function tl(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ir=c,el):c}}var ir=null;function nl(){if(ir===null)throw Error(n(459));var i=ir;return ir=null,i}function il(i){if(i===el||i===an)throw Error(n(483))}var al=null,sl=0;function uc(i){var a=sl;return sl+=1,al===null&&(al=[]),Bf(al,i,a)}function ds(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function eu(i,a){throw a.$$typeof===b?Error(n(525)):(i=Object.prototype.toString.call(a),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Ff(i){function a(le,ie){if(i){var ge=le.deletions;ge===null?(le.deletions=[ie],le.flags|=16):ge.push(ie)}}function c(le,ie){if(!i)return null;for(;ie!==null;)a(le,ie),ie=ie.sibling;return null}function d(le){for(var ie=new Map;le!==null;)le.key!==null?ie.set(le.key,le):ie.set(le.index,le),le=le.sibling;return ie}function y(le,ie){return le=xa(le,ie),le.index=0,le.sibling=null,le}function S(le,ie,ge){return le.index=ge,i?(ge=le.alternate,ge!==null?(ge=ge.index,ge<ie?(le.flags|=67108866,ie):ge):(le.flags|=67108866,ie)):(le.flags|=1048576,ie)}function L(le){return i&&le.alternate===null&&(le.flags|=67108866),le}function V(le,ie,ge,Pe){return ie===null||ie.tag!==6?(ie=Cf(ge,le.mode,Pe),ie.return=le,ie):(ie=y(ie,ge),ie.return=le,ie)}function $(le,ie,ge,Pe){var It=ge.type;return It===R?De(le,ie,ge.props.children,Pe,ge.key):ie!==null&&(ie.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===W&&tl(It)===ie.type)?(ie=y(ie,ge.props),ds(ie,ge),ie.return=le,ie):(ie=Zs(ge.type,ge.key,ge.props,null,le.mode,Pe),ds(ie,ge),ie.return=le,ie)}function ve(le,ie,ge,Pe){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==ge.containerInfo||ie.stateNode.implementation!==ge.implementation?(ie=Rf(ge,le.mode,Pe),ie.return=le,ie):(ie=y(ie,ge.children||[]),ie.return=le,ie)}function De(le,ie,ge,Pe,It){return ie===null||ie.tag!==7?(ie=ro(ge,le.mode,Pe,It),ie.return=le,ie):(ie=y(ie,ge),ie.return=le,ie)}function Be(le,ie,ge){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=Cf(""+ie,le.mode,ge),ie.return=le,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case M:return ge=Zs(ie.type,ie.key,ie.props,null,le.mode,ge),ds(ge,ie),ge.return=le,ge;case A:return ie=Rf(ie,le.mode,ge),ie.return=le,ie;case W:return ie=tl(ie),Be(le,ie,ge)}if(pe(ie)||se(ie))return ie=ro(ie,le.mode,ge,null),ie.return=le,ie;if(typeof ie.then=="function")return Be(le,uc(ie),ge);if(ie.$$typeof===D)return Be(le,$l(le,ie),ge);eu(le,ie)}return null}function xe(le,ie,ge,Pe){var It=ie!==null?ie.key:null;if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return It!==null?null:V(le,ie,""+ge,Pe);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case M:return ge.key===It?$(le,ie,ge,Pe):null;case A:return ge.key===It?ve(le,ie,ge,Pe):null;case W:return ge=tl(ge),xe(le,ie,ge,Pe)}if(pe(ge)||se(ge))return It!==null?null:De(le,ie,ge,Pe,null);if(typeof ge.then=="function")return xe(le,ie,uc(ge),Pe);if(ge.$$typeof===D)return xe(le,ie,$l(le,ge),Pe);eu(le,ge)}return null}function Ce(le,ie,ge,Pe,It){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number"||typeof Pe=="bigint")return le=le.get(ge)||null,V(ie,le,""+Pe,It);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case M:return le=le.get(Pe.key===null?ge:Pe.key)||null,$(ie,le,Pe,It);case A:return le=le.get(Pe.key===null?ge:Pe.key)||null,ve(ie,le,Pe,It);case W:return Pe=tl(Pe),Ce(le,ie,ge,Pe,It)}if(pe(Pe)||se(Pe))return le=le.get(ge)||null,De(ie,le,Pe,It,null);if(typeof Pe.then=="function")return Ce(le,ie,ge,uc(Pe),It);if(Pe.$$typeof===D)return Ce(le,ie,ge,$l(ie,Pe),It);eu(ie,Pe)}return null}function Mt(le,ie,ge,Pe){for(var It=null,Rn=null,At=ie,ln=ie=0,bn=null;At!==null&&ln<ge.length;ln++){At.index>ln?(bn=At,At=null):bn=At.sibling;var Nn=xe(le,At,ge[ln],Pe);if(Nn===null){At===null&&(At=bn);break}i&&At&&Nn.alternate===null&&a(le,At),ie=S(Nn,ie,ln),Rn===null?It=Nn:Rn.sibling=Nn,Rn=Nn,At=bn}if(ln===ge.length)return c(le,At),mn&&Qs(le,ln),It;if(At===null){for(;ln<ge.length;ln++)At=Be(le,ge[ln],Pe),At!==null&&(ie=S(At,ie,ln),Rn===null?It=At:Rn.sibling=At,Rn=At);return mn&&Qs(le,ln),It}for(At=d(At);ln<ge.length;ln++)bn=Ce(At,le,ln,ge[ln],Pe),bn!==null&&(i&&bn.alternate!==null&&At.delete(bn.key===null?ln:bn.key),ie=S(bn,ie,ln),Rn===null?It=bn:Rn.sibling=bn,Rn=bn);return i&&At.forEach(function(Su){return a(le,Su)}),mn&&Qs(le,ln),It}function kt(le,ie,ge,Pe){if(ge==null)throw Error(n(151));for(var It=null,Rn=null,At=ie,ln=ie=0,bn=null,Nn=ge.next();At!==null&&!Nn.done;ln++,Nn=ge.next()){At.index>ln?(bn=At,At=null):bn=At.sibling;var Su=xe(le,At,Nn.value,Pe);if(Su===null){At===null&&(At=bn);break}i&&At&&Su.alternate===null&&a(le,At),ie=S(Su,ie,ln),Rn===null?It=Su:Rn.sibling=Su,Rn=Su,At=bn}if(Nn.done)return c(le,At),mn&&Qs(le,ln),It;if(At===null){for(;!Nn.done;ln++,Nn=ge.next())Nn=Be(le,Nn.value,Pe),Nn!==null&&(ie=S(Nn,ie,ln),Rn===null?It=Nn:Rn.sibling=Nn,Rn=Nn);return mn&&Qs(le,ln),It}for(At=d(At);!Nn.done;ln++,Nn=ge.next())Nn=Ce(At,le,ln,Nn.value,Pe),Nn!==null&&(i&&Nn.alternate!==null&&At.delete(Nn.key===null?ln:Nn.key),ie=S(Nn,ie,ln),Rn===null?It=Nn:Rn.sibling=Nn,Rn=Nn);return i&&At.forEach(function(JA){return a(le,JA)}),mn&&Qs(le,ln),It}function Gn(le,ie,ge,Pe){if(typeof ge=="object"&&ge!==null&&ge.type===R&&ge.key===null&&(ge=ge.props.children),typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case M:e:{for(var It=ge.key;ie!==null;){if(ie.key===It){if(It=ge.type,It===R){if(ie.tag===7){c(le,ie.sibling),Pe=y(ie,ge.props.children),Pe.return=le,le=Pe;break e}}else if(ie.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===W&&tl(It)===ie.type){c(le,ie.sibling),Pe=y(ie,ge.props),ds(Pe,ge),Pe.return=le,le=Pe;break e}c(le,ie);break}else a(le,ie);ie=ie.sibling}ge.type===R?(Pe=ro(ge.props.children,le.mode,Pe,ge.key),Pe.return=le,le=Pe):(Pe=Zs(ge.type,ge.key,ge.props,null,le.mode,Pe),ds(Pe,ge),Pe.return=le,le=Pe)}return L(le);case A:e:{for(It=ge.key;ie!==null;){if(ie.key===It)if(ie.tag===4&&ie.stateNode.containerInfo===ge.containerInfo&&ie.stateNode.implementation===ge.implementation){c(le,ie.sibling),Pe=y(ie,ge.children||[]),Pe.return=le,le=Pe;break e}else{c(le,ie);break}else a(le,ie);ie=ie.sibling}Pe=Rf(ge,le.mode,Pe),Pe.return=le,le=Pe}return L(le);case W:return ge=tl(ge),Gn(le,ie,ge,Pe)}if(pe(ge))return Mt(le,ie,ge,Pe);if(se(ge)){if(It=se(ge),typeof It!="function")throw Error(n(150));return ge=It.call(ge),kt(le,ie,ge,Pe)}if(typeof ge.then=="function")return Gn(le,ie,uc(ge),Pe);if(ge.$$typeof===D)return Gn(le,ie,$l(le,ge),Pe);eu(le,ge)}return typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint"?(ge=""+ge,ie!==null&&ie.tag===6?(c(le,ie.sibling),Pe=y(ie,ge),Pe.return=le,le=Pe):(c(le,ie),Pe=Cf(ge,le.mode,Pe),Pe.return=le,le=Pe),L(le)):c(le,ie)}return function(le,ie,ge,Pe){try{sl=0;var It=Gn(le,ie,ge,Pe);return al=null,It}catch(At){if(At===el||At===an)throw At;var Rn=ei(29,At,null,le.mode);return Rn.lanes=Pe,Rn.return=le,Rn}}}var Dr=Ff(!0),kf=Ff(!1),ha=!1;function cc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zd(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Lr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function po(i,a,c){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(wt&2)!==0){var y=d.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),d.pending=a,a=fs(i),ao(i,null,c),a}return Hi(i,d,a,c),fs(i)}function mo(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var d=a.lanes;d&=i.pendingLanes,c|=d,a.lanes=c,Kr(i,c)}}function Ut(i,a){var c=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var y=null,S=null;if(c=c.firstBaseUpdate,c!==null){do{var L={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};S===null?y=S=L:S=S.next=L,c=c.next}while(c!==null);S===null?y=S=a:S=S.next=a}else y=S=a;c={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:S,shared:d.shared,callbacks:d.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var Bd=!1;function fc(){if(Bd){var i=hs;if(i!==null)throw i}}function tu(i,a,c,d){Bd=!1;var y=i.updateQueue;ha=!1;var S=y.firstBaseUpdate,L=y.lastBaseUpdate,V=y.shared.pending;if(V!==null){y.shared.pending=null;var $=V,ve=$.next;$.next=null,L===null?S=ve:L.next=ve,L=$;var De=i.alternate;De!==null&&(De=De.updateQueue,V=De.lastBaseUpdate,V!==L&&(V===null?De.firstBaseUpdate=ve:V.next=ve,De.lastBaseUpdate=$))}if(S!==null){var Be=y.baseState;L=0,De=ve=$=null,V=S;do{var xe=V.lane&-536870913,Ce=xe!==V.lane;if(Ce?($t&xe)===xe:(d&xe)===xe){xe!==0&&xe===Nr&&(Bd=!0),De!==null&&(De=De.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Mt=i,kt=V;xe=a;var Gn=c;switch(kt.tag){case 1:if(Mt=kt.payload,typeof Mt=="function"){Be=Mt.call(Gn,Be,xe);break e}Be=Mt;break e;case 3:Mt.flags=Mt.flags&-65537|128;case 0:if(Mt=kt.payload,xe=typeof Mt=="function"?Mt.call(Gn,Be,xe):Mt,xe==null)break e;Be=x({},Be,xe);break e;case 2:ha=!0}}xe=V.callback,xe!==null&&(i.flags|=64,Ce&&(i.flags|=8192),Ce=y.callbacks,Ce===null?y.callbacks=[xe]:Ce.push(xe))}else Ce={lane:xe,tag:V.tag,payload:V.payload,callback:V.callback,next:null},De===null?(ve=De=Ce,$=Be):De=De.next=Ce,L|=xe;if(V=V.next,V===null){if(V=y.shared.pending,V===null)break;Ce=V,V=Ce.next,Ce.next=null,y.lastBaseUpdate=Ce,y.shared.pending=null}}while(!0);De===null&&($=Be),y.baseState=$,y.firstBaseUpdate=ve,y.lastBaseUpdate=De,S===null&&(y.shared.lanes=0),cr|=L,i.lanes=L,i.memoizedState=Be}}function nu(i,a){if(typeof i!="function")throw Error(n(191,i));i.call(a)}function pg(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)nu(c[i],a)}var iu=X(null),Vf=X(0);function mg(i,a){i=Qa,Ae(Vf,i),Ae(iu,a),Qa=i|a.baseLanes}function Fd(){Ae(Vf,Qa),Ae(iu,iu.current)}function hc(){Qa=Vf.current,oe(iu),oe(Vf)}var Ma=X(null),da=null;function Ur(i){var a=i.alternate;Ae(gn,gn.current&1),Ae(Ma,i),da===null&&(a===null||iu.current!==null||a.memoizedState!==null)&&(da=i)}function kd(i){Ae(gn,gn.current),Ae(Ma,i),da===null&&(da=i)}function gg(i){i.tag===22?(Ae(gn,gn.current),Ae(Ma,i),da===null&&(da=i)):Ea()}function Ea(){Ae(gn,gn.current),Ae(Ma,Ma.current)}function hi(i){oe(Ma),da===i&&(da=null),oe(gn)}var gn=X(0);function ja(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||S_(c)||M_(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Zn=0,Yt=null,On=null,hn=null,ps=!1,au=!1,rl=!1,Hf=0,dc=0,su=null,Vd=0;function ni(){throw Error(n(321))}function Hd(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!ca(i[c],a[c]))return!1;return!0}function Gf(i,a,c,d,y,S){return Zn=S,Yt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Y.H=i===null||i.memoizedState===null?Yg:lp,rl=!1,S=c(d,y),rl=!1,au&&(S=ol(a,c,d,y)),vg(i),S}function vg(i){Y.H=ru;var a=On!==null&&On.next!==null;if(Zn=0,hn=On=Yt=null,ps=!1,dc=0,su=null,a)throw Error(n(300));i===null||Mi||(i=i.dependencies,i!==null&&rc(i)&&(Mi=!0))}function ol(i,a,c,d){Yt=i;var y=0;do{if(au&&(su=null),dc=0,au=!1,25<=y)throw Error(n(301));if(y+=1,hn=On=null,i.updateQueue!=null){var S=i.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}Y.H=ms,S=a(c,d)}while(au);return S}function ll(){var i=Y.H,a=i.useState()[0];return a=typeof a.then=="function"?pc(a):a,i=i.useState()[0],(On!==null?On.memoizedState:null)!==i&&(Yt.flags|=1024),a}function Gd(){var i=Hf!==0;return Hf=0,i}function Xd(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function Wd(i){if(ps){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ps=!1}Zn=0,hn=On=Yt=null,au=!1,dc=Hf=0,su=null}function Di(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?Yt.memoizedState=hn=i:hn=hn.next=i,hn}function di(){if(On===null){var i=Yt.alternate;i=i!==null?i.memoizedState:null}else i=On.next;var a=hn===null?Yt.memoizedState:hn.next;if(a!==null)hn=a,On=i;else{if(i===null)throw Yt.alternate===null?Error(n(467)):Error(n(310));On=i,i={memoizedState:On.memoizedState,baseState:On.baseState,baseQueue:On.baseQueue,queue:On.queue,next:null},hn===null?Yt.memoizedState=hn=i:hn=hn.next=i}return hn}function Xf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pc(i){var a=dc;return dc+=1,su===null&&(su=[]),i=Bf(su,i,a),a=Yt,(hn===null?a.memoizedState:hn.next)===null&&(a=a.alternate,Y.H=a===null||a.memoizedState===null?Yg:lp),i}function go(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return pc(i);if(i.$$typeof===D)return Vt(i)}throw Error(n(438,String(i)))}function qd(i){var a=null,c=Yt.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var d=Yt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Xf(),Yt.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),d=0;d<i;d++)c[d]=P;return a.index++,c}function Ir(i,a){return typeof a=="function"?a(i):a}function Wf(i){var a=di();return jd(a,On,i)}function jd(i,a,c){var d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=c;var y=i.baseQueue,S=d.pending;if(S!==null){if(y!==null){var L=y.next;y.next=S.next,S.next=L}a.baseQueue=y=S,d.pending=null}if(S=i.baseState,y===null)i.memoizedState=S;else{a=y.next;var V=L=null,$=null,ve=a,De=!1;do{var Be=ve.lane&-536870913;if(Be!==ve.lane?($t&Be)===Be:(Zn&Be)===Be){var xe=ve.revertLane;if(xe===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null}),Be===Nr&&(De=!0);else if((Zn&xe)===xe){ve=ve.next,xe===Nr&&(De=!0);continue}else Be={lane:0,revertLane:ve.revertLane,gesture:null,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},$===null?(V=$=Be,L=S):$=$.next=Be,Yt.lanes|=xe,cr|=xe;Be=ve.action,rl&&c(S,Be),S=ve.hasEagerState?ve.eagerState:c(S,Be)}else xe={lane:Be,revertLane:ve.revertLane,gesture:ve.gesture,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},$===null?(V=$=xe,L=S):$=$.next=xe,Yt.lanes|=Be,cr|=Be;ve=ve.next}while(ve!==null&&ve!==a);if($===null?L=S:$.next=V,!ca(S,i.memoizedState)&&(Mi=!0,De&&(c=hs,c!==null)))throw c;i.memoizedState=S,i.baseState=L,i.baseQueue=$,d.lastRenderedState=S}return y===null&&(d.lanes=0),[i.memoizedState,d.dispatch]}function Yd(i){var a=di(),c=a.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=i;var d=c.dispatch,y=c.pending,S=a.memoizedState;if(y!==null){c.pending=null;var L=y=y.next;do S=i(S,L.action),L=L.next;while(L!==y);ca(S,a.memoizedState)||(Mi=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),c.lastRenderedState=S}return[S,d]}function yg(i,a,c){var d=Yt,y=di(),S=mn;if(S){if(c===void 0)throw Error(n(407));c=c()}else c=a();var L=!ca((On||y).memoizedState,c);if(L&&(y.memoizedState=c,Mi=!0),y=y.queue,np(bg.bind(null,d,y,i),[i]),y.getSnapshot!==a||L||hn!==null&&hn.memoizedState.tag&1){if(d.flags|=2048,vo(9,{destroy:void 0},xg.bind(null,d,y,c,a),null),Gt===null)throw Error(n(349));S||(Zn&127)!==0||_g(d,a,c)}return c}function _g(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=Yt.updateQueue,a===null?(a=Xf(),Yt.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function xg(i,a,c,d){a.value=c,a.getSnapshot=d,Sg(a)&&Mg(i)}function bg(i,a,c){return c(function(){Sg(a)&&Mg(i)})}function Sg(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!ca(i,c)}catch{return!0}}function Mg(i){var a=fa(i,2);a!==null&&rn(a,i,2)}function Zd(i){var a=Di();if(typeof i=="function"){var c=i;if(i=c(),rl){ct(!0);try{c()}finally{ct(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:i},a}function Qd(i,a,c,d){return i.baseState=c,jd(i,On,typeof d=="function"?d:Ir)}function r_(i,a,c,d,y){if(Zf(i))throw Error(n(485));if(i=a.action,i!==null){var S={payload:y,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){S.listeners.push(L)}};Y.T!==null?c(!0):S.isTransition=!1,d(S),c=a.pending,c===null?(S.next=a.pending=S,Eg(a,S)):(S.next=c.next,a.pending=c.next=S)}}function Eg(i,a){var c=a.action,d=a.payload,y=i.state;if(a.isTransition){var S=Y.T,L={};Y.T=L;try{var V=c(y,d),$=Y.S;$!==null&&$(L,V),Tg(i,a,V)}catch(ve){Kd(i,a,ve)}finally{S!==null&&L.types!==null&&(S.types=L.types),Y.T=S}}else try{S=c(y,d),Tg(i,a,S)}catch(ve){Kd(i,a,ve)}}function Tg(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){Ag(i,a,d)},function(d){return Kd(i,a,d)}):Ag(i,a,c)}function Ag(i,a,c){a.status="fulfilled",a.value=c,wg(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,Eg(i,c)))}function Kd(i,a,c){var d=i.pending;if(i.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=c,wg(a),a=a.next;while(a!==d)}i.action=null}function wg(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function Jd(i,a){return a}function $d(i,a){if(mn){var c=Gt.formState;if(c!==null){e:{var d=Yt;if(mn){if(kn){t:{for(var y=kn,S=Wa;y.nodeType!==8;){if(!S){y=null;break t}if(y=dr(y.nextSibling),y===null){y=null;break t}}S=y.data,y=S==="F!"||S==="F"?y:null}if(y){kn=dr(y.nextSibling),d=y.data==="F!";break e}}Js(d)}d=!1}d&&(a=c[0])}}return c=Di(),c.memoizedState=c.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jd,lastRenderedState:a},c.queue=d,c=Wg.bind(null,Yt,d),d.dispatch=c,d=Zd(!1),S=op.bind(null,Yt,!1,d.queue),d=Di(),y={state:a,dispatch:null,action:i,pending:null},d.queue=y,c=r_.bind(null,Yt,y,S,c),y.dispatch=c,d.memoizedState=i,[a,c,!1]}function Cg(i){var a=di();return ep(a,On,i)}function ep(i,a,c){if(a=jd(i,a,Jd)[0],i=Wf(Ir)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=pc(a)}catch(L){throw L===el?an:L}else d=a;a=di();var y=a.queue,S=y.dispatch;return c!==a.memoizedState&&(Yt.flags|=2048,vo(9,{destroy:void 0},Rg.bind(null,y,c),null)),[d,S,i]}function Rg(i,a){i.action=a}function tp(i){var a=di(),c=On;if(c!==null)return ep(a,c,i);di(),a=a.memoizedState,c=di();var d=c.queue.dispatch;return c.memoizedState=i,[a,d,!1]}function vo(i,a,c,d){return i={tag:i,create:c,deps:d,inst:a,next:null},a=Yt.updateQueue,a===null&&(a=Xf(),Yt.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(d=c.next,c.next=i,i.next=d,a.lastEffect=i),i}function qf(){return di().memoizedState}function jf(i,a,c,d){var y=Di();Yt.flags|=i,y.memoizedState=vo(1|a,{destroy:void 0},c,d===void 0?null:d)}function Yf(i,a,c,d){var y=di();d=d===void 0?null:d;var S=y.memoizedState.inst;On!==null&&d!==null&&Hd(d,On.memoizedState.deps)?y.memoizedState=vo(a,S,c,d):(Yt.flags|=i,y.memoizedState=vo(1|a,S,c,d))}function Ng(i,a){jf(8390656,8,i,a)}function np(i,a){Yf(2048,8,i,a)}function Dg(i){Yt.flags|=4;var a=Yt.updateQueue;if(a===null)a=Xf(),Yt.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function Lg(i){var a=di().memoizedState;return Dg({ref:a,nextImpl:i}),function(){if((wt&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function Ug(i,a){return Yf(4,2,i,a)}function Ig(i,a){return Yf(4,4,i,a)}function Og(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function Pg(i,a,c){c=c!=null?c.concat([i]):null,Yf(4,4,Og.bind(null,a,i),c)}function ip(){}function zg(i,a){var c=di();a=a===void 0?null:a;var d=c.memoizedState;return a!==null&&Hd(a,d[1])?d[0]:(c.memoizedState=[i,a],i)}function Bg(i,a){var c=di();a=a===void 0?null:a;var d=c.memoizedState;if(a!==null&&Hd(a,d[1]))return d[0];if(d=i(),rl){ct(!0);try{i()}finally{ct(!1)}}return c.memoizedState=[d,a],d}function ap(i,a,c){return c===void 0||(Zn&1073741824)!==0&&($t&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=cn(),Yt.lanes|=i,cr|=i,c)}function Fg(i,a,c,d){return ca(c,a)?c:iu.current!==null?(i=ap(i,c,d),ca(i,a)||(Mi=!0),i):(Zn&42)===0||(Zn&1073741824)!==0&&($t&261930)===0?(Mi=!0,i.memoizedState=c):(i=cn(),Yt.lanes|=i,cr|=i,a)}function kg(i,a,c,d,y){var S=q.p;q.p=S!==0&&8>S?S:8;var L=Y.T,V={};Y.T=V,op(i,!1,a,c);try{var $=y(),ve=Y.S;if(ve!==null&&ve(V,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var De=Od($,d);mc(i,a,De,Ja(i))}else mc(i,a,d,Ja(i))}catch(Be){mc(i,a,{then:function(){},status:"rejected",reason:Be},Ja())}finally{q.p=S,L!==null&&V.types!==null&&(L.types=V.types),Y.T=L}}function o_(){}function sp(i,a,c,d){if(i.tag!==5)throw Error(n(476));var y=Vg(i).queue;kg(i,y,a,ne,c===null?o_:function(){return Hg(i),c(d)})}function Vg(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:ne},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function Hg(i){var a=Vg(i);a.next===null&&(a=i.alternate.memoizedState),mc(i,a.next.queue,{},Ja())}function rp(){return Vt(Cp)}function Gg(){return di().memoizedState}function Xg(){return di().memoizedState}function l_(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Ja();i=Lr(c);var d=po(a,i,c);d!==null&&(rn(d,a,c),mo(d,a,c)),a={cache:Ld()},i.payload=a;return}a=a.return}}function u_(i,a,c){var d=Ja();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Zf(i)?qg(a,c):(c=Af(i,a,c,d),c!==null&&(rn(c,i,d),jg(c,a,d)))}function Wg(i,a,c){var d=Ja();mc(i,a,c,d)}function mc(i,a,c,d){var y={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Zf(i))qg(a,y);else{var S=i.alternate;if(i.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var L=a.lastRenderedState,V=S(L,c);if(y.hasEagerState=!0,y.eagerState=V,ca(V,L))return Hi(i,a,y,0),Gt===null&&ac(),!1}catch{}if(c=Af(i,a,y,d),c!==null)return rn(c,i,d),jg(c,a,d),!0}return!1}function op(i,a,c,d){if(d={lane:2,revertLane:Me(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Zf(i)){if(a)throw Error(n(479))}else a=Af(i,c,d,2),a!==null&&rn(a,i,2)}function Zf(i){var a=i.alternate;return i===Yt||a!==null&&a===Yt}function qg(i,a){au=ps=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function jg(i,a,c){if((c&4194048)!==0){var d=a.lanes;d&=i.pendingLanes,c|=d,a.lanes=c,Kr(i,c)}}var ru={readContext:Vt,use:go,useCallback:ni,useContext:ni,useEffect:ni,useImperativeHandle:ni,useLayoutEffect:ni,useInsertionEffect:ni,useMemo:ni,useReducer:ni,useRef:ni,useState:ni,useDebugValue:ni,useDeferredValue:ni,useTransition:ni,useSyncExternalStore:ni,useId:ni,useHostTransitionStatus:ni,useFormState:ni,useActionState:ni,useOptimistic:ni,useMemoCache:ni,useCacheRefresh:ni};ru.useEffectEvent=ni;var Yg={readContext:Vt,use:go,useCallback:function(i,a){return Di().memoizedState=[i,a===void 0?null:a],i},useContext:Vt,useEffect:Ng,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,jf(4194308,4,Og.bind(null,a,i),c)},useLayoutEffect:function(i,a){return jf(4194308,4,i,a)},useInsertionEffect:function(i,a){jf(4,2,i,a)},useMemo:function(i,a){var c=Di();a=a===void 0?null:a;var d=i();if(rl){ct(!0);try{i()}finally{ct(!1)}}return c.memoizedState=[d,a],d},useReducer:function(i,a,c){var d=Di();if(c!==void 0){var y=c(a);if(rl){ct(!0);try{c(a)}finally{ct(!1)}}}else y=a;return d.memoizedState=d.baseState=y,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:y},d.queue=i,i=i.dispatch=u_.bind(null,Yt,i),[d.memoizedState,i]},useRef:function(i){var a=Di();return i={current:i},a.memoizedState=i},useState:function(i){i=Zd(i);var a=i.queue,c=Wg.bind(null,Yt,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:ip,useDeferredValue:function(i,a){var c=Di();return ap(c,i,a)},useTransition:function(){var i=Zd(!1);return i=kg.bind(null,Yt,i.queue,!0,!1),Di().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var d=Yt,y=Di();if(mn){if(c===void 0)throw Error(n(407));c=c()}else{if(c=a(),Gt===null)throw Error(n(349));($t&127)!==0||_g(d,a,c)}y.memoizedState=c;var S={value:c,getSnapshot:a};return y.queue=S,Ng(bg.bind(null,d,S,i),[i]),d.flags|=2048,vo(9,{destroy:void 0},xg.bind(null,d,S,c,a),null),c},useId:function(){var i=Di(),a=Gt.identifierPrefix;if(mn){var c=Us,d=ti;c=(d&~(1<<32-K(d)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Hf++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=Vd++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:rp,useFormState:$d,useActionState:$d,useOptimistic:function(i){var a=Di();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=op.bind(null,Yt,!0,c),c.dispatch=a,[i,a]},useMemoCache:qd,useCacheRefresh:function(){return Di().memoizedState=l_.bind(null,Yt)},useEffectEvent:function(i){var a=Di(),c={impl:i};return a.memoizedState=c,function(){if((wt&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},lp={readContext:Vt,use:go,useCallback:zg,useContext:Vt,useEffect:np,useImperativeHandle:Pg,useInsertionEffect:Ug,useLayoutEffect:Ig,useMemo:Bg,useReducer:Wf,useRef:qf,useState:function(){return Wf(Ir)},useDebugValue:ip,useDeferredValue:function(i,a){var c=di();return Fg(c,On.memoizedState,i,a)},useTransition:function(){var i=Wf(Ir)[0],a=di().memoizedState;return[typeof i=="boolean"?i:pc(i),a]},useSyncExternalStore:yg,useId:Gg,useHostTransitionStatus:rp,useFormState:Cg,useActionState:Cg,useOptimistic:function(i,a){var c=di();return Qd(c,On,i,a)},useMemoCache:qd,useCacheRefresh:Xg};lp.useEffectEvent=Lg;var ms={readContext:Vt,use:go,useCallback:zg,useContext:Vt,useEffect:np,useImperativeHandle:Pg,useInsertionEffect:Ug,useLayoutEffect:Ig,useMemo:Bg,useReducer:Yd,useRef:qf,useState:function(){return Yd(Ir)},useDebugValue:ip,useDeferredValue:function(i,a){var c=di();return On===null?ap(c,i,a):Fg(c,On.memoizedState,i,a)},useTransition:function(){var i=Yd(Ir)[0],a=di().memoizedState;return[typeof i=="boolean"?i:pc(i),a]},useSyncExternalStore:yg,useId:Gg,useHostTransitionStatus:rp,useFormState:tp,useActionState:tp,useOptimistic:function(i,a){var c=di();return On!==null?Qd(c,On,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:qd,useCacheRefresh:Xg};ms.useEffectEvent=Lg;function Qf(i,a,c,d){a=i.memoizedState,c=c(d,a),c=c==null?a:x({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var gc={enqueueSetState:function(i,a,c){i=i._reactInternals;var d=Ja(),y=Lr(d);y.payload=a,c!=null&&(y.callback=c),a=po(i,y,d),a!==null&&(rn(a,i,d),mo(a,i,d))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var d=Ja(),y=Lr(d);y.tag=1,y.payload=a,c!=null&&(y.callback=c),a=po(i,y,d),a!==null&&(rn(a,i,d),mo(a,i,d))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Ja(),d=Lr(c);d.tag=2,a!=null&&(d.callback=a),a=po(i,d,c),a!==null&&(rn(a,i,c),mo(a,i,c))}};function up(i,a,c,d,y,S,L){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,S,L):a.prototype&&a.prototype.isPureReactComponent?!Hl(c,d)||!Hl(y,S):!0}function cp(i,a,c,d){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,d),a.state!==i&&gc.enqueueReplaceState(a,a.state,null)}function yo(i,a){var c=a;if("ref"in a){c={};for(var d in a)d!=="ref"&&(c[d]=a[d])}if(i=i.defaultProps){c===a&&(c=x({},c));for(var y in i)c[y]===void 0&&(c[y]=i[y])}return c}function Zg(i){ic(i)}function fp(i){console.error(i)}function hp(i){ic(i)}function Kf(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function Qg(i,a,c){try{var d=i.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function dp(i,a,c){return c=Lr(c),c.tag=3,c.payload={element:null},c.callback=function(){Kf(i,a)},c}function pp(i){return i=Lr(i),i.tag=3,i}function Kg(i,a,c,d){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var S=d.value;i.payload=function(){return y(S)},i.callback=function(){Qg(a,c,d)}}var L=c.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(i.callback=function(){Qg(a,c,d),typeof y!="function"&&(gi===null?gi=new Set([this]):gi.add(this));var V=d.stack;this.componentDidCatch(d.value,{componentStack:V!==null?V:""})})}function Li(i,a,c,d,y){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=c.alternate,a!==null&&nr(a,c,y,!0),c=Ma.current,c!==null){switch(c.tag){case 31:case 13:return da===null?du():c.alternate===null&&ii===0&&(ii=3),c.flags&=-257,c.flags|=65536,c.lanes=y,d===zf?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([d]):a.add(d),Cc(i,d,y)),!1;case 22:return c.flags|=65536,d===zf?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([d]):c.add(d)),Cc(i,d,y)),!1}throw Error(n(435,c.tag))}return Cc(i,d,y),du(),!1}if(mn)return a=Ma.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,d!==Ql&&(i=Error(n(422),{cause:d}),$s(Xa(i,c)))):(d!==Ql&&(a=Error(n(423),{cause:d}),$s(Xa(a,c))),i=i.current.alternate,i.flags|=65536,y&=-y,i.lanes|=y,d=Xa(d,c),y=dp(i.stateNode,d,y),Ut(i,y),ii!==4&&(ii=2)),!1;var S=Error(n(520),{cause:d});if(S=Xa(S,c),gl===null?gl=[S]:gl.push(S),ii!==4&&(ii=2),a===null)return!0;d=Xa(d,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=y&-y,c.lanes|=i,i=dp(c.stateNode,d,i),Ut(c,i),!1;case 1:if(a=c.type,S=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(gi===null||!gi.has(S))))return c.flags|=65536,y&=-y,c.lanes|=y,y=pp(y),Kg(y,i,c,d),Ut(c,y),!1}c=c.return}while(c!==null);return!1}var Jf=Error(n(461)),Mi=!1;function Gi(i,a,c,d){a.child=i===null?kf(a,null,c,d):Dr(a,i.child,c,d)}function mp(i,a,c,d,y){c=c.render;var S=a.ref;if("ref"in d){var L={};for(var V in d)V!=="ref"&&(L[V]=d[V])}else L=d;return fo(a),d=Gf(i,a,c,L,S,y),V=Gd(),i!==null&&!Mi?(Xd(i,a,y),pi(i,a,y)):(mn&&V&&Ks(a),a.flags|=1,Gi(i,a,d,y),a.child)}function ul(i,a,c,d,y){if(i===null){var S=c.type;return typeof S=="function"&&!wf(S)&&S.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=S,$f(i,a,S,d,y)):(i=Zs(c.type,null,d,a,a.mode,y),i.ref=a.ref,i.return=a,a.child=i)}if(S=i.child,!sh(i,y)){var L=S.memoizedProps;if(c=c.compare,c=c!==null?c:Hl,c(L,d)&&i.ref===a.ref)return pi(i,a,y)}return a.flags|=1,i=xa(S,d),i.ref=a.ref,i.return=a,a.child=i}function $f(i,a,c,d,y){if(i!==null){var S=i.memoizedProps;if(Hl(S,d)&&i.ref===a.ref)if(Mi=!1,a.pendingProps=d=S,sh(i,y))(i.flags&131072)!==0&&(Mi=!0);else return a.lanes=i.lanes,pi(i,a,y)}return ou(i,a,c,d,y)}function cl(i,a,c,d){var y=d.children,S=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(S=S!==null?S.baseLanes|c:c,i!==null){for(d=a.child=i.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~S}else d=0,a.child=null;return Ta(i,a,S,c,d)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&oc(a,S!==null?S.cachePool:null),S!==null?mg(a,S):Fd(),gg(a);else return d=a.lanes=536870912,Ta(i,a,S!==null?S.baseLanes|c:c,c,d)}else S!==null?(oc(a,S.cachePool),mg(a,S),Ea(),a.memoizedState=null):(i!==null&&oc(a,null),Fd(),Ea());return Gi(i,a,y,c),a.child}function ar(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ta(i,a,c,d,y){var S=Pf();return S=S===null?null:{parent:Si._currentValue,pool:S},a.memoizedState={baseLanes:c,cachePool:S},i!==null&&oc(a,null),Fd(),gg(a),i!==null&&nr(i,a,d,!0),a.childLanes=y,null}function eh(i,a){return a=ah({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function Jg(i,a,c){return Dr(a,i.child,null,c),i=eh(a,a.pendingProps),i.flags|=2,hi(a),a.memoizedState=null,i}function th(i,a,c){var d=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(mn){if(d.mode==="hidden")return i=eh(a,d),a.lanes=536870912,ar(null,i);if(kd(a),(i=kn)?(i=SS(i,Wa),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:wr!==null?{id:ti,overflow:Us}:null,retryLane:536870912,hydrationErrors:null},c=jl(i),c.return=a,a.child=c,li=a,kn=null)):i=null,i===null)throw Js(a);return a.lanes=536870912,null}return eh(a,d)}var S=i.memoizedState;if(S!==null){var L=S.dehydrated;if(kd(a),y)if(a.flags&256)a.flags&=-257,a=Jg(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(n(558));else if(Mi||nr(i,a,c,!1),y=(c&i.childLanes)!==0,Mi||y){if(d=Gt,d!==null&&(L=Ho(d,c),L!==0&&L!==S.retryLane))throw S.retryLane=L,fa(i,L),rn(d,i,L),Jf;du(),a=Jg(i,a,c)}else i=S.treeContext,kn=dr(L.nextSibling),li=a,mn=!0,Cr=null,Wa=!1,i!==null&&Df(a,i),a=eh(a,d),a.flags|=4096;return a}return i=xa(i.child,{mode:d.mode,children:d.children}),i.ref=a.ref,a.child=i,i.return=a,i}function fl(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(n(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function ou(i,a,c,d,y){return fo(a),c=Gf(i,a,c,d,void 0,y),d=Gd(),i!==null&&!Mi?(Xd(i,a,y),pi(i,a,y)):(mn&&d&&Ks(a),a.flags|=1,Gi(i,a,c,y),a.child)}function vc(i,a,c,d,y,S){return fo(a),a.updateQueue=null,c=ol(a,d,c,y),vg(i),d=Gd(),i!==null&&!Mi?(Xd(i,a,S),pi(i,a,S)):(mn&&d&&Ks(a),a.flags|=1,Gi(i,a,c,S),a.child)}function nh(i,a,c,d,y){if(fo(a),a.stateNode===null){var S=so,L=c.contextType;typeof L=="object"&&L!==null&&(S=Vt(L)),S=new c(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=gc,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},cc(a),L=c.contextType,S.context=typeof L=="object"&&L!==null?Vt(L):so,S.state=a.memoizedState,L=c.getDerivedStateFromProps,typeof L=="function"&&(Qf(a,c,L,d),S.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(L=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),L!==S.state&&gc.enqueueReplaceState(S,S.state,null),tu(a,d,S,y),fc(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(i===null){S=a.stateNode;var V=a.memoizedProps,$=yo(c,V);S.props=$;var ve=S.context,De=c.contextType;L=so,typeof De=="object"&&De!==null&&(L=Vt(De));var Be=c.getDerivedStateFromProps;De=typeof Be=="function"||typeof S.getSnapshotBeforeUpdate=="function",V=a.pendingProps!==V,De||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(V||ve!==L)&&cp(a,S,d,L),ha=!1;var xe=a.memoizedState;S.state=xe,tu(a,d,S,y),fc(),ve=a.memoizedState,V||xe!==ve||ha?(typeof Be=="function"&&(Qf(a,c,Be,d),ve=a.memoizedState),($=ha||up(a,c,$,d,xe,ve,L))?(De||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(a.flags|=4194308)):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ve),S.props=d,S.state=ve,S.context=L,d=$):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,zd(i,a),L=a.memoizedProps,De=yo(c,L),S.props=De,Be=a.pendingProps,xe=S.context,ve=c.contextType,$=so,typeof ve=="object"&&ve!==null&&($=Vt(ve)),V=c.getDerivedStateFromProps,(ve=typeof V=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(L!==Be||xe!==$)&&cp(a,S,d,$),ha=!1,xe=a.memoizedState,S.state=xe,tu(a,d,S,y),fc();var Ce=a.memoizedState;L!==Be||xe!==Ce||ha||i!==null&&i.dependencies!==null&&rc(i.dependencies)?(typeof V=="function"&&(Qf(a,c,V,d),Ce=a.memoizedState),(De=ha||up(a,c,De,d,xe,Ce,$)||i!==null&&i.dependencies!==null&&rc(i.dependencies))?(ve||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,Ce,$),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,Ce,$)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||L===i.memoizedProps&&xe===i.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===i.memoizedProps&&xe===i.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=Ce),S.props=d,S.state=Ce,S.context=$,d=De):(typeof S.componentDidUpdate!="function"||L===i.memoizedProps&&xe===i.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||L===i.memoizedProps&&xe===i.memoizedState||(a.flags|=1024),d=!1)}return S=d,fl(i,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,i!==null&&d?(a.child=Dr(a,i.child,null,y),a.child=Dr(a,null,c,y)):Gi(i,a,c,y),a.memoizedState=S.state,i=a.child):i=pi(i,a,y),i}function $g(i,a,c,d){return uo(),a.flags|=256,Gi(i,a,c,d),a.child}var gp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function aa(i){return{baseLanes:i,cachePool:Pd()}}function ih(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=ga),i}function e0(i,a,c){var d=a.pendingProps,y=!1,S=(a.flags&128)!==0,L;if((L=S)||(L=i!==null&&i.memoizedState===null?!1:(gn.current&2)!==0),L&&(y=!0,a.flags&=-129),L=(a.flags&32)!==0,a.flags&=-33,i===null){if(mn){if(y?Ur(a):Ea(),(i=kn)?(i=SS(i,Wa),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:wr!==null?{id:ti,overflow:Us}:null,retryLane:536870912,hydrationErrors:null},c=jl(i),c.return=a,a.child=c,li=a,kn=null)):i=null,i===null)throw Js(a);return M_(i)?a.lanes=32:a.lanes=536870912,null}var V=d.children;return d=d.fallback,y?(Ea(),y=a.mode,V=ah({mode:"hidden",children:V},y),d=ro(d,y,c,null),V.return=a,d.return=a,V.sibling=d,a.child=V,d=a.child,d.memoizedState=aa(c),d.childLanes=ih(i,L,c),a.memoizedState=gp,ar(null,d)):(Ur(a),yc(a,V))}var $=i.memoizedState;if($!==null&&(V=$.dehydrated,V!==null)){if(S)a.flags&256?(Ur(a),a.flags&=-257,a=vp(i,a,c)):a.memoizedState!==null?(Ea(),a.child=i.child,a.flags|=128,a=null):(Ea(),V=d.fallback,y=a.mode,d=ah({mode:"visible",children:d.children},y),V=ro(V,y,c,null),V.flags|=2,d.return=a,V.return=a,d.sibling=V,a.child=d,Dr(a,i.child,null,c),d=a.child,d.memoizedState=aa(c),d.childLanes=ih(i,L,c),a.memoizedState=gp,a=ar(null,d));else if(Ur(a),M_(V)){if(L=V.nextSibling&&V.nextSibling.dataset,L)var ve=L.dgst;L=ve,d=Error(n(419)),d.stack="",d.digest=L,$s({value:d,source:null,stack:null}),a=vp(i,a,c)}else if(Mi||nr(i,a,c,!1),L=(c&i.childLanes)!==0,Mi||L){if(L=Gt,L!==null&&(d=Ho(L,c),d!==0&&d!==$.retryLane))throw $.retryLane=d,fa(i,d),rn(L,i,d),Jf;S_(V)||du(),a=vp(i,a,c)}else S_(V)?(a.flags|=192,a.child=i.child,a=null):(i=$.treeContext,kn=dr(V.nextSibling),li=a,mn=!0,Cr=null,Wa=!1,i!==null&&Df(a,i),a=yc(a,d.children),a.flags|=4096);return a}return y?(Ea(),V=d.fallback,y=a.mode,$=i.child,ve=$.sibling,d=xa($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,ve!==null?V=xa(ve,V):(V=ro(V,y,c,null),V.flags|=2),V.return=a,d.return=a,d.sibling=V,a.child=d,ar(null,d),d=a.child,V=i.child.memoizedState,V===null?V=aa(c):(y=V.cachePool,y!==null?($=Si._currentValue,y=y.parent!==$?{parent:$,pool:$}:y):y=Pd(),V={baseLanes:V.baseLanes|c,cachePool:y}),d.memoizedState=V,d.childLanes=ih(i,L,c),a.memoizedState=gp,ar(i.child,d)):(Ur(a),c=i.child,i=c.sibling,c=xa(c,{mode:"visible",children:d.children}),c.return=a,c.sibling=null,i!==null&&(L=a.deletions,L===null?(a.deletions=[i],a.flags|=16):L.push(i)),a.child=c,a.memoizedState=null,c)}function yc(i,a){return a=ah({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function ah(i,a){return i=ei(22,i,null,a),i.lanes=0,i}function vp(i,a,c){return Dr(a,i.child,null,c),i=yc(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function t0(i,a,c){i.lanes|=a;var d=i.alternate;d!==null&&(d.lanes|=a),Uf(i.return,a,c)}function hl(i,a,c,d,y,S){var L=i.memoizedState;L===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:y,treeForkCount:S}:(L.isBackwards=a,L.rendering=null,L.renderingStartTime=0,L.last=d,L.tail=c,L.tailMode=y,L.treeForkCount=S)}function Aa(i,a,c){var d=a.pendingProps,y=d.revealOrder,S=d.tail;d=d.children;var L=gn.current,V=(L&2)!==0;if(V?(L=L&1|2,a.flags|=128):L&=1,Ae(gn,L),Gi(i,a,d,c),d=mn?Zl:0,!V&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&t0(i,c,a);else if(i.tag===19)t0(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(y){case"forwards":for(c=a.child,y=null;c!==null;)i=c.alternate,i!==null&&ja(i)===null&&(y=c),c=c.sibling;c=y,c===null?(y=a.child,a.child=null):(y=c.sibling,c.sibling=null),hl(a,!1,y,c,S,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,y=a.child,a.child=null;y!==null;){if(i=y.alternate,i!==null&&ja(i)===null){a.child=y;break}i=y.sibling,y.sibling=c,c=y,y=i}hl(a,!0,c,null,S,d);break;case"together":hl(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function pi(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),cr|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(nr(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(n(153));if(a.child!==null){for(i=a.child,c=xa(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=xa(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function sh(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&rc(i)))}function c_(i,a,c){switch(a.tag){case 3:tt(a,a.stateNode.containerInfo),Rr(a,Si,i.memoizedState.cache),uo();break;case 27:case 5:ht(a);break;case 4:tt(a,a.stateNode.containerInfo);break;case 10:Rr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,kd(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(Ur(a),a.flags|=128,null):(c&a.child.childLanes)!==0?e0(i,a,c):(Ur(a),i=pi(i,a,c),i!==null?i.sibling:null);Ur(a);break;case 19:var y=(i.flags&128)!==0;if(d=(c&a.childLanes)!==0,d||(nr(i,a,c,!1),d=(c&a.childLanes)!==0),y){if(d)return Aa(i,a,c);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Ae(gn,gn.current),d)break;return null;case 22:return a.lanes=0,cl(i,a,c,a.pendingProps);case 24:Rr(a,Si,i.memoizedState.cache)}return pi(i,a,c)}function rh(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)Mi=!0;else{if(!sh(i,c)&&(a.flags&128)===0)return Mi=!1,c_(i,a,c);Mi=(i.flags&131072)!==0}else Mi=!1,mn&&(a.flags&1048576)!==0&&lg(a,Zl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(i=tl(a.elementType),a.type=i,typeof i=="function")wf(i)?(d=yo(i,d),a.tag=1,a=nh(null,a,i,d,c)):(a.tag=0,a=ou(null,a,i,d,c));else{if(i!=null){var y=i.$$typeof;if(y===U){a.tag=11,a=mp(null,a,i,d,c);break e}else if(y===H){a.tag=14,a=ul(null,a,i,d,c);break e}}throw a=fe(i)||i,Error(n(306,a,""))}}return a;case 0:return ou(i,a,a.type,a.pendingProps,c);case 1:return d=a.type,y=yo(d,a.pendingProps),nh(i,a,d,y,c);case 3:e:{if(tt(a,a.stateNode.containerInfo),i===null)throw Error(n(387));d=a.pendingProps;var S=a.memoizedState;y=S.element,zd(i,a),tu(a,d,null,c);var L=a.memoizedState;if(d=L.cache,Rr(a,Si,d),d!==S.cache&&If(a,[Si],c,!0),fc(),d=L.element,S.isDehydrated)if(S={element:d,isDehydrated:!1,cache:L.cache},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){a=$g(i,a,d,c);break e}else if(d!==y){y=Xa(Error(n(424)),a),$s(y),a=$g(i,a,d,c);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,kn=dr(i.firstChild),li=a,mn=!0,Cr=null,Wa=!0,c=kf(a,null,d,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(uo(),d===y){a=pi(i,a,c);break e}Gi(i,a,d,c)}a=a.child}return a;case 26:return fl(i,a),i===null?(c=CS(a.type,null,a.pendingProps,null))?a.memoizedState=c:mn||(c=a.type,i=a.pendingProps,d=s0(de.current).createElement(c),d[$n]=a,d[Ri]=i,ya(d,c,i),k(d),a.stateNode=d):a.memoizedState=CS(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return ht(a),i===null&&mn&&(d=a.stateNode=TS(a.type,a.pendingProps,de.current),li=a,Wa=!0,y=kn,vu(a.type)?(E_=y,kn=dr(d.firstChild)):kn=y),Gi(i,a,a.pendingProps.children,c),fl(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&mn&&((y=d=kn)&&(d=CA(d,a.type,a.pendingProps,Wa),d!==null?(a.stateNode=d,li=a,kn=dr(d.firstChild),Wa=!1,y=!0):y=!1),y||Js(a)),ht(a),y=a.type,S=a.pendingProps,L=i!==null?i.memoizedProps:null,d=S.children,__(y,S)?d=null:L!==null&&__(y,L)&&(a.flags|=32),a.memoizedState!==null&&(y=Gf(i,a,ll,null,null,c),Cp._currentValue=y),fl(i,a),Gi(i,a,d,c),a.child;case 6:return i===null&&mn&&((i=c=kn)&&(c=RA(c,a.pendingProps,Wa),c!==null?(a.stateNode=c,li=a,kn=null,i=!0):i=!1),i||Js(a)),null;case 13:return e0(i,a,c);case 4:return tt(a,a.stateNode.containerInfo),d=a.pendingProps,i===null?a.child=Dr(a,null,d,c):Gi(i,a,d,c),a.child;case 11:return mp(i,a,a.type,a.pendingProps,c);case 7:return Gi(i,a,a.pendingProps,c),a.child;case 8:return Gi(i,a,a.pendingProps.children,c),a.child;case 12:return Gi(i,a,a.pendingProps.children,c),a.child;case 10:return d=a.pendingProps,Rr(a,a.type,d.value),Gi(i,a,d.children,c),a.child;case 9:return y=a.type._context,d=a.pendingProps.children,fo(a),y=Vt(y),d=d(y),a.flags|=1,Gi(i,a,d,c),a.child;case 14:return ul(i,a,a.type,a.pendingProps,c);case 15:return $f(i,a,a.type,a.pendingProps,c);case 19:return Aa(i,a,c);case 31:return th(i,a,c);case 22:return cl(i,a,c,a.pendingProps);case 24:return fo(a),d=Vt(Si),i===null?(y=Pf(),y===null&&(y=Gt,S=Ld(),y.pooledCache=S,S.refCount++,S!==null&&(y.pooledCacheLanes|=c),y=S),a.memoizedState={parent:d,cache:y},cc(a),Rr(a,Si,y)):((i.lanes&c)!==0&&(zd(i,a),tu(a,null,null,c),fc()),y=i.memoizedState,S=a.memoizedState,y.parent!==d?(y={parent:d,cache:d},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Rr(a,Si,d)):(d=S.cache,Rr(a,Si,d),d!==y.cache&&If(a,[Si],c,!0))),Gi(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function sr(i){i.flags|=4}function _c(i,a,c,d,y){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(y&335544128)===y)if(i.stateNode.complete)i.flags|=8192;else if(si())i.flags|=8192;else throw ir=zf,lc}else i.flags&=-16777217}function yp(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!US(a))if(si())i.flags|=8192;else throw ir=zf,lc}function Or(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?Jt():536870912,i.lanes|=a,qn|=a)}function rr(i,a){if(!mn)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function Pn(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,d=0;if(a)for(var y=i.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=i,y=y.sibling;else for(y=i.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=i,y=y.sibling;return i.subtreeFlags|=d,i.childLanes=c,a}function xc(i,a,c){var d=a.pendingProps;switch(Nf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pn(a),null;case 1:return Pn(a),null;case 3:return c=a.stateNode,d=null,i!==null&&(d=i.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),tr(Si),st(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Kl(a)?sr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Lf())),Pn(a),null;case 26:var y=a.type,S=a.memoizedState;return i===null?(sr(a),S!==null?(Pn(a),yp(a,S)):(Pn(a),_c(a,y,null,d,c))):S?S!==i.memoizedState?(sr(a),Pn(a),yp(a,S)):(Pn(a),a.flags&=-16777217):(i=i.memoizedProps,i!==d&&sr(a),Pn(a),_c(a,y,i,d,c)),null;case 27:if(jt(a),c=de.current,y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==d&&sr(a);else{if(!d){if(a.stateNode===null)throw Error(n(166));return Pn(a),null}i=Fe.current,Kl(a)?ug(a):(i=TS(y,d,c),a.stateNode=i,sr(a))}return Pn(a),null;case 5:if(jt(a),y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==d&&sr(a);else{if(!d){if(a.stateNode===null)throw Error(n(166));return Pn(a),null}if(S=Fe.current,Kl(a))ug(a);else{var L=s0(de.current);switch(S){case 1:S=L.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:S=L.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":S=L.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":S=L.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":S=L.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof d.is=="string"?L.createElement("select",{is:d.is}):L.createElement("select"),d.multiple?S.multiple=!0:d.size&&(S.size=d.size);break;default:S=typeof d.is=="string"?L.createElement(y,{is:d.is}):L.createElement(y)}}S[$n]=a,S[Ri]=d;e:for(L=a.child;L!==null;){if(L.tag===5||L.tag===6)S.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===a)break e;for(;L.sibling===null;){if(L.return===null||L.return===a)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}a.stateNode=S;e:switch(ya(S,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&sr(a)}}return Pn(a),_c(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==d&&sr(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(n(166));if(i=de.current,Kl(a)){if(i=a.stateNode,c=a.memoizedProps,d=null,y=li,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}i[$n]=a,i=!!(i.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||pS(i.nodeValue,c)),i||Js(a,!0)}else i=s0(i).createTextNode(d),i[$n]=a,a.stateNode=i}return Pn(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(d=Kl(a),c!==null){if(i===null){if(!d)throw Error(n(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[$n]=a}else uo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Pn(a),i=!1}else c=Lf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(hi(a),a):(hi(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Pn(a),null;case 13:if(d=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(y=Kl(a),d!==null&&d.dehydrated!==null){if(i===null){if(!y)throw Error(n(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(n(317));y[$n]=a}else uo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Pn(a),y=!1}else y=Lf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(hi(a),a):(hi(a),null)}return hi(a),(a.flags&128)!==0?(a.lanes=c,a):(c=d!==null,i=i!==null&&i.memoizedState!==null,c&&(d=a.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==y&&(d.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),Or(a,a.updateQueue),Pn(a),null);case 4:return st(),i===null&&p_(a.stateNode.containerInfo),Pn(a),null;case 10:return tr(a.type),Pn(a),null;case 19:if(oe(gn),d=a.memoizedState,d===null)return Pn(a),null;if(y=(a.flags&128)!==0,S=d.rendering,S===null)if(y)rr(d,!1);else{if(ii!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(S=ja(i),S!==null){for(a.flags|=128,rr(d,!1),i=S.updateQueue,a.updateQueue=i,Or(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)ql(c,i),c=c.sibling;return Ae(gn,gn.current&1|2),mn&&Qs(a,d.treeForkCount),a.child}i=i.sibling}d.tail!==null&&O()>mi&&(a.flags|=128,y=!0,rr(d,!1),a.lanes=4194304)}else{if(!y)if(i=ja(S),i!==null){if(a.flags|=128,y=!0,i=i.updateQueue,a.updateQueue=i,Or(a,i),rr(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!mn)return Pn(a),null}else 2*O()-d.renderingStartTime>mi&&c!==536870912&&(a.flags|=128,y=!0,rr(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(i=d.last,i!==null?i.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(i=d.tail,d.rendering=i,d.tail=i.sibling,d.renderingStartTime=O(),i.sibling=null,c=gn.current,Ae(gn,y?c&1|2:c&1),mn&&Qs(a,d.treeForkCount),i):(Pn(a),null);case 22:case 23:return hi(a),hc(),d=a.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(c&536870912)!==0&&(a.flags&128)===0&&(Pn(a),a.subtreeFlags&6&&(a.flags|=8192)):Pn(a),c=a.updateQueue,c!==null&&Or(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==c&&(a.flags|=2048),i!==null&&oe(ho),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),tr(Si),Pn(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function gs(i,a){switch(Nf(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return tr(Si),st(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return jt(a),null;case 31:if(a.memoizedState!==null){if(hi(a),a.alternate===null)throw Error(n(340));uo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(hi(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));uo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return oe(gn),null;case 4:return st(),null;case 10:return tr(a.type),null;case 22:case 23:return hi(a),hc(),i!==null&&oe(ho),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return tr(Si),null;case 25:return null;default:return null}}function Ya(i,a){switch(Nf(a),a.tag){case 3:tr(Si),st();break;case 26:case 27:case 5:jt(a);break;case 4:st();break;case 31:a.memoizedState!==null&&hi(a);break;case 13:hi(a);break;case 19:oe(gn);break;case 10:tr(a.type);break;case 22:case 23:hi(a),hc(),i!==null&&oe(ho);break;case 24:tr(Si)}}function vs(i,a){try{var c=a.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var y=d.next;c=y;do{if((c.tag&i)===i){d=void 0;var S=c.create,L=c.inst;d=S(),L.destroy=d}c=c.next}while(c!==y)}}catch(V){En(a,a.return,V)}}function Qi(i,a,c){try{var d=a.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var S=y.next;d=S;do{if((d.tag&i)===i){var L=d.inst,V=L.destroy;if(V!==void 0){L.destroy=void 0,y=a;var $=c,ve=V;try{ve()}catch(De){En(y,$,De)}}}d=d.next}while(d!==S)}}catch(De){En(a,a.return,De)}}function Is(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{pg(a,c)}catch(d){En(i,i.return,d)}}}function Xi(i,a,c){c.props=yo(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(d){En(i,a,d)}}function Pr(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:d=i.stateNode;break;default:d=i.stateNode}typeof c=="function"?i.refCleanup=c(d):c.current=d}}catch(y){En(i,a,y)}}function Ki(i,a){var c=i.ref,d=i.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(y){En(i,a,y)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){En(i,a,y)}else c.current=null}function bc(i){var a=i.type,c=i.memoizedProps,d=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(y){En(i,i.return,y)}}function Ui(i,a,c){try{var d=i.stateNode;SA(d,i.type,c,a),d[Ri]=a}catch(y){En(i,i.return,y)}}function Qn(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&vu(i.type)||i.tag===4}function dn(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Qn(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&vu(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function or(i,a,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Er));else if(d!==4&&(d===27&&vu(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(or(i,a,c),i=i.sibling;i!==null;)or(i,a,c),i=i.sibling}function pa(i,a,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(d!==4&&(d===27&&vu(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(pa(i,a,c),i=i.sibling;i!==null;)pa(i,a,c),i=i.sibling}function oh(i){var a=i.stateNode,c=i.memoizedProps;try{for(var d=i.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);ya(a,d,c),a[$n]=i,a[Ri]=c}catch(S){En(i,i.return,S)}}var ys=!1,Vn=!1,Os=!1,n0=typeof WeakSet=="function"?WeakSet:Set,Wi=null;function f_(i,a){if(i=i.containerInfo,v_=h0,i=ag(i),wd(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var y=d.anchorOffset,S=d.focusNode;d=d.focusOffset;try{c.nodeType,S.nodeType}catch{c=null;break e}var L=0,V=-1,$=-1,ve=0,De=0,Be=i,xe=null;t:for(;;){for(var Ce;Be!==c||y!==0&&Be.nodeType!==3||(V=L+y),Be!==S||d!==0&&Be.nodeType!==3||($=L+d),Be.nodeType===3&&(L+=Be.nodeValue.length),(Ce=Be.firstChild)!==null;)xe=Be,Be=Ce;for(;;){if(Be===i)break t;if(xe===c&&++ve===y&&(V=L),xe===S&&++De===d&&($=L),(Ce=Be.nextSibling)!==null)break;Be=xe,xe=Be.parentNode}Be=Ce}c=V===-1||$===-1?null:{start:V,end:$}}else c=null}c=c||{start:0,end:0}}else c=null;for(y_={focusedElem:i,selectionRange:c},h0=!1,Wi=a;Wi!==null;)if(a=Wi,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Wi=i;else for(;Wi!==null;){switch(a=Wi,S=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)y=i[c],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&S!==null){i=void 0,c=a,y=S.memoizedProps,S=S.memoizedState,d=c.stateNode;try{var Mt=yo(c.type,y);i=d.getSnapshotBeforeUpdate(Mt,S),d.__reactInternalSnapshotBeforeUpdate=i}catch(kt){En(c,c.return,kt)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)b_(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":b_(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(n(163))}if(i=a.sibling,i!==null){i.return=a.return,Wi=i;break}Wi=a.return}}function Kn(i,a,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:bs(i,c),d&4&&vs(5,c);break;case 1:if(bs(i,c),d&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(L){En(c,c.return,L)}else{var y=yo(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(y,a,i.__reactInternalSnapshotBeforeUpdate)}catch(L){En(c,c.return,L)}}d&64&&Is(c),d&512&&Pr(c,c.return);break;case 3:if(bs(i,c),d&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{pg(i,a)}catch(L){En(c,c.return,L)}}break;case 27:a===null&&d&4&&oh(c);case 26:case 5:bs(i,c),a===null&&d&4&&bc(c),d&512&&Pr(c,c.return);break;case 12:bs(i,c);break;case 31:bs(i,c),d&4&&_o(i,c);break;case 13:bs(i,c),d&4&&lu(i,c),d&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=p.bind(null,c),NA(i,c))));break;case 22:if(d=c.memoizedState!==null||ys,!d){a=a!==null&&a.memoizedState!==null||Vn,y=ys;var S=Vn;ys=d,(Vn=a)&&!S?ma(i,c,(c.subtreeFlags&8772)!==0):bs(i,c),ys=y,Vn=S}break;case 30:break;default:bs(i,c)}}function Sc(i){var a=i.alternate;a!==null&&(i.alternate=null,Sc(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&br(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Dn=null,sa=!1;function _s(i,a,c){for(c=c.child;c!==null;)lh(i,a,c),c=c.sibling}function lh(i,a,c){if(Ze&&typeof Ze.onCommitFiberUnmount=="function")try{Ze.onCommitFiberUnmount(Ve,c)}catch{}switch(c.tag){case 26:Vn||Ki(c,a),_s(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Vn||Ki(c,a);var d=Dn,y=sa;vu(c.type)&&(Dn=c.stateNode,sa=!1),_s(i,a,c),Tp(c.stateNode),Dn=d,sa=y;break;case 5:Vn||Ki(c,a);case 6:if(d=Dn,y=sa,Dn=null,_s(i,a,c),Dn=d,sa=y,Dn!==null)if(sa)try{(Dn.nodeType===9?Dn.body:Dn.nodeName==="HTML"?Dn.ownerDocument.body:Dn).removeChild(c.stateNode)}catch(S){En(c,a,S)}else try{Dn.removeChild(c.stateNode)}catch(S){En(c,a,S)}break;case 18:Dn!==null&&(sa?(i=Dn,xS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),gh(i)):xS(Dn,c.stateNode));break;case 4:d=Dn,y=sa,Dn=c.stateNode.containerInfo,sa=!0,_s(i,a,c),Dn=d,sa=y;break;case 0:case 11:case 14:case 15:Qi(2,c,a),Vn||Qi(4,c,a),_s(i,a,c);break;case 1:Vn||(Ki(c,a),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Xi(c,a,d)),_s(i,a,c);break;case 21:_s(i,a,c);break;case 22:Vn=(d=Vn)||c.memoizedState!==null,_s(i,a,c),Vn=d;break;default:_s(i,a,c)}}function _o(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{gh(i)}catch(c){En(a,a.return,c)}}}function lu(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{gh(i)}catch(c){En(a,a.return,c)}}function _p(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new n0),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new n0),a;default:throw Error(n(435,i.tag))}}function zr(i,a){var c=_p(i);a.forEach(function(d){if(!c.has(d)){c.add(d);var y=v.bind(null,i,d);d.then(y,y)}})}function Ii(i,a){var c=a.deletions;if(c!==null)for(var d=0;d<c.length;d++){var y=c[d],S=i,L=a,V=L;e:for(;V!==null;){switch(V.tag){case 27:if(vu(V.type)){Dn=V.stateNode,sa=!1;break e}break;case 5:Dn=V.stateNode,sa=!1;break e;case 3:case 4:Dn=V.stateNode.containerInfo,sa=!0;break e}V=V.return}if(Dn===null)throw Error(n(160));lh(S,L,y),Dn=null,sa=!1,S=y.alternate,S!==null&&(S.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)xo(a,i),a=a.sibling}var xs=null;function xo(i,a){var c=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Ii(a,i),Oi(i),d&4&&(Qi(3,i,i.return),vs(3,i),Qi(5,i,i.return));break;case 1:Ii(a,i),Oi(i),d&512&&(Vn||c===null||Ki(c,c.return)),d&64&&ys&&(i=i.updateQueue,i!==null&&(d=i.callbacks,d!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var y=xs;if(Ii(a,i),Oi(i),d&512&&(Vn||c===null||Ki(c,c.return)),d&4){var S=c!==null?c.memoizedState:null;if(d=i.memoizedState,c===null)if(d===null)if(i.stateNode===null){e:{d=i.type,c=i.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":S=y.getElementsByTagName("title")[0],(!S||S[Ds]||S[$n]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=y.createElement(d),y.head.insertBefore(S,y.querySelector("head > title"))),ya(S,d,c),S[$n]=i,k(S),d=S;break e;case"link":var L=DS("link","href",y).get(d+(c.href||""));if(L){for(var V=0;V<L.length;V++)if(S=L[V],S.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&S.getAttribute("rel")===(c.rel==null?null:c.rel)&&S.getAttribute("title")===(c.title==null?null:c.title)&&S.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){L.splice(V,1);break t}}S=y.createElement(d),ya(S,d,c),y.head.appendChild(S);break;case"meta":if(L=DS("meta","content",y).get(d+(c.content||""))){for(V=0;V<L.length;V++)if(S=L[V],S.getAttribute("content")===(c.content==null?null:""+c.content)&&S.getAttribute("name")===(c.name==null?null:c.name)&&S.getAttribute("property")===(c.property==null?null:c.property)&&S.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&S.getAttribute("charset")===(c.charSet==null?null:c.charSet)){L.splice(V,1);break t}}S=y.createElement(d),ya(S,d,c),y.head.appendChild(S);break;default:throw Error(n(468,d))}S[$n]=i,k(S),d=S}i.stateNode=d}else LS(y,i.type,i.stateNode);else i.stateNode=NS(y,d,i.memoizedProps);else S!==d?(S===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):S.count--,d===null?LS(y,i.type,i.stateNode):NS(y,d,i.memoizedProps)):d===null&&i.stateNode!==null&&Ui(i,i.memoizedProps,c.memoizedProps)}break;case 27:Ii(a,i),Oi(i),d&512&&(Vn||c===null||Ki(c,c.return)),c!==null&&d&4&&Ui(i,i.memoizedProps,c.memoizedProps);break;case 5:if(Ii(a,i),Oi(i),d&512&&(Vn||c===null||Ki(c,c.return)),i.flags&32){y=i.stateNode;try{bi(y,"")}catch(Mt){En(i,i.return,Mt)}}d&4&&i.stateNode!=null&&(y=i.memoizedProps,Ui(i,y,c!==null?c.memoizedProps:y)),d&1024&&(Os=!0);break;case 6:if(Ii(a,i),Oi(i),d&4){if(i.stateNode===null)throw Error(n(162));d=i.memoizedProps,c=i.stateNode;try{c.nodeValue=d}catch(Mt){En(i,i.return,Mt)}}break;case 3:if(l0=null,y=xs,xs=r0(a.containerInfo),Ii(a,i),xs=y,Oi(i),d&4&&c!==null&&c.memoizedState.isDehydrated)try{gh(a.containerInfo)}catch(Mt){En(i,i.return,Mt)}Os&&(Os=!1,uh(i));break;case 4:d=xs,xs=r0(i.stateNode.containerInfo),Ii(a,i),Oi(i),xs=d;break;case 12:Ii(a,i),Oi(i);break;case 31:Ii(a,i),Oi(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zr(i,d)));break;case 13:Ii(a,i),Oi(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(uu=O()),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zr(i,d)));break;case 22:y=i.memoizedState!==null;var $=c!==null&&c.memoizedState!==null,ve=ys,De=Vn;if(ys=ve||y,Vn=De||$,Ii(a,i),Vn=De,ys=ve,Oi(i),d&8192)e:for(a=i.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(c===null||$||ys||Vn||lr(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){$=c=a;try{if(S=$.stateNode,y)L=S.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{V=$.stateNode;var Be=$.memoizedProps.style,xe=Be!=null&&Be.hasOwnProperty("display")?Be.display:null;V.style.display=xe==null||typeof xe=="boolean"?"":(""+xe).trim()}}catch(Mt){En($,$.return,Mt)}}}else if(a.tag===6){if(c===null){$=a;try{$.stateNode.nodeValue=y?"":$.memoizedProps}catch(Mt){En($,$.return,Mt)}}}else if(a.tag===18){if(c===null){$=a;try{var Ce=$.stateNode;y?bS(Ce,!0):bS($.stateNode,!1)}catch(Mt){En($,$.return,Mt)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=i.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,zr(i,c))));break;case 19:Ii(a,i),Oi(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zr(i,d)));break;case 30:break;case 21:break;default:Ii(a,i),Oi(i)}}function Oi(i){var a=i.flags;if(a&2){try{for(var c,d=i.return;d!==null;){if(Qn(d)){c=d;break}d=d.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var y=c.stateNode,S=dn(i);pa(i,S,y);break;case 5:var L=c.stateNode;c.flags&32&&(bi(L,""),c.flags&=-33);var V=dn(i);pa(i,V,L);break;case 3:case 4:var $=c.stateNode.containerInfo,ve=dn(i);or(i,ve,$);break;default:throw Error(n(161))}}catch(De){En(i,i.return,De)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function uh(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;uh(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function bs(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Kn(i,a.alternate,a),a=a.sibling}function lr(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Qi(4,a,a.return),lr(a);break;case 1:Ki(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Xi(a,a.return,c),lr(a);break;case 27:Tp(a.stateNode);case 26:case 5:Ki(a,a.return),lr(a);break;case 22:a.memoizedState===null&&lr(a);break;case 30:lr(a);break;default:lr(a)}i=i.sibling}}function ma(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,y=i,S=a,L=S.flags;switch(S.tag){case 0:case 11:case 15:ma(y,S,c),vs(4,S);break;case 1:if(ma(y,S,c),d=S,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ve){En(d,d.return,ve)}if(d=S,y=d.updateQueue,y!==null){var V=d.stateNode;try{var $=y.shared.hiddenCallbacks;if($!==null)for(y.shared.hiddenCallbacks=null,y=0;y<$.length;y++)nu($[y],V)}catch(ve){En(d,d.return,ve)}}c&&L&64&&Is(S),Pr(S,S.return);break;case 27:oh(S);case 26:case 5:ma(y,S,c),c&&d===null&&L&4&&bc(S),Pr(S,S.return);break;case 12:ma(y,S,c);break;case 31:ma(y,S,c),c&&L&4&&_o(y,S);break;case 13:ma(y,S,c),c&&L&4&&lu(y,S);break;case 22:S.memoizedState===null&&ma(y,S,c),Pr(S,S.return);break;case 30:break;default:ma(y,S,c)}a=a.sibling}}function bo(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&$o(c))}function dl(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$o(i))}function Ji(i,a,c,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)xp(i,a,c,d),a=a.sibling}function xp(i,a,c,d){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Ji(i,a,c,d),y&2048&&vs(9,a);break;case 1:Ji(i,a,c,d);break;case 3:Ji(i,a,c,d),y&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$o(i)));break;case 12:if(y&2048){Ji(i,a,c,d),i=a.stateNode;try{var S=a.memoizedProps,L=S.id,V=S.onPostCommit;typeof V=="function"&&V(L,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch($){En(a,a.return,$)}}else Ji(i,a,c,d);break;case 31:Ji(i,a,c,d);break;case 13:Ji(i,a,c,d);break;case 23:break;case 22:S=a.stateNode,L=a.alternate,a.memoizedState!==null?S._visibility&2?Ji(i,a,c,d):ur(i,a):S._visibility&2?Ji(i,a,c,d):(S._visibility|=2,$i(i,a,c,d,(a.subtreeFlags&10256)!==0||!1)),y&2048&&bo(L,a);break;case 24:Ji(i,a,c,d),y&2048&&dl(a.alternate,a);break;default:Ji(i,a,c,d)}}function $i(i,a,c,d,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var S=i,L=a,V=c,$=d,ve=L.flags;switch(L.tag){case 0:case 11:case 15:$i(S,L,V,$,y),vs(8,L);break;case 23:break;case 22:var De=L.stateNode;L.memoizedState!==null?De._visibility&2?$i(S,L,V,$,y):ur(S,L):(De._visibility|=2,$i(S,L,V,$,y)),y&&ve&2048&&bo(L.alternate,L);break;case 24:$i(S,L,V,$,y),y&&ve&2048&&dl(L.alternate,L);break;default:$i(S,L,V,$,y)}a=a.sibling}}function ur(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,d=a,y=d.flags;switch(d.tag){case 22:ur(c,d),y&2048&&bo(d.alternate,d);break;case 24:ur(c,d),y&2048&&dl(d.alternate,d);break;default:ur(c,d)}a=a.sibling}}var pl=8192;function Za(i,a,c){if(i.subtreeFlags&pl)for(i=i.child;i!==null;)ch(i,a,c),i=i.sibling}function ch(i,a,c){switch(i.tag){case 26:Za(i,a,c),i.flags&pl&&i.memoizedState!==null&&HA(c,xs,i.memoizedState,i.memoizedProps);break;case 5:Za(i,a,c);break;case 3:case 4:var d=xs;xs=r0(i.stateNode.containerInfo),Za(i,a,c),xs=d;break;case 22:i.memoizedState===null&&(d=i.alternate,d!==null&&d.memoizedState!==null?(d=pl,pl=16777216,Za(i,a,c),pl=d):Za(i,a,c));break;default:Za(i,a,c)}}function ml(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function So(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];Wi=d,ui(d,i)}ml(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)wa(i),i=i.sibling}function wa(i){switch(i.tag){case 0:case 11:case 15:So(i),i.flags&2048&&Qi(9,i,i.return);break;case 3:So(i);break;case 12:So(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,Ca(i)):So(i);break;default:So(i)}}function Ca(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];Wi=d,ui(d,i)}ml(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Qi(8,a,a.return),Ca(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Ca(a));break;default:Ca(a)}i=i.sibling}}function ui(i,a){for(;Wi!==null;){var c=Wi;switch(c.tag){case 0:case 11:case 15:Qi(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:$o(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Wi=d;else e:for(c=i;Wi!==null;){d=Wi;var y=d.sibling,S=d.return;if(Sc(d),d===c){Wi=null;break e}if(y!==null){y.return=S,Wi=y;break e}Wi=S}}}var Br={getCacheForType:function(i){var a=Vt(Si),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Vt(Si).controller.signal}},Zt=typeof WeakMap=="function"?WeakMap:Map,wt=0,Gt=null,sn=null,$t=0,vn=0,ra=null,Ss=!1,Ps=!1,bp=!1,Qa=0,ii=0,cr=0,Mo=0,Mc=0,ga=0,qn=0,gl=null,ci=null,fi=!1,uu=0,Sp=0,mi=1/0,ai=null,gi=null,Ln=0,Ka=null,cu=null,Ms=0,fu=0,hu=null,Ec=null,Eo=0,vl=null;function Ja(){return(wt&2)!==0&&$t!==0?$t&-$t:Y.T!==null?Me():Go()}function cn(){if(ga===0)if(($t&536870912)===0||mn){var i=Ge;Ge<<=1,(Ge&3932160)===0&&(Ge=262144),ga=i}else ga=536870912;return i=Ma.current,i!==null&&(i.flags|=32),ga}function rn(i,a,c){(i===Gt&&(vn===2||vn===9)||i.cancelPendingCommit!==null)&&(Ao(i,0),Ei(i,$t,ga,!1)),Jn(i,c),((wt&2)===0||i!==Gt)&&(i===Gt&&((wt&2)===0&&(Mo|=c),ii===4&&Ei(i,$t,ga,!1)),We(i))}function fn(i,a,c){if((wt&6)!==0)throw Error(n(327));var d=!c&&(a&127)===0&&(a&i.expiredLanes)===0||Ye(i,a),y=d?Tc(i,a):va(i,a,!0),S=d;do{if(y===0){Ps&&!d&&Ei(i,a,0,!1);break}else{if(c=i.current.alternate,S&&!Un(c)){y=va(i,a,!1),S=!1;continue}if(y===2){if(S=a,i.errorRecoveryDisabledLanes&S)var L=0;else L=i.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){a=L;e:{var V=i;y=gl;var $=V.current.memoizedState.isDehydrated;if($&&(Ao(V,L).flags|=256),L=va(V,L,!1),L!==2){if(bp&&!$){V.errorRecoveryDisabledLanes|=S,Mo|=S,y=4;break e}S=ci,ci=y,S!==null&&(ci===null?ci=S:ci.push.apply(ci,S))}y=L}if(S=!1,y!==2)continue}}if(y===1){Ao(i,0),Ei(i,a,0,!0);break}e:{switch(d=i,S=y,S){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:Ei(d,a,ga,!Ss);break e;case 2:ci=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(y=uu+300-O(),10<y)){if(Ei(d,a,ga,!Ss),Ue(d,0,!0)!==0)break e;Ms=a,d.timeoutHandle=yS(pn.bind(null,d,c,ci,ai,fi,a,ga,Mo,qn,Ss,S,"Throttled",-0,0),y);break e}pn(d,c,ci,ai,fi,a,ga,Mo,qn,Ss,S,null,-0,0)}}break}while(!0);We(i)}function pn(i,a,c,d,y,S,L,V,$,ve,De,Be,xe,Ce){if(i.timeoutHandle=-1,Be=a.subtreeFlags,Be&8192||(Be&16785408)===16785408){Be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Er},ch(a,S,Be);var Mt=(S&62914560)===S?uu-O():(S&4194048)===S?Sp-O():0;if(Mt=GA(Be,Mt),Mt!==null){Ms=S,i.cancelPendingCommit=Mt(kr.bind(null,i,a,S,c,d,y,L,V,$,De,Be,null,xe,Ce)),Ei(i,S,L,!ve);return}}kr(i,a,S,c,d,y,L,V,$)}function Un(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var y=c[d],S=y.getSnapshot;y=y.value;try{if(!ca(S(),y))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ei(i,a,c,d){a&=~Mc,a&=~Mo,i.suspendedLanes|=a,i.pingedLanes&=~a,d&&(i.warmLanes|=a),d=i.expirationTimes;for(var y=a;0<y;){var S=31-K(y),L=1<<S;d[S]=-1,y&=~L}c!==0&&Qr(i,c,a)}function zs(){return(wt&6)===0?(gt(0),!1):!0}function To(){if(sn!==null){if(vn===0)var i=sn.return;else i=sn,er=co=null,Wd(i),al=null,sl=0,i=sn;for(;i!==null;)Ya(i.alternate,i),i=i.return;sn=null}}function Ao(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,TA(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Ms=0,To(),Gt=i,sn=c=xa(i.current,null),$t=a,vn=0,ra=null,Ss=!1,Ps=Ye(i,a),bp=!1,qn=ga=Mc=Mo=cr=ii=0,ci=gl=null,fi=!1,(a&8)!==0&&(a|=a&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=a;0<d;){var y=31-K(d),S=1<<y;a|=i[y],d&=~S}return Qa=a,ac(),c}function fr(i,a){Yt=null,Y.H=ru,a===el||a===an?(a=nl(),vn=3):a===lc?(a=nl(),vn=4):vn=a===Jf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ra=a,sn===null&&(ii=1,Kf(i,Xa(a,i.current)))}function si(){var i=Ma.current;return i===null?!0:($t&4194048)===$t?da===null:($t&62914560)===$t||($t&536870912)!==0?i===da:!1}function Fr(){var i=Y.H;return Y.H=ru,i===null?ru:i}function wo(){var i=Y.A;return Y.A=Br,i}function du(){ii=4,Ss||($t&4194048)!==$t&&Ma.current!==null||(Ps=!0),(cr&134217727)===0&&(Mo&134217727)===0||Gt===null||Ei(Gt,$t,ga,!1)}function va(i,a,c){var d=wt;wt|=2;var y=Fr(),S=wo();(Gt!==i||$t!==a)&&(ai=null,Ao(i,a)),a=!1;var L=ii;e:do try{if(vn!==0&&sn!==null){var V=sn,$=ra;switch(vn){case 8:To(),L=6;break e;case 3:case 2:case 9:case 6:Ma.current===null&&(a=!0);var ve=vn;if(vn=0,ra=null,yl(i,V,$,ve),c&&Ps){L=0;break e}break;default:ve=vn,vn=0,ra=null,yl(i,V,$,ve)}}pu(),L=ii;break}catch(De){fr(i,De)}while(!0);return a&&i.shellSuspendCounter++,er=co=null,wt=d,Y.H=y,Y.A=S,sn===null&&(Gt=null,$t=0,ac()),L}function pu(){for(;sn!==null;)fh(sn)}function Tc(i,a){var c=wt;wt|=2;var d=Fr(),y=wo();Gt!==i||$t!==a?(ai=null,mi=O()+500,Ao(i,a)):Ps=Ye(i,a);e:do try{if(vn!==0&&sn!==null){a=sn;var S=ra;t:switch(vn){case 1:vn=0,ra=null,yl(i,a,S,1);break;case 2:case 9:if(Sa(S)){vn=0,ra=null,Ac(a);break}a=function(){vn!==2&&vn!==9||Gt!==i||(vn=7),We(i)},S.then(a,a);break e;case 3:vn=7;break e;case 4:vn=5;break e;case 7:Sa(S)?(vn=0,ra=null,Ac(a)):(vn=0,ra=null,yl(i,a,S,7));break;case 5:var L=null;switch(sn.tag){case 26:L=sn.memoizedState;case 5:case 27:var V=sn;if(L?US(L):V.stateNode.complete){vn=0,ra=null;var $=V.sibling;if($!==null)sn=$;else{var ve=V.return;ve!==null?(sn=ve,Co(ve)):sn=null}break t}}vn=0,ra=null,yl(i,a,S,5);break;case 6:vn=0,ra=null,yl(i,a,S,6);break;case 8:To(),ii=6;break e;default:throw Error(n(462))}}Ra();break}catch(De){fr(i,De)}while(!0);return er=co=null,Y.H=d,Y.A=y,wt=c,sn!==null?0:(Gt=null,$t=0,ac(),ii)}function Ra(){for(;sn!==null&&!Qe();)fh(sn)}function fh(i){var a=rh(i.alternate,i,Qa);i.memoizedProps=i.pendingProps,a===null?Co(i):sn=a}function Ac(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=vc(c,a,a.pendingProps,a.type,void 0,$t);break;case 11:a=vc(c,a,a.pendingProps,a.type.render,a.ref,$t);break;case 5:Wd(a);default:Ya(c,a),a=sn=ql(a,Qa),a=rh(c,a,Qa)}i.memoizedProps=i.pendingProps,a===null?Co(i):sn=a}function yl(i,a,c,d){er=co=null,Wd(a),al=null,sl=0;var y=a.return;try{if(Li(i,y,a,c,$t)){ii=1,Kf(i,Xa(c,i.current)),sn=null;return}}catch(S){if(y!==null)throw sn=y,S;ii=1,Kf(i,Xa(c,i.current)),sn=null;return}a.flags&32768?(mn||d===1?i=!0:Ps||($t&536870912)!==0?i=!1:(Ss=i=!0,(d===2||d===9||d===3||d===6)&&(d=Ma.current,d!==null&&d.tag===13&&(d.flags|=16384))),wc(a,i)):Co(a)}function Co(i){var a=i;do{if((a.flags&32768)!==0){wc(a,Ss);return}i=a.return;var c=xc(a.alternate,a,Qa);if(c!==null){sn=c;return}if(a=a.sibling,a!==null){sn=a;return}sn=a=i}while(a!==null);ii===0&&(ii=5)}function wc(i,a){do{var c=gs(i.alternate,i);if(c!==null){c.flags&=32767,sn=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){sn=i;return}sn=i=c}while(i!==null);ii=6,sn=null}function kr(i,a,c,d,y,S,L,V,$){i.cancelPendingCommit=null;do mu();while(Ln!==0);if((wt&6)!==0)throw Error(n(327));if(a!==null){if(a===i.current)throw Error(n(177));if(S=a.lanes|a.childLanes,S|=Vi,Ci(i,c,S,L,V,$),i===Gt&&(sn=Gt=null,$t=0),cu=a,Ka=i,Ms=c,fu=S,hu=y,Ec=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,T(Ee,function(){return hh(),null})):(i.callbackNode=null,i.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=Y.T,Y.T=null,y=q.p,q.p=2,L=wt,wt|=4;try{f_(i,a,c)}finally{wt=L,q.p=y,Y.T=d}}Ln=1,Ti(),Vr(),_l()}}function Ti(){if(Ln===1){Ln=0;var i=Ka,a=cu,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=Y.T,Y.T=null;var d=q.p;q.p=2;var y=wt;wt|=4;try{xo(a,i);var S=y_,L=ag(i.containerInfo),V=S.focusedElem,$=S.selectionRange;if(L!==V&&V&&V.ownerDocument&&Fn(V.ownerDocument.documentElement,V)){if($!==null&&wd(V)){var ve=$.start,De=$.end;if(De===void 0&&(De=ve),"selectionStart"in V)V.selectionStart=ve,V.selectionEnd=Math.min(De,V.value.length);else{var Be=V.ownerDocument||document,xe=Be&&Be.defaultView||window;if(xe.getSelection){var Ce=xe.getSelection(),Mt=V.textContent.length,kt=Math.min($.start,Mt),Gn=$.end===void 0?kt:Math.min($.end,Mt);!Ce.extend&&kt>Gn&&(L=Gn,Gn=kt,kt=L);var le=Gl(V,kt),ie=Gl(V,Gn);if(le&&ie&&(Ce.rangeCount!==1||Ce.anchorNode!==le.node||Ce.anchorOffset!==le.offset||Ce.focusNode!==ie.node||Ce.focusOffset!==ie.offset)){var ge=Be.createRange();ge.setStart(le.node,le.offset),Ce.removeAllRanges(),kt>Gn?(Ce.addRange(ge),Ce.extend(ie.node,ie.offset)):(ge.setEnd(ie.node,ie.offset),Ce.addRange(ge))}}}}for(Be=[],Ce=V;Ce=Ce.parentNode;)Ce.nodeType===1&&Be.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<Be.length;V++){var Pe=Be[V];Pe.element.scrollLeft=Pe.left,Pe.element.scrollTop=Pe.top}}h0=!!v_,y_=v_=null}finally{wt=y,q.p=d,Y.T=c}}i.current=a,Ln=2}}function Vr(){if(Ln===2){Ln=0;var i=Ka,a=cu,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=Y.T,Y.T=null;var d=q.p;q.p=2;var y=wt;wt|=4;try{Kn(i,a.alternate,a)}finally{wt=y,q.p=d,Y.T=c}}Ln=3}}function _l(){if(Ln===4||Ln===3){Ln=0,G();var i=Ka,a=cu,c=Ms,d=Ec;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Ln=5:(Ln=0,cu=Ka=null,hr(i,i.pendingLanes));var y=i.pendingLanes;if(y===0&&(gi=null),xr(c),a=a.stateNode,Ze&&typeof Ze.onCommitFiberRoot=="function")try{Ze.onCommitFiberRoot(Ve,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=Y.T,y=q.p,q.p=2,Y.T=null;try{for(var S=i.onRecoverableError,L=0;L<d.length;L++){var V=d[L];S(V.value,{componentStack:V.stack})}}finally{Y.T=a,q.p=y}}(Ms&3)!==0&&mu(),We(i),y=i.pendingLanes,(c&261930)!==0&&(y&42)!==0?i===vl?Eo++:(Eo=0,vl=i):Eo=0,gt(0)}}function hr(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,$o(a)))}function mu(){return Ti(),Vr(),_l(),hh()}function hh(){if(Ln!==5)return!1;var i=Ka,a=fu;fu=0;var c=xr(Ms),d=Y.T,y=q.p;try{q.p=32>c?32:c,Y.T=null,c=hu,hu=null;var S=Ka,L=Ms;if(Ln=0,cu=Ka=null,Ms=0,(wt&6)!==0)throw Error(n(331));var V=wt;if(wt|=4,wa(S.current),xp(S,S.current,L,c),wt=V,gt(0,!1),Ze&&typeof Ze.onPostCommitFiberRoot=="function")try{Ze.onPostCommitFiberRoot(Ve,S)}catch{}return!0}finally{q.p=y,Y.T=d,hr(i,a)}}function Mp(i,a,c){a=Xa(c,a),a=dp(i.stateNode,a,2),i=po(i,a,2),i!==null&&(Jn(i,2),We(i))}function En(i,a,c){if(i.tag===3)Mp(i,i,c);else for(;a!==null;){if(a.tag===3){Mp(a,i,c);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(gi===null||!gi.has(d))){i=Xa(c,i),c=pp(2),d=po(a,c,2),d!==null&&(Kg(c,d,a,i),Jn(d,2),We(d));break}}a=a.return}}function Cc(i,a,c){var d=i.pingCache;if(d===null){d=i.pingCache=new Zt;var y=new Set;d.set(a,y)}else y=d.get(a),y===void 0&&(y=new Set,d.set(a,y));y.has(c)||(bp=!0,y.add(c),i=o.bind(null,i,a,c),a.then(i,i))}function o(i,a,c){var d=i.pingCache;d!==null&&d.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,Gt===i&&($t&c)===c&&(ii===4||ii===3&&($t&62914560)===$t&&300>O()-uu?(wt&2)===0&&Ao(i,0):Mc|=c,qn===$t&&(qn=0)),We(i)}function l(i,a){a===0&&(a=Jt()),i=fa(i,a),i!==null&&(Jn(i,a),We(i))}function p(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),l(i,c)}function v(i,a){var c=0;switch(i.tag){case 31:case 13:var d=i.stateNode,y=i.memoizedState;y!==null&&(c=y.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(n(314))}d!==null&&d.delete(a),l(i,c)}function T(i,a){return ot(i,a)}var C=null,F=null,ee=!1,we=!1,ke=!1,it=0;function We(i){i!==F&&i.next===null&&(F===null?C=F=i:F=F.next=i),we=!0,ee||(ee=!0,ce())}function gt(i,a){if(!ke&&we){ke=!0;do for(var c=!1,d=C;d!==null;){if(i!==0){var y=d.pendingLanes;if(y===0)var S=0;else{var L=d.suspendedLanes,V=d.pingedLanes;S=(1<<31-K(42|i)+1)-1,S&=y&~(L&~V),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(c=!0,_e(d,S))}else S=$t,S=Ue(d,d===Gt?S:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(S&3)===0||Ye(d,S)||(c=!0,_e(d,S));d=d.next}while(c);ke=!1}}function qt(){vi()}function vi(){we=ee=!1;var i=0;it!==0&&EA()&&(i=it);for(var a=O(),c=null,d=C;d!==null;){var y=d.next,S=gu(d,a);S===0?(d.next=null,c===null?C=y:c.next=y,y===null&&(F=c)):(c=d,(i!==0||(S&3)!==0)&&(we=!0)),d=y}Ln!==0&&Ln!==5||gt(i),it!==0&&(it=0)}function gu(i,a){for(var c=i.suspendedLanes,d=i.pingedLanes,y=i.expirationTimes,S=i.pendingLanes&-62914561;0<S;){var L=31-K(S),V=1<<L,$=y[L];$===-1?((V&c)===0||(V&d)!==0)&&(y[L]=Ct(V,a)):$<=a&&(i.expiredLanes|=V),S&=~V}if(a=Gt,c=$t,c=Ue(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d=i.callbackNode,c===0||i===a&&(vn===2||vn===9)||i.cancelPendingCommit!==null)return d!==null&&d!==null&&Tt(d),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||Ye(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(d!==null&&Tt(d),xr(c)){case 2:case 8:c=Ie;break;case 32:c=Ee;break;case 268435456:c=Ke;break;default:c=Ee}return d=Ro.bind(null,i),c=ot(c,d),i.callbackPriority=a,i.callbackNode=c,a}return d!==null&&d!==null&&Tt(d),i.callbackPriority=2,i.callbackNode=null,2}function Ro(i,a){if(Ln!==0&&Ln!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(mu()&&i.callbackNode!==c)return null;var d=$t;return d=Ue(i,i===Gt?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d===0?null:(fn(i,d,a),gu(i,O()),i.callbackNode!=null&&i.callbackNode===c?Ro.bind(null,i):null)}function _e(i,a){if(mu())return null;fn(i,a,!0)}function ce(){AA(function(){(wt&6)!==0?ot(Te,qt):vi()})}function Me(){if(it===0){var i=Nr;i===0&&(i=je,je<<=1,(je&261888)===0&&(je=256)),it=i}return it}function $e(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Xu(""+i)}function Ot(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function ri(i,a,c,d,y){if(a==="submit"&&c&&c.stateNode===y){var S=$e((y[Ri]||null).action),L=d.submitter;L&&(a=(a=L[Ri]||null)?$e(a.formAction):L.getAttribute("formAction"),a!==null&&(S=a,L=null));var V=new ju("action","action",null,d,y);i.push({event:V,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(it!==0){var $=L?Ot(y,L):new FormData(y);sp(c,{pending:!0,data:$,method:y.method,action:S},null,$)}}else typeof S=="function"&&(V.preventDefault(),$=L?Ot(y,L):new FormData(y),sp(c,{pending:!0,data:$,method:y.method,action:S},S,$))},currentTarget:y}]})}}for(var zt=0;zt<nc.length;zt++){var xn=nc[zt],qi=xn.toLowerCase(),Tn=xn[0].toUpperCase()+xn.slice(1);us(qi,"on"+Tn)}us(Tf,"onAnimationEnd"),us(tc,"onAnimationIteration"),us(Rd,"onAnimationStart"),us("dblclick","onDoubleClick"),us("focusin","onFocus"),us("focusout","onBlur"),us(rg,"onTransitionRun"),us(i_,"onTransitionStart"),us(og,"onTransitionCancel"),us(Nd,"onTransitionEnd"),ue("onMouseEnter",["mouseout","mouseover"]),ue("onMouseLeave",["mouseout","mouseover"]),ue("onPointerEnter",["pointerout","pointerover"]),ue("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Es="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),h_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Es));function cS(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var d=i[c],y=d.event;d=d.listeners;e:{var S=void 0;if(a)for(var L=d.length-1;0<=L;L--){var V=d[L],$=V.instance,ve=V.currentTarget;if(V=V.listener,$!==S&&y.isPropagationStopped())break e;S=V,y.currentTarget=ve;try{S(y)}catch(De){ic(De)}y.currentTarget=null,S=$}else for(L=0;L<d.length;L++){if(V=d[L],$=V.instance,ve=V.currentTarget,V=V.listener,$!==S&&y.isPropagationStopped())break e;S=V,y.currentTarget=ve;try{S(y)}catch(De){ic(De)}y.currentTarget=null,S=$}}}}function yn(i,a){var c=a[Va];c===void 0&&(c=a[Va]=new Set);var d=i+"__bubble";c.has(d)||(fS(a,i,2,!1),c.add(d))}function d_(i,a,c){var d=0;a&&(d|=4),fS(c,i,d,a)}var i0="_reactListening"+Math.random().toString(36).slice(2);function p_(i){if(!i[i0]){i[i0]=!0,re.forEach(function(c){c!=="selectionchange"&&(h_.has(c)||d_(c,!1,i),d_(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[i0]||(a[i0]=!0,d_("selectionchange",!1,a))}}function fS(i,a,c,d){switch(kS(a)){case 2:var y=qA;break;case 8:y=jA;break;default:y=R_}c=y.bind(null,a,c,i),y=void 0,!fd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),d?y!==void 0?i.addEventListener(a,c,{capture:!0,passive:y}):i.addEventListener(a,c,!0):y!==void 0?i.addEventListener(a,c,{passive:y}):i.addEventListener(a,c,!1)}function m_(i,a,c,d,y){var S=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var L=d.tag;if(L===3||L===4){var V=d.stateNode.containerInfo;if(V===y)break;if(L===4)for(L=d.return;L!==null;){var $=L.tag;if(($===3||$===4)&&L.stateNode.containerInfo===y)return;L=L.return}for(;V!==null;){if(L=Sr(V),L===null)return;if($=L.tag,$===5||$===6||$===26||$===27){d=S=L;continue e}V=V.parentNode}}d=d.return}cd(function(){var ve=S,De=hf(c),Be=[];e:{var xe=ls.get(i);if(xe!==void 0){var Ce=ju,Mt=i;switch(i){case"keypress":if(qu(c)===0)break e;case"keydown":case"keyup":Ce=Yo;break;case"focusin":Mt="focus",Ce=gf;break;case"focusout":Mt="blur",Ce=gf;break;case"beforeblur":case"afterblur":Ce=gf;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ce=hd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ce=km;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ce=qm;break;case Tf:case tc:case Rd:Ce=e_;break;case Nd:Ce=n_;break;case"scroll":case"scrollend":Ce=Bm;break;case"wheel":Ce=Ym;break;case"copy":case"cut":case"paste":Ce=Hm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ce=md;break;case"toggle":case"beforetoggle":Ce=Qm}var kt=(a&4)!==0,Gn=!kt&&(i==="scroll"||i==="scrollend"),le=kt?xe!==null?xe+"Capture":null:xe;kt=[];for(var ie=ve,ge;ie!==null;){var Pe=ie;if(ge=Pe.stateNode,Pe=Pe.tag,Pe!==5&&Pe!==26&&Pe!==27||ge===null||le===null||(Pe=Il(ie,le),Pe!=null&&kt.push(Ep(ie,Pe,ge))),Gn)break;ie=ie.return}0<kt.length&&(xe=new Ce(xe,Mt,null,c,De),Be.push({event:xe,listeners:kt}))}}if((a&7)===0){e:{if(xe=i==="mouseover"||i==="pointerover",Ce=i==="mouseout"||i==="pointerout",xe&&c!==ff&&(Mt=c.relatedTarget||c.fromElement)&&(Sr(Mt)||Mt[ka]))break e;if((Ce||xe)&&(xe=De.window===De?De:(xe=De.ownerDocument)?xe.defaultView||xe.parentWindow:window,Ce?(Mt=c.relatedTarget||c.toElement,Ce=ve,Mt=Mt?Sr(Mt):null,Mt!==null&&(Gn=u(Mt),kt=Mt.tag,Mt!==Gn||kt!==5&&kt!==27&&kt!==6)&&(Mt=null)):(Ce=null,Mt=ve),Ce!==Mt)){if(kt=hd,Pe="onMouseLeave",le="onMouseEnter",ie="mouse",(i==="pointerout"||i==="pointerover")&&(kt=md,Pe="onPointerLeave",le="onPointerEnter",ie="pointer"),Gn=Ce==null?xe:eo(Ce),ge=Mt==null?xe:eo(Mt),xe=new kt(Pe,ie+"leave",Ce,c,De),xe.target=Gn,xe.relatedTarget=ge,Pe=null,Sr(De)===ve&&(kt=new kt(le,ie+"enter",Mt,c,De),kt.target=ge,kt.relatedTarget=Gn,Pe=kt),Gn=Pe,Ce&&Mt)t:{for(kt=_A,le=Ce,ie=Mt,ge=0,Pe=le;Pe;Pe=kt(Pe))ge++;Pe=0;for(var It=ie;It;It=kt(It))Pe++;for(;0<ge-Pe;)le=kt(le),ge--;for(;0<Pe-ge;)ie=kt(ie),Pe--;for(;ge--;){if(le===ie||ie!==null&&le===ie.alternate){kt=le;break t}le=kt(le),ie=kt(ie)}kt=null}else kt=null;Ce!==null&&hS(Be,xe,Ce,kt,!1),Mt!==null&&Gn!==null&&hS(Be,Gn,Mt,kt,!0)}}e:{if(xe=ve?eo(ve):window,Ce=xe.nodeName&&xe.nodeName.toLowerCase(),Ce==="select"||Ce==="input"&&xe.type==="file")var Rn=Sd;else if(bd(xe))if(qs)Rn=ig;else{Rn=Td;var At=tg}else Ce=xe.nodeName,!Ce||Ce.toLowerCase()!=="input"||xe.type!=="checkbox"&&xe.type!=="radio"?ve&&rs(ve.elementType)&&(Rn=Sd):Rn=ng;if(Rn&&(Rn=Rn(i,ve))){Mf(Be,Rn,c,De);break e}At&&At(i,xe,ve),i==="focusout"&&ve&&xe.type==="number"&&ve.memoizedProps.value!=null&&Wn(xe,"number",xe.value)}switch(At=ve?eo(ve):window,i){case"focusin":(bd(At)||At.contentEditable==="true")&&(js=At,Ys=ve,Xl=null);break;case"focusout":Xl=Ys=js=null;break;case"mousedown":Ef=!0;break;case"contextmenu":case"mouseup":case"dragend":Ef=!1,Wl(Be,c,De);break;case"selectionchange":if(sg)break;case"keydown":case"keyup":Wl(Be,c,De)}var ln;if(Zo)e:{switch(i){case"compositionstart":var bn="onCompositionStart";break e;case"compositionend":bn="onCompositionEnd";break e;case"compositionupdate":bn="onCompositionUpdate";break e}bn=void 0}else Qo?Sf(i,c)&&(bn="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(bn="onCompositionStart");bn&&(vd&&c.locale!=="ko"&&(Qo||bn!=="onCompositionStart"?bn==="onCompositionEnd"&&Qo&&(ln=Wu()):(Ga=De,pf="value"in Ga?Ga.value:Ga.textContent,Qo=!0)),At=a0(ve,bn),0<At.length&&(bn=new vf(bn,i,null,c,De),Be.push({event:bn,listeners:At}),ln?bn.data=ln:(ln=yd(c),ln!==null&&(bn.data=ln)))),(ln=bf?$m(i,c):_d(i,c))&&(bn=a0(ve,"onBeforeInput"),0<bn.length&&(At=new vf("onBeforeInput","beforeinput",null,c,De),Be.push({event:At,listeners:bn}),At.data=ln)),ri(Be,i,ve,c,De)}cS(Be,a)})}function Ep(i,a,c){return{instance:i,listener:a,currentTarget:c}}function a0(i,a){for(var c=a+"Capture",d=[];i!==null;){var y=i,S=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||S===null||(y=Il(i,c),y!=null&&d.unshift(Ep(i,y,S)),y=Il(i,a),y!=null&&d.push(Ep(i,y,S))),i.tag===3)return d;i=i.return}return[]}function _A(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function hS(i,a,c,d,y){for(var S=a._reactName,L=[];c!==null&&c!==d;){var V=c,$=V.alternate,ve=V.stateNode;if(V=V.tag,$!==null&&$===d)break;V!==5&&V!==26&&V!==27||ve===null||($=ve,y?(ve=Il(c,S),ve!=null&&L.unshift(Ep(c,ve,$))):y||(ve=Il(c,S),ve!=null&&L.push(Ep(c,ve,$)))),c=c.return}L.length!==0&&i.push({event:a,listeners:L})}var xA=/\r\n?/g,bA=/\u0000|\uFFFD/g;function dS(i){return(typeof i=="string"?i:""+i).replace(xA,`
`).replace(bA,"")}function pS(i,a){return a=dS(a),dS(i)===a}function Hn(i,a,c,d,y,S){switch(c){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||bi(i,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&bi(i,""+d);break;case"className":Lt(i,"class",d);break;case"tabIndex":Lt(i,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Lt(i,c,d);break;case"style":Wo(i,d,S);break;case"data":if(a!=="object"){Lt(i,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=Xu(""+d),i.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(c==="formAction"?(a!=="input"&&Hn(i,a,"name",y.name,y,null),Hn(i,a,"formEncType",y.formEncType,y,null),Hn(i,a,"formMethod",y.formMethod,y,null),Hn(i,a,"formTarget",y.formTarget,y,null)):(Hn(i,a,"encType",y.encType,y,null),Hn(i,a,"method",y.method,y,null),Hn(i,a,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=Xu(""+d),i.setAttribute(c,d);break;case"onClick":d!=null&&(i.onclick=Er);break;case"onScroll":d!=null&&yn("scroll",i);break;case"onScrollEnd":d!=null&&yn("scrollend",i);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(n(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"multiple":i.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":i.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){i.removeAttribute("xlink:href");break}c=Xu(""+d),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""+d):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":d===!0?i.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,d):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?i.setAttribute(c,d):i.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?i.removeAttribute(c):i.setAttribute(c,d);break;case"popover":yn("beforetoggle",i),yn("toggle",i),xt(i,"popover",d);break;case"xlinkActuate":St(i,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":St(i,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":St(i,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":St(i,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":St(i,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":St(i,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":St(i,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":St(i,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":St(i,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":xt(i,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Pm.get(c)||c,xt(i,c,d))}}function g_(i,a,c,d,y,S){switch(c){case"style":Wo(i,d,S);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(n(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"children":typeof d=="string"?bi(i,d):(typeof d=="number"||typeof d=="bigint")&&bi(i,""+d);break;case"onScroll":d!=null&&yn("scroll",i);break;case"onScrollEnd":d!=null&&yn("scrollend",i);break;case"onClick":d!=null&&(i.onclick=Er);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Se.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(y=c.endsWith("Capture"),a=c.slice(2,y?c.length-7:void 0),S=i[Ri]||null,S=S!=null?S[c]:null,typeof S=="function"&&i.removeEventListener(a,S,y),typeof d=="function")){typeof S!="function"&&S!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,d,y);break e}c in i?i[c]=d:d===!0?i.setAttribute(c,""):xt(i,c,d)}}}function ya(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yn("error",i),yn("load",i);var d=!1,y=!1,S;for(S in c)if(c.hasOwnProperty(S)){var L=c[S];if(L!=null)switch(S){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:Hn(i,a,S,L,c,null)}}y&&Hn(i,a,"srcSet",c.srcSet,c,null),d&&Hn(i,a,"src",c.src,c,null);return;case"input":yn("invalid",i);var V=S=L=y=null,$=null,ve=null;for(d in c)if(c.hasOwnProperty(d)){var De=c[d];if(De!=null)switch(d){case"name":y=De;break;case"type":L=De;break;case"checked":$=De;break;case"defaultChecked":ve=De;break;case"value":S=De;break;case"defaultValue":V=De;break;case"children":case"dangerouslySetInnerHTML":if(De!=null)throw Error(n(137,a));break;default:Hn(i,a,d,De,c,null)}}Ls(i,S,V,$,ve,L,y,!1);return;case"select":yn("invalid",i),d=L=S=null;for(y in c)if(c.hasOwnProperty(y)&&(V=c[y],V!=null))switch(y){case"value":S=V;break;case"defaultValue":L=V;break;case"multiple":d=V;default:Hn(i,a,y,V,c,null)}a=S,c=L,i.multiple=!!d,a!=null?la(i,!!d,a,!1):c!=null&&la(i,!!d,c,!0);return;case"textarea":yn("invalid",i),S=y=d=null;for(L in c)if(c.hasOwnProperty(L)&&(V=c[L],V!=null))switch(L){case"value":d=V;break;case"defaultValue":y=V;break;case"children":S=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(n(91));break;default:Hn(i,a,L,V,c,null)}Ni(i,d,y,S);return;case"option":for($ in c)c.hasOwnProperty($)&&(d=c[$],d!=null)&&($==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":Hn(i,a,$,d,c,null));return;case"dialog":yn("beforetoggle",i),yn("toggle",i),yn("cancel",i),yn("close",i);break;case"iframe":case"object":yn("load",i);break;case"video":case"audio":for(d=0;d<Es.length;d++)yn(Es[d],i);break;case"image":yn("error",i),yn("load",i);break;case"details":yn("toggle",i);break;case"embed":case"source":case"link":yn("error",i),yn("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ve in c)if(c.hasOwnProperty(ve)&&(d=c[ve],d!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:Hn(i,a,ve,d,c,null)}return;default:if(rs(a)){for(De in c)c.hasOwnProperty(De)&&(d=c[De],d!==void 0&&g_(i,a,De,d,c,void 0));return}}for(V in c)c.hasOwnProperty(V)&&(d=c[V],d!=null&&Hn(i,a,V,d,c,null))}function SA(i,a,c,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,S=null,L=null,V=null,$=null,ve=null,De=null;for(Ce in c){var Be=c[Ce];if(c.hasOwnProperty(Ce)&&Be!=null)switch(Ce){case"checked":break;case"value":break;case"defaultValue":$=Be;default:d.hasOwnProperty(Ce)||Hn(i,a,Ce,null,d,Be)}}for(var xe in d){var Ce=d[xe];if(Be=c[xe],d.hasOwnProperty(xe)&&(Ce!=null||Be!=null))switch(xe){case"type":S=Ce;break;case"name":y=Ce;break;case"checked":ve=Ce;break;case"defaultChecked":De=Ce;break;case"value":L=Ce;break;case"defaultValue":V=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(n(137,a));break;default:Ce!==Be&&Hn(i,a,xe,Ce,d,Be)}}xi(i,L,V,$,ve,De,S,y);return;case"select":Ce=L=V=xe=null;for(S in c)if($=c[S],c.hasOwnProperty(S)&&$!=null)switch(S){case"value":break;case"multiple":Ce=$;default:d.hasOwnProperty(S)||Hn(i,a,S,null,d,$)}for(y in d)if(S=d[y],$=c[y],d.hasOwnProperty(y)&&(S!=null||$!=null))switch(y){case"value":xe=S;break;case"defaultValue":V=S;break;case"multiple":L=S;default:S!==$&&Hn(i,a,y,S,d,$)}a=V,c=L,d=Ce,xe!=null?la(i,!!c,xe,!1):!!d!=!!c&&(a!=null?la(i,!!c,a,!0):la(i,!!c,c?[]:"",!1));return;case"textarea":Ce=xe=null;for(V in c)if(y=c[V],c.hasOwnProperty(V)&&y!=null&&!d.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:Hn(i,a,V,null,d,y)}for(L in d)if(y=d[L],S=c[L],d.hasOwnProperty(L)&&(y!=null||S!=null))switch(L){case"value":xe=y;break;case"defaultValue":Ce=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(n(91));break;default:y!==S&&Hn(i,a,L,y,d,S)}An(i,xe,Ce);return;case"option":for(var Mt in c)xe=c[Mt],c.hasOwnProperty(Mt)&&xe!=null&&!d.hasOwnProperty(Mt)&&(Mt==="selected"?i.selected=!1:Hn(i,a,Mt,null,d,xe));for($ in d)xe=d[$],Ce=c[$],d.hasOwnProperty($)&&xe!==Ce&&(xe!=null||Ce!=null)&&($==="selected"?i.selected=xe&&typeof xe!="function"&&typeof xe!="symbol":Hn(i,a,$,xe,d,Ce));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var kt in c)xe=c[kt],c.hasOwnProperty(kt)&&xe!=null&&!d.hasOwnProperty(kt)&&Hn(i,a,kt,null,d,xe);for(ve in d)if(xe=d[ve],Ce=c[ve],d.hasOwnProperty(ve)&&xe!==Ce&&(xe!=null||Ce!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(n(137,a));break;default:Hn(i,a,ve,xe,d,Ce)}return;default:if(rs(a)){for(var Gn in c)xe=c[Gn],c.hasOwnProperty(Gn)&&xe!==void 0&&!d.hasOwnProperty(Gn)&&g_(i,a,Gn,void 0,d,xe);for(De in d)xe=d[De],Ce=c[De],!d.hasOwnProperty(De)||xe===Ce||xe===void 0&&Ce===void 0||g_(i,a,De,xe,d,Ce);return}}for(var le in c)xe=c[le],c.hasOwnProperty(le)&&xe!=null&&!d.hasOwnProperty(le)&&Hn(i,a,le,null,d,xe);for(Be in d)xe=d[Be],Ce=c[Be],!d.hasOwnProperty(Be)||xe===Ce||xe==null&&Ce==null||Hn(i,a,Be,xe,d,Ce)}function mS(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function MA(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var y=c[d],S=y.transferSize,L=y.initiatorType,V=y.duration;if(S&&V&&mS(L)){for(L=0,V=y.responseEnd,d+=1;d<c.length;d++){var $=c[d],ve=$.startTime;if(ve>V)break;var De=$.transferSize,Be=$.initiatorType;De&&mS(Be)&&($=$.responseEnd,L+=De*($<V?1:(V-ve)/($-ve)))}if(--d,a+=8*(S+L)/(y.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var v_=null,y_=null;function s0(i){return i.nodeType===9?i:i.ownerDocument}function gS(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vS(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function __(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var x_=null;function EA(){var i=window.event;return i&&i.type==="popstate"?i===x_?!1:(x_=i,!0):(x_=null,!1)}var yS=typeof setTimeout=="function"?setTimeout:void 0,TA=typeof clearTimeout=="function"?clearTimeout:void 0,_S=typeof Promise=="function"?Promise:void 0,AA=typeof queueMicrotask=="function"?queueMicrotask:typeof _S<"u"?function(i){return _S.resolve(null).then(i).catch(wA)}:yS;function wA(i){setTimeout(function(){throw i})}function vu(i){return i==="head"}function xS(i,a){var c=a,d=0;do{var y=c.nextSibling;if(i.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"||c==="/&"){if(d===0){i.removeChild(y),gh(a);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Tp(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Tp(c);for(var S=c.firstChild;S;){var L=S.nextSibling,V=S.nodeName;S[Ds]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&S.rel.toLowerCase()==="stylesheet"||c.removeChild(S),S=L}}else c==="body"&&Tp(i.ownerDocument.body);c=y}while(c);gh(a)}function bS(i,a){var c=i;i=0;do{var d=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=d}while(c)}function b_(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":b_(c),br(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function CA(i,a,c,d){for(;i.nodeType===1;){var y=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(d){if(!i[Ds])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(S=i.getAttribute("rel"),S==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(S!==y.rel||i.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||i.getAttribute("title")!==(y.title==null?null:y.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(S=i.getAttribute("src"),(S!==(y.src==null?null:y.src)||i.getAttribute("type")!==(y.type==null?null:y.type)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&S&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var S=y.name==null?null:""+y.name;if(y.type==="hidden"&&i.getAttribute("name")===S)return i}else return i;if(i=dr(i.nextSibling),i===null)break}return null}function RA(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=dr(i.nextSibling),i===null))return null;return i}function SS(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=dr(i.nextSibling),i===null))return null;return i}function S_(i){return i.data==="$?"||i.data==="$~"}function M_(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function NA(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var d=function(){a(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),i._reactRetry=d}}function dr(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var E_=null;function MS(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return dr(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function ES(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function TS(i,a,c){switch(a=s0(c),i){case"html":if(i=a.documentElement,!i)throw Error(n(452));return i;case"head":if(i=a.head,!i)throw Error(n(453));return i;case"body":if(i=a.body,!i)throw Error(n(454));return i;default:throw Error(n(451))}}function Tp(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);br(i)}var pr=new Map,AS=new Set;function r0(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var xl=q.d;q.d={f:DA,r:LA,D:UA,C:IA,L:OA,m:PA,X:BA,S:zA,M:FA};function DA(){var i=xl.f(),a=zs();return i||a}function LA(i){var a=Mr(i);a!==null&&a.tag===5&&a.type==="form"?Hg(a):xl.r(i)}var dh=typeof document>"u"?null:document;function wS(i,a,c){var d=dh;if(d&&typeof a=="string"&&a){var y=Ft(a);y='link[rel="'+i+'"][href="'+y+'"]',typeof c=="string"&&(y+='[crossorigin="'+c+'"]'),AS.has(y)||(AS.add(y),i={rel:i,crossOrigin:c,href:a},d.querySelector(y)===null&&(a=d.createElement("link"),ya(a,"link",i),k(a),d.head.appendChild(a)))}}function UA(i){xl.D(i),wS("dns-prefetch",i,null)}function IA(i,a){xl.C(i,a),wS("preconnect",i,a)}function OA(i,a,c){xl.L(i,a,c);var d=dh;if(d&&i&&a){var y='link[rel="preload"][as="'+Ft(a)+'"]';a==="image"&&c&&c.imageSrcSet?(y+='[imagesrcset="'+Ft(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(y+='[imagesizes="'+Ft(c.imageSizes)+'"]')):y+='[href="'+Ft(i)+'"]';var S=y;switch(a){case"style":S=ph(i);break;case"script":S=mh(i)}pr.has(S)||(i=x({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),pr.set(S,i),d.querySelector(y)!==null||a==="style"&&d.querySelector(Ap(S))||a==="script"&&d.querySelector(wp(S))||(a=d.createElement("link"),ya(a,"link",i),k(a),d.head.appendChild(a)))}}function PA(i,a){xl.m(i,a);var c=dh;if(c&&i){var d=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Ft(d)+'"][href="'+Ft(i)+'"]',S=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=mh(i)}if(!pr.has(S)&&(i=x({rel:"modulepreload",href:i},a),pr.set(S,i),c.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(wp(S)))return}d=c.createElement("link"),ya(d,"link",i),k(d),c.head.appendChild(d)}}}function zA(i,a,c){xl.S(i,a,c);var d=dh;if(d&&i){var y=Xs(d).hoistableStyles,S=ph(i);a=a||"default";var L=y.get(S);if(!L){var V={loading:0,preload:null};if(L=d.querySelector(Ap(S)))V.loading=5;else{i=x({rel:"stylesheet",href:i,"data-precedence":a},c),(c=pr.get(S))&&T_(i,c);var $=L=d.createElement("link");k($),ya($,"link",i),$._p=new Promise(function(ve,De){$.onload=ve,$.onerror=De}),$.addEventListener("load",function(){V.loading|=1}),$.addEventListener("error",function(){V.loading|=2}),V.loading|=4,o0(L,a,d)}L={type:"stylesheet",instance:L,count:1,state:V},y.set(S,L)}}}function BA(i,a){xl.X(i,a);var c=dh;if(c&&i){var d=Xs(c).hoistableScripts,y=mh(i),S=d.get(y);S||(S=c.querySelector(wp(y)),S||(i=x({src:i,async:!0},a),(a=pr.get(y))&&A_(i,a),S=c.createElement("script"),k(S),ya(S,"link",i),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},d.set(y,S))}}function FA(i,a){xl.M(i,a);var c=dh;if(c&&i){var d=Xs(c).hoistableScripts,y=mh(i),S=d.get(y);S||(S=c.querySelector(wp(y)),S||(i=x({src:i,async:!0,type:"module"},a),(a=pr.get(y))&&A_(i,a),S=c.createElement("script"),k(S),ya(S,"link",i),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},d.set(y,S))}}function CS(i,a,c,d){var y=(y=de.current)?r0(y):null;if(!y)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=ph(c.href),c=Xs(y).hoistableStyles,d=c.get(a),d||(d={type:"style",instance:null,count:0,state:null},c.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=ph(c.href);var S=Xs(y).hoistableStyles,L=S.get(i);if(L||(y=y.ownerDocument||y,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(i,L),(S=y.querySelector(Ap(i)))&&!S._p&&(L.instance=S,L.state.loading=5),pr.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},pr.set(i,c),S||kA(y,i,c,L.state))),a&&d===null)throw Error(n(528,""));return L}if(a&&d!==null)throw Error(n(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=mh(c),c=Xs(y).hoistableScripts,d=c.get(a),d||(d={type:"script",instance:null,count:0,state:null},c.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function ph(i){return'href="'+Ft(i)+'"'}function Ap(i){return'link[rel="stylesheet"]['+i+"]"}function RS(i){return x({},i,{"data-precedence":i.precedence,precedence:null})}function kA(i,a,c,d){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=i.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),ya(a,"link",c),k(a),i.head.appendChild(a))}function mh(i){return'[src="'+Ft(i)+'"]'}function wp(i){return"script[async]"+i}function NS(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var d=i.querySelector('style[data-href~="'+Ft(c.href)+'"]');if(d)return a.instance=d,k(d),d;var y=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),k(d),ya(d,"style",y),o0(d,c.precedence,i),a.instance=d;case"stylesheet":y=ph(c.href);var S=i.querySelector(Ap(y));if(S)return a.state.loading|=4,a.instance=S,k(S),S;d=RS(c),(y=pr.get(y))&&T_(d,y),S=(i.ownerDocument||i).createElement("link"),k(S);var L=S;return L._p=new Promise(function(V,$){L.onload=V,L.onerror=$}),ya(S,"link",d),a.state.loading|=4,o0(S,c.precedence,i),a.instance=S;case"script":return S=mh(c.src),(y=i.querySelector(wp(S)))?(a.instance=y,k(y),y):(d=c,(y=pr.get(S))&&(d=x({},c),A_(d,y)),i=i.ownerDocument||i,y=i.createElement("script"),k(y),ya(y,"link",d),i.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(n(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,o0(d,c.precedence,i));return a.instance}function o0(i,a,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,S=y,L=0;L<d.length;L++){var V=d[L];if(V.dataset.precedence===a)S=V;else if(S!==y)break}S?S.parentNode.insertBefore(i,S.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function T_(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function A_(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var l0=null;function DS(i,a,c){if(l0===null){var d=new Map,y=l0=new Map;y.set(c,d)}else y=l0,d=y.get(c),d||(d=new Map,y.set(c,d));if(d.has(i))return d;for(d.set(i,null),c=c.getElementsByTagName(i),y=0;y<c.length;y++){var S=c[y];if(!(S[Ds]||S[$n]||i==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var L=S.getAttribute(a)||"";L=i+L;var V=d.get(L);V?V.push(S):d.set(L,[S])}}return d}function LS(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function VA(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function US(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function HA(i,a,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var y=ph(d.href),S=a.querySelector(Ap(y));if(S){a=S._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=u0.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=S,k(S);return}S=a.ownerDocument||a,d=RS(d),(y=pr.get(y))&&T_(d,y),S=S.createElement("link"),k(S);var L=S;L._p=new Promise(function(V,$){L.onload=V,L.onerror=$}),ya(S,"link",d),c.instance=S}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=u0.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var w_=0;function GA(i,a){return i.stylesheets&&i.count===0&&f0(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var d=setTimeout(function(){if(i.stylesheets&&f0(i,i.stylesheets),i.unsuspend){var S=i.unsuspend;i.unsuspend=null,S()}},6e4+a);0<i.imgBytes&&w_===0&&(w_=62500*MA());var y=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&f0(i,i.stylesheets),i.unsuspend)){var S=i.unsuspend;i.unsuspend=null,S()}},(i.imgBytes>w_?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function u0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)f0(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var c0=null;function f0(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,c0=new Map,a.forEach(XA,i),c0=null,u0.call(i))}function XA(i,a){if(!(a.state.loading&4)){var c=c0.get(i);if(c)var d=c.get(null);else{c=new Map,c0.set(i,c);for(var y=i.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<y.length;S++){var L=y[S];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(c.set(L.dataset.precedence,L),d=L)}d&&c.set(null,d)}y=a.instance,L=y.getAttribute("data-precedence"),S=c.get(L)||d,S===d&&c.set(null,y),c.set(L,y),this.count++,d=u0.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),S?S.parentNode.insertBefore(y,S.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(y,i.firstChild)),a.state.loading|=4}}var Cp={$$typeof:D,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function WA(i,a,c,d,y,S,L,V,$){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=nn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nn(0),this.hiddenUpdates=nn(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=S,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function IS(i,a,c,d,y,S,L,V,$,ve,De,Be){return i=new WA(i,a,c,L,$,ve,De,Be,V),a=1,S===!0&&(a|=24),S=ei(3,null,null,a),i.current=S,S.stateNode=i,a=Ld(),a.refCount++,i.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:c,cache:a},cc(S),i}function OS(i){return i?(i=so,i):so}function PS(i,a,c,d,y,S){y=OS(y),d.context===null?d.context=y:d.pendingContext=y,d=Lr(a),d.payload={element:c},S=S===void 0?null:S,S!==null&&(d.callback=S),c=po(i,d,a),c!==null&&(rn(c,i,a),mo(c,i,a))}function zS(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function C_(i,a){zS(i,a),(i=i.alternate)&&zS(i,a)}function BS(i){if(i.tag===13||i.tag===31){var a=fa(i,67108864);a!==null&&rn(a,i,67108864),C_(i,67108864)}}function FS(i){if(i.tag===13||i.tag===31){var a=Ja();a=Jr(a);var c=fa(i,a);c!==null&&rn(c,i,a),C_(i,a)}}var h0=!0;function qA(i,a,c,d){var y=Y.T;Y.T=null;var S=q.p;try{q.p=2,R_(i,a,c,d)}finally{q.p=S,Y.T=y}}function jA(i,a,c,d){var y=Y.T;Y.T=null;var S=q.p;try{q.p=8,R_(i,a,c,d)}finally{q.p=S,Y.T=y}}function R_(i,a,c,d){if(h0){var y=N_(d);if(y===null)m_(i,a,d,d0,c),VS(i,d);else if(ZA(y,i,a,c,d))d.stopPropagation();else if(VS(i,d),a&4&&-1<YA.indexOf(i)){for(;y!==null;){var S=Mr(y);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var L=Xe(S.pendingLanes);if(L!==0){var V=S;for(V.pendingLanes|=2,V.entangledLanes|=2;L;){var $=1<<31-K(L);V.entanglements[1]|=$,L&=~$}We(S),(wt&6)===0&&(mi=O()+500,gt(0))}}break;case 31:case 13:V=fa(S,2),V!==null&&rn(V,S,2),zs(),C_(S,2)}if(S=N_(d),S===null&&m_(i,a,d,d0,c),S===y)break;y=S}y!==null&&d.stopPropagation()}else m_(i,a,d,null,c)}}function N_(i){return i=hf(i),D_(i)}var d0=null;function D_(i){if(d0=null,i=Sr(i),i!==null){var a=u(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=f(a),i!==null)return i;i=null}else if(c===31){if(i=h(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return d0=i,null}function kS(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ae()){case Te:return 2;case Ie:return 8;case Ee:case dt:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var L_=!1,yu=null,_u=null,xu=null,Rp=new Map,Np=new Map,bu=[],YA="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function VS(i,a){switch(i){case"focusin":case"focusout":yu=null;break;case"dragenter":case"dragleave":_u=null;break;case"mouseover":case"mouseout":xu=null;break;case"pointerover":case"pointerout":Rp.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Np.delete(a.pointerId)}}function Dp(i,a,c,d,y,S){return i===null||i.nativeEvent!==S?(i={blockedOn:a,domEventName:c,eventSystemFlags:d,nativeEvent:S,targetContainers:[y]},a!==null&&(a=Mr(a),a!==null&&BS(a)),i):(i.eventSystemFlags|=d,a=i.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),i)}function ZA(i,a,c,d,y){switch(a){case"focusin":return yu=Dp(yu,i,a,c,d,y),!0;case"dragenter":return _u=Dp(_u,i,a,c,d,y),!0;case"mouseover":return xu=Dp(xu,i,a,c,d,y),!0;case"pointerover":var S=y.pointerId;return Rp.set(S,Dp(Rp.get(S)||null,i,a,c,d,y)),!0;case"gotpointercapture":return S=y.pointerId,Np.set(S,Dp(Np.get(S)||null,i,a,c,d,y)),!0}return!1}function HS(i){var a=Sr(i.target);if(a!==null){var c=u(a);if(c!==null){if(a=c.tag,a===13){if(a=f(c),a!==null){i.blockedOn=a,na(i.priority,function(){FS(c)});return}}else if(a===31){if(a=h(c),a!==null){i.blockedOn=a,na(i.priority,function(){FS(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function p0(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=N_(i.nativeEvent);if(c===null){c=i.nativeEvent;var d=new c.constructor(c.type,c);ff=d,c.target.dispatchEvent(d),ff=null}else return a=Mr(c),a!==null&&BS(a),i.blockedOn=c,!1;a.shift()}return!0}function GS(i,a,c){p0(i)&&c.delete(a)}function QA(){L_=!1,yu!==null&&p0(yu)&&(yu=null),_u!==null&&p0(_u)&&(_u=null),xu!==null&&p0(xu)&&(xu=null),Rp.forEach(GS),Np.forEach(GS)}function m0(i,a){i.blockedOn===a&&(i.blockedOn=null,L_||(L_=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,QA)))}var g0=null;function XS(i){g0!==i&&(g0=i,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){g0===i&&(g0=null);for(var a=0;a<i.length;a+=3){var c=i[a],d=i[a+1],y=i[a+2];if(typeof d!="function"){if(D_(d||c)===null)continue;break}var S=Mr(c);S!==null&&(i.splice(a,3),a-=3,sp(S,{pending:!0,data:y,method:c.method,action:d},d,y))}}))}function gh(i){function a($){return m0($,i)}yu!==null&&m0(yu,i),_u!==null&&m0(_u,i),xu!==null&&m0(xu,i),Rp.forEach(a),Np.forEach(a);for(var c=0;c<bu.length;c++){var d=bu[c];d.blockedOn===i&&(d.blockedOn=null)}for(;0<bu.length&&(c=bu[0],c.blockedOn===null);)HS(c),c.blockedOn===null&&bu.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var y=c[d],S=c[d+1],L=y[Ri]||null;if(typeof S=="function")L||XS(c);else if(L){var V=null;if(S&&S.hasAttribute("formAction")){if(y=S,L=S[Ri]||null)V=L.formAction;else if(D_(y)!==null)continue}else V=L.action;typeof V=="function"?c[d+1]=V:(c.splice(d,3),d-=3),XS(c)}}}function WS(){function i(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(L){return y=L})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function U_(i){this._internalRoot=i}v0.prototype.render=U_.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,d=Ja();PS(c,d,i,a,null,null)},v0.prototype.unmount=U_.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;PS(i.current,2,null,i,null,null),zs(),a[ka]=null}};function v0(i){this._internalRoot=i}v0.prototype.unstable_scheduleHydration=function(i){if(i){var a=Go();i={blockedOn:null,target:i,priority:a};for(var c=0;c<bu.length&&a!==0&&a<bu[c].priority;c++);bu.splice(c,0,i),c===0&&HS(i)}};var qS=e.version;if(qS!=="19.2.4")throw Error(n(527,qS,"19.2.4"));q.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=g(a),i=i!==null?_(i):null,i=i===null?null:i.stateNode,i};var KA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var y0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!y0.isDisabled&&y0.supportsFiber)try{Ve=y0.inject(KA),Ze=y0}catch{}}return Up.createRoot=function(i,a){if(!s(i))throw Error(n(299));var c=!1,d="",y=Zg,S=fp,L=hp;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(S=a.onCaughtError),a.onRecoverableError!==void 0&&(L=a.onRecoverableError)),a=IS(i,1,!1,null,null,c,d,null,y,S,L,WS),i[ka]=a.current,p_(i),new U_(a)},Up.hydrateRoot=function(i,a,c){if(!s(i))throw Error(n(299));var d=!1,y="",S=Zg,L=fp,V=hp,$=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onUncaughtError!==void 0&&(S=c.onUncaughtError),c.onCaughtError!==void 0&&(L=c.onCaughtError),c.onRecoverableError!==void 0&&(V=c.onRecoverableError),c.formState!==void 0&&($=c.formState)),a=IS(i,1,!0,a,c??null,d,y,$,S,L,V,WS),a.context=OS(null),c=a.current,d=Ja(),d=Jr(d),y=Lr(d),y.callback=null,po(c,y,d),c=d,a.current.lanes=c,Jn(a,c),We(a),i[ka]=a.current,p_(i),new v0(a)},Up.version="19.2.4",Up}var nM;function rw(){if(nM)return O_.exports;nM=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),O_.exports=sw(),O_.exports}var ow=rw();const lw=py(ow),uw="modulepreload",cw=function(r){return"/"+r},iM={},Hr=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){let m=function(g){return Promise.all(g.map(_=>Promise.resolve(_).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=f?.nonce||f?.getAttribute("nonce");s=m(t.map(g=>{if(g=cw(g),g in iM)return;iM[g]=!0;const _=g.endsWith(".css"),x=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))return;const b=document.createElement("link");if(b.rel=_?"stylesheet":uw,_||(b.as="script"),b.crossOrigin="",b.href=g,h&&b.setAttribute("nonce",h),document.head.appendChild(b),_)return new Promise((M,A)=>{b.addEventListener("load",M),b.addEventListener("error",()=>A(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return s.then(f=>{for(const h of f||[])h.status==="rejected"&&u(h.reason);return e().catch(u)})},fw="assumption-toggle",hw="Assumption Toggle",dw="1.0.0",pw="glitch_assumption_toggle",mw="@nommo/assumption-toggle",gw="dist/assumption-toggle.js",vw="src/index.tsx",yw=["glitch-component","crt","logic"],_w={componentId:fw,displayName:hw,version:dw,folderName:pw,packageName:mw,entry:gw,source:vw,tags:yw},xw="ccd",bw="CCD Photon Explorer",Sw="0.1.0",Mw="glitch_ccd",Ew="@glitch-components/ccd",Tw="dist/index.html",Aw="src/index.tsx",ww=["internal","visualization","tooling"],Cw={componentId:xw,displayName:bw,version:Sw,folderName:Mw,packageName:Ew,entry:Tw,source:Aw,tags:ww},Rw="chess_analogy",Nw="Chess Move Set Lab",Dw="1.0.0",Lw="glitch_chess_analogy",Uw="@glitch-components/chess-analogy",Iw="dist/chess_analogy.js",Ow="src/index.tsx",Pw=["glitch-component","reference","2d","chess"],zw={componentId:Rw,displayName:Nw,version:Dw,folderName:Lw,packageName:Uw,entry:Iw,source:Ow,tags:Pw},Bw="gallery",Fw="Glitch Gallery",kw="0.1.0",Vw="glitch_gallery",Hw="@glitch-components/gallery",Gw="dist/index.html",Xw="src/index.tsx",Ww=["internal","tooling","preview"],qw={componentId:Bw,displayName:Fw,version:kw,folderName:Vw,packageName:Hw,entry:Gw,source:Xw,tags:Ww},jw="level-questions",Yw="Level Questions",Zw="1.0.0",Qw="glitch_level_questions",Kw="level-questions",Jw="dist/level-questions.js",$w="src/index.tsx",eC=["glitch-component","quiz","role-mapping"],tC={componentId:jw,displayName:Yw,version:Zw,folderName:Qw,packageName:Kw,entry:Jw,source:$w,tags:eC},nC="lightlane",iC="Lightlane Challenge",aC="0.1.0",sC="glitch_lightlane",rC="@nommo/lightlane",oC="dist/lightlane.js",lC="src/index.tsx",uC=["glitch-component","reference","3d"],cC={componentId:nC,displayName:iC,version:aC,folderName:sC,packageName:rC,entry:oC,source:lC,tags:uC},fC="migration-paradox",hC="The Migration Paradox",dC="1.0.0",pC="glitch_migration_paradox",mC="migration-paradox",gC="dist/migration-paradox.js",vC="src/index.tsx",yC=["glitch-component","paradox","narrative"],_C={componentId:fC,displayName:hC,version:dC,folderName:pC,packageName:mC,entry:gC,source:vC,tags:yC},xC="onboarding",bC="Glitch University Onboarding",SC="1.0.0",MC="glitch_onboarding",EC="@glitch-components/onboarding",TC="dist/onboarding.js",AC="src/index.tsx",wC=["glitch-component","onboarding","narrative"],CC={componentId:xC,displayName:bC,version:SC,folderName:MC,packageName:EC,entry:TC,source:AC,tags:wC},RC="onboarding2",NC="Facility Slideshow",DC="1.0.0",LC="glitch_onboarding2",UC="@glitch-components/onboarding2",IC="dist/onboarding2.js",OC="src/index.tsx",PC=["glitch-component","onboarding","slideshow"],zC={componentId:RC,displayName:NC,version:DC,folderName:LC,packageName:UC,entry:IC,source:OC,tags:PC},BC="sphere-paradox",FC="Create a Perfect Sphere",kC="1.0.0",VC="glitch_sphere_paradox",HC="sphere-paradox",GC="dist/sphere-paradox.js",XC="src/index.tsx",WC=["glitch-component","3d","paradox"],qC={componentId:BC,displayName:FC,version:kC,folderName:VC,packageName:HC,entry:GC,source:XC,tags:WC},jC="voxel-universe",YC="Voxel Universe",ZC="1.0.0",QC="glitch_voxel_universe",KC="@glitch-components/voxel-universe",JC="dist/voxel_universe.js",$C="src/index.tsx",e3=["glitch-component","voxel","geometry"],t3={componentId:jC,displayName:YC,version:ZC,folderName:QC,packageName:KC,entry:JC,source:$C,tags:e3};function kx(){return kx=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},kx.apply(null,arguments)}var rt=Tm();const hb=py(rt);const my="182",Gc={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Xc={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},iE=0,Vx=1,aE=2,n3=3,sE=0,Xh=1,Kp=2,jc=3,Ll=0,as=1,Uo=2,Po=0,Kc=1,Hx=2,Gx=3,Xx=4,rE=5,Du=100,oE=101,lE=102,uE=103,cE=104,fE=200,hE=201,dE=202,pE=203,vv=204,yv=205,mE=206,gE=207,vE=208,yE=209,_E=210,xE=211,bE=212,SE=213,ME=214,_v=0,xv=1,bv=2,ef=3,Sv=4,Mv=5,Ev=6,Tv=7,Am=0,EE=1,TE=2,gr=0,db=1,pb=2,mb=3,gy=4,gb=5,vb=6,yb=7,Wx="attached",AE="detached",vy=300,zo=301,Pu=302,om=303,lm=304,id=306,um=1e3,Rs=1001,cm=1002,Bi=1003,_b=1004,i3=1004,Vh=1005,a3=1005,oi=1006,Jp=1007,s3=1007,Io=1008,r3=1008,ts=1009,xb=1010,bb=1011,qh=1012,yy=1013,vr=1014,is=1015,Bo=1016,_y=1017,xy=1018,jh=1020,Sb=35902,Mb=35899,Eb=1021,Tb=1022,Oa=1023,Fo=1026,Uu=1027,by=1028,wm=1029,tf=1030,Sy=1031,o3=1032,My=1033,$p=33776,em=33777,tm=33778,nm=33779,Av=35840,wv=35841,Cv=35842,Rv=35843,Nv=36196,Dv=37492,Lv=37496,Uv=37488,Iv=37489,Ov=37490,Pv=37491,zv=37808,Bv=37809,Fv=37810,kv=37811,Vv=37812,Hv=37813,Gv=37814,Xv=37815,Wv=37816,qv=37817,jv=37818,Yv=37819,Zv=37820,Qv=37821,Kv=36492,Jv=36494,$v=36495,ey=36283,ty=36284,ny=36285,iy=36286,wE=2200,CE=2201,RE=2202,fm=2300,ay=2301,dv=2302,Yc=2400,Zc=2401,hm=2402,Ey=2500,Ab=2501,l3=0,u3=1,c3=2,NE=3200,f3=3201,h3=3202,d3=3203,ku=0,DE=1,Cl="",Ia="srgb",zu="srgb-linear",dm="linear",zn="srgb",p3="",m3="rg",g3="ga",v3=0,Wc=7680,y3=7681,_3=7682,x3=7683,b3=34055,S3=34056,M3=5386,E3=512,T3=513,A3=514,w3=515,C3=516,R3=517,N3=518,qx=519,LE=512,UE=513,IE=514,Ty=515,OE=516,PE=517,Ay=518,zE=519,pm=35044,D3=35048,L3=35040,U3=35045,I3=35049,O3=35041,P3=35046,z3=35050,B3=35042,F3="100",jx="300 es",ks=2e3,Yh=2001,k3={COMPUTE:"compute",RENDER:"render"},V3={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},H3={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function BE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const G3={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Hh(r,e){return new G3[r](e)}function FE(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function mm(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function kE(){const r=mm("canvas");return r.style.display="block",r}const aM={};let Bu=null;function X3(r){Bu=r}function W3(){return Bu}function gm(...r){const e="THREE."+r.shift();Bu?Bu("log",e,...r):console.log(e,...r)}function ft(...r){const e="THREE."+r.shift();Bu?Bu("warn",e,...r):console.warn(e,...r)}function Rt(...r){const e="THREE."+r.shift();Bu?Bu("error",e,...r):console.error(e,...r)}function Zh(...r){const e=r.join(" ");e in aM||(aM[e]=!0,ft(...r))}function q3(r,e,t){return new Promise(function(n,s){function u(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:s();break;case r.TIMEOUT_EXPIRED:setTimeout(u,t);break;default:n()}}setTimeout(u,t)})}let ko=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const s=n[e];if(s!==void 0){const u=s.indexOf(t);u!==-1&&s.splice(u,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let u=0,f=s.length;u<f;u++)s[u].call(this,e);e.target=null}}};const Da=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let sM=1234567;const Jc=Math.PI/180,Qh=180/Math.PI;function Vs(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Da[r&255]+Da[r>>8&255]+Da[r>>16&255]+Da[r>>24&255]+"-"+Da[e&255]+Da[e>>8&255]+"-"+Da[e>>16&15|64]+Da[e>>24&255]+"-"+Da[t&63|128]+Da[t>>8&255]+"-"+Da[t>>16&255]+Da[t>>24&255]+Da[n&255]+Da[n>>8&255]+Da[n>>16&255]+Da[n>>24&255]).toLowerCase()}function Ht(r,e,t){return Math.max(e,Math.min(t,r))}function wb(r,e){return(r%e+e)%e}function j3(r,e,t,n,s){return n+(r-e)*(s-n)/(t-e)}function Y3(r,e,t){return r!==e?(t-r)/(e-r):0}function im(r,e,t){return(1-t)*r+t*e}function Z3(r,e,t,n){return im(r,e,1-Math.exp(-t*n))}function Q3(r,e=1){return e-Math.abs(wb(r,e*2)-e)}function K3(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function J3(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function $3(r,e){return r+Math.floor(Math.random()*(e-r+1))}function eR(r,e){return r+Math.random()*(e-r)}function tR(r){return r*(.5-Math.random())}function nR(r){r!==void 0&&(sM=r);let e=sM+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function iR(r){return r*Jc}function aR(r){return r*Qh}function sR(r){return(r&r-1)===0&&r!==0}function rR(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function oR(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function lR(r,e,t,n,s){const u=Math.cos,f=Math.sin,h=u(t/2),m=f(t/2),g=u((e+n)/2),_=f((e+n)/2),x=u((e-n)/2),b=f((e-n)/2),M=u((n-e)/2),A=f((n-e)/2);switch(s){case"XYX":r.set(h*_,m*x,m*b,h*g);break;case"YZY":r.set(m*b,h*_,m*x,h*g);break;case"ZXZ":r.set(m*x,m*b,h*_,h*g);break;case"XZX":r.set(h*_,m*A,m*M,h*g);break;case"YXY":r.set(m*M,h*_,m*A,h*g);break;case"ZYZ":r.set(m*A,m*M,h*_,h*g);break;default:ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function ns(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function on(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const uR={DEG2RAD:Jc,RAD2DEG:Qh,generateUUID:Vs,clamp:Ht,euclideanModulo:wb,mapLinear:j3,inverseLerp:Y3,lerp:im,damp:Z3,pingpong:Q3,smoothstep:K3,smootherstep:J3,randInt:$3,randFloat:eR,randFloatSpread:tR,seededRandom:nR,degToRad:iR,radToDeg:aR,isPowerOfTwo:sR,ceilPowerOfTwo:rR,floorPowerOfTwo:oR,setQuaternionFromProperEuler:lR,normalize:on,denormalize:ns};class ze{constructor(e=0,t=0){ze.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw 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,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[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=Ht(this.x,e.x,t.x),this.y=Ht(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ht(this.x,e,t),this.y=Ht(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ht(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(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ht(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,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),s=Math.sin(t),u=this.x-e.x,f=this.y-e.y;return this.x=u*n-f*s+e.x,this.y=u*s+f*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pa{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,u,f,h){let m=n[s+0],g=n[s+1],_=n[s+2],x=n[s+3],b=u[f+0],M=u[f+1],A=u[f+2],R=u[f+3];if(h<=0){e[t+0]=m,e[t+1]=g,e[t+2]=_,e[t+3]=x;return}if(h>=1){e[t+0]=b,e[t+1]=M,e[t+2]=A,e[t+3]=R;return}if(x!==R||m!==b||g!==M||_!==A){let w=m*b+g*M+_*A+x*R;w<0&&(b=-b,M=-M,A=-A,R=-R,w=-w);let E=1-h;if(w<.9995){const N=Math.acos(w),D=Math.sin(N);E=Math.sin(E*N)/D,h=Math.sin(h*N)/D,m=m*E+b*h,g=g*E+M*h,_=_*E+A*h,x=x*E+R*h}else{m=m*E+b*h,g=g*E+M*h,_=_*E+A*h,x=x*E+R*h;const N=1/Math.sqrt(m*m+g*g+_*_+x*x);m*=N,g*=N,_*=N,x*=N}}e[t]=m,e[t+1]=g,e[t+2]=_,e[t+3]=x}static multiplyQuaternionsFlat(e,t,n,s,u,f){const h=n[s],m=n[s+1],g=n[s+2],_=n[s+3],x=u[f],b=u[f+1],M=u[f+2],A=u[f+3];return e[t]=h*A+_*x+m*M-g*b,e[t+1]=m*A+_*b+g*x-h*M,e[t+2]=g*A+_*M+h*b-m*x,e[t+3]=_*A-h*x-m*b-g*M,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,s=e._y,u=e._z,f=e._order,h=Math.cos,m=Math.sin,g=h(n/2),_=h(s/2),x=h(u/2),b=m(n/2),M=m(s/2),A=m(u/2);switch(f){case"XYZ":this._x=b*_*x+g*M*A,this._y=g*M*x-b*_*A,this._z=g*_*A+b*M*x,this._w=g*_*x-b*M*A;break;case"YXZ":this._x=b*_*x+g*M*A,this._y=g*M*x-b*_*A,this._z=g*_*A-b*M*x,this._w=g*_*x+b*M*A;break;case"ZXY":this._x=b*_*x-g*M*A,this._y=g*M*x+b*_*A,this._z=g*_*A+b*M*x,this._w=g*_*x-b*M*A;break;case"ZYX":this._x=b*_*x-g*M*A,this._y=g*M*x+b*_*A,this._z=g*_*A-b*M*x,this._w=g*_*x+b*M*A;break;case"YZX":this._x=b*_*x+g*M*A,this._y=g*M*x+b*_*A,this._z=g*_*A-b*M*x,this._w=g*_*x-b*M*A;break;case"XZY":this._x=b*_*x-g*M*A,this._y=g*M*x-b*_*A,this._z=g*_*A+b*M*x,this._w=g*_*x+b*M*A;break;default:ft("Quaternion: .setFromEuler() encountered an unknown order: "+f)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],s=t[4],u=t[8],f=t[1],h=t[5],m=t[9],g=t[2],_=t[6],x=t[10],b=n+h+x;if(b>0){const M=.5/Math.sqrt(b+1);this._w=.25/M,this._x=(_-m)*M,this._y=(u-g)*M,this._z=(f-s)*M}else if(n>h&&n>x){const M=2*Math.sqrt(1+n-h-x);this._w=(_-m)/M,this._x=.25*M,this._y=(s+f)/M,this._z=(u+g)/M}else if(h>x){const M=2*Math.sqrt(1+h-n-x);this._w=(u-g)/M,this._x=(s+f)/M,this._y=.25*M,this._z=(m+_)/M}else{const M=2*Math.sqrt(1+x-n-h);this._w=(f-s)/M,this._x=(u+g)/M,this._y=(m+_)/M,this._z=.25*M}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(Ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const s=Math.min(1,t/n);return this.slerp(e,s),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 e===0?(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,s=e._y,u=e._z,f=e._w,h=t._x,m=t._y,g=t._z,_=t._w;return this._x=n*_+f*h+s*g-u*m,this._y=s*_+f*m+u*h-n*g,this._z=u*_+f*g+n*m-s*h,this._w=f*_-n*h-s*m-u*g,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,s=e._y,u=e._z,f=e._w,h=this.dot(e);h<0&&(n=-n,s=-s,u=-u,f=-f,h=-h);let m=1-t;if(h<.9995){const g=Math.acos(h),_=Math.sin(g);m=Math.sin(m*g)/_,t=Math.sin(t*g)/_,this._x=this._x*m+n*t,this._y=this._y*m+s*t,this._z=this._z*m+u*t,this._w=this._w*m+f*t,this._onChangeCallback()}else this._x=this._x*m+n*t,this._y=this._y*m+s*t,this._z=this._z*m+u*t,this._w=this._w*m+f*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(),s=Math.sqrt(1-n),u=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),u*Math.sin(t),u*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._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 j{constructor(e=0,t=0,n=0){j.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(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(rM.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(rM.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,s=this.z,u=e.elements;return this.x=u[0]*t+u[3]*n+u[6]*s,this.y=u[1]*t+u[4]*n+u[7]*s,this.z=u[2]*t+u[5]*n+u[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,s=this.z,u=e.elements,f=1/(u[3]*t+u[7]*n+u[11]*s+u[15]);return this.x=(u[0]*t+u[4]*n+u[8]*s+u[12])*f,this.y=(u[1]*t+u[5]*n+u[9]*s+u[13])*f,this.z=(u[2]*t+u[6]*n+u[10]*s+u[14])*f,this}applyQuaternion(e){const t=this.x,n=this.y,s=this.z,u=e.x,f=e.y,h=e.z,m=e.w,g=2*(f*s-h*n),_=2*(h*t-u*s),x=2*(u*n-f*t);return this.x=t+m*g+f*x-h*_,this.y=n+m*_+h*g-u*x,this.z=s+m*x+u*_-f*g,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,s=this.z,u=e.elements;return this.x=u[0]*t+u[4]*n+u[8]*s,this.y=u[1]*t+u[5]*n+u[9]*s,this.z=u[2]*t+u[6]*n+u[10]*s,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=Ht(this.x,e.x,t.x),this.y=Ht(this.y,e.y,t.y),this.z=Ht(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ht(this.x,e,t),this.y=Ht(this.y,e,t),this.z=Ht(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ht(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,s=e.y,u=e.z,f=t.x,h=t.y,m=t.z;return this.x=s*m-u*h,this.y=u*f-n*m,this.z=n*h-s*f,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return k_.copy(this).projectOnVector(e),this.sub(k_)}reflect(e){return this.sub(k_.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}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 s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*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(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-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}}const k_=new j,rM=new Pa;class en{constructor(e,t,n,s,u,f,h,m,g){en.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,u,f,h,m,g)}set(e,t,n,s,u,f,h,m,g){const _=this.elements;return _[0]=e,_[1]=s,_[2]=h,_[3]=t,_[4]=u,_[5]=m,_[6]=n,_[7]=f,_[8]=g,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,s=t.elements,u=this.elements,f=n[0],h=n[3],m=n[6],g=n[1],_=n[4],x=n[7],b=n[2],M=n[5],A=n[8],R=s[0],w=s[3],E=s[6],N=s[1],D=s[4],U=s[7],B=s[2],z=s[5],H=s[8];return u[0]=f*R+h*N+m*B,u[3]=f*w+h*D+m*z,u[6]=f*E+h*U+m*H,u[1]=g*R+_*N+x*B,u[4]=g*w+_*D+x*z,u[7]=g*E+_*U+x*H,u[2]=b*R+M*N+A*B,u[5]=b*w+M*D+A*z,u[8]=b*E+M*U+A*H,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],s=e[2],u=e[3],f=e[4],h=e[5],m=e[6],g=e[7],_=e[8];return t*f*_-t*h*g-n*u*_+n*h*m+s*u*g-s*f*m}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],u=e[3],f=e[4],h=e[5],m=e[6],g=e[7],_=e[8],x=_*f-h*g,b=h*m-_*u,M=g*u-f*m,A=t*x+n*b+s*M;if(A===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/A;return e[0]=x*R,e[1]=(s*g-_*n)*R,e[2]=(h*n-s*f)*R,e[3]=b*R,e[4]=(_*t-s*m)*R,e[5]=(s*u-h*t)*R,e[6]=M*R,e[7]=(n*m-g*t)*R,e[8]=(f*t-n*u)*R,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,s,u,f,h){const m=Math.cos(u),g=Math.sin(u);return this.set(n*m,n*g,-n*(m*f+g*h)+f+e,-s*g,s*m,-s*(-g*f+m*h)+h+t,0,0,1),this}scale(e,t){return this.premultiply(V_.makeScale(e,t)),this}rotate(e){return this.premultiply(V_.makeRotation(-e)),this}translate(e,t){return this.premultiply(V_.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 s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=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)}}const V_=new en,oM=new en().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),lM=new en().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function cR(){const r={enabled:!0,workingColorSpace:zu,spaces:{},convert:function(s,u,f){return this.enabled===!1||u===f||!u||!f||(this.spaces[u].transfer===zn&&(s.r=Nl(s.r),s.g=Nl(s.g),s.b=Nl(s.b)),this.spaces[u].primaries!==this.spaces[f].primaries&&(s.applyMatrix3(this.spaces[u].toXYZ),s.applyMatrix3(this.spaces[f].fromXYZ)),this.spaces[f].transfer===zn&&(s.r=Wh(s.r),s.g=Wh(s.g),s.b=Wh(s.b))),s},workingToColorSpace:function(s,u){return this.convert(s,this.workingColorSpace,u)},colorSpaceToWorking:function(s,u){return this.convert(s,u,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Cl?dm:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,u=this.workingColorSpace){return s.fromArray(this.spaces[u].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,u,f){return s.copy(this.spaces[u].toXYZ).multiply(this.spaces[f].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,u){return Zh("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(s,u)},toWorkingColorSpace:function(s,u){return Zh("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(s,u)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[zu]:{primaries:e,whitePoint:n,transfer:dm,toXYZ:oM,fromXYZ:lM,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ia},outputColorSpaceConfig:{drawingBufferColorSpace:Ia}},[Ia]:{primaries:e,whitePoint:n,transfer:zn,toXYZ:oM,fromXYZ:lM,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ia}}}),r}const Sn=cR();function Nl(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Wh(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let vh;class VE{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{vh===void 0&&(vh=mm("canvas")),vh.width=e.width,vh.height=e.height;const s=vh.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=vh}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=mm("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const s=n.getImageData(0,0,e.width,e.height),u=s.data;for(let f=0;f<u.length;f++)u[f]=Nl(u[f]/255)*255;return n.putImageData(s,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Nl(t[n]/255)*255):t[n]=Nl(t[n]);return{data:t,width:e.width,height:e.height}}else return ft("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let fR=0;class Iu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:fR++}),this.uuid=Vs(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let u;if(Array.isArray(s)){u=[];for(let f=0,h=s.length;f<h;f++)s[f].isDataTexture?u.push(H_(s[f].image)):u.push(H_(s[f]))}else u=H_(s);n.url=u}return t||(e.images[this.uuid]=n),n}}function H_(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?VE.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(ft("Texture: Unable to serialize Texture."),{})}let hR=0;const G_=new j;class wi extends ko{constructor(e=wi.DEFAULT_IMAGE,t=wi.DEFAULT_MAPPING,n=Rs,s=Rs,u=oi,f=Io,h=Oa,m=ts,g=wi.DEFAULT_ANISOTROPY,_=Cl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hR++}),this.uuid=Vs(),this.name="",this.source=new Iu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=u,this.minFilter=f,this.anisotropy=g,this.format=h,this.internalFormat=null,this.type=m,this.offset=new ze(0,0),this.repeat=new ze(1,1),this.center=new ze(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new en,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=_,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}get width(){return this.source.getSize(G_).x}get height(){return this.source.getSize(G_).y}get depth(){return this.source.getSize(G_).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}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.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(n===void 0){ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){ft(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)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,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!==vy)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case um:e.x=e.x-Math.floor(e.x);break;case Rs:e.x=e.x<0?0:1;break;case cm:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case um:e.y=e.y-Math.floor(e.y);break;case Rs:e.y=e.y<0?0:1;break;case cm:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}wi.DEFAULT_IMAGE=null;wi.DEFAULT_MAPPING=vy;wi.DEFAULT_ANISOTROPY=1;class jn{constructor(e=0,t=0,n=0,s=1){jn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=s}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,s){return this.x=e,this.y=t,this.z=n,this.w=s,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=e.w!==void 0?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,s=this.z,u=this.w,f=e.elements;return this.x=f[0]*t+f[4]*n+f[8]*s+f[12]*u,this.y=f[1]*t+f[5]*n+f[9]*s+f[13]*u,this.z=f[2]*t+f[6]*n+f[10]*s+f[14]*u,this.w=f[3]*t+f[7]*n+f[11]*s+f[15]*u,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,s,u;const m=e.elements,g=m[0],_=m[4],x=m[8],b=m[1],M=m[5],A=m[9],R=m[2],w=m[6],E=m[10];if(Math.abs(_-b)<.01&&Math.abs(x-R)<.01&&Math.abs(A-w)<.01){if(Math.abs(_+b)<.1&&Math.abs(x+R)<.1&&Math.abs(A+w)<.1&&Math.abs(g+M+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const D=(g+1)/2,U=(M+1)/2,B=(E+1)/2,z=(_+b)/4,H=(x+R)/4,W=(A+w)/4;return D>U&&D>B?D<.01?(n=0,s=.707106781,u=.707106781):(n=Math.sqrt(D),s=z/n,u=H/n):U>B?U<.01?(n=.707106781,s=0,u=.707106781):(s=Math.sqrt(U),n=z/s,u=W/s):B<.01?(n=.707106781,s=.707106781,u=0):(u=Math.sqrt(B),n=H/u,s=W/u),this.set(n,s,u,t),this}let N=Math.sqrt((w-A)*(w-A)+(x-R)*(x-R)+(b-_)*(b-_));return Math.abs(N)<.001&&(N=1),this.x=(w-A)/N,this.y=(x-R)/N,this.z=(b-_)/N,this.w=Math.acos((g+M+E-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ht(this.x,e.x,t.x),this.y=Ht(this.y,e.y,t.y),this.z=Ht(this.z,e.z,t.z),this.w=Ht(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ht(this.x,e,t),this.y=Ht(this.y,e,t),this.z=Ht(this.z,e,t),this.w=Ht(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ht(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Cb extends ko{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:oi,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 jn(0,0,e,t),this.scissorTest=!1,this.viewport=new jn(0,0,e,t);const s={width:e,height:t,depth:n.depth},u=new wi(s);this.textures=[];const f=n.count;for(let h=0;h<f;h++)this.textures[h]=u.clone(),this.textures[h].isRenderTargetTexture=!0,this.textures[h].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:oi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let s=0,u=this.textures.length;s<u;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);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;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const s=Object.assign({},e.textures[t].image);this.textures[t].source=new Iu(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Hs extends Cb{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class wy extends wi{constructor(e=null,t=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Bi,this.minFilter=Bi,this.wrapR=Rs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dR extends Hs{constructor(e=1,t=1,n=1,s={}){super(e,t,s),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new wy(null,e,t,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class Cy extends wi{constructor(e=null,t=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=Bi,this.minFilter=Bi,this.wrapR=Rs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pR extends Hs{constructor(e=1,t=1,n=1,s={}){super(e,t,s),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Cy(null,e,t,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class za{constructor(e=new j(1/0,1/0,1/0),t=new j(-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;t<n;t+=3)this.expandByPoint(Gr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Gr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Gr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const u=n.getAttribute("position");if(t===!0&&u!==void 0&&e.isInstancedMesh!==!0)for(let f=0,h=u.count;f<h;f++)e.isMesh===!0?e.getVertexPosition(f,Gr):Gr.fromBufferAttribute(u,f),Gr.applyMatrix4(e.matrixWorld),this.expandByPoint(Gr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),_0.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),_0.copy(n.boundingBox)),_0.applyMatrix4(e.matrixWorld),this.union(_0)}const s=e.children;for(let u=0,f=s.length;u<f;u++)this.expandByObject(s[u],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Gr),Gr.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(Ip),x0.subVectors(this.max,Ip),yh.subVectors(e.a,Ip),_h.subVectors(e.b,Ip),xh.subVectors(e.c,Ip),Mu.subVectors(_h,yh),Eu.subVectors(xh,_h),Rc.subVectors(yh,xh);let t=[0,-Mu.z,Mu.y,0,-Eu.z,Eu.y,0,-Rc.z,Rc.y,Mu.z,0,-Mu.x,Eu.z,0,-Eu.x,Rc.z,0,-Rc.x,-Mu.y,Mu.x,0,-Eu.y,Eu.x,0,-Rc.y,Rc.x,0];return!X_(t,yh,_h,xh,x0)||(t=[1,0,0,0,1,0,0,0,1],!X_(t,yh,_h,xh,x0))?!1:(b0.crossVectors(Mu,Eu),t=[b0.x,b0.y,b0.z],X_(t,yh,_h,xh,x0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gr).length()*.5),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()?this:(bl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bl),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 bl=[new j,new j,new j,new j,new j,new j,new j,new j],Gr=new j,_0=new za,yh=new j,_h=new j,xh=new j,Mu=new j,Eu=new j,Rc=new j,Ip=new j,x0=new j,b0=new j,Nc=new j;function X_(r,e,t,n,s){for(let u=0,f=r.length-3;u<=f;u+=3){Nc.fromArray(r,u);const h=s.x*Math.abs(Nc.x)+s.y*Math.abs(Nc.y)+s.z*Math.abs(Nc.z),m=e.dot(Nc),g=t.dot(Nc),_=n.dot(Nc);if(Math.max(-Math.max(m,g,_),Math.min(m,g,_))>h)return!1}return!0}const mR=new za,Op=new j,W_=new j;class _a{constructor(e=new j,t=-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;t!==void 0?n.copy(t):mR.setFromPoints(e).getCenter(n);let s=0;for(let u=0,f=e.length;u<f;u++)s=Math.max(s,n.distanceToSquared(e[u]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Op.subVectors(e,this.center);const t=Op.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(Op,s/n),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(W_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Op.copy(e.center).add(W_)),this.expandByPoint(Op.copy(e.center).sub(W_))),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}}const Sl=new j,q_=new j,S0=new j,Tu=new j,j_=new j,M0=new j,Y_=new j;class of{constructor(e=new j,t=new j(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,Sl)),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=Sl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sl.copy(this.origin).addScaledVector(this.direction,t),Sl.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){q_.copy(e).add(t).multiplyScalar(.5),S0.copy(t).sub(e).normalize(),Tu.copy(this.origin).sub(q_);const u=e.distanceTo(t)*.5,f=-this.direction.dot(S0),h=Tu.dot(this.direction),m=-Tu.dot(S0),g=Tu.lengthSq(),_=Math.abs(1-f*f);let x,b,M,A;if(_>0)if(x=f*m-h,b=f*h-m,A=u*_,x>=0)if(b>=-A)if(b<=A){const R=1/_;x*=R,b*=R,M=x*(x+f*b+2*h)+b*(f*x+b+2*m)+g}else b=u,x=Math.max(0,-(f*b+h)),M=-x*x+b*(b+2*m)+g;else b=-u,x=Math.max(0,-(f*b+h)),M=-x*x+b*(b+2*m)+g;else b<=-A?(x=Math.max(0,-(-f*u+h)),b=x>0?-u:Math.min(Math.max(-u,-m),u),M=-x*x+b*(b+2*m)+g):b<=A?(x=0,b=Math.min(Math.max(-u,-m),u),M=b*(b+2*m)+g):(x=Math.max(0,-(f*u+h)),b=x>0?u:Math.min(Math.max(-u,-m),u),M=-x*x+b*(b+2*m)+g);else b=f>0?-u:u,x=Math.max(0,-(f*b+h)),M=-x*x+b*(b+2*m)+g;return n&&n.copy(this.origin).addScaledVector(this.direction,x),s&&s.copy(q_).addScaledVector(S0,b),M}intersectSphere(e,t){Sl.subVectors(e.center,this.origin);const n=Sl.dot(this.direction),s=Sl.dot(Sl)-n*n,u=e.radius*e.radius;if(s>u)return null;const f=Math.sqrt(u-s),h=n-f,m=n+f;return m<0?null:h<0?this.at(m,t):this.at(h,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?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 n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,u,f,h,m;const g=1/this.direction.x,_=1/this.direction.y,x=1/this.direction.z,b=this.origin;return g>=0?(n=(e.min.x-b.x)*g,s=(e.max.x-b.x)*g):(n=(e.max.x-b.x)*g,s=(e.min.x-b.x)*g),_>=0?(u=(e.min.y-b.y)*_,f=(e.max.y-b.y)*_):(u=(e.max.y-b.y)*_,f=(e.min.y-b.y)*_),n>f||u>s||((u>n||isNaN(n))&&(n=u),(f<s||isNaN(s))&&(s=f),x>=0?(h=(e.min.z-b.z)*x,m=(e.max.z-b.z)*x):(h=(e.max.z-b.z)*x,m=(e.min.z-b.z)*x),n>m||h>s)||((h>n||n!==n)&&(n=h),(m<s||s!==s)&&(s=m),s<0)?null:this.at(n>=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,Sl)!==null}intersectTriangle(e,t,n,s,u){j_.subVectors(t,e),M0.subVectors(n,e),Y_.crossVectors(j_,M0);let f=this.direction.dot(Y_),h;if(f>0){if(s)return null;h=1}else if(f<0)h=-1,f=-f;else return null;Tu.subVectors(this.origin,e);const m=h*this.direction.dot(M0.crossVectors(Tu,M0));if(m<0)return null;const g=h*this.direction.dot(j_.cross(Tu));if(g<0||m+g>f)return null;const _=-h*Tu.dot(Y_);return _<0?null:this.at(_/f,u)}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 Xt{constructor(e,t,n,s,u,f,h,m,g,_,x,b,M,A,R,w){Xt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,s,u,f,h,m,g,_,x,b,M,A,R,w)}set(e,t,n,s,u,f,h,m,g,_,x,b,M,A,R,w){const E=this.elements;return E[0]=e,E[4]=t,E[8]=n,E[12]=s,E[1]=u,E[5]=f,E[9]=h,E[13]=m,E[2]=g,E[6]=_,E[10]=x,E[14]=b,E[3]=M,E[7]=A,E[11]=R,E[15]=w,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 Xt().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 this.determinant()===0?(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(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,s=1/bh.setFromMatrixColumn(e,0).length(),u=1/bh.setFromMatrixColumn(e,1).length(),f=1/bh.setFromMatrixColumn(e,2).length();return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=0,t[4]=n[4]*u,t[5]=n[5]*u,t[6]=n[6]*u,t[7]=0,t[8]=n[8]*f,t[9]=n[9]*f,t[10]=n[10]*f,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,s=e.y,u=e.z,f=Math.cos(n),h=Math.sin(n),m=Math.cos(s),g=Math.sin(s),_=Math.cos(u),x=Math.sin(u);if(e.order==="XYZ"){const b=f*_,M=f*x,A=h*_,R=h*x;t[0]=m*_,t[4]=-m*x,t[8]=g,t[1]=M+A*g,t[5]=b-R*g,t[9]=-h*m,t[2]=R-b*g,t[6]=A+M*g,t[10]=f*m}else if(e.order==="YXZ"){const b=m*_,M=m*x,A=g*_,R=g*x;t[0]=b+R*h,t[4]=A*h-M,t[8]=f*g,t[1]=f*x,t[5]=f*_,t[9]=-h,t[2]=M*h-A,t[6]=R+b*h,t[10]=f*m}else if(e.order==="ZXY"){const b=m*_,M=m*x,A=g*_,R=g*x;t[0]=b-R*h,t[4]=-f*x,t[8]=A+M*h,t[1]=M+A*h,t[5]=f*_,t[9]=R-b*h,t[2]=-f*g,t[6]=h,t[10]=f*m}else if(e.order==="ZYX"){const b=f*_,M=f*x,A=h*_,R=h*x;t[0]=m*_,t[4]=A*g-M,t[8]=b*g+R,t[1]=m*x,t[5]=R*g+b,t[9]=M*g-A,t[2]=-g,t[6]=h*m,t[10]=f*m}else if(e.order==="YZX"){const b=f*m,M=f*g,A=h*m,R=h*g;t[0]=m*_,t[4]=R-b*x,t[8]=A*x+M,t[1]=x,t[5]=f*_,t[9]=-h*_,t[2]=-g*_,t[6]=M*x+A,t[10]=b-R*x}else if(e.order==="XZY"){const b=f*m,M=f*g,A=h*m,R=h*g;t[0]=m*_,t[4]=-x,t[8]=g*_,t[1]=b*x+R,t[5]=f*_,t[9]=M*x-A,t[2]=A*x-M,t[6]=h*_,t[10]=R*x+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gR,e,vR)}lookAt(e,t,n){const s=this.elements;return Bs.subVectors(e,t),Bs.lengthSq()===0&&(Bs.z=1),Bs.normalize(),Au.crossVectors(n,Bs),Au.lengthSq()===0&&(Math.abs(n.z)===1?Bs.x+=1e-4:Bs.z+=1e-4,Bs.normalize(),Au.crossVectors(n,Bs)),Au.normalize(),E0.crossVectors(Bs,Au),s[0]=Au.x,s[4]=E0.x,s[8]=Bs.x,s[1]=Au.y,s[5]=E0.y,s[9]=Bs.y,s[2]=Au.z,s[6]=E0.z,s[10]=Bs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=t.elements,u=this.elements,f=n[0],h=n[4],m=n[8],g=n[12],_=n[1],x=n[5],b=n[9],M=n[13],A=n[2],R=n[6],w=n[10],E=n[14],N=n[3],D=n[7],U=n[11],B=n[15],z=s[0],H=s[4],W=s[8],I=s[12],P=s[1],Z=s[5],se=s[9],te=s[13],fe=s[2],pe=s[6],Y=s[10],q=s[14],ne=s[3],be=s[7],Ne=s[11],X=s[15];return u[0]=f*z+h*P+m*fe+g*ne,u[4]=f*H+h*Z+m*pe+g*be,u[8]=f*W+h*se+m*Y+g*Ne,u[12]=f*I+h*te+m*q+g*X,u[1]=_*z+x*P+b*fe+M*ne,u[5]=_*H+x*Z+b*pe+M*be,u[9]=_*W+x*se+b*Y+M*Ne,u[13]=_*I+x*te+b*q+M*X,u[2]=A*z+R*P+w*fe+E*ne,u[6]=A*H+R*Z+w*pe+E*be,u[10]=A*W+R*se+w*Y+E*Ne,u[14]=A*I+R*te+w*q+E*X,u[3]=N*z+D*P+U*fe+B*ne,u[7]=N*H+D*Z+U*pe+B*be,u[11]=N*W+D*se+U*Y+B*Ne,u[15]=N*I+D*te+U*q+B*X,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],s=e[8],u=e[12],f=e[1],h=e[5],m=e[9],g=e[13],_=e[2],x=e[6],b=e[10],M=e[14],A=e[3],R=e[7],w=e[11],E=e[15],N=m*M-g*b,D=h*M-g*x,U=h*b-m*x,B=f*M-g*_,z=f*b-m*_,H=f*x-h*_;return t*(R*N-w*D+E*U)-n*(A*N-w*B+E*z)+s*(A*D-R*B+E*H)-u*(A*U-R*z+w*H)}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 s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],u=e[3],f=e[4],h=e[5],m=e[6],g=e[7],_=e[8],x=e[9],b=e[10],M=e[11],A=e[12],R=e[13],w=e[14],E=e[15],N=x*w*g-R*b*g+R*m*M-h*w*M-x*m*E+h*b*E,D=A*b*g-_*w*g-A*m*M+f*w*M+_*m*E-f*b*E,U=_*R*g-A*x*g+A*h*M-f*R*M-_*h*E+f*x*E,B=A*x*m-_*R*m-A*h*b+f*R*b+_*h*w-f*x*w,z=t*N+n*D+s*U+u*B;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const H=1/z;return e[0]=N*H,e[1]=(R*b*u-x*w*u-R*s*M+n*w*M+x*s*E-n*b*E)*H,e[2]=(h*w*u-R*m*u+R*s*g-n*w*g-h*s*E+n*m*E)*H,e[3]=(x*m*u-h*b*u-x*s*g+n*b*g+h*s*M-n*m*M)*H,e[4]=D*H,e[5]=(_*w*u-A*b*u+A*s*M-t*w*M-_*s*E+t*b*E)*H,e[6]=(A*m*u-f*w*u-A*s*g+t*w*g+f*s*E-t*m*E)*H,e[7]=(f*b*u-_*m*u+_*s*g-t*b*g-f*s*M+t*m*M)*H,e[8]=U*H,e[9]=(A*x*u-_*R*u-A*n*M+t*R*M+_*n*E-t*x*E)*H,e[10]=(f*R*u-A*h*u+A*n*g-t*R*g-f*n*E+t*h*E)*H,e[11]=(_*h*u-f*x*u-_*n*g+t*x*g+f*n*M-t*h*M)*H,e[12]=B*H,e[13]=(_*R*s-A*x*s+A*n*b-t*R*b-_*n*w+t*x*w)*H,e[14]=(A*h*s-f*R*s-A*n*m+t*R*m+f*n*w-t*h*w)*H,e[15]=(f*x*s-_*h*s+_*n*m-t*x*m-f*n*b+t*h*b)*H,this}scale(e){const t=this.elements,n=e.x,s=e.y,u=e.z;return t[0]*=n,t[4]*=s,t[8]*=u,t[1]*=n,t[5]*=s,t[9]*=u,t[2]*=n,t[6]*=s,t[10]*=u,t[3]*=n,t[7]*=s,t[11]*=u,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],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,s))}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),s=Math.sin(t),u=1-n,f=e.x,h=e.y,m=e.z,g=u*f,_=u*h;return this.set(g*f+n,g*h-s*m,g*m+s*h,0,g*h+s*m,_*h+n,_*m-s*f,0,g*m-s*h,_*m+s*f,u*m*m+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,s,u,f){return this.set(1,n,u,0,e,1,f,0,t,s,1,0,0,0,0,1),this}compose(e,t,n){const s=this.elements,u=t._x,f=t._y,h=t._z,m=t._w,g=u+u,_=f+f,x=h+h,b=u*g,M=u*_,A=u*x,R=f*_,w=f*x,E=h*x,N=m*g,D=m*_,U=m*x,B=n.x,z=n.y,H=n.z;return s[0]=(1-(R+E))*B,s[1]=(M+U)*B,s[2]=(A-D)*B,s[3]=0,s[4]=(M-U)*z,s[5]=(1-(b+E))*z,s[6]=(w+N)*z,s[7]=0,s[8]=(A+D)*H,s[9]=(w-N)*H,s[10]=(1-(b+R))*H,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,n){const s=this.elements;if(e.x=s[12],e.y=s[13],e.z=s[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let u=bh.set(s[0],s[1],s[2]).length();const f=bh.set(s[4],s[5],s[6]).length(),h=bh.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),Xr.copy(this);const g=1/u,_=1/f,x=1/h;return Xr.elements[0]*=g,Xr.elements[1]*=g,Xr.elements[2]*=g,Xr.elements[4]*=_,Xr.elements[5]*=_,Xr.elements[6]*=_,Xr.elements[8]*=x,Xr.elements[9]*=x,Xr.elements[10]*=x,t.setFromRotationMatrix(Xr),n.x=u,n.y=f,n.z=h,this}makePerspective(e,t,n,s,u,f,h=ks,m=!1){const g=this.elements,_=2*u/(t-e),x=2*u/(n-s),b=(t+e)/(t-e),M=(n+s)/(n-s);let A,R;if(m)A=u/(f-u),R=f*u/(f-u);else if(h===ks)A=-(f+u)/(f-u),R=-2*f*u/(f-u);else if(h===Yh)A=-f/(f-u),R=-f*u/(f-u);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return g[0]=_,g[4]=0,g[8]=b,g[12]=0,g[1]=0,g[5]=x,g[9]=M,g[13]=0,g[2]=0,g[6]=0,g[10]=A,g[14]=R,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this}makeOrthographic(e,t,n,s,u,f,h=ks,m=!1){const g=this.elements,_=2/(t-e),x=2/(n-s),b=-(t+e)/(t-e),M=-(n+s)/(n-s);let A,R;if(m)A=1/(f-u),R=f/(f-u);else if(h===ks)A=-2/(f-u),R=-(f+u)/(f-u);else if(h===Yh)A=-1/(f-u),R=-u/(f-u);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return g[0]=_,g[4]=0,g[8]=0,g[12]=b,g[1]=0,g[5]=x,g[9]=0,g[13]=M,g[2]=0,g[6]=0,g[10]=A,g[14]=R,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<16;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=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}}const bh=new j,Xr=new Xt,gR=new j(0,0,0),vR=new j(1,1,1),Au=new j,E0=new j,Bs=new j,uM=new Xt,cM=new Pa;class Gs{constructor(e=0,t=0,n=0,s=Gs.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=s}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,s=this._order){return this._x=e,this._y=t,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const s=e.elements,u=s[0],f=s[4],h=s[8],m=s[1],g=s[5],_=s[9],x=s[2],b=s[6],M=s[10];switch(t){case"XYZ":this._y=Math.asin(Ht(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-_,M),this._z=Math.atan2(-f,u)):(this._x=Math.atan2(b,g),this._z=0);break;case"YXZ":this._x=Math.asin(-Ht(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(h,M),this._z=Math.atan2(m,g)):(this._y=Math.atan2(-x,u),this._z=0);break;case"ZXY":this._x=Math.asin(Ht(b,-1,1)),Math.abs(b)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-f,g)):(this._y=0,this._z=Math.atan2(m,u));break;case"ZYX":this._y=Math.asin(-Ht(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(b,M),this._z=Math.atan2(m,u)):(this._x=0,this._z=Math.atan2(-f,g));break;case"YZX":this._z=Math.asin(Ht(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(-_,g),this._y=Math.atan2(-x,u)):(this._x=0,this._y=Math.atan2(h,M));break;case"XZY":this._z=Math.asin(-Ht(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(b,g),this._y=Math.atan2(h,u)):(this._x=Math.atan2(-_,M),this._y=0);break;default:ft("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return uM.makeRotationFromQuaternion(e),this.setFromRotationMatrix(uM,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return cM.setFromEuler(this),this.setFromQuaternion(cM,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],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Gs.DEFAULT_ORDER="XYZ";class Kh{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let yR=0;const fM=new j,Sh=new Pa,Ml=new Xt,T0=new j,Pp=new j,_R=new j,xR=new Pa,hM=new j(1,0,0),dM=new j(0,1,0),pM=new j(0,0,1),mM={type:"added"},bR={type:"removed"},Mh={type:"childadded",child:null},Z_={type:"childremoved",child:null};class Cn extends ko{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yR++}),this.uuid=Vs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Cn.DEFAULT_UP.clone();const e=new j,t=new Gs,n=new Pa,s=new j(1,1,1);function u(){n.setFromEuler(t,!1)}function f(){t.setFromQuaternion(n,void 0,!1)}t._onChange(u),n._onChange(f),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Xt},normalMatrix:{value:new en}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=Cn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Cn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Kh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Sh.setFromAxisAngle(e,t),this.quaternion.multiply(Sh),this}rotateOnWorldAxis(e,t){return Sh.setFromAxisAngle(e,t),this.quaternion.premultiply(Sh),this}rotateX(e){return this.rotateOnAxis(hM,e)}rotateY(e){return this.rotateOnAxis(dM,e)}rotateZ(e){return this.rotateOnAxis(pM,e)}translateOnAxis(e,t){return fM.copy(e).applyQuaternion(this.quaternion),this.position.add(fM.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(hM,e)}translateY(e){return this.translateOnAxis(dM,e)}translateZ(e){return this.translateOnAxis(pM,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ml.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?T0.copy(e):T0.set(e,t,n);const s=this.parent;this.updateWorldMatrix(!0,!1),Pp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ml.lookAt(Pp,T0,this.up):Ml.lookAt(T0,Pp,this.up),this.quaternion.setFromRotationMatrix(Ml),s&&(Ml.extractRotation(s.matrixWorld),Sh.setFromRotationMatrix(Ml),this.quaternion.premultiply(Sh.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Rt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(mM),Mh.child=e,this.dispatchEvent(Mh),Mh.child=null):Rt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(bR),Z_.child=e,this.dispatchEvent(Z_),Z_.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ml.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ml.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ml),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(mM),Mh.child=e,this.dispatchEvent(Mh),Mh.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,s=this.children.length;n<s;n++){const f=this.children[n].getObjectByProperty(e,t);if(f!==void 0)return f}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const s=this.children;for(let u=0,f=s.length;u<f;u++)s[u].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pp,e,_R),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pp,xR,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,s=t.length;n<s;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const s=this.children;for(let u=0,f=s.length;u<f;u++)s[u].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(h=>({...h,boundingBox:h.boundingBox?h.boundingBox.toJSON():void 0,boundingSphere:h.boundingSphere?h.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(h=>({...h})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function u(h,m){return h[m.uuid]===void 0&&(h[m.uuid]=m.toJSON(e)),m.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=u(e.geometries,this.geometry);const h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){const m=h.shapes;if(Array.isArray(m))for(let g=0,_=m.length;g<_;g++){const x=m[g];u(e.shapes,x)}else u(e.shapes,m)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(u(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const h=[];for(let m=0,g=this.material.length;m<g;m++)h.push(u(e.materials,this.material[m]));s.material=h}else s.material=u(e.materials,this.material);if(this.children.length>0){s.children=[];for(let h=0;h<this.children.length;h++)s.children.push(this.children[h].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let h=0;h<this.animations.length;h++){const m=this.animations[h];s.animations.push(u(e.animations,m))}}if(t){const h=f(e.geometries),m=f(e.materials),g=f(e.textures),_=f(e.images),x=f(e.shapes),b=f(e.skeletons),M=f(e.animations),A=f(e.nodes);h.length>0&&(n.geometries=h),m.length>0&&(n.materials=m),g.length>0&&(n.textures=g),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),b.length>0&&(n.skeletons=b),M.length>0&&(n.animations=M),A.length>0&&(n.nodes=A)}return n.object=s,n;function f(h){const m=[];for(const g in h){const _=h[g];delete _.metadata,m.push(_)}return m}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const s=e.children[n];this.add(s.clone())}return this}}Cn.DEFAULT_UP=new j(0,1,0);Cn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Cn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wr=new j,El=new j,Q_=new j,Tl=new j,Eh=new j,Th=new j,gM=new j,K_=new j,J_=new j,$_=new j,ex=new jn,tx=new jn,nx=new jn;class Cs{constructor(e=new j,t=new j,n=new j){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),Wr.subVectors(e,t),s.cross(Wr);const u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(e,t,n,s,u){Wr.subVectors(s,t),El.subVectors(n,t),Q_.subVectors(e,t);const f=Wr.dot(Wr),h=Wr.dot(El),m=Wr.dot(Q_),g=El.dot(El),_=El.dot(Q_),x=f*g-h*h;if(x===0)return u.set(0,0,0),null;const b=1/x,M=(g*m-h*_)*b,A=(f*_-h*m)*b;return u.set(1-M-A,A,M)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,Tl)===null?!1:Tl.x>=0&&Tl.y>=0&&Tl.x+Tl.y<=1}static getInterpolation(e,t,n,s,u,f,h,m){return this.getBarycoord(e,t,n,s,Tl)===null?(m.x=0,m.y=0,"z"in m&&(m.z=0),"w"in m&&(m.w=0),null):(m.setScalar(0),m.addScaledVector(u,Tl.x),m.addScaledVector(f,Tl.y),m.addScaledVector(h,Tl.z),m)}static getInterpolatedAttribute(e,t,n,s,u,f){return ex.setScalar(0),tx.setScalar(0),nx.setScalar(0),ex.fromBufferAttribute(e,t),tx.fromBufferAttribute(e,n),nx.fromBufferAttribute(e,s),f.setScalar(0),f.addScaledVector(ex,u.x),f.addScaledVector(tx,u.y),f.addScaledVector(nx,u.z),f}static isFrontFacing(e,t,n,s){return Wr.subVectors(n,t),El.subVectors(e,t),Wr.cross(El).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),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 Wr.subVectors(this.c,this.b),El.subVectors(this.a,this.b),Wr.cross(El).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Cs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Cs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,u){return Cs.getInterpolation(e,this.a,this.b,this.c,t,n,s,u)}containsPoint(e){return Cs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Cs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,s=this.b,u=this.c;let f,h;Eh.subVectors(s,n),Th.subVectors(u,n),K_.subVectors(e,n);const m=Eh.dot(K_),g=Th.dot(K_);if(m<=0&&g<=0)return t.copy(n);J_.subVectors(e,s);const _=Eh.dot(J_),x=Th.dot(J_);if(_>=0&&x<=_)return t.copy(s);const b=m*x-_*g;if(b<=0&&m>=0&&_<=0)return f=m/(m-_),t.copy(n).addScaledVector(Eh,f);$_.subVectors(e,u);const M=Eh.dot($_),A=Th.dot($_);if(A>=0&&M<=A)return t.copy(u);const R=M*g-m*A;if(R<=0&&g>=0&&A<=0)return h=g/(g-A),t.copy(n).addScaledVector(Th,h);const w=_*A-M*x;if(w<=0&&x-_>=0&&M-A>=0)return gM.subVectors(u,s),h=(x-_)/(x-_+(M-A)),t.copy(s).addScaledVector(gM,h);const E=1/(w+R+b);return f=R*E,h=b*E,t.copy(n).addScaledVector(Eh,f).addScaledVector(Th,h)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const HE={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},wu={h:0,s:0,l:0},A0={h:0,s:0,l:0};function ix(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class yt{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(t===void 0&&n===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ia){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=Sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Sn.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=Sn.workingColorSpace){if(e=wb(e,1),t=Ht(t,0,1),n=Ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const u=n<=.5?n*(1+t):n+t-n*t,f=2*n-u;this.r=ix(f,u,e+1/3),this.g=ix(f,u,e),this.b=ix(f,u,e-1/3)}return Sn.colorSpaceToWorking(this,s),this}setStyle(e,t=Ia){function n(u){u!==void 0&&parseFloat(u)<1&&ft("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let u;const f=s[1],h=s[2];switch(f){case"rgb":case"rgba":if(u=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(u[4]),this.setRGB(Math.min(255,parseInt(u[1],10))/255,Math.min(255,parseInt(u[2],10))/255,Math.min(255,parseInt(u[3],10))/255,t);if(u=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(u[4]),this.setRGB(Math.min(100,parseInt(u[1],10))/100,Math.min(100,parseInt(u[2],10))/100,Math.min(100,parseInt(u[3],10))/100,t);break;case"hsl":case"hsla":if(u=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return n(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,t);break;default:ft("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const u=s[1],f=u.length;if(f===3)return this.setRGB(parseInt(u.charAt(0),16)/15,parseInt(u.charAt(1),16)/15,parseInt(u.charAt(2),16)/15,t);if(f===6)return this.setHex(parseInt(u,16),t);ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ia){const n=HE[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ft("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=Nl(e.r),this.g=Nl(e.g),this.b=Nl(e.b),this}copyLinearToSRGB(e){return this.r=Wh(e.r),this.g=Wh(e.g),this.b=Wh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ia){return Sn.workingToColorSpace(La.copy(this),e),Math.round(Ht(La.r*255,0,255))*65536+Math.round(Ht(La.g*255,0,255))*256+Math.round(Ht(La.b*255,0,255))}getHexString(e=Ia){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Sn.workingColorSpace){Sn.workingToColorSpace(La.copy(this),t);const n=La.r,s=La.g,u=La.b,f=Math.max(n,s,u),h=Math.min(n,s,u);let m,g;const _=(h+f)/2;if(h===f)m=0,g=0;else{const x=f-h;switch(g=_<=.5?x/(f+h):x/(2-f-h),f){case n:m=(s-u)/x+(s<u?6:0);break;case s:m=(u-n)/x+2;break;case u:m=(n-s)/x+4;break}m/=6}return e.h=m,e.s=g,e.l=_,e}getRGB(e,t=Sn.workingColorSpace){return Sn.workingToColorSpace(La.copy(this),t),e.r=La.r,e.g=La.g,e.b=La.b,e}getStyle(e=Ia){Sn.workingToColorSpace(La.copy(this),e);const t=La.r,n=La.g,s=La.b;return e!==Ia?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(wu),this.setHSL(wu.h+e,wu.s+t,wu.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(wu),e.getHSL(A0);const n=im(wu.h,A0.h,t),s=im(wu.s,A0.s,t),u=im(wu.l,A0.l,t);return this.setHSL(n,s,u),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,s=this.b,u=e.elements;return this.r=u[0]*t+u[3]*n+u[6]*s,this.g=u[1]*t+u[4]*n+u[7]*s,this.b=u[2]*t+u[5]*n+u[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const La=new yt;yt.NAMES=HE;let SR=0;class Ba extends ko{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:SR++}),this.uuid=Vs(),this.name="",this.type="Material",this.blending=Kc,this.side=Ll,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=vv,this.blendDst=yv,this.blendEquation=Du,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new yt(0,0,0),this.blendAlpha=0,this.depthFunc=ef,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=qx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Wc,this.stencilZFail=Wc,this.stencilZPass=Wc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ft(`Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(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),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(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,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Kc&&(n.blending=this.blending),this.side!==Ll&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==vv&&(n.blendSrc=this.blendSrc),this.blendDst!==yv&&(n.blendDst=this.blendDst),this.blendEquation!==Du&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ef&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==qx&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Wc&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Wc&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Wc&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(u){const f=[];for(const h in u){const m=u[h];delete m.metadata,f.push(m)}return f}if(t){const u=s(e.textures),f=s(e.images);u.length>0&&(n.textures=u),f.length>0&&(n.images=f)}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(t!==null){const s=t.length;n=new Array(s);for(let u=0;u!==s;++u)n[u]=t[u].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){e===!0&&this.version++}}class Vu extends Ba{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new yt(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 Gs,this.combine=Am,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 Rl=MR();function MR(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),s=new Uint32Array(512);for(let m=0;m<256;++m){const g=m-127;g<-27?(n[m]=0,n[m|256]=32768,s[m]=24,s[m|256]=24):g<-14?(n[m]=1024>>-g-14,n[m|256]=1024>>-g-14|32768,s[m]=-g-1,s[m|256]=-g-1):g<=15?(n[m]=g+15<<10,n[m|256]=g+15<<10|32768,s[m]=13,s[m|256]=13):g<128?(n[m]=31744,n[m|256]=64512,s[m]=24,s[m|256]=24):(n[m]=31744,n[m|256]=64512,s[m]=13,s[m|256]=13)}const u=new Uint32Array(2048),f=new Uint32Array(64),h=new Uint32Array(64);for(let m=1;m<1024;++m){let g=m<<13,_=0;for(;(g&8388608)===0;)g<<=1,_-=8388608;g&=-8388609,_+=947912704,u[m]=g|_}for(let m=1024;m<2048;++m)u[m]=939524096+(m-1024<<13);for(let m=1;m<31;++m)f[m]=m<<23;f[31]=1199570944,f[32]=2147483648;for(let m=33;m<63;++m)f[m]=2147483648+(m-32<<23);f[63]=3347054592;for(let m=1;m<64;++m)m!==32&&(h[m]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:s,mantissaTable:u,exponentTable:f,offsetTable:h}}function As(r){Math.abs(r)>65504&&ft("DataUtils.toHalfFloat(): Value out of range."),r=Ht(r,-65504,65504),Rl.floatView[0]=r;const e=Rl.uint32View[0],t=e>>23&511;return Rl.baseTable[t]+((e&8388607)>>Rl.shiftTable[t])}function Yp(r){const e=r>>10;return Rl.uint32View[0]=Rl.mantissaTable[Rl.offsetTable[e]+(r&1023)]+Rl.exponentTable[e],Rl.floatView[0]}class ER{static toHalfFloat(e){return As(e)}static fromHalfFloat(e){return Yp(e)}}const ji=new j,w0=new ze;let TR=0;class Xn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:TR++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=pm,this.updateRanges=[],this.gpuType=is,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&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 s=0,u=this.itemSize;s<u;s++)this.array[e+s]=t.array[n+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)w0.fromBufferAttribute(this,t),w0.applyMatrix3(e),this.setXY(t,w0.x,w0.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyMatrix3(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyMatrix4(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyNormalMatrix(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.transformDirection(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ns(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ns(t,this.array)),t}setX(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ns(t,this.array)),t}setY(e,t){return this.normalized&&(t=on(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=ns(t,this.array)),t}setZ(e,t){return this.normalized&&(t=on(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=ns(t,this.array)),t}setW(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this}setXYZW(e,t,n,s,u){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array),u=on(u,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this.array[e+3]=u,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!==pm&&(e.usage=this.usage),e}}class AR extends Xn{constructor(e,t,n){super(new Int8Array(e),t,n)}}class wR extends Xn{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class CR extends Xn{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class RR extends Xn{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Rb extends Xn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class NR extends Xn{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Nb extends Xn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class DR extends Xn{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Yp(this.array[e*this.itemSize]);return this.normalized&&(t=ns(t,this.array)),t}setX(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize]=As(t),this}getY(e){let t=Yp(this.array[e*this.itemSize+1]);return this.normalized&&(t=ns(t,this.array)),t}setY(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize+1]=As(t),this}getZ(e){let t=Yp(this.array[e*this.itemSize+2]);return this.normalized&&(t=ns(t,this.array)),t}setZ(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize+2]=As(t),this}getW(e){let t=Yp(this.array[e*this.itemSize+3]);return this.normalized&&(t=ns(t,this.array)),t}setW(e,t){return this.normalized&&(t=on(t,this.array)),this.array[e*this.itemSize+3]=As(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array)),this.array[e+0]=As(t),this.array[e+1]=As(n),this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array)),this.array[e+0]=As(t),this.array[e+1]=As(n),this.array[e+2]=As(s),this}setXYZW(e,t,n,s,u){return e*=this.itemSize,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array),u=on(u,this.array)),this.array[e+0]=As(t),this.array[e+1]=As(n),this.array[e+2]=As(s),this.array[e+3]=As(u),this}}class bt extends Xn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let LR=0;const mr=new Xt,ax=new Cn,Ah=new j,Fs=new za,zp=new za,oa=new j;class Kt extends ko{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:LR++}),this.uuid=Vs(),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(BE(e)?Nb:Rb)(e,1):this.index=e,this}setIndirect(e,t=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 this.attributes[e]!==void 0}addGroup(e,t,n=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;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const u=new en().getNormalMatrix(e);n.applyNormalMatrix(u),n.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return mr.makeRotationFromQuaternion(e),this.applyMatrix4(mr),this}rotateX(e){return mr.makeRotationX(e),this.applyMatrix4(mr),this}rotateY(e){return mr.makeRotationY(e),this.applyMatrix4(mr),this}rotateZ(e){return mr.makeRotationZ(e),this.applyMatrix4(mr),this}translate(e,t,n){return mr.makeTranslation(e,t,n),this.applyMatrix4(mr),this}scale(e,t,n){return mr.makeScale(e,t,n),this.applyMatrix4(mr),this}lookAt(e){return ax.lookAt(e),ax.updateMatrix(),this.applyMatrix4(ax.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ah).negate(),this.translate(Ah.x,Ah.y,Ah.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let s=0,u=e.length;s<u;s++){const f=e[s];n.push(f.x,f.y,f.z||0)}this.setAttribute("position",new bt(n,3))}else{const n=Math.min(e.length,t.count);for(let s=0;s<n;s++){const u=e[s];t.setXYZ(s,u.x,u.y,u.z||0)}e.length>t.count&&ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new za);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Rt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){const u=t[n];Fs.setFromBufferAttribute(u),this.morphTargetsRelative?(oa.addVectors(this.boundingBox.min,Fs.min),this.boundingBox.expandByPoint(oa),oa.addVectors(this.boundingBox.max,Fs.max),this.boundingBox.expandByPoint(oa)):(this.boundingBox.expandByPoint(Fs.min),this.boundingBox.expandByPoint(Fs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Rt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _a);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Rt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(e){const n=this.boundingSphere.center;if(Fs.setFromBufferAttribute(e),t)for(let u=0,f=t.length;u<f;u++){const h=t[u];zp.setFromBufferAttribute(h),this.morphTargetsRelative?(oa.addVectors(Fs.min,zp.min),Fs.expandByPoint(oa),oa.addVectors(Fs.max,zp.max),Fs.expandByPoint(oa)):(Fs.expandByPoint(zp.min),Fs.expandByPoint(zp.max))}Fs.getCenter(n);let s=0;for(let u=0,f=e.count;u<f;u++)oa.fromBufferAttribute(e,u),s=Math.max(s,n.distanceToSquared(oa));if(t)for(let u=0,f=t.length;u<f;u++){const h=t[u],m=this.morphTargetsRelative;for(let g=0,_=h.count;g<_;g++)oa.fromBufferAttribute(h,g),m&&(Ah.fromBufferAttribute(e,g),oa.add(Ah)),s=Math.max(s,n.distanceToSquared(oa))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Rt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Rt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,s=t.normal,u=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Xn(new Float32Array(4*n.count),4));const f=this.getAttribute("tangent"),h=[],m=[];for(let W=0;W<n.count;W++)h[W]=new j,m[W]=new j;const g=new j,_=new j,x=new j,b=new ze,M=new ze,A=new ze,R=new j,w=new j;function E(W,I,P){g.fromBufferAttribute(n,W),_.fromBufferAttribute(n,I),x.fromBufferAttribute(n,P),b.fromBufferAttribute(u,W),M.fromBufferAttribute(u,I),A.fromBufferAttribute(u,P),_.sub(g),x.sub(g),M.sub(b),A.sub(b);const Z=1/(M.x*A.y-A.x*M.y);isFinite(Z)&&(R.copy(_).multiplyScalar(A.y).addScaledVector(x,-M.y).multiplyScalar(Z),w.copy(x).multiplyScalar(M.x).addScaledVector(_,-A.x).multiplyScalar(Z),h[W].add(R),h[I].add(R),h[P].add(R),m[W].add(w),m[I].add(w),m[P].add(w))}let N=this.groups;N.length===0&&(N=[{start:0,count:e.count}]);for(let W=0,I=N.length;W<I;++W){const P=N[W],Z=P.start,se=P.count;for(let te=Z,fe=Z+se;te<fe;te+=3)E(e.getX(te+0),e.getX(te+1),e.getX(te+2))}const D=new j,U=new j,B=new j,z=new j;function H(W){B.fromBufferAttribute(s,W),z.copy(B);const I=h[W];D.copy(I),D.sub(B.multiplyScalar(B.dot(I))).normalize(),U.crossVectors(z,I);const Z=U.dot(m[W])<0?-1:1;f.setXYZW(W,D.x,D.y,D.z,Z)}for(let W=0,I=N.length;W<I;++W){const P=N[W],Z=P.start,se=P.count;for(let te=Z,fe=Z+se;te<fe;te+=3)H(e.getX(te+0)),H(e.getX(te+1)),H(e.getX(te+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Xn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let b=0,M=n.count;b<M;b++)n.setXYZ(b,0,0,0);const s=new j,u=new j,f=new j,h=new j,m=new j,g=new j,_=new j,x=new j;if(e)for(let b=0,M=e.count;b<M;b+=3){const A=e.getX(b+0),R=e.getX(b+1),w=e.getX(b+2);s.fromBufferAttribute(t,A),u.fromBufferAttribute(t,R),f.fromBufferAttribute(t,w),_.subVectors(f,u),x.subVectors(s,u),_.cross(x),h.fromBufferAttribute(n,A),m.fromBufferAttribute(n,R),g.fromBufferAttribute(n,w),h.add(_),m.add(_),g.add(_),n.setXYZ(A,h.x,h.y,h.z),n.setXYZ(R,m.x,m.y,m.z),n.setXYZ(w,g.x,g.y,g.z)}else for(let b=0,M=t.count;b<M;b+=3)s.fromBufferAttribute(t,b+0),u.fromBufferAttribute(t,b+1),f.fromBufferAttribute(t,b+2),_.subVectors(f,u),x.subVectors(s,u),_.cross(x),n.setXYZ(b+0,_.x,_.y,_.z),n.setXYZ(b+1,_.x,_.y,_.z),n.setXYZ(b+2,_.x,_.y,_.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)oa.fromBufferAttribute(e,t),oa.normalize(),e.setXYZ(t,oa.x,oa.y,oa.z)}toNonIndexed(){function e(h,m){const g=h.array,_=h.itemSize,x=h.normalized,b=new g.constructor(m.length*_);let M=0,A=0;for(let R=0,w=m.length;R<w;R++){h.isInterleavedBufferAttribute?M=m[R]*h.data.stride+h.offset:M=m[R]*_;for(let E=0;E<_;E++)b[A++]=g[M++]}return new Xn(b,_,x)}if(this.index===null)return ft("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Kt,n=this.index.array,s=this.attributes;for(const h in s){const m=s[h],g=e(m,n);t.setAttribute(h,g)}const u=this.morphAttributes;for(const h in u){const m=[],g=u[h];for(let _=0,x=g.length;_<x;_++){const b=g[_],M=e(b,n);m.push(M)}t.morphAttributes[h]=m}t.morphTargetsRelative=this.morphTargetsRelative;const f=this.groups;for(let h=0,m=f.length;h<m;h++){const g=f[h];t.addGroup(g.start,g.count,g.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const m=this.parameters;for(const g in m)m[g]!==void 0&&(e[g]=m[g]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const m in n){const g=n[m];e.data.attributes[m]=g.toJSON(e.data)}const s={};let u=!1;for(const m in this.morphAttributes){const g=this.morphAttributes[m],_=[];for(let x=0,b=g.length;x<b;x++){const M=g[x];_.push(M.toJSON(e.data))}_.length>0&&(s[m]=_,u=!0)}u&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const f=this.groups;f.length>0&&(e.data.groups=JSON.parse(JSON.stringify(f)));const h=this.boundingSphere;return h!==null&&(e.data.boundingSphere=h.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;n!==null&&this.setIndex(n.clone());const s=e.attributes;for(const g in s){const _=s[g];this.setAttribute(g,_.clone(t))}const u=e.morphAttributes;for(const g in u){const _=[],x=u[g];for(let b=0,M=x.length;b<M;b++)_.push(x[b].clone(t));this.morphAttributes[g]=_}this.morphTargetsRelative=e.morphTargetsRelative;const f=e.groups;for(let g=0,_=f.length;g<_;g++){const x=f[g];this.addGroup(x.start,x.count,x.materialIndex)}const h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());const m=e.boundingSphere;return m!==null&&(this.boundingSphere=m.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const vM=new Xt,Dc=new of,C0=new _a,yM=new j,R0=new j,N0=new j,D0=new j,sx=new j,L0=new j,_M=new j,U0=new j;class Yi extends Cn{constructor(e=new Kt,t=new Vu){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),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,f=s.length;u<f;u++){const h=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=u}}}}getVertexPosition(e,t){const n=this.geometry,s=n.attributes.position,u=n.morphAttributes.position,f=n.morphTargetsRelative;t.fromBufferAttribute(s,e);const h=this.morphTargetInfluences;if(u&&h){L0.set(0,0,0);for(let m=0,g=u.length;m<g;m++){const _=h[m],x=u[m];_!==0&&(sx.fromBufferAttribute(x,e),f?L0.addScaledVector(sx,_):L0.addScaledVector(sx.sub(t),_))}t.add(L0)}return t}raycast(e,t){const n=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),C0.copy(n.boundingSphere),C0.applyMatrix4(u),Dc.copy(e.ray).recast(e.near),!(C0.containsPoint(Dc.origin)===!1&&(Dc.intersectSphere(C0,yM)===null||Dc.origin.distanceToSquared(yM)>(e.far-e.near)**2))&&(vM.copy(u).invert(),Dc.copy(e.ray).applyMatrix4(vM),!(n.boundingBox!==null&&Dc.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Dc)))}_computeIntersections(e,t,n){let s;const u=this.geometry,f=this.material,h=u.index,m=u.attributes.position,g=u.attributes.uv,_=u.attributes.uv1,x=u.attributes.normal,b=u.groups,M=u.drawRange;if(h!==null)if(Array.isArray(f))for(let A=0,R=b.length;A<R;A++){const w=b[A],E=f[w.materialIndex],N=Math.max(w.start,M.start),D=Math.min(h.count,Math.min(w.start+w.count,M.start+M.count));for(let U=N,B=D;U<B;U+=3){const z=h.getX(U),H=h.getX(U+1),W=h.getX(U+2);s=I0(this,E,e,n,g,_,x,z,H,W),s&&(s.faceIndex=Math.floor(U/3),s.face.materialIndex=w.materialIndex,t.push(s))}}else{const A=Math.max(0,M.start),R=Math.min(h.count,M.start+M.count);for(let w=A,E=R;w<E;w+=3){const N=h.getX(w),D=h.getX(w+1),U=h.getX(w+2);s=I0(this,f,e,n,g,_,x,N,D,U),s&&(s.faceIndex=Math.floor(w/3),t.push(s))}}else if(m!==void 0)if(Array.isArray(f))for(let A=0,R=b.length;A<R;A++){const w=b[A],E=f[w.materialIndex],N=Math.max(w.start,M.start),D=Math.min(m.count,Math.min(w.start+w.count,M.start+M.count));for(let U=N,B=D;U<B;U+=3){const z=U,H=U+1,W=U+2;s=I0(this,E,e,n,g,_,x,z,H,W),s&&(s.faceIndex=Math.floor(U/3),s.face.materialIndex=w.materialIndex,t.push(s))}}else{const A=Math.max(0,M.start),R=Math.min(m.count,M.start+M.count);for(let w=A,E=R;w<E;w+=3){const N=w,D=w+1,U=w+2;s=I0(this,f,e,n,g,_,x,N,D,U),s&&(s.faceIndex=Math.floor(w/3),t.push(s))}}}}function UR(r,e,t,n,s,u,f,h){let m;if(e.side===as?m=n.intersectTriangle(f,u,s,!0,h):m=n.intersectTriangle(s,u,f,e.side===Ll,h),m===null)return null;U0.copy(h),U0.applyMatrix4(r.matrixWorld);const g=t.ray.origin.distanceTo(U0);return g<t.near||g>t.far?null:{distance:g,point:U0.clone(),object:r}}function I0(r,e,t,n,s,u,f,h,m,g){r.getVertexPosition(h,R0),r.getVertexPosition(m,N0),r.getVertexPosition(g,D0);const _=UR(r,e,t,n,R0,N0,D0,_M);if(_){const x=new j;Cs.getBarycoord(_M,R0,N0,D0,x),s&&(_.uv=Cs.getInterpolatedAttribute(s,h,m,g,x,new ze)),u&&(_.uv1=Cs.getInterpolatedAttribute(u,h,m,g,x,new ze)),f&&(_.normal=Cs.getInterpolatedAttribute(f,h,m,g,x,new j),_.normal.dot(n.direction)>0&&_.normal.multiplyScalar(-1));const b={a:h,b:m,c:g,normal:new j,materialIndex:0};Cs.getNormal(R0,N0,D0,b.normal),_.face=b,_.barycoord=x}return _}class lf extends Kt{constructor(e=1,t=1,n=1,s=1,u=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:u,depthSegments:f};const h=this;s=Math.floor(s),u=Math.floor(u),f=Math.floor(f);const m=[],g=[],_=[],x=[];let b=0,M=0;A("z","y","x",-1,-1,n,t,e,f,u,0),A("z","y","x",1,-1,n,t,-e,f,u,1),A("x","z","y",1,1,e,n,t,s,f,2),A("x","z","y",1,-1,e,n,-t,s,f,3),A("x","y","z",1,-1,e,t,n,s,u,4),A("x","y","z",-1,-1,e,t,-n,s,u,5),this.setIndex(m),this.setAttribute("position",new bt(g,3)),this.setAttribute("normal",new bt(_,3)),this.setAttribute("uv",new bt(x,2));function A(R,w,E,N,D,U,B,z,H,W,I){const P=U/H,Z=B/W,se=U/2,te=B/2,fe=z/2,pe=H+1,Y=W+1;let q=0,ne=0;const be=new j;for(let Ne=0;Ne<Y;Ne++){const X=Ne*Z-te;for(let oe=0;oe<pe;oe++){const Ae=oe*P-se;be[R]=Ae*N,be[w]=X*D,be[E]=fe,g.push(be.x,be.y,be.z),be[R]=0,be[w]=0,be[E]=z>0?1:-1,_.push(be.x,be.y,be.z),x.push(oe/H),x.push(1-Ne/W),q+=1}}for(let Ne=0;Ne<W;Ne++)for(let X=0;X<H;X++){const oe=b+X+pe*Ne,Ae=b+X+pe*(Ne+1),Fe=b+(X+1)+pe*(Ne+1),lt=b+(X+1)+pe*Ne;m.push(oe,Ae,lt),m.push(Ae,Fe,lt),ne+=6}h.addGroup(M,ne,I),M+=ne,b+=q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lf(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Jh(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const s=r[t][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(ft("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=s.clone():Array.isArray(s)?e[t][n]=s.slice():e[t][n]=s}}return e}function es(r){const e={};for(let t=0;t<r.length;t++){const n=Jh(r[t]);for(const s in n)e[s]=n[s]}return e}function IR(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function GE(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Sn.workingColorSpace}const XE={clone:Jh,merge:es};var OR=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,PR=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class yr extends Ba{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=OR,this.fragmentShader=PR,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Jh(e.uniforms),this.uniformsGroups=IR(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const f=this.uniforms[s].value;f&&f.isTexture?t.uniforms[s]={type:"t",value:f.toJSON(e).uuid}:f&&f.isColor?t.uniforms[s]={type:"c",value:f.getHex()}:f&&f.isVector2?t.uniforms[s]={type:"v2",value:f.toArray()}:f&&f.isVector3?t.uniforms[s]={type:"v3",value:f.toArray()}:f&&f.isVector4?t.uniforms[s]={type:"v4",value:f.toArray()}:f&&f.isMatrix3?t.uniforms[s]={type:"m3",value:f.toArray()}:f&&f.isMatrix4?t.uniforms[s]={type:"m4",value:f.toArray()}:t.uniforms[s]={value:f}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ry extends Cn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xt,this.projectionMatrix=new Xt,this.projectionMatrixInverse=new Xt,this.coordinateSystem=ks,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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Cu=new j,xM=new ze,bM=new ze;class zi extends Ry{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=s,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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Qh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Jc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qh*2*Math.atan(Math.tan(Jc*.5*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){Cu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Cu.x,Cu.y).multiplyScalar(-e/Cu.z),Cu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Cu.x,Cu.y).multiplyScalar(-e/Cu.z)}getViewSize(e,t){return this.getViewBounds(e,xM,bM),t.subVectors(bM,xM)}setViewOffset(e,t,n,s,u,f){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=u,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Jc*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,u=-.5*s;const f=this.view;if(this.view!==null&&this.view.enabled){const m=f.fullWidth,g=f.fullHeight;u+=f.offsetX*s/m,t-=f.offsetY*n/g,s*=f.width/m,n*=f.height/g}const h=this.filmOffset;h!==0&&(u+=e*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(u,u+s,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const wh=-90,Ch=1;class WE extends Cn{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new zi(wh,Ch,e,t);s.layers=this.layers,this.add(s);const u=new zi(wh,Ch,e,t);u.layers=this.layers,this.add(u);const f=new zi(wh,Ch,e,t);f.layers=this.layers,this.add(f);const h=new zi(wh,Ch,e,t);h.layers=this.layers,this.add(h);const m=new zi(wh,Ch,e,t);m.layers=this.layers,this.add(m);const g=new zi(wh,Ch,e,t);g.layers=this.layers,this.add(g)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,s,u,f,h,m]=t;for(const g of t)this.remove(g);if(e===ks)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),u.up.set(0,0,-1),u.lookAt(0,1,0),f.up.set(0,0,1),f.lookAt(0,-1,0),h.up.set(0,1,0),h.lookAt(0,0,1),m.up.set(0,1,0),m.lookAt(0,0,-1);else if(e===Yh)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),u.up.set(0,0,1),u.lookAt(0,1,0),f.up.set(0,0,-1),f.lookAt(0,-1,0),h.up.set(0,-1,0),h.lookAt(0,0,1),m.up.set(0,-1,0),m.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const g of t)this.add(g),g.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[u,f,h,m,g,_]=this.children,x=e.getRenderTarget(),b=e.getActiveCubeFace(),M=e.getActiveMipmapLevel(),A=e.xr.enabled;e.xr.enabled=!1;const R=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,s),e.render(t,u),e.setRenderTarget(n,1,s),e.render(t,f),e.setRenderTarget(n,2,s),e.render(t,h),e.setRenderTarget(n,3,s),e.render(t,m),e.setRenderTarget(n,4,s),e.render(t,g),n.texture.generateMipmaps=R,e.setRenderTarget(n,5,s),e.render(t,_),e.setRenderTarget(x,b,M),e.xr.enabled=A,n.texture.needsPMREMUpdate=!0}}class Cm extends wi{constructor(e=[],t=zo,n,s,u,f,h,m,g,_){super(e,t,n,s,u,f,h,m,g,_),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Db extends Hs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new Cm(s),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={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},s=new lf(5,5,5),u=new yr({name:"CubemapFromEquirect",uniforms:Jh(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:as,blending:Po});u.uniforms.tEquirect.value=t;const f=new Yi(s,u),h=t.minFilter;return t.minFilter===Io&&(t.minFilter=oi),new WE(1,10,this).update(e,f),t.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){const u=e.getRenderTarget();for(let f=0;f<6;f++)e.setRenderTarget(this,f),e.clear(t,n,s);e.setRenderTarget(u)}}class Gh extends Cn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zR={type:"move"};class pv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let s=null,u=null,f=null;const h=this._targetRay,m=this._grip,g=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(g&&e.hand){f=!0;for(const R of e.hand.values()){const w=t.getJointPose(R,n),E=this._getHandJoint(g,R);w!==null&&(E.matrix.fromArray(w.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=w.radius),E.visible=w!==null}const _=g.joints["index-finger-tip"],x=g.joints["thumb-tip"],b=_.position.distanceTo(x.position),M=.02,A=.005;g.inputState.pinching&&b>M+A?(g.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!g.inputState.pinching&&b<=M-A&&(g.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else m!==null&&e.gripSpace&&(u=t.getPose(e.gripSpace,n),u!==null&&(m.matrix.fromArray(u.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,u.linearVelocity?(m.hasLinearVelocity=!0,m.linearVelocity.copy(u.linearVelocity)):m.hasLinearVelocity=!1,u.angularVelocity?(m.hasAngularVelocity=!0,m.angularVelocity.copy(u.angularVelocity)):m.hasAngularVelocity=!1));h!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&u!==null&&(s=u),s!==null&&(h.matrix.fromArray(s.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,s.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(s.linearVelocity)):h.hasLinearVelocity=!1,s.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(s.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(zR)))}return h!==null&&(h.visible=s!==null),m!==null&&(m.visible=u!==null),g!==null&&(g.visible=f!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Gh;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ny{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new yt(e),this.density=t}clone(){return new Ny(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Dy{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new yt(e),this.near=t,this.far=n}clone(){return new Dy(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Lb extends Cn{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 Gs,this.environmentIntensity=1,this.environmentRotation=new Gs,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(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),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ly{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=pm,this.updateRanges=[],this.version=0,this.uuid=Vs()}onUploadCallback(){}set needsUpdate(e){e===!0&&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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let s=0,u=this.stride;s<u;s++)this.array[e+s]=t.array[n+s];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Vs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(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 e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Vs()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(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 $a=new j;class nf{constructor(e,t,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=s}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;t<n;t++)$a.fromBufferAttribute(this,t),$a.applyMatrix4(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$a.fromBufferAttribute(this,t),$a.applyNormalMatrix(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$a.fromBufferAttribute(this,t),$a.transformDirection(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ns(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=on(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=on(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ns(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ns(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ns(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ns(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this}setXYZW(e,t,n,s,u){return e=e*this.data.stride+this.offset,this.normalized&&(t=on(t,this.array),n=on(n,this.array),s=on(s,this.array),u=on(u,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this.data.array[e+3]=u,this}clone(e){if(e===void 0){gm("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)t.push(this.data.array[s+u])}return new Xn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nf(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){gm("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const s=n*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)t.push(this.data.array[s+u])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ub extends Ba{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new yt(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}}let Rh;const Bp=new j,Nh=new j,Dh=new j,Lh=new ze,Fp=new ze,qE=new Xt,O0=new j,kp=new j,P0=new j,SM=new ze,rx=new ze,MM=new ze;class jE extends Cn{constructor(e=new Ub){if(super(),this.isSprite=!0,this.type="Sprite",Rh===void 0){Rh=new Kt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ly(t,5);Rh.setIndex([0,1,2,0,2,3]),Rh.setAttribute("position",new nf(n,3,0,!1)),Rh.setAttribute("uv",new nf(n,2,3,!1))}this.geometry=Rh,this.material=e,this.center=new ze(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Rt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Nh.setFromMatrixScale(this.matrixWorld),qE.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Dh.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Nh.multiplyScalar(-Dh.z);const n=this.material.rotation;let s,u;n!==0&&(u=Math.cos(n),s=Math.sin(n));const f=this.center;z0(O0.set(-.5,-.5,0),Dh,f,Nh,s,u),z0(kp.set(.5,-.5,0),Dh,f,Nh,s,u),z0(P0.set(.5,.5,0),Dh,f,Nh,s,u),SM.set(0,0),rx.set(1,0),MM.set(1,1);let h=e.ray.intersectTriangle(O0,kp,P0,!1,Bp);if(h===null&&(z0(kp.set(-.5,.5,0),Dh,f,Nh,s,u),rx.set(0,1),h=e.ray.intersectTriangle(O0,P0,kp,!1,Bp),h===null))return;const m=e.ray.origin.distanceTo(Bp);m<e.near||m>e.far||t.push({distance:m,point:Bp.clone(),uv:Cs.getInterpolation(Bp,O0,kp,P0,SM,rx,MM,new ze),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function z0(r,e,t,n,s,u){Lh.subVectors(r,t).addScalar(.5).multiply(n),s!==void 0?(Fp.x=u*Lh.x-s*Lh.y,Fp.y=s*Lh.x+u*Lh.y):Fp.copy(Lh),r.copy(e),r.x+=Fp.x,r.y+=Fp.y,r.applyMatrix4(qE)}const B0=new j,EM=new j;class YE extends Cn{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,s=t.length;n<s;n++){const u=t[n];this.addLevel(u.object.clone(),u.distance,u.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const s=this.levels;let u;for(u=0;u<s.length&&!(t<s[u].distance);u++);return s.splice(u,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const s=t.splice(n,1);return this.remove(s[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,s;for(n=1,s=t.length;n<s;n++){let u=t[n].distance;if(t[n].object.visible&&(u-=u*t[n].hysteresis),e<u)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){B0.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(B0);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){B0.setFromMatrixPosition(e.matrixWorld),EM.setFromMatrixPosition(this.matrixWorld);const n=B0.distanceTo(EM)/e.zoom;t[0].object.visible=!0;let s,u;for(s=1,u=t.length;s<u;s++){let f=t[s].distance;if(t[s].object.visible&&(f-=f*t[s].hysteresis),n>=f)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;s<u;s++)t[s].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let s=0,u=n.length;s<u;s++){const f=n[s];t.object.levels.push({object:f.object.uuid,distance:f.distance,hysteresis:f.hysteresis})}return t}}const TM=new j,AM=new jn,wM=new jn,BR=new j,CM=new Xt,F0=new j,ox=new _a,RM=new Xt,lx=new of;class ZE extends Yi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Wx,this.bindMatrix=new Xt,this.bindMatrixInverse=new Xt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new za),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,F0),this.boundingBox.expandByPoint(F0)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new _a),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,F0),this.boundingSphere.expandByPoint(F0)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ox.copy(this.boundingSphere),ox.applyMatrix4(s),e.ray.intersectsSphere(ox)!==!1&&(RM.copy(s).invert(),lx.copy(e.ray).applyMatrix4(RM),!(this.boundingBox!==null&&lx.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,lx)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new jn,t=this.geometry.attributes.skinWeight;for(let n=0,s=t.count;n<s;n++){e.fromBufferAttribute(t,n);const u=1/e.manhattanLength();u!==1/0?e.multiplyScalar(u):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Wx?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===AE?this.bindMatrixInverse.copy(this.bindMatrix).invert():ft("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,s=this.geometry;AM.fromBufferAttribute(s.attributes.skinIndex,e),wM.fromBufferAttribute(s.attributes.skinWeight,e),TM.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let u=0;u<4;u++){const f=wM.getComponent(u);if(f!==0){const h=AM.getComponent(u);CM.multiplyMatrices(n.bones[h].matrixWorld,n.boneInverses[h]),t.addScaledVector(BR.copy(TM).applyMatrix4(CM),f)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Ib extends Cn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Yr extends wi{constructor(e=null,t=1,n=1,s,u,f,h,m,g=Bi,_=Bi,x,b){super(null,f,h,m,g,_,s,u,x,b),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const NM=new Xt,FR=new Xt;class Uy{constructor(e=[],t=[]){this.uuid=Vs(),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(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){ft("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new Xt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Xt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let u=0,f=e.length;u<f;u++){const h=e[u]?e[u].matrixWorld:FR;NM.multiplyMatrices(h,t[u]),NM.toArray(n,u*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new Uy(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Yr(t,e,e,Oa,is);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,s=e.bones.length;n<s;n++){const u=e.bones[n];let f=t[u];f===void 0&&(ft("Skeleton: No bone found with UUID:",u),f=new Ib),this.bones.push(f),this.boneInverses.push(new Xt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let s=0,u=t.length;s<u;s++){const f=t[s];e.bones.push(f.uuid);const h=n[s];e.boneInverses.push(h.toArray())}return e}}class $h extends Xn{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}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 Uh=new Xt,DM=new Xt,k0=[],LM=new za,kR=new Xt,Vp=new Yi,Hp=new _a;class QE extends Yi{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new $h(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,kR)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new za),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Uh),LM.copy(e.boundingBox).applyMatrix4(Uh),this.boundingBox.union(LM)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new _a),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Uh),Hp.copy(e.boundingSphere).applyMatrix4(Uh),this.boundingSphere.union(Hp)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,s=this.morphTexture.source.data.data,u=n.length+1,f=e*u+1;for(let h=0;h<n.length;h++)n[h]=s[f+h]}raycast(e,t){const n=this.matrixWorld,s=this.count;if(Vp.geometry=this.geometry,Vp.material=this.material,Vp.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hp.copy(this.boundingSphere),Hp.applyMatrix4(n),e.ray.intersectsSphere(Hp)!==!1))for(let u=0;u<s;u++){this.getMatrixAt(u,Uh),DM.multiplyMatrices(n,Uh),Vp.matrixWorld=DM,Vp.raycast(e,k0);for(let f=0,h=k0.length;f<h;f++){const m=k0[f];m.instanceId=u,m.object=this,t.push(m)}k0.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new $h(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new Yr(new Float32Array(s*this.count),s,this.count,by,is));const u=this.morphTexture.source.data.data;let f=0;for(let g=0;g<n.length;g++)f+=n[g];const h=this.geometry.morphTargetsRelative?1:1-f,m=s*e;u[m]=h,u.set(n,m+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const ux=new j,VR=new j,HR=new en;class wl{constructor(e=new j(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const s=ux.subVectors(n,t).cross(VR.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,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){const n=e.delta(ux),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const u=-(e.start.dot(this.normal)+this.constant)/s;return u<0||u>1?null:t.copy(e.start).addScaledVector(n,u)}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||HR.getNormalMatrix(e),s=this.coplanarPoint(ux).applyMatrix4(e),u=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(u),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 Lc=new _a,GR=new ze(.5,.5),V0=new j;class ad{constructor(e=new wl,t=new wl,n=new wl,s=new wl,u=new wl,f=new wl){this.planes=[e,t,n,s,u,f]}set(e,t,n,s,u,f){const h=this.planes;return h[0].copy(e),h[1].copy(t),h[2].copy(n),h[3].copy(s),h[4].copy(u),h[5].copy(f),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ks,n=!1){const s=this.planes,u=e.elements,f=u[0],h=u[1],m=u[2],g=u[3],_=u[4],x=u[5],b=u[6],M=u[7],A=u[8],R=u[9],w=u[10],E=u[11],N=u[12],D=u[13],U=u[14],B=u[15];if(s[0].setComponents(g-f,M-_,E-A,B-N).normalize(),s[1].setComponents(g+f,M+_,E+A,B+N).normalize(),s[2].setComponents(g+h,M+x,E+R,B+D).normalize(),s[3].setComponents(g-h,M-x,E-R,B-D).normalize(),n)s[4].setComponents(m,b,w,U).normalize(),s[5].setComponents(g-m,M-b,E-w,B-U).normalize();else if(s[4].setComponents(g-m,M-b,E-w,B-U).normalize(),t===ks)s[5].setComponents(g+m,M+b,E+w,B+U).normalize();else if(t===Yh)s[5].setComponents(m,b,w,U).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Lc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Lc.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Lc)}intersectsSprite(e){Lc.center.set(0,0,0);const t=GR.distanceTo(e.center);return Lc.radius=.7071067811865476+t,Lc.applyMatrix4(e.matrixWorld),this.intersectsSphere(Lc)}intersectsSphere(e){const t=this.planes,n=e.center,s=-e.radius;for(let u=0;u<6;u++)if(t[u].distanceToPoint(n)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const s=t[n];if(V0.x=s.normal.x>0?e.max.x:e.min.x,V0.y=s.normal.y>0?e.max.y:e.min.y,V0.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(V0)<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 No=new Xt,Do=new ad;class Iy{constructor(){this.coordinateSystem=ks}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const s=t.cameras[n];if(No.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Do.setFromProjectionMatrix(No,s.coordinateSystem,s.reversedDepth),Do.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const s=t.cameras[n];if(No.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Do.setFromProjectionMatrix(No,s.coordinateSystem,s.reversedDepth),Do.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const s=t.cameras[n];if(No.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Do.setFromProjectionMatrix(No,s.coordinateSystem,s.reversedDepth),Do.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const s=t.cameras[n];if(No.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Do.setFromProjectionMatrix(No,s.coordinateSystem,s.reversedDepth),Do.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const s=t.cameras[n];if(No.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Do.setFromProjectionMatrix(No,s.coordinateSystem,s.reversedDepth),Do.containsPoint(e))return!0}return!1}clone(){return new Iy}}function cx(r,e){return r-e}function XR(r,e){return r.z-e.z}function WR(r,e){return e.z-r.z}class qR{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,s){const u=this.pool,f=this.list;this.index>=u.length&&u.push({start:-1,count:-1,z:-1,index:-1});const h=u[this.index];f.push(h),this.index++,h.start=e,h.count=t,h.z=n,h.index=s}reset(){this.list.length=0,this.index=0}}const Ts=new Xt,jR=new yt(1,1,1),UM=new ad,YR=new Iy,H0=new za,Uc=new _a,Gp=new j,IM=new j,ZR=new j,fx=new qR,Ua=new Yi,G0=[];function QR(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const s=r.count;for(let u=0;u<s;u++)for(let f=0;f<n;f++)e.setComponent(u+t,f,r.getComponent(u,f))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function Ic(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class KE extends Yi{constructor(e,t,n=t*2,s){super(new Kt,s),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._multiDrawInstances=null,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(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Yr(t,e,e,Oa,is);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Yr(t,e,e,wm,vr);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 Yr(t,e,e,Oa,is);n.colorSpace=Sn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const u in e.attributes){const f=e.getAttribute(u),{array:h,itemSize:m,normalized:g}=f,_=new h.constructor(n*m),x=new Xn(_,m,g);t.setAttribute(u,x)}if(e.getIndex()!==null){const u=n>65535?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Xn(u,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!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 "${n}". All geometries must have consistent attributes.`);const s=e.getAttribute(n),u=t.getAttribute(n);if(s.itemSize!==u.itemSize||s.normalized!==u.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||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new za);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,s=t.length;n<s;n++){if(t[n].active===!1)continue;const u=t[n].geometryIndex;this.getMatrixAt(n,Ts),this.getBoundingBoxAt(u,H0).applyMatrix4(Ts),e.union(H0)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _a);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,s=t.length;n<s;n++){if(t[n].active===!1)continue;const u=t[n].geometryIndex;this.getMatrixAt(n,Ts),this.getBoundingSphereAt(u,Uc).applyMatrix4(Ts),e.union(Uc)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(cx),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=n):(s=this._instanceInfo.length,this._instanceInfo.push(n));const u=this._matricesTexture;Ts.identity().toArray(u.image.data,s*16),u.needsUpdate=!0;const f=this._colorsTexture;return f&&(jR.toArray(f.image.data,s*4),f.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},u=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const f=e.getIndex();if(f!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=n===-1?f.count:n),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let m;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(cx),m=this._availableGeometryIds.shift(),u[m]=s):(m=this._geometryCount,this._geometryCount++,u.push(s)),this.setGeometryAt(m,e),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,m}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,s=n.getIndex()!==null,u=n.getIndex(),f=t.getIndex(),h=this._geometryInfo[e];if(s&&f.count>h.reservedIndexCount||t.attributes.position.count>h.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const m=h.vertexStart,g=h.reservedVertexCount;h.vertexCount=t.getAttribute("position").count;for(const _ in n.attributes){const x=t.getAttribute(_),b=n.getAttribute(_);QR(x,b,m);const M=x.itemSize;for(let A=x.count,R=g;A<R;A++){const w=m+A;for(let E=0;E<M;E++)b.setComponent(w,E,0)}b.needsUpdate=!0,b.addUpdateRange(m*M,g*M)}if(s){const _=h.indexStart,x=h.reservedIndexCount;h.indexCount=t.getIndex().count;for(let b=0;b<f.count;b++)u.setX(_+b,m+f.getX(b));for(let b=f.count,M=x;b<M;b++)u.setX(_+b,m);u.needsUpdate=!0,u.addUpdateRange(_,h.reservedIndexCount)}return h.start=s?h.indexStart:h.vertexStart,h.count=s?h.indexCount:h.vertexCount,h.boundingBox=null,t.boundingBox!==null&&(h.boundingBox=t.boundingBox.clone()),h.boundingSphere=null,t.boundingSphere!==null&&(h.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let s=0,u=n.length;s<u;s++)n[s].active&&n[s].geometryIndex===e&&this.deleteInstance(s);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,s=n.map((f,h)=>h).sort((f,h)=>n[f].vertexStart-n[h].vertexStart),u=this.geometry;for(let f=0,h=n.length;f<h;f++){const m=s[f],g=n[m];if(g.active!==!1){if(u.index!==null){if(g.indexStart!==t){const{indexStart:_,vertexStart:x,reservedIndexCount:b}=g,M=u.index,A=M.array,R=e-x;for(let w=_;w<_+b;w++)A[w]=A[w]+R;M.array.copyWithin(t,_,_+b),M.addUpdateRange(t,b),M.needsUpdate=!0,g.indexStart=t}t+=g.reservedIndexCount}if(g.vertexStart!==e){const{vertexStart:_,reservedVertexCount:x}=g,b=u.attributes;for(const M in b){const A=b[M],{array:R,itemSize:w}=A;R.copyWithin(e*w,_*w,(_+x)*w),A.addUpdateRange(e*w,x*w),A.needsUpdate=!0}g.vertexStart=e}e+=g.reservedVertexCount,g.start=u.index?g.indexStart:g.vertexStart,this._nextIndexStart=u.index?g.indexStart+g.reservedIndexCount:0,this._nextVertexStart=g.vertexStart+g.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,s=this._geometryInfo[e];if(s.boundingBox===null){const u=new za,f=n.index,h=n.attributes.position;for(let m=s.start,g=s.start+s.count;m<g;m++){let _=m;f&&(_=f.getX(_)),u.expandByPoint(Gp.fromBufferAttribute(h,_))}s.boundingBox=u}return t.copy(s.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,s=this._geometryInfo[e];if(s.boundingSphere===null){const u=new _a;this.getBoundingBoxAt(e,H0),H0.getCenter(u.center);const f=n.index,h=n.attributes.position;let m=0;for(let g=s.start,_=s.start+s.count;g<_;g++){let x=g;f&&(x=f.getX(x)),Gp.fromBufferAttribute(h,x),m=Math.max(m,u.center.distanceToSquared(Gp))}u.radius=Math.sqrt(m),s.boundingSphere=u}return t.copy(s.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,s=this._matricesTexture.image.data;return t.toArray(s,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){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(cx);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const s=new Int32Array(e),u=new Int32Array(e);Ic(this._multiDrawCounts,s),Ic(this._multiDrawStarts,u),this._multiDrawCounts=s,this._multiDrawStarts=u,this._maxInstanceCount=e;const f=this._indirectTexture,h=this._matricesTexture,m=this._colorsTexture;f.dispose(),this._initIndirectTexture(),Ic(f.image.data,this._indirectTexture.image.data),h.dispose(),this._initMatricesTexture(),Ic(h.image.data,this._matricesTexture.image.data),m&&(m.dispose(),this._initColorsTexture(),Ic(m.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(h=>h.active);if(Math.max(...n.map(h=>h.vertexStart+h.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(m=>m.indexStart+m.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const u=this.geometry;u.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Kt,this._initializeGeometry(u));const f=this.geometry;u.index&&Ic(u.index.array,f.index.array);for(const h in u.attributes)Ic(u.attributes[h].array,f.attributes[h].array)}raycast(e,t){const n=this._instanceInfo,s=this._geometryInfo,u=this.matrixWorld,f=this.geometry;Ua.material=this.material,Ua.geometry.index=f.index,Ua.geometry.attributes=f.attributes,Ua.geometry.boundingBox===null&&(Ua.geometry.boundingBox=new za),Ua.geometry.boundingSphere===null&&(Ua.geometry.boundingSphere=new _a);for(let h=0,m=n.length;h<m;h++){if(!n[h].visible||!n[h].active)continue;const g=n[h].geometryIndex,_=s[g];Ua.geometry.setDrawRange(_.start,_.count),this.getMatrixAt(h,Ua.matrixWorld).premultiply(u),this.getBoundingBoxAt(g,Ua.geometry.boundingBox),this.getBoundingSphereAt(g,Ua.geometry.boundingSphere),Ua.raycast(e,G0);for(let x=0,b=G0.length;x<b;x++){const M=G0[x];M.object=this,M.batchId=h,t.push(M)}G0.length=0}Ua.material=null,Ua.geometry.index=null,Ua.geometry.attributes={},Ua.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),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(),this._colorsTexture!==null&&(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,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,s,u){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const f=s.getIndex(),h=f===null?1:f.array.BYTES_PER_ELEMENT,m=this._instanceInfo,g=this._multiDrawStarts,_=this._multiDrawCounts,x=this._geometryInfo,b=this.perObjectFrustumCulled,M=this._indirectTexture,A=M.image.data,R=n.isArrayCamera?YR:UM;b&&!n.isArrayCamera&&(Ts.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),UM.setFromProjectionMatrix(Ts,n.coordinateSystem,n.reversedDepth));let w=0;if(this.sortObjects){Ts.copy(this.matrixWorld).invert(),Gp.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ts),IM.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ts);for(let D=0,U=m.length;D<U;D++)if(m[D].visible&&m[D].active){const B=m[D].geometryIndex;this.getMatrixAt(D,Ts),this.getBoundingSphereAt(B,Uc).applyMatrix4(Ts);let z=!1;if(b&&(z=!R.intersectsSphere(Uc,n)),!z){const H=x[B],W=ZR.subVectors(Uc.center,Gp).dot(IM);fx.push(H.start,H.count,W,D)}}const E=fx.list,N=this.customSort;N===null?E.sort(u.transparent?WR:XR):N.call(this,E,n);for(let D=0,U=E.length;D<U;D++){const B=E[D];g[w]=B.start*h,_[w]=B.count,A[w]=B.index,w++}fx.reset()}else for(let E=0,N=m.length;E<N;E++)if(m[E].visible&&m[E].active){const D=m[E].geometryIndex;let U=!1;if(b&&(this.getMatrixAt(E,Ts),this.getBoundingSphereAt(D,Uc).applyMatrix4(Ts),U=!R.intersectsSphere(Uc,n)),!U){const B=x[D];g[w]=B.start*h,_[w]=B.count,A[w]=E,w++}}M.needsUpdate=!0,this._multiDrawCount=w,this._visibilityChanged=!1}onBeforeShadow(e,t,n,s,u,f){this.onBeforeRender(e,null,s,u,f)}}class ss extends Ba{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new yt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const sy=new j,ry=new j,OM=new Xt,Xp=new of,X0=new _a,hx=new j,PM=new j;class Fu extends Cn{constructor(e=new Kt,t=new ss){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(e.index===null){const t=e.attributes.position,n=[0];for(let s=1,u=t.count;s<u;s++)sy.fromBufferAttribute(t,s-1),ry.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=sy.distanceTo(ry);e.setAttribute("lineDistance",new bt(n,1))}else ft("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,s=this.matrixWorld,u=e.params.Line.threshold,f=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),X0.copy(n.boundingSphere),X0.applyMatrix4(s),X0.radius+=u,e.ray.intersectsSphere(X0)===!1)return;OM.copy(s).invert(),Xp.copy(e.ray).applyMatrix4(OM);const h=u/((this.scale.x+this.scale.y+this.scale.z)/3),m=h*h,g=this.isLineSegments?2:1,_=n.index,b=n.attributes.position;if(_!==null){const M=Math.max(0,f.start),A=Math.min(_.count,f.start+f.count);for(let R=M,w=A-1;R<w;R+=g){const E=_.getX(R),N=_.getX(R+1),D=W0(this,e,Xp,m,E,N,R);D&&t.push(D)}if(this.isLineLoop){const R=_.getX(A-1),w=_.getX(M),E=W0(this,e,Xp,m,R,w,A-1);E&&t.push(E)}}else{const M=Math.max(0,f.start),A=Math.min(b.count,f.start+f.count);for(let R=M,w=A-1;R<w;R+=g){const E=W0(this,e,Xp,m,R,R+1,R);E&&t.push(E)}if(this.isLineLoop){const R=W0(this,e,Xp,m,A-1,M,A-1);R&&t.push(R)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,f=s.length;u<f;u++){const h=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=u}}}}}function W0(r,e,t,n,s,u,f){const h=r.geometry.attributes.position;if(sy.fromBufferAttribute(h,s),ry.fromBufferAttribute(h,u),t.distanceSqToSegment(sy,ry,hx,PM)>n)return;hx.applyMatrix4(r.matrixWorld);const g=e.ray.origin.distanceTo(hx);if(!(g<e.near||g>e.far))return{distance:g,point:PM.clone().applyMatrix4(r.matrixWorld),index:f,face:null,faceIndex:null,barycoord:null,object:r}}const zM=new j,BM=new j;class Vo extends Fu{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let s=0,u=t.count;s<u;s+=2)zM.fromBufferAttribute(t,s),BM.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+zM.distanceTo(BM);e.setAttribute("lineDistance",new bt(n,1))}else ft("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class JE extends Fu{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ob extends Ba{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new yt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const FM=new Xt,Yx=new of,q0=new _a,j0=new j;class $E extends Cn{constructor(e=new Kt,t=new Ob){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,s=this.matrixWorld,u=e.params.Points.threshold,f=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),q0.copy(n.boundingSphere),q0.applyMatrix4(s),q0.radius+=u,e.ray.intersectsSphere(q0)===!1)return;FM.copy(s).invert(),Yx.copy(e.ray).applyMatrix4(FM);const h=u/((this.scale.x+this.scale.y+this.scale.z)/3),m=h*h,g=n.index,x=n.attributes.position;if(g!==null){const b=Math.max(0,f.start),M=Math.min(g.count,f.start+f.count);for(let A=b,R=M;A<R;A++){const w=g.getX(A);j0.fromBufferAttribute(x,w),kM(j0,w,m,s,e,t,this)}}else{const b=Math.max(0,f.start),M=Math.min(x.count,f.start+f.count);for(let A=b,R=M;A<R;A++)j0.fromBufferAttribute(x,A),kM(j0,A,m,s,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,f=s.length;u<f;u++){const h=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=u}}}}}function kM(r,e,t,n,s,u,f){const h=Yx.distanceSqToPoint(r);if(h<t){const m=new j;Yx.closestPointToPoint(r,m),m.applyMatrix4(n);const g=s.ray.origin.distanceTo(m);if(g<s.near||g>s.far)return;u.push({distance:g,distanceToRay:Math.sqrt(h),point:m,index:e,face:null,faceIndex:null,barycoord:null,object:f})}}class eT extends wi{constructor(e,t,n,s,u=oi,f=oi,h,m,g){super(e,t,n,s,u,f,h,m,g),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const _=this;function x(){_.needsUpdate=!0,_._requestVideoFrameCallbackId=e.requestVideoFrameCallback(x)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(x))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class KR extends eT{constructor(e,t,n,s,u,f,h,m){super({},e,t,n,s,u,f,h,m),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class JR extends wi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Bi,this.minFilter=Bi,this.generateMipmaps=!1,this.needsUpdate=!0}}class Oy extends wi{constructor(e,t,n,s,u,f,h,m,g,_,x,b){super(null,f,h,m,g,_,s,u,x,b),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class $R extends Oy{constructor(e,t,n,s,u,f){super(e,t,n,u,f),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=Rs,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eN extends Oy{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,zo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class tN extends wi{constructor(e,t,n,s,u,f,h,m,g){super(e,t,n,s,u,f,h,m,g),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ed extends wi{constructor(e,t,n=vr,s,u,f,h=Bi,m=Bi,g,_=Fo,x=1){if(_!==Fo&&_!==Uu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const b={width:e,height:t,depth:x};super(b,s,u,f,h,m,_,n,g),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Iu(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class tT extends ed{constructor(e,t=vr,n=zo,s,u,f=Bi,h=Bi,m,g=Fo){const _={width:e,height:e,depth:1},x=[_,_,_,_,_,_];super(e,e,t,n,s,u,f,h,m,g),this.image=x,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Pb extends wi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Py extends Kt{constructor(e=1,t=1,n=4,s=8,u=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:s,heightSegments:u},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),s=Math.max(3,Math.floor(s)),u=Math.max(1,Math.floor(u));const f=[],h=[],m=[],g=[],_=t/2,x=Math.PI/2*e,b=t,M=2*x+b,A=n*2+u,R=s+1,w=new j,E=new j;for(let N=0;N<=A;N++){let D=0,U=0,B=0,z=0;if(N<=n){const I=N/n,P=I*Math.PI/2;U=-_-e*Math.cos(P),B=e*Math.sin(P),z=-e*Math.cos(P),D=I*x}else if(N<=n+u){const I=(N-n)/u;U=-_+I*t,B=e,z=0,D=x+I*b}else{const I=(N-n-u)/n,P=I*Math.PI/2;U=_+e*Math.sin(P),B=e*Math.cos(P),z=e*Math.sin(P),D=x+b+I*x}const H=Math.max(0,Math.min(1,D/M));let W=0;N===0?W=.5/s:N===A&&(W=-.5/s);for(let I=0;I<=s;I++){const P=I/s,Z=P*Math.PI*2,se=Math.sin(Z),te=Math.cos(Z);E.x=-B*te,E.y=U,E.z=B*se,h.push(E.x,E.y,E.z),w.set(-B*te,z,B*se),w.normalize(),m.push(w.x,w.y,w.z),g.push(P+W,H)}if(N>0){const I=(N-1)*R;for(let P=0;P<s;P++){const Z=I+P,se=I+P+1,te=N*R+P,fe=N*R+P+1;f.push(Z,se,te),f.push(se,fe,te)}}}this.setIndex(f),this.setAttribute("position",new bt(h,3)),this.setAttribute("normal",new bt(m,3)),this.setAttribute("uv",new bt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Py(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class zy extends Kt{constructor(e=1,t=32,n=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:s},t=Math.max(3,t);const u=[],f=[],h=[],m=[],g=new j,_=new ze;f.push(0,0,0),h.push(0,0,1),m.push(.5,.5);for(let x=0,b=3;x<=t;x++,b+=3){const M=n+x/t*s;g.x=e*Math.cos(M),g.y=e*Math.sin(M),f.push(g.x,g.y,g.z),h.push(0,0,1),_.x=(f[b]/e+1)/2,_.y=(f[b+1]/e+1)/2,m.push(_.x,_.y)}for(let x=1;x<=t;x++)u.push(x,x+1,0);this.setIndex(u),this.setAttribute("position",new bt(f,3)),this.setAttribute("normal",new bt(h,3)),this.setAttribute("uv",new bt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zy(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Rm extends Kt{constructor(e=1,t=1,n=1,s=32,u=1,f=!1,h=0,m=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:s,heightSegments:u,openEnded:f,thetaStart:h,thetaLength:m};const g=this;s=Math.floor(s),u=Math.floor(u);const _=[],x=[],b=[],M=[];let A=0;const R=[],w=n/2;let E=0;N(),f===!1&&(e>0&&D(!0),t>0&&D(!1)),this.setIndex(_),this.setAttribute("position",new bt(x,3)),this.setAttribute("normal",new bt(b,3)),this.setAttribute("uv",new bt(M,2));function N(){const U=new j,B=new j;let z=0;const H=(t-e)/n;for(let W=0;W<=u;W++){const I=[],P=W/u,Z=P*(t-e)+e;for(let se=0;se<=s;se++){const te=se/s,fe=te*m+h,pe=Math.sin(fe),Y=Math.cos(fe);B.x=Z*pe,B.y=-P*n+w,B.z=Z*Y,x.push(B.x,B.y,B.z),U.set(pe,H,Y).normalize(),b.push(U.x,U.y,U.z),M.push(te,1-P),I.push(A++)}R.push(I)}for(let W=0;W<s;W++)for(let I=0;I<u;I++){const P=R[I][W],Z=R[I+1][W],se=R[I+1][W+1],te=R[I][W+1];(e>0||I!==0)&&(_.push(P,Z,te),z+=3),(t>0||I!==u-1)&&(_.push(Z,se,te),z+=3)}g.addGroup(E,z,0),E+=z}function D(U){const B=A,z=new ze,H=new j;let W=0;const I=U===!0?e:t,P=U===!0?1:-1;for(let se=1;se<=s;se++)x.push(0,w*P,0),b.push(0,P,0),M.push(.5,.5),A++;const Z=A;for(let se=0;se<=s;se++){const fe=se/s*m+h,pe=Math.cos(fe),Y=Math.sin(fe);H.x=I*Y,H.y=w*P,H.z=I*pe,x.push(H.x,H.y,H.z),b.push(0,P,0),z.x=pe*.5+.5,z.y=Y*.5*P+.5,M.push(z.x,z.y),A++}for(let se=0;se<s;se++){const te=B+se,fe=Z+se;U===!0?_.push(fe,fe+1,te):_.push(fe+1,fe,te),W+=3}g.addGroup(E,W,U===!0?1:2),E+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rm(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Nm extends Rm{constructor(e=1,t=1,n=32,s=1,u=!1,f=0,h=Math.PI*2){super(0,e,t,n,s,u,f,h),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:s,openEnded:u,thetaStart:f,thetaLength:h}}static fromJSON(e){return new Nm(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Hu extends Kt{constructor(e=[],t=[],n=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:s};const u=[],f=[];h(s),g(n),_(),this.setAttribute("position",new bt(u,3)),this.setAttribute("normal",new bt(u.slice(),3)),this.setAttribute("uv",new bt(f,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function h(N){const D=new j,U=new j,B=new j;for(let z=0;z<t.length;z+=3)M(t[z+0],D),M(t[z+1],U),M(t[z+2],B),m(D,U,B,N)}function m(N,D,U,B){const z=B+1,H=[];for(let W=0;W<=z;W++){H[W]=[];const I=N.clone().lerp(U,W/z),P=D.clone().lerp(U,W/z),Z=z-W;for(let se=0;se<=Z;se++)se===0&&W===z?H[W][se]=I:H[W][se]=I.clone().lerp(P,se/Z)}for(let W=0;W<z;W++)for(let I=0;I<2*(z-W)-1;I++){const P=Math.floor(I/2);I%2===0?(b(H[W][P+1]),b(H[W+1][P]),b(H[W][P])):(b(H[W][P+1]),b(H[W+1][P+1]),b(H[W+1][P]))}}function g(N){const D=new j;for(let U=0;U<u.length;U+=3)D.x=u[U+0],D.y=u[U+1],D.z=u[U+2],D.normalize().multiplyScalar(N),u[U+0]=D.x,u[U+1]=D.y,u[U+2]=D.z}function _(){const N=new j;for(let D=0;D<u.length;D+=3){N.x=u[D+0],N.y=u[D+1],N.z=u[D+2];const U=w(N)/2/Math.PI+.5,B=E(N)/Math.PI+.5;f.push(U,1-B)}A(),x()}function x(){for(let N=0;N<f.length;N+=6){const D=f[N+0],U=f[N+2],B=f[N+4],z=Math.max(D,U,B),H=Math.min(D,U,B);z>.9&&H<.1&&(D<.2&&(f[N+0]+=1),U<.2&&(f[N+2]+=1),B<.2&&(f[N+4]+=1))}}function b(N){u.push(N.x,N.y,N.z)}function M(N,D){const U=N*3;D.x=e[U+0],D.y=e[U+1],D.z=e[U+2]}function A(){const N=new j,D=new j,U=new j,B=new j,z=new ze,H=new ze,W=new ze;for(let I=0,P=0;I<u.length;I+=9,P+=6){N.set(u[I+0],u[I+1],u[I+2]),D.set(u[I+3],u[I+4],u[I+5]),U.set(u[I+6],u[I+7],u[I+8]),z.set(f[P+0],f[P+1]),H.set(f[P+2],f[P+3]),W.set(f[P+4],f[P+5]),B.copy(N).add(D).add(U).divideScalar(3);const Z=w(B);R(z,P+0,N,Z),R(H,P+2,D,Z),R(W,P+4,U,Z)}}function R(N,D,U,B){B<0&&N.x===1&&(f[D]=N.x-1),U.x===0&&U.z===0&&(f[D]=B/2/Math.PI+.5)}function w(N){return Math.atan2(N.z,-N.x)}function E(N){return Math.atan2(-N.y,Math.sqrt(N.x*N.x+N.z*N.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hu(e.vertices,e.indices,e.radius,e.detail)}}class By extends Hu{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,s=1/n,u=[-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,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],f=[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];super(u,f,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new By(e.radius,e.detail)}}const Y0=new j,Z0=new j,dx=new j,Q0=new Cs;class nT extends Kt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const s=Math.pow(10,4),u=Math.cos(Jc*t),f=e.getIndex(),h=e.getAttribute("position"),m=f?f.count:h.count,g=[0,0,0],_=["a","b","c"],x=new Array(3),b={},M=[];for(let A=0;A<m;A+=3){f?(g[0]=f.getX(A),g[1]=f.getX(A+1),g[2]=f.getX(A+2)):(g[0]=A,g[1]=A+1,g[2]=A+2);const{a:R,b:w,c:E}=Q0;if(R.fromBufferAttribute(h,g[0]),w.fromBufferAttribute(h,g[1]),E.fromBufferAttribute(h,g[2]),Q0.getNormal(dx),x[0]=`${Math.round(R.x*s)},${Math.round(R.y*s)},${Math.round(R.z*s)}`,x[1]=`${Math.round(w.x*s)},${Math.round(w.y*s)},${Math.round(w.z*s)}`,x[2]=`${Math.round(E.x*s)},${Math.round(E.y*s)},${Math.round(E.z*s)}`,!(x[0]===x[1]||x[1]===x[2]||x[2]===x[0]))for(let N=0;N<3;N++){const D=(N+1)%3,U=x[N],B=x[D],z=Q0[_[N]],H=Q0[_[D]],W=`${U}_${B}`,I=`${B}_${U}`;I in b&&b[I]?(dx.dot(b[I].normal)<=u&&(M.push(z.x,z.y,z.z),M.push(H.x,H.y,H.z)),b[I]=null):W in b||(b[W]={index0:g[N],index1:g[D],normal:dx.clone()})}}for(const A in b)if(b[A]){const{index0:R,index1:w}=b[A];Y0.fromBufferAttribute(h,R),Z0.fromBufferAttribute(h,w),M.push(Y0.x,Y0.y,Y0.z),M.push(Z0.x,Z0.y,Z0.z)}this.setAttribute("position",new bt(M,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Zr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ft("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=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(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,s=this.getPoint(0),u=0;t.push(0);for(let f=1;f<=e;f++)n=this.getPoint(f/e),u+=n.distanceTo(s),t.push(u),s=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let s=0;const u=n.length;let f;t?f=t:f=e*n[u-1];let h=0,m=u-1,g;for(;h<=m;)if(s=Math.floor(h+(m-h)/2),g=n[s]-f,g<0)h=s+1;else if(g>0)m=s-1;else{m=s;break}if(s=m,n[s]===f)return s/(u-1);const _=n[s],b=n[s+1]-_,M=(f-_)/b;return(s+M)/(u-1)}getTangent(e,t){let s=e-1e-4,u=e+1e-4;s<0&&(s=0),u>1&&(u=1);const f=this.getPoint(s),h=this.getPoint(u),m=t||(f.isVector2?new ze:new j);return m.copy(h).sub(f).normalize(),m}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new j,s=[],u=[],f=[],h=new j,m=new Xt;for(let M=0;M<=e;M++){const A=M/e;s[M]=this.getTangentAt(A,new j)}u[0]=new j,f[0]=new j;let g=Number.MAX_VALUE;const _=Math.abs(s[0].x),x=Math.abs(s[0].y),b=Math.abs(s[0].z);_<=g&&(g=_,n.set(1,0,0)),x<=g&&(g=x,n.set(0,1,0)),b<=g&&n.set(0,0,1),h.crossVectors(s[0],n).normalize(),u[0].crossVectors(s[0],h),f[0].crossVectors(s[0],u[0]);for(let M=1;M<=e;M++){if(u[M]=u[M-1].clone(),f[M]=f[M-1].clone(),h.crossVectors(s[M-1],s[M]),h.length()>Number.EPSILON){h.normalize();const A=Math.acos(Ht(s[M-1].dot(s[M]),-1,1));u[M].applyMatrix4(m.makeRotationAxis(h,A))}f[M].crossVectors(s[M],u[M])}if(t===!0){let M=Math.acos(Ht(u[0].dot(u[e]),-1,1));M/=e,s[0].dot(h.crossVectors(u[0],u[e]))>0&&(M=-M);for(let A=1;A<=e;A++)u[A].applyMatrix4(m.makeRotationAxis(s[A],M*A)),f[A].crossVectors(s[A],u[A])}return{tangents:s,normals:u,binormals:f}}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 Fy extends Zr{constructor(e=0,t=0,n=1,s=1,u=0,f=Math.PI*2,h=!1,m=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=s,this.aStartAngle=u,this.aEndAngle=f,this.aClockwise=h,this.aRotation=m}getPoint(e,t=new ze){const n=t,s=Math.PI*2;let u=this.aEndAngle-this.aStartAngle;const f=Math.abs(u)<Number.EPSILON;for(;u<0;)u+=s;for(;u>s;)u-=s;u<Number.EPSILON&&(f?u=0:u=s),this.aClockwise===!0&&!f&&(u===s?u=-s:u=u-s);const h=this.aStartAngle+e*u;let m=this.aX+this.xRadius*Math.cos(h),g=this.aY+this.yRadius*Math.sin(h);if(this.aRotation!==0){const _=Math.cos(this.aRotation),x=Math.sin(this.aRotation),b=m-this.aX,M=g-this.aY;m=b*_-M*x+this.aX,g=b*x+M*_+this.aY}return n.set(m,g)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class iT extends Fy{constructor(e,t,n,s,u,f){super(e,t,n,n,s,u,f),this.isArcCurve=!0,this.type="ArcCurve"}}function zb(){let r=0,e=0,t=0,n=0;function s(u,f,h,m){r=u,e=h,t=-3*u+3*f-2*h-m,n=2*u-2*f+h+m}return{initCatmullRom:function(u,f,h,m,g){s(f,h,g*(h-u),g*(m-f))},initNonuniformCatmullRom:function(u,f,h,m,g,_,x){let b=(f-u)/g-(h-u)/(g+_)+(h-f)/_,M=(h-f)/_-(m-f)/(_+x)+(m-h)/x;b*=_,M*=_,s(f,h,b,M)},calc:function(u){const f=u*u,h=f*u;return r+e*u+t*f+n*h}}}const K0=new j,px=new zb,mx=new zb,gx=new zb;class aT extends Zr{constructor(e=[],t=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=s}getPoint(e,t=new j){const n=t,s=this.points,u=s.length,f=(u-(this.closed?0:1))*e;let h=Math.floor(f),m=f-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/u)+1)*u:m===0&&h===u-1&&(h=u-2,m=1);let g,_;this.closed||h>0?g=s[(h-1)%u]:(K0.subVectors(s[0],s[1]).add(s[0]),g=K0);const x=s[h%u],b=s[(h+1)%u];if(this.closed||h+2<u?_=s[(h+2)%u]:(K0.subVectors(s[u-1],s[u-2]).add(s[u-1]),_=K0),this.curveType==="centripetal"||this.curveType==="chordal"){const M=this.curveType==="chordal"?.5:.25;let A=Math.pow(g.distanceToSquared(x),M),R=Math.pow(x.distanceToSquared(b),M),w=Math.pow(b.distanceToSquared(_),M);R<1e-4&&(R=1),A<1e-4&&(A=R),w<1e-4&&(w=R),px.initNonuniformCatmullRom(g.x,x.x,b.x,_.x,A,R,w),mx.initNonuniformCatmullRom(g.y,x.y,b.y,_.y,A,R,w),gx.initNonuniformCatmullRom(g.z,x.z,b.z,_.z,A,R,w)}else this.curveType==="catmullrom"&&(px.initCatmullRom(g.x,x.x,b.x,_.x,this.tension),mx.initCatmullRom(g.y,x.y,b.y,_.y,this.tension),gx.initCatmullRom(g.z,x.z,b.z,_.z,this.tension));return n.set(px.calc(m),mx.calc(m),gx.calc(m)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const s=e.points[t];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const s=this.points[t];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const s=e.points[t];this.points.push(new j().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function VM(r,e,t,n,s){const u=(n-e)*.5,f=(s-t)*.5,h=r*r,m=r*h;return(2*t-2*n+u+f)*m+(-3*t+3*n-2*u-f)*h+u*r+t}function nN(r,e){const t=1-r;return t*t*e}function iN(r,e){return 2*(1-r)*r*e}function aN(r,e){return r*r*e}function am(r,e,t,n){return nN(r,e)+iN(r,t)+aN(r,n)}function sN(r,e){const t=1-r;return t*t*t*e}function rN(r,e){const t=1-r;return 3*t*t*r*e}function oN(r,e){return 3*(1-r)*r*r*e}function lN(r,e){return r*r*r*e}function sm(r,e,t,n,s){return sN(r,e)+rN(r,t)+oN(r,n)+lN(r,s)}class Bb extends Zr{constructor(e=new ze,t=new ze,n=new ze,s=new ze){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=s}getPoint(e,t=new ze){const n=t,s=this.v0,u=this.v1,f=this.v2,h=this.v3;return n.set(sm(e,s.x,u.x,f.x,h.x),sm(e,s.y,u.y,f.y,h.y)),n}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 sT extends Zr{constructor(e=new j,t=new j,n=new j,s=new j){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=s}getPoint(e,t=new j){const n=t,s=this.v0,u=this.v1,f=this.v2,h=this.v3;return n.set(sm(e,s.x,u.x,f.x,h.x),sm(e,s.y,u.y,f.y,h.y),sm(e,s.z,u.z,f.z,h.z)),n}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 Fb extends Zr{constructor(e=new ze,t=new ze){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ze){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ze){return t.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 rT extends Zr{constructor(e=new j,t=new j){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new j){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new j){return t.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 kb extends Zr{constructor(e=new ze,t=new ze,n=new ze){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ze){const n=t,s=this.v0,u=this.v1,f=this.v2;return n.set(am(e,s.x,u.x,f.x),am(e,s.y,u.y,f.y)),n}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 Vb extends Zr{constructor(e=new j,t=new j,n=new j){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new j){const n=t,s=this.v0,u=this.v1,f=this.v2;return n.set(am(e,s.x,u.x,f.x),am(e,s.y,u.y,f.y),am(e,s.z,u.z,f.z)),n}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 Hb extends Zr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ze){const n=t,s=this.points,u=(s.length-1)*e,f=Math.floor(u),h=u-f,m=s[f===0?f:f-1],g=s[f],_=s[f>s.length-2?s.length-1:f+1],x=s[f>s.length-3?s.length-1:f+2];return n.set(VM(h,m.x,g.x,_.x,x.x),VM(h,m.y,g.y,_.y,x.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const s=e.points[t];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const s=e.points[t];this.points.push(new ze().fromArray(s))}return this}}var oy=Object.freeze({__proto__:null,ArcCurve:iT,CatmullRomCurve3:aT,CubicBezierCurve:Bb,CubicBezierCurve3:sT,EllipseCurve:Fy,LineCurve:Fb,LineCurve3:rT,QuadraticBezierCurve:kb,QuadraticBezierCurve3:Vb,SplineCurve:Hb});class oT extends Zr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new oy[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),s=this.getCurveLengths();let u=0;for(;u<s.length;){if(s[u]>=n){const f=s[u]-n,h=this.curves[u],m=h.getLength(),g=m===0?0:1-f/m;return h.getPointAt(g,t)}u++}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,s=this.curves.length;n<s;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=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(e=12){const t=[];let n;for(let s=0,u=this.curves;s<u.length;s++){const f=u[s],h=f.isEllipseCurve?e*2:f.isLineCurve||f.isLineCurve3?1:f.isSplineCurve?e*f.points.length:e,m=f.getPoints(h);for(let g=0;g<m.length;g++){const _=m[g];n&&n.equals(_)||(t.push(_),n=_)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const s=e.curves[t];this.curves.push(s.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const s=this.curves[t];e.curves.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const s=e.curves[t];this.curves.push(new oy[s.type]().fromJSON(s))}return this}}class ly extends oT{constructor(e){super(),this.type="Path",this.currentPoint=new ze,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Fb(this.currentPoint.clone(),new ze(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,s){const u=new kb(this.currentPoint.clone(),new ze(e,t),new ze(n,s));return this.curves.push(u),this.currentPoint.set(n,s),this}bezierCurveTo(e,t,n,s,u,f){const h=new Bb(this.currentPoint.clone(),new ze(e,t),new ze(n,s),new ze(u,f));return this.curves.push(h),this.currentPoint.set(u,f),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Hb(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,s,u,f){const h=this.currentPoint.x,m=this.currentPoint.y;return this.absarc(e+h,t+m,n,s,u,f),this}absarc(e,t,n,s,u,f){return this.absellipse(e,t,n,n,s,u,f),this}ellipse(e,t,n,s,u,f,h,m){const g=this.currentPoint.x,_=this.currentPoint.y;return this.absellipse(e+g,t+_,n,s,u,f,h,m),this}absellipse(e,t,n,s,u,f,h,m){const g=new Fy(e,t,n,s,u,f,h,m);if(this.curves.length>0){const x=g.getPoint(0);x.equals(this.currentPoint)||this.lineTo(x.x,x.y)}this.curves.push(g);const _=g.getPoint(1);return this.currentPoint.copy(_),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 $c extends ly{constructor(e){super(e),this.uuid=Vs(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,s=this.holes.length;n<s;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const s=e.holes[t];this.holes.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const s=this.holes[t];e.holes.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const s=e.holes[t];this.holes.push(new ly().fromJSON(s))}return this}}function uN(r,e,t=2){const n=e&&e.length,s=n?e[0]*t:r.length;let u=lT(r,0,s,t,!0);const f=[];if(!u||u.next===u.prev)return f;let h,m,g;if(n&&(u=pN(r,e,u,t)),r.length>80*t){h=r[0],m=r[1];let _=h,x=m;for(let b=t;b<s;b+=t){const M=r[b],A=r[b+1];M<h&&(h=M),A<m&&(m=A),M>_&&(_=M),A>x&&(x=A)}g=Math.max(_-h,x-m),g=g!==0?32767/g:0}return vm(u,f,t,h,m,g,0),f}function lT(r,e,t,n,s){let u;if(s===TN(r,e,t,n)>0)for(let f=e;f<t;f+=n)u=HM(f/n|0,r[f],r[f+1],u);else for(let f=t-n;f>=e;f-=n)u=HM(f/n|0,r[f],r[f+1],u);return u&&td(u,u.next)&&(_m(u),u=u.next),u}function af(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(td(t,t.next)||_i(t.prev,t,t.next)===0)){if(_m(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function vm(r,e,t,n,s,u,f){if(!r)return;!f&&u&&_N(r,n,s,u);let h=r;for(;r.prev!==r.next;){const m=r.prev,g=r.next;if(u?fN(r,n,s,u):cN(r)){e.push(m.i,r.i,g.i),_m(r),r=g.next,h=g.next;continue}if(r=g,r===h){f?f===1?(r=hN(af(r),e),vm(r,e,t,n,s,u,2)):f===2&&dN(r,e,t,n,s,u):vm(af(r),e,t,n,s,u,1);break}}}function cN(r){const e=r.prev,t=r,n=r.next;if(_i(e,t,n)>=0)return!1;const s=e.x,u=t.x,f=n.x,h=e.y,m=t.y,g=n.y,_=Math.min(s,u,f),x=Math.min(h,m,g),b=Math.max(s,u,f),M=Math.max(h,m,g);let A=n.next;for(;A!==e;){if(A.x>=_&&A.x<=b&&A.y>=x&&A.y<=M&&Zp(s,h,u,m,f,g,A.x,A.y)&&_i(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function fN(r,e,t,n){const s=r.prev,u=r,f=r.next;if(_i(s,u,f)>=0)return!1;const h=s.x,m=u.x,g=f.x,_=s.y,x=u.y,b=f.y,M=Math.min(h,m,g),A=Math.min(_,x,b),R=Math.max(h,m,g),w=Math.max(_,x,b),E=Zx(M,A,e,t,n),N=Zx(R,w,e,t,n);let D=r.prevZ,U=r.nextZ;for(;D&&D.z>=E&&U&&U.z<=N;){if(D.x>=M&&D.x<=R&&D.y>=A&&D.y<=w&&D!==s&&D!==f&&Zp(h,_,m,x,g,b,D.x,D.y)&&_i(D.prev,D,D.next)>=0||(D=D.prevZ,U.x>=M&&U.x<=R&&U.y>=A&&U.y<=w&&U!==s&&U!==f&&Zp(h,_,m,x,g,b,U.x,U.y)&&_i(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;D&&D.z>=E;){if(D.x>=M&&D.x<=R&&D.y>=A&&D.y<=w&&D!==s&&D!==f&&Zp(h,_,m,x,g,b,D.x,D.y)&&_i(D.prev,D,D.next)>=0)return!1;D=D.prevZ}for(;U&&U.z<=N;){if(U.x>=M&&U.x<=R&&U.y>=A&&U.y<=w&&U!==s&&U!==f&&Zp(h,_,m,x,g,b,U.x,U.y)&&_i(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function hN(r,e){let t=r;do{const n=t.prev,s=t.next.next;!td(n,s)&&cT(n,t,t.next,s)&&ym(n,s)&&ym(s,n)&&(e.push(n.i,t.i,s.i),_m(t),_m(t.next),t=r=s),t=t.next}while(t!==r);return af(t)}function dN(r,e,t,n,s,u){let f=r;do{let h=f.next.next;for(;h!==f.prev;){if(f.i!==h.i&&SN(f,h)){let m=fT(f,h);f=af(f,f.next),m=af(m,m.next),vm(f,e,t,n,s,u,0),vm(m,e,t,n,s,u,0);return}h=h.next}f=f.next}while(f!==r)}function pN(r,e,t,n){const s=[];for(let u=0,f=e.length;u<f;u++){const h=e[u]*n,m=u<f-1?e[u+1]*n:r.length,g=lT(r,h,m,n,!1);g===g.next&&(g.steiner=!0),s.push(bN(g))}s.sort(mN);for(let u=0;u<s.length;u++)t=gN(s[u],t);return t}function mN(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=n-s}return t}function gN(r,e){const t=vN(r,e);if(!t)return e;const n=fT(t,r);return af(n,n.next),af(t,t.next)}function vN(r,e){let t=e;const n=r.x,s=r.y;let u=-1/0,f;if(td(r,t))return t;do{if(td(r,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const x=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(x<=n&&x>u&&(u=x,f=t.x<t.next.x?t:t.next,x===n))return f}t=t.next}while(t!==e);if(!f)return null;const h=f,m=f.x,g=f.y;let _=1/0;t=f;do{if(n>=t.x&&t.x>=m&&n!==t.x&&uT(s<g?n:u,s,m,g,s<g?u:n,s,t.x,t.y)){const x=Math.abs(s-t.y)/(n-t.x);ym(t,r)&&(x<_||x===_&&(t.x>f.x||t.x===f.x&&yN(f,t)))&&(f=t,_=x)}t=t.next}while(t!==h);return f}function yN(r,e){return _i(r.prev,r,e.prev)<0&&_i(e.next,r,r.next)<0}function _N(r,e,t,n){let s=r;do s.z===0&&(s.z=Zx(s.x,s.y,e,t,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,xN(s)}function xN(r){let e,t=1;do{let n=r,s;r=null;let u=null;for(e=0;n;){e++;let f=n,h=0;for(let g=0;g<t&&(h++,f=f.nextZ,!!f);g++);let m=t;for(;h>0||m>0&&f;)h!==0&&(m===0||!f||n.z<=f.z)?(s=n,n=n.nextZ,h--):(s=f,f=f.nextZ,m--),u?u.nextZ=s:r=s,s.prevZ=u,u=s;n=f}u.nextZ=null,t*=2}while(e>1);return r}function Zx(r,e,t,n,s){return r=(r-t)*s|0,e=(e-n)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function bN(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function uT(r,e,t,n,s,u,f,h){return(s-f)*(e-h)>=(r-f)*(u-h)&&(r-f)*(n-h)>=(t-f)*(e-h)&&(t-f)*(u-h)>=(s-f)*(n-h)}function Zp(r,e,t,n,s,u,f,h){return!(r===f&&e===h)&&uT(r,e,t,n,s,u,f,h)}function SN(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!MN(r,e)&&(ym(r,e)&&ym(e,r)&&EN(r,e)&&(_i(r.prev,r,e.prev)||_i(r,e.prev,e))||td(r,e)&&_i(r.prev,r,r.next)>0&&_i(e.prev,e,e.next)>0)}function _i(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function td(r,e){return r.x===e.x&&r.y===e.y}function cT(r,e,t,n){const s=$0(_i(r,e,t)),u=$0(_i(r,e,n)),f=$0(_i(t,n,r)),h=$0(_i(t,n,e));return!!(s!==u&&f!==h||s===0&&J0(r,t,e)||u===0&&J0(r,n,e)||f===0&&J0(t,r,n)||h===0&&J0(t,e,n))}function J0(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function $0(r){return r>0?1:r<0?-1:0}function MN(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&cT(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ym(r,e){return _i(r.prev,r,r.next)<0?_i(r,e,r.next)>=0&&_i(r,r.prev,e)>=0:_i(r,e,r.prev)<0||_i(r,r.next,e)<0}function EN(r,e){let t=r,n=!1;const s=(r.x+e.x)/2,u=(r.y+e.y)/2;do t.y>u!=t.next.y>u&&t.next.y!==t.y&&s<(t.next.x-t.x)*(u-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function fT(r,e){const t=Qx(r.i,r.x,r.y),n=Qx(e.i,e.x,e.y),s=r.next,u=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,n.next=t,t.prev=n,u.next=n,n.prev=u,n}function HM(r,e,t,n){const s=Qx(r,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function _m(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Qx(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function TN(r,e,t,n){let s=0;for(let u=e,f=t-n;u<t;u+=n)s+=(r[f]-r[u])*(r[u+1]+r[f+1]),f=u;return s}class AN{static triangulate(e,t,n=2){return uN(e,t,n)}}class jr{static area(e){const t=e.length;let n=0;for(let s=t-1,u=0;u<t;s=u++)n+=e[s].x*e[u].y-e[u].x*e[s].y;return n*.5}static isClockWise(e){return jr.area(e)<0}static triangulateShape(e,t){const n=[],s=[],u=[];GM(e),XM(n,e);let f=e.length;t.forEach(GM);for(let m=0;m<t.length;m++)s.push(f),f+=t[m].length,XM(n,t[m]);const h=AN.triangulate(n,s);for(let m=0;m<h.length;m+=3)u.push(h.slice(m,m+3));return u}}function GM(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function XM(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class ky extends Kt{constructor(e=new $c([new ze(.5,.5),new ze(-.5,.5),new ze(-.5,-.5),new ze(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,s=[],u=[];for(let h=0,m=e.length;h<m;h++){const g=e[h];f(g)}this.setAttribute("position",new bt(s,3)),this.setAttribute("uv",new bt(u,2)),this.computeVertexNormals();function f(h){const m=[],g=t.curveSegments!==void 0?t.curveSegments:12,_=t.steps!==void 0?t.steps:1,x=t.depth!==void 0?t.depth:1;let b=t.bevelEnabled!==void 0?t.bevelEnabled:!0,M=t.bevelThickness!==void 0?t.bevelThickness:.2,A=t.bevelSize!==void 0?t.bevelSize:M-.1,R=t.bevelOffset!==void 0?t.bevelOffset:0,w=t.bevelSegments!==void 0?t.bevelSegments:3;const E=t.extrudePath,N=t.UVGenerator!==void 0?t.UVGenerator:wN;let D,U=!1,B,z,H,W;if(E){D=E.getSpacedPoints(_),U=!0,b=!1;const Le=E.isCatmullRomCurve3?E.closed:!1;B=E.computeFrenetFrames(_,Le),z=new j,H=new j,W=new j}b||(w=0,M=0,A=0,R=0);const I=h.extractPoints(g);let P=I.shape;const Z=I.holes;if(!jr.isClockWise(P)){P=P.reverse();for(let Le=0,He=Z.length;Le<He;Le++){const Oe=Z[Le];jr.isClockWise(Oe)&&(Z[Le]=Oe.reverse())}}function te(Le){const Oe=10000000000000001e-36;let nt=Le[0];for(let Q=1;Q<=Le.length;Q++){const Et=Q%Le.length,ot=Le[Et],Tt=ot.x-nt.x,Qe=ot.y-nt.y,G=Tt*Tt+Qe*Qe,O=Math.max(Math.abs(ot.x),Math.abs(ot.y),Math.abs(nt.x),Math.abs(nt.y)),ae=Oe*O*O;if(G<=ae){Le.splice(Et,1),Q--;continue}nt=ot}}te(P),Z.forEach(te);const fe=Z.length,pe=P;for(let Le=0;Le<fe;Le++){const He=Z[Le];P=P.concat(He)}function Y(Le,He,Oe){return He||Rt("ExtrudeGeometry: vec does not exist"),Le.clone().addScaledVector(He,Oe)}const q=P.length;function ne(Le,He,Oe){let nt,Q,Et;const ot=Le.x-He.x,Tt=Le.y-He.y,Qe=Oe.x-Le.x,G=Oe.y-Le.y,O=ot*ot+Tt*Tt,ae=ot*G-Tt*Qe;if(Math.abs(ae)>Number.EPSILON){const Te=Math.sqrt(O),Ie=Math.sqrt(Qe*Qe+G*G),Ee=He.x-Tt/Te,dt=He.y+ot/Te,Ke=Oe.x-G/Ie,vt=Oe.y+Qe/Ie,Dt=((Ke-Ee)*G-(vt-dt)*Qe)/(ot*G-Tt*Qe);nt=Ee+ot*Dt-Le.x,Q=dt+Tt*Dt-Le.y;const Ve=nt*nt+Q*Q;if(Ve<=2)return new ze(nt,Q);Et=Math.sqrt(Ve/2)}else{let Te=!1;ot>Number.EPSILON?Qe>Number.EPSILON&&(Te=!0):ot<-Number.EPSILON?Qe<-Number.EPSILON&&(Te=!0):Math.sign(Tt)===Math.sign(G)&&(Te=!0),Te?(nt=-Tt,Q=ot,Et=Math.sqrt(O)):(nt=ot,Q=Tt,Et=Math.sqrt(O/2))}return new ze(nt/Et,Q/Et)}const be=[];for(let Le=0,He=pe.length,Oe=He-1,nt=Le+1;Le<He;Le++,Oe++,nt++)Oe===He&&(Oe=0),nt===He&&(nt=0),be[Le]=ne(pe[Le],pe[Oe],pe[nt]);const Ne=[];let X,oe=be.concat();for(let Le=0,He=fe;Le<He;Le++){const Oe=Z[Le];X=[];for(let nt=0,Q=Oe.length,Et=Q-1,ot=nt+1;nt<Q;nt++,Et++,ot++)Et===Q&&(Et=0),ot===Q&&(ot=0),X[nt]=ne(Oe[nt],Oe[Et],Oe[ot]);Ne.push(X),oe=oe.concat(X)}let Ae;if(w===0)Ae=jr.triangulateShape(pe,Z);else{const Le=[],He=[];for(let Oe=0;Oe<w;Oe++){const nt=Oe/w,Q=M*Math.cos(nt*Math.PI/2),Et=A*Math.sin(nt*Math.PI/2)+R;for(let ot=0,Tt=pe.length;ot<Tt;ot++){const Qe=Y(pe[ot],be[ot],Et);st(Qe.x,Qe.y,-Q),nt===0&&Le.push(Qe)}for(let ot=0,Tt=fe;ot<Tt;ot++){const Qe=Z[ot];X=Ne[ot];const G=[];for(let O=0,ae=Qe.length;O<ae;O++){const Te=Y(Qe[O],X[O],Et);st(Te.x,Te.y,-Q),nt===0&&G.push(Te)}nt===0&&He.push(G)}}Ae=jr.triangulateShape(Le,He)}const Fe=Ae.length,lt=A+R;for(let Le=0;Le<q;Le++){const He=b?Y(P[Le],oe[Le],lt):P[Le];U?(H.copy(B.normals[0]).multiplyScalar(He.x),z.copy(B.binormals[0]).multiplyScalar(He.y),W.copy(D[0]).add(H).add(z),st(W.x,W.y,W.z)):st(He.x,He.y,0)}for(let Le=1;Le<=_;Le++)for(let He=0;He<q;He++){const Oe=b?Y(P[He],oe[He],lt):P[He];U?(H.copy(B.normals[Le]).multiplyScalar(Oe.x),z.copy(B.binormals[Le]).multiplyScalar(Oe.y),W.copy(D[Le]).add(H).add(z),st(W.x,W.y,W.z)):st(Oe.x,Oe.y,x/_*Le)}for(let Le=w-1;Le>=0;Le--){const He=Le/w,Oe=M*Math.cos(He*Math.PI/2),nt=A*Math.sin(He*Math.PI/2)+R;for(let Q=0,Et=pe.length;Q<Et;Q++){const ot=Y(pe[Q],be[Q],nt);st(ot.x,ot.y,x+Oe)}for(let Q=0,Et=Z.length;Q<Et;Q++){const ot=Z[Q];X=Ne[Q];for(let Tt=0,Qe=ot.length;Tt<Qe;Tt++){const G=Y(ot[Tt],X[Tt],nt);U?st(G.x,G.y+D[_-1].y,D[_-1].x+Oe):st(G.x,G.y,x+Oe)}}}de(),Re();function de(){const Le=s.length/3;if(b){let He=0,Oe=q*He;for(let nt=0;nt<Fe;nt++){const Q=Ae[nt];ht(Q[2]+Oe,Q[1]+Oe,Q[0]+Oe)}He=_+w*2,Oe=q*He;for(let nt=0;nt<Fe;nt++){const Q=Ae[nt];ht(Q[0]+Oe,Q[1]+Oe,Q[2]+Oe)}}else{for(let He=0;He<Fe;He++){const Oe=Ae[He];ht(Oe[2],Oe[1],Oe[0])}for(let He=0;He<Fe;He++){const Oe=Ae[He];ht(Oe[0]+q*_,Oe[1]+q*_,Oe[2]+q*_)}}n.addGroup(Le,s.length/3-Le,0)}function Re(){const Le=s.length/3;let He=0;tt(pe,He),He+=pe.length;for(let Oe=0,nt=Z.length;Oe<nt;Oe++){const Q=Z[Oe];tt(Q,He),He+=Q.length}n.addGroup(Le,s.length/3-Le,1)}function tt(Le,He){let Oe=Le.length;for(;--Oe>=0;){const nt=Oe;let Q=Oe-1;Q<0&&(Q=Le.length-1);for(let Et=0,ot=_+w*2;Et<ot;Et++){const Tt=q*Et,Qe=q*(Et+1),G=He+nt+Tt,O=He+Q+Tt,ae=He+Q+Qe,Te=He+nt+Qe;jt(G,O,ae,Te)}}}function st(Le,He,Oe){m.push(Le),m.push(He),m.push(Oe)}function ht(Le,He,Oe){tn(Le),tn(He),tn(Oe);const nt=s.length/3,Q=N.generateTopUV(n,s,nt-3,nt-2,nt-1);Nt(Q[0]),Nt(Q[1]),Nt(Q[2])}function jt(Le,He,Oe,nt){tn(Le),tn(He),tn(nt),tn(He),tn(Oe),tn(nt);const Q=s.length/3,Et=N.generateSideWallUV(n,s,Q-6,Q-3,Q-2,Q-1);Nt(Et[0]),Nt(Et[1]),Nt(Et[3]),Nt(Et[1]),Nt(Et[2]),Nt(Et[3])}function tn(Le){s.push(m[Le*3+0]),s.push(m[Le*3+1]),s.push(m[Le*3+2])}function Nt(Le){u.push(Le.x),u.push(Le.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return CN(t,n,e)}static fromJSON(e,t){const n=[];for(let u=0,f=e.shapes.length;u<f;u++){const h=t[e.shapes[u]];n.push(h)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new oy[s.type]().fromJSON(s)),new ky(n,e.options)}}const wN={generateTopUV:function(r,e,t,n,s){const u=e[t*3],f=e[t*3+1],h=e[n*3],m=e[n*3+1],g=e[s*3],_=e[s*3+1];return[new ze(u,f),new ze(h,m),new ze(g,_)]},generateSideWallUV:function(r,e,t,n,s,u){const f=e[t*3],h=e[t*3+1],m=e[t*3+2],g=e[n*3],_=e[n*3+1],x=e[n*3+2],b=e[s*3],M=e[s*3+1],A=e[s*3+2],R=e[u*3],w=e[u*3+1],E=e[u*3+2];return Math.abs(h-_)<Math.abs(f-g)?[new ze(f,1-m),new ze(g,1-x),new ze(b,1-A),new ze(R,1-E)]:[new ze(h,1-m),new ze(_,1-x),new ze(M,1-A),new ze(w,1-E)]}};function CN(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,s=r.length;n<s;n++){const u=r[n];t.shapes.push(u.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Vy extends Hu{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,s=[-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],u=[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];super(s,u,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Vy(e.radius,e.detail)}}class Hy extends Kt{constructor(e=[new ze(0,-.5),new ze(.5,0),new ze(0,.5)],t=12,n=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:s},t=Math.floor(t),s=Ht(s,0,Math.PI*2);const u=[],f=[],h=[],m=[],g=[],_=1/t,x=new j,b=new ze,M=new j,A=new j,R=new j;let w=0,E=0;for(let N=0;N<=e.length-1;N++)switch(N){case 0:w=e[N+1].x-e[N].x,E=e[N+1].y-e[N].y,M.x=E*1,M.y=-w,M.z=E*0,R.copy(M),M.normalize(),m.push(M.x,M.y,M.z);break;case e.length-1:m.push(R.x,R.y,R.z);break;default:w=e[N+1].x-e[N].x,E=e[N+1].y-e[N].y,M.x=E*1,M.y=-w,M.z=E*0,A.copy(M),M.x+=R.x,M.y+=R.y,M.z+=R.z,M.normalize(),m.push(M.x,M.y,M.z),R.copy(A)}for(let N=0;N<=t;N++){const D=n+N*_*s,U=Math.sin(D),B=Math.cos(D);for(let z=0;z<=e.length-1;z++){x.x=e[z].x*U,x.y=e[z].y,x.z=e[z].x*B,f.push(x.x,x.y,x.z),b.x=N/t,b.y=z/(e.length-1),h.push(b.x,b.y);const H=m[3*z+0]*U,W=m[3*z+1],I=m[3*z+0]*B;g.push(H,W,I)}}for(let N=0;N<t;N++)for(let D=0;D<e.length-1;D++){const U=D+N*e.length,B=U,z=U+e.length,H=U+e.length+1,W=U+1;u.push(B,z,W),u.push(H,W,z)}this.setIndex(u),this.setAttribute("position",new bt(f,3)),this.setAttribute("uv",new bt(h,2)),this.setAttribute("normal",new bt(g,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hy(e.points,e.segments,e.phiStart,e.phiLength)}}class Dm extends Hu{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,s,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Dm(e.radius,e.detail)}}class sd extends Kt{constructor(e=1,t=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:s};const u=e/2,f=t/2,h=Math.floor(n),m=Math.floor(s),g=h+1,_=m+1,x=e/h,b=t/m,M=[],A=[],R=[],w=[];for(let E=0;E<_;E++){const N=E*b-f;for(let D=0;D<g;D++){const U=D*x-u;A.push(U,-N,0),R.push(0,0,1),w.push(D/h),w.push(1-E/m)}}for(let E=0;E<m;E++)for(let N=0;N<h;N++){const D=N+g*E,U=N+g*(E+1),B=N+1+g*(E+1),z=N+1+g*E;M.push(D,U,z),M.push(U,B,z)}this.setIndex(M),this.setAttribute("position",new bt(A,3)),this.setAttribute("normal",new bt(R,3)),this.setAttribute("uv",new bt(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sd(e.width,e.height,e.widthSegments,e.heightSegments)}}class Gy extends Kt{constructor(e=.5,t=1,n=32,s=1,u=0,f=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:s,thetaStart:u,thetaLength:f},n=Math.max(3,n),s=Math.max(1,s);const h=[],m=[],g=[],_=[];let x=e;const b=(t-e)/s,M=new j,A=new ze;for(let R=0;R<=s;R++){for(let w=0;w<=n;w++){const E=u+w/n*f;M.x=x*Math.cos(E),M.y=x*Math.sin(E),m.push(M.x,M.y,M.z),g.push(0,0,1),A.x=(M.x/t+1)/2,A.y=(M.y/t+1)/2,_.push(A.x,A.y)}x+=b}for(let R=0;R<s;R++){const w=R*(n+1);for(let E=0;E<n;E++){const N=E+w,D=N,U=N+n+1,B=N+n+2,z=N+1;h.push(D,U,z),h.push(U,B,z)}}this.setIndex(h),this.setAttribute("position",new bt(m,3)),this.setAttribute("normal",new bt(g,3)),this.setAttribute("uv",new bt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gy(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Xy extends Kt{constructor(e=new $c([new ze(0,.5),new ze(-.5,-.5),new ze(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],s=[],u=[],f=[];let h=0,m=0;if(Array.isArray(e)===!1)g(e);else for(let _=0;_<e.length;_++)g(e[_]),this.addGroup(h,m,_),h+=m,m=0;this.setIndex(n),this.setAttribute("position",new bt(s,3)),this.setAttribute("normal",new bt(u,3)),this.setAttribute("uv",new bt(f,2));function g(_){const x=s.length/3,b=_.extractPoints(t);let M=b.shape;const A=b.holes;jr.isClockWise(M)===!1&&(M=M.reverse());for(let w=0,E=A.length;w<E;w++){const N=A[w];jr.isClockWise(N)===!0&&(A[w]=N.reverse())}const R=jr.triangulateShape(M,A);for(let w=0,E=A.length;w<E;w++){const N=A[w];M=M.concat(N)}for(let w=0,E=M.length;w<E;w++){const N=M[w];s.push(N.x,N.y,0),u.push(0,0,1),f.push(N.x,N.y)}for(let w=0,E=R.length;w<E;w++){const N=R[w],D=N[0]+x,U=N[1]+x,B=N[2]+x;n.push(D,U,B),m+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return RN(t,e)}static fromJSON(e,t){const n=[];for(let s=0,u=e.shapes.length;s<u;s++){const f=t[e.shapes[s]];n.push(f)}return new Xy(n,e.curveSegments)}}function RN(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const s=r[t];e.shapes.push(s.uuid)}else e.shapes.push(r.uuid);return e}class Lm extends Kt{constructor(e=1,t=32,n=16,s=0,u=Math.PI*2,f=0,h=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:s,phiLength:u,thetaStart:f,thetaLength:h},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const m=Math.min(f+h,Math.PI);let g=0;const _=[],x=new j,b=new j,M=[],A=[],R=[],w=[];for(let E=0;E<=n;E++){const N=[],D=E/n;let U=0;E===0&&f===0?U=.5/t:E===n&&m===Math.PI&&(U=-.5/t);for(let B=0;B<=t;B++){const z=B/t;x.x=-e*Math.cos(s+z*u)*Math.sin(f+D*h),x.y=e*Math.cos(f+D*h),x.z=e*Math.sin(s+z*u)*Math.sin(f+D*h),A.push(x.x,x.y,x.z),b.copy(x).normalize(),R.push(b.x,b.y,b.z),w.push(z+U,1-D),N.push(g++)}_.push(N)}for(let E=0;E<n;E++)for(let N=0;N<t;N++){const D=_[E][N+1],U=_[E][N],B=_[E+1][N],z=_[E+1][N+1];(E!==0||f>0)&&M.push(D,U,z),(E!==n-1||m<Math.PI)&&M.push(U,B,z)}this.setIndex(M),this.setAttribute("position",new bt(A,3)),this.setAttribute("normal",new bt(R,3)),this.setAttribute("uv",new bt(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lm(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Wy extends Hu{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,s,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Wy(e.radius,e.detail)}}class qy extends Kt{constructor(e=1,t=.4,n=12,s=48,u=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:s,arc:u},n=Math.floor(n),s=Math.floor(s);const f=[],h=[],m=[],g=[],_=new j,x=new j,b=new j;for(let M=0;M<=n;M++)for(let A=0;A<=s;A++){const R=A/s*u,w=M/n*Math.PI*2;x.x=(e+t*Math.cos(w))*Math.cos(R),x.y=(e+t*Math.cos(w))*Math.sin(R),x.z=t*Math.sin(w),h.push(x.x,x.y,x.z),_.x=e*Math.cos(R),_.y=e*Math.sin(R),b.subVectors(x,_).normalize(),m.push(b.x,b.y,b.z),g.push(A/s),g.push(M/n)}for(let M=1;M<=n;M++)for(let A=1;A<=s;A++){const R=(s+1)*M+A-1,w=(s+1)*(M-1)+A-1,E=(s+1)*(M-1)+A,N=(s+1)*M+A;f.push(R,w,N),f.push(w,E,N)}this.setIndex(f),this.setAttribute("position",new bt(h,3)),this.setAttribute("normal",new bt(m,3)),this.setAttribute("uv",new bt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qy(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class jy extends Kt{constructor(e=1,t=.4,n=64,s=8,u=2,f=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:s,p:u,q:f},n=Math.floor(n),s=Math.floor(s);const h=[],m=[],g=[],_=[],x=new j,b=new j,M=new j,A=new j,R=new j,w=new j,E=new j;for(let D=0;D<=n;++D){const U=D/n*u*Math.PI*2;N(U,u,f,e,M),N(U+.01,u,f,e,A),w.subVectors(A,M),E.addVectors(A,M),R.crossVectors(w,E),E.crossVectors(R,w),R.normalize(),E.normalize();for(let B=0;B<=s;++B){const z=B/s*Math.PI*2,H=-t*Math.cos(z),W=t*Math.sin(z);x.x=M.x+(H*E.x+W*R.x),x.y=M.y+(H*E.y+W*R.y),x.z=M.z+(H*E.z+W*R.z),m.push(x.x,x.y,x.z),b.subVectors(x,M).normalize(),g.push(b.x,b.y,b.z),_.push(D/n),_.push(B/s)}}for(let D=1;D<=n;D++)for(let U=1;U<=s;U++){const B=(s+1)*(D-1)+(U-1),z=(s+1)*D+(U-1),H=(s+1)*D+U,W=(s+1)*(D-1)+U;h.push(B,z,W),h.push(z,H,W)}this.setIndex(h),this.setAttribute("position",new bt(m,3)),this.setAttribute("normal",new bt(g,3)),this.setAttribute("uv",new bt(_,2));function N(D,U,B,z,H){const W=Math.cos(D),I=Math.sin(D),P=B/U*D,Z=Math.cos(P);H.x=z*(2+Z)*.5*W,H.y=z*(2+Z)*I*.5,H.z=z*Math.sin(P)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jy(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Yy extends Kt{constructor(e=new Vb(new j(-1,-1,0),new j(-1,1,0),new j(1,1,0)),t=64,n=1,s=8,u=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:s,closed:u};const f=e.computeFrenetFrames(t,u);this.tangents=f.tangents,this.normals=f.normals,this.binormals=f.binormals;const h=new j,m=new j,g=new ze;let _=new j;const x=[],b=[],M=[],A=[];R(),this.setIndex(A),this.setAttribute("position",new bt(x,3)),this.setAttribute("normal",new bt(b,3)),this.setAttribute("uv",new bt(M,2));function R(){for(let D=0;D<t;D++)w(D);w(u===!1?t:0),N(),E()}function w(D){_=e.getPointAt(D/t,_);const U=f.normals[D],B=f.binormals[D];for(let z=0;z<=s;z++){const H=z/s*Math.PI*2,W=Math.sin(H),I=-Math.cos(H);m.x=I*U.x+W*B.x,m.y=I*U.y+W*B.y,m.z=I*U.z+W*B.z,m.normalize(),b.push(m.x,m.y,m.z),h.x=_.x+n*m.x,h.y=_.y+n*m.y,h.z=_.z+n*m.z,x.push(h.x,h.y,h.z)}}function E(){for(let D=1;D<=t;D++)for(let U=1;U<=s;U++){const B=(s+1)*(D-1)+(U-1),z=(s+1)*D+(U-1),H=(s+1)*D+U,W=(s+1)*(D-1)+U;A.push(B,z,W),A.push(z,H,W)}}function N(){for(let D=0;D<=t;D++)for(let U=0;U<=s;U++)g.x=D/t,g.y=U/s,M.push(g.x,g.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Yy(new oy[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class hT extends Kt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,s=new j,u=new j;if(e.index!==null){const f=e.attributes.position,h=e.index;let m=e.groups;m.length===0&&(m=[{start:0,count:h.count,materialIndex:0}]);for(let g=0,_=m.length;g<_;++g){const x=m[g],b=x.start,M=x.count;for(let A=b,R=b+M;A<R;A+=3)for(let w=0;w<3;w++){const E=h.getX(A+w),N=h.getX(A+(w+1)%3);s.fromBufferAttribute(f,E),u.fromBufferAttribute(f,N),WM(s,u,n)===!0&&(t.push(s.x,s.y,s.z),t.push(u.x,u.y,u.z))}}}else{const f=e.attributes.position;for(let h=0,m=f.count/3;h<m;h++)for(let g=0;g<3;g++){const _=3*h+g,x=3*h+(g+1)%3;s.fromBufferAttribute(f,_),u.fromBufferAttribute(f,x),WM(s,u,n)===!0&&(t.push(s.x,s.y,s.z),t.push(u.x,u.y,u.z))}}this.setAttribute("position",new bt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function WM(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,s=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(s)===!0?!1:(t.add(n),t.add(s),!0)}var qM=Object.freeze({__proto__:null,BoxGeometry:lf,CapsuleGeometry:Py,CircleGeometry:zy,ConeGeometry:Nm,CylinderGeometry:Rm,DodecahedronGeometry:By,EdgesGeometry:nT,ExtrudeGeometry:ky,IcosahedronGeometry:Vy,LatheGeometry:Hy,OctahedronGeometry:Dm,PlaneGeometry:sd,PolyhedronGeometry:Hu,RingGeometry:Gy,ShapeGeometry:Xy,SphereGeometry:Lm,TetrahedronGeometry:Wy,TorusGeometry:qy,TorusKnotGeometry:jy,TubeGeometry:Yy,WireframeGeometry:hT});class dT extends Ba{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new yt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Gb extends yr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Xb extends Ba{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new yt(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 yt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(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 Gs,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 pT extends Xb{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 ze(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ht(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new yt(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 yt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new yt(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 mT extends Ba{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new yt(16777215),this.specular=new yt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Gs,this.combine=Am,this.reflectivity=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.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 gT extends Ba{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new yt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(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 vT extends Ba{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(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 yT extends Ba{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new yt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Gs,this.combine=Am,this.reflectivity=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.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 Wb extends Ba{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=NE,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 qb extends Ba{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 _T extends Ba{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new yt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ku,this.normalScale=new ze(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 xT extends ss{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 Qc(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function bT(r){function e(s,u){return r[s]-r[u]}const t=r.length,n=new Array(t);for(let s=0;s!==t;++s)n[s]=s;return n.sort(e),n}function Kx(r,e,t){const n=r.length,s=new r.constructor(n);for(let u=0,f=0;f!==n;++u){const h=t[u]*e;for(let m=0;m!==e;++m)s[f++]=r[h+m]}return s}function jb(r,e,t,n){let s=1,u=r[0];for(;u!==void 0&&u[n]===void 0;)u=r[s++];if(u===void 0)return;let f=u[n];if(f!==void 0)if(Array.isArray(f))do f=u[n],f!==void 0&&(e.push(u.time),t.push(...f)),u=r[s++];while(u!==void 0);else if(f.toArray!==void 0)do f=u[n],f!==void 0&&(e.push(u.time),f.toArray(t,t.length)),u=r[s++];while(u!==void 0);else do f=u[n],f!==void 0&&(e.push(u.time),t.push(f)),u=r[s++];while(u!==void 0)}function NN(r,e,t,n,s=30){const u=r.clone();u.name=e;const f=[];for(let m=0;m<u.tracks.length;++m){const g=u.tracks[m],_=g.getValueSize(),x=[],b=[];for(let M=0;M<g.times.length;++M){const A=g.times[M]*s;if(!(A<t||A>=n)){x.push(g.times[M]);for(let R=0;R<_;++R)b.push(g.values[M*_+R])}}x.length!==0&&(g.times=Qc(x,g.times.constructor),g.values=Qc(b,g.values.constructor),f.push(g))}u.tracks=f;let h=1/0;for(let m=0;m<u.tracks.length;++m)h>u.tracks[m].times[0]&&(h=u.tracks[m].times[0]);for(let m=0;m<u.tracks.length;++m)u.tracks[m].shift(-1*h);return u.resetDuration(),u}function DN(r,e=0,t=r,n=30){n<=0&&(n=30);const s=t.tracks.length,u=e/n;for(let f=0;f<s;++f){const h=t.tracks[f],m=h.ValueTypeName;if(m==="bool"||m==="string")continue;const g=r.tracks.find(function(E){return E.name===h.name&&E.ValueTypeName===m});if(g===void 0)continue;let _=0;const x=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(_=x/3);let b=0;const M=g.getValueSize();g.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(b=M/3);const A=h.times.length-1;let R;if(u<=h.times[0]){const E=_,N=x-_;R=h.values.slice(E,N)}else if(u>=h.times[A]){const E=A*x+_,N=E+x-_;R=h.values.slice(E,N)}else{const E=h.createInterpolant(),N=_,D=x-_;E.evaluate(u),R=E.resultBuffer.slice(N,D)}m==="quaternion"&&new Pa().fromArray(R).normalize().conjugate().toArray(R);const w=g.times.length;for(let E=0;E<w;++E){const N=E*M+b;if(m==="quaternion")Pa.multiplyQuaternionsFlat(g.values,N,R,0,g.values,N);else{const D=M-b*2;for(let U=0;U<D;++U)g.values[N+U]-=R[U]}}}return r.blendMode=Ab,r}class LN{static convertArray(e,t){return Qc(e,t)}static isTypedArray(e){return FE(e)}static getKeyframeOrder(e){return bT(e)}static sortedArray(e,t,n){return Kx(e,t,n)}static flattenJSON(e,t,n,s){jb(e,t,n,s)}static subclip(e,t,n,s,u=30){return NN(e,t,n,s,u)}static makeClipAdditive(e,t=0,n=e,s=30){return DN(e,t,n,s)}}class Um{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s: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,s=t[n],u=t[n-1];e:{t:{let f;n:{i:if(!(e<s)){for(let h=n+2;;){if(s===void 0){if(e<u)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===h)break;if(u=s,s=t[++n],e<s)break t}f=t.length;break n}if(!(e>=u)){const h=t[1];e<h&&(n=2,u=h);for(let m=n-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===m)break;if(s=u,u=t[--n-1],e>=u)break t}f=n,n=0;break n}break e}for(;n<f;){const h=n+f>>>1;e<t[h]?f=h:n=h+1}if(s=t[n],u=t[n-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,u,s)}return this.interpolate_(n,u,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,u=e*s;for(let f=0;f!==s;++f)t[f]=n[u+f];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ST extends Um{constructor(e,t,n,s){super(e,t,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Yc,endingEnd:Yc}}intervalChanged_(e,t,n){const s=this.parameterPositions;let u=e-2,f=e+1,h=s[u],m=s[f];if(h===void 0)switch(this.getSettings_().endingStart){case Zc:u=e,h=2*t-n;break;case hm:u=s.length-2,h=t+s[u]-s[u+1];break;default:u=e,h=n}if(m===void 0)switch(this.getSettings_().endingEnd){case Zc:f=e,m=2*n-t;break;case hm:f=1,m=n+s[1]-s[0];break;default:f=e-1,m=t}const g=(n-t)*.5,_=this.valueSize;this._weightPrev=g/(t-h),this._weightNext=g/(m-n),this._offsetPrev=u*_,this._offsetNext=f*_}interpolate_(e,t,n,s){const u=this.resultBuffer,f=this.sampleValues,h=this.valueSize,m=e*h,g=m-h,_=this._offsetPrev,x=this._offsetNext,b=this._weightPrev,M=this._weightNext,A=(n-t)/(s-t),R=A*A,w=R*A,E=-b*w+2*b*R-b*A,N=(1+b)*w+(-1.5-2*b)*R+(-.5+b)*A+1,D=(-1-M)*w+(1.5+M)*R+.5*A,U=M*w-M*R;for(let B=0;B!==h;++B)u[B]=E*f[_+B]+N*f[g+B]+D*f[m+B]+U*f[x+B];return u}}class Yb extends Um{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const u=this.resultBuffer,f=this.sampleValues,h=this.valueSize,m=e*h,g=m-h,_=(n-t)/(s-t),x=1-_;for(let b=0;b!==h;++b)u[b]=f[g+b]*x+f[m+b]*_;return u}}class MT extends Um{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class _r{constructor(e,t,n,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Qc(t,this.TimeBufferType),this.values=Qc(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Qc(e.times,Array),values:Qc(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new MT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Yb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ST(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case fm:t=this.InterpolantFactoryMethodDiscrete;break;case ay:t=this.InterpolantFactoryMethodLinear;break;case dv:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return ft("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return fm;case this.InterpolantFactoryMethodLinear:return ay;case this.InterpolantFactoryMethodSmooth:return dv}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]*=e}return this}trim(e,t){const n=this.times,s=n.length;let u=0,f=s-1;for(;u!==s&&n[u]<e;)++u;for(;f!==-1&&n[f]>t;)--f;if(++f,u!==0||f!==s){u>=f&&(f=Math.max(f,1),u=f-1);const h=this.getValueSize();this.times=n.slice(u,f),this.values=this.values.slice(u*h,f*h)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Rt("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,s=this.values,u=n.length;u===0&&(Rt("KeyframeTrack: Track is empty.",this),e=!1);let f=null;for(let h=0;h!==u;h++){const m=n[h];if(typeof m=="number"&&isNaN(m)){Rt("KeyframeTrack: Time is not a valid number.",this,h,m),e=!1;break}if(f!==null&&f>m){Rt("KeyframeTrack: Out of order keys.",this,h,m,f),e=!1;break}f=m}if(s!==void 0&&FE(s))for(let h=0,m=s.length;h!==m;++h){const g=s[h];if(isNaN(g)){Rt("KeyframeTrack: Value is not a valid number.",this,h,g),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===dv,u=e.length-1;let f=1;for(let h=1;h<u;++h){let m=!1;const g=e[h],_=e[h+1];if(g!==_&&(h!==1||g!==e[0]))if(s)m=!0;else{const x=h*n,b=x-n,M=x+n;for(let A=0;A!==n;++A){const R=t[x+A];if(R!==t[b+A]||R!==t[M+A]){m=!0;break}}}if(m){if(h!==f){e[f]=e[h];const x=h*n,b=f*n;for(let M=0;M!==n;++M)t[b+M]=t[x+M]}++f}}if(u>0){e[f]=e[u];for(let h=u*n,m=f*n,g=0;g!==n;++g)t[m+g]=t[h+g];++f}return f!==e.length?(this.times=e.slice(0,f),this.values=t.slice(0,f*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}_r.prototype.ValueTypeName="";_r.prototype.TimeBufferType=Float32Array;_r.prototype.ValueBufferType=Float32Array;_r.prototype.DefaultInterpolation=ay;class uf extends _r{constructor(e,t,n){super(e,t,n)}}uf.prototype.ValueTypeName="bool";uf.prototype.ValueBufferType=Array;uf.prototype.DefaultInterpolation=fm;uf.prototype.InterpolantFactoryMethodLinear=void 0;uf.prototype.InterpolantFactoryMethodSmooth=void 0;class Zb extends _r{constructor(e,t,n,s){super(e,t,n,s)}}Zb.prototype.ValueTypeName="color";class xm extends _r{constructor(e,t,n,s){super(e,t,n,s)}}xm.prototype.ValueTypeName="number";class ET extends Um{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){const u=this.resultBuffer,f=this.sampleValues,h=this.valueSize,m=(n-t)/(s-t);let g=e*h;for(let _=g+h;g!==_;g+=4)Pa.slerpFlat(u,0,f,g-h,f,g,m);return u}}class Im extends _r{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new ET(this.times,this.values,this.getValueSize(),e)}}Im.prototype.ValueTypeName="quaternion";Im.prototype.InterpolantFactoryMethodSmooth=void 0;class cf extends _r{constructor(e,t,n){super(e,t,n)}}cf.prototype.ValueTypeName="string";cf.prototype.ValueBufferType=Array;cf.prototype.DefaultInterpolation=fm;cf.prototype.InterpolantFactoryMethodLinear=void 0;cf.prototype.InterpolantFactoryMethodSmooth=void 0;class bm extends _r{constructor(e,t,n,s){super(e,t,n,s)}}bm.prototype.ValueTypeName="vector";class Sm{constructor(e="",t=-1,n=[],s=Ey){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=Vs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,s=1/(e.fps||1);for(let f=0,h=n.length;f!==h;++f)t.push(IN(n[f]).scale(s));const u=new this(e.name,e.duration,t,e.blendMode);return u.uuid=e.uuid,u.userData=JSON.parse(e.userData||"{}"),u}static toJSON(e){const t=[],n=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let u=0,f=n.length;u!==f;++u)t.push(_r.toJSON(n[u]));return s}static CreateFromMorphTargetSequence(e,t,n,s){const u=t.length,f=[];for(let h=0;h<u;h++){let m=[],g=[];m.push((h+u-1)%u,h,(h+1)%u),g.push(0,1,0);const _=bT(m);m=Kx(m,1,_),g=Kx(g,1,_),!s&&m[0]===0&&(m.push(u),g.push(g[0])),f.push(new xm(".morphTargetInfluences["+t[h].name+"]",m,g).scale(1/n))}return new this(e,-1,f)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const s=e;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===t)return n[s];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const s={},u=/^([\w-]*?)([\d]+)$/;for(let h=0,m=e.length;h<m;h++){const g=e[h],_=g.name.match(u);if(_&&_.length>1){const x=_[1];let b=s[x];b||(s[x]=b=[]),b.push(g)}}const f=[];for(const h in s)f.push(this.CreateFromMorphTargetSequence(h,s[h],t,n));return f}static parseAnimation(e,t){if(ft("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Rt("AnimationClip: No animation in JSONLoader data."),null;const n=function(x,b,M,A,R){if(M.length!==0){const w=[],E=[];jb(M,w,E,A),w.length!==0&&R.push(new x(b,w,E))}},s=[],u=e.name||"default",f=e.fps||30,h=e.blendMode;let m=e.length||-1;const g=e.hierarchy||[];for(let x=0;x<g.length;x++){const b=g[x].keys;if(!(!b||b.length===0))if(b[0].morphTargets){const M={};let A;for(A=0;A<b.length;A++)if(b[A].morphTargets)for(let R=0;R<b[A].morphTargets.length;R++)M[b[A].morphTargets[R]]=-1;for(const R in M){const w=[],E=[];for(let N=0;N!==b[A].morphTargets.length;++N){const D=b[A];w.push(D.time),E.push(D.morphTarget===R?1:0)}s.push(new xm(".morphTargetInfluence["+R+"]",w,E))}m=M.length*f}else{const M=".bones["+t[x].name+"]";n(bm,M+".position",b,"pos",s),n(Im,M+".quaternion",b,"rot",s),n(bm,M+".scale",b,"scl",s)}}return s.length===0?null:new this(u,m,s,h)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,s=e.length;n!==s;++n){const u=this.tracks[n];t=Math.max(t,u.times[u.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function UN(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xm;case"vector":case"vector2":case"vector3":case"vector4":return bm;case"color":return Zb;case"quaternion":return Im;case"bool":case"boolean":return uf;case"string":return cf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function IN(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=UN(r.type);if(r.times===void 0){const t=[],n=[];jb(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Oo={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Qb{constructor(e,t,n){const s=this;let u=!1,f=0,h=0,m;const g=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(_){h++,u===!1&&s.onStart!==void 0&&s.onStart(_,f,h),u=!0},this.itemEnd=function(_){f++,s.onProgress!==void 0&&s.onProgress(_,f,h),f===h&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return m?m(_):_},this.setURLModifier=function(_){return m=_,this},this.addHandler=function(_,x){return g.push(_,x),this},this.removeHandler=function(_){const x=g.indexOf(_);return x!==-1&&g.splice(x,2),this},this.getHandler=function(_){for(let x=0,b=g.length;x<b;x+=2){const M=g[x],A=g[x+1];if(M.global&&(M.lastIndex=0),M.test(_))return A}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const TT=new Qb;class Ns{constructor(e){this.manager=e!==void 0?e:TT,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(s,u){n.load(e,s,t,u)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Ns.DEFAULT_MATERIAL_NAME="__DEFAULT";const Al={};class ON extends Error{constructor(e,t){super(e),this.response=t}}class Ul extends Ns{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=Oo.get(`file:${e}`);if(u!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(u),this.manager.itemEnd(e)},0),u;if(Al[e]!==void 0){Al[e].push({onLoad:t,onProgress:n,onError:s});return}Al[e]=[],Al[e].push({onLoad:t,onProgress:n,onError:s});const f=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),h=this.mimeType,m=this.responseType;fetch(f).then(g=>{if(g.status===200||g.status===0){if(g.status===0&&ft("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||g.body===void 0||g.body.getReader===void 0)return g;const _=Al[e],x=g.body.getReader(),b=g.headers.get("X-File-Size")||g.headers.get("Content-Length"),M=b?parseInt(b):0,A=M!==0;let R=0;const w=new ReadableStream({start(E){N();function N(){x.read().then(({done:D,value:U})=>{if(D)E.close();else{R+=U.byteLength;const B=new ProgressEvent("progress",{lengthComputable:A,loaded:R,total:M});for(let z=0,H=_.length;z<H;z++){const W=_[z];W.onProgress&&W.onProgress(B)}E.enqueue(U),N()}},D=>{E.error(D)})}}});return new Response(w)}else throw new ON(`fetch for "${g.url}" responded with ${g.status}: ${g.statusText}`,g)}).then(g=>{switch(m){case"arraybuffer":return g.arrayBuffer();case"blob":return g.blob();case"document":return g.text().then(_=>new DOMParser().parseFromString(_,h));case"json":return g.json();default:if(h==="")return g.text();{const x=/charset="?([^;"\s]*)"?/i.exec(h),b=x&&x[1]?x[1].toLowerCase():void 0,M=new TextDecoder(b);return g.arrayBuffer().then(A=>M.decode(A))}}}).then(g=>{Oo.add(`file:${e}`,g);const _=Al[e];delete Al[e];for(let x=0,b=_.length;x<b;x++){const M=_[x];M.onLoad&&M.onLoad(g)}}).catch(g=>{const _=Al[e];if(_===void 0)throw this.manager.itemError(e),g;delete Al[e];for(let x=0,b=_.length;x<b;x++){const M=_[x];M.onError&&M.onError(g)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class PN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=new Ul(this.manager);f.setPath(this.path),f.setRequestHeader(this.requestHeader),f.setWithCredentials(this.withCredentials),f.load(e,function(h){try{t(u.parse(JSON.parse(h)))}catch(m){s?s(m):Rt(m),u.manager.itemError(e)}},n,s)}parse(e){const t=[];for(let n=0;n<e.length;n++){const s=Sm.parse(e[n]);t.push(s)}return t}}class zN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=[],h=new Oy,m=new Ul(this.manager);m.setPath(this.path),m.setResponseType("arraybuffer"),m.setRequestHeader(this.requestHeader),m.setWithCredentials(u.withCredentials);let g=0;function _(x){m.load(e[x],function(b){const M=u.parse(b,!0);f[x]={width:M.width,height:M.height,format:M.format,mipmaps:M.mipmaps},g+=1,g===6&&(M.mipmapCount===1&&(h.minFilter=oi),h.image=f,h.format=M.format,h.needsUpdate=!0,t&&t(h))},n,s)}if(Array.isArray(e))for(let x=0,b=e.length;x<b;++x)_(x);else m.load(e,function(x){const b=u.parse(x,!0);if(b.isCubemap){const M=b.mipmaps.length/b.mipmapCount;for(let A=0;A<M;A++){f[A]={mipmaps:[]};for(let R=0;R<b.mipmapCount;R++)f[A].mipmaps.push(b.mipmaps[A*b.mipmapCount+R]),f[A].format=b.format,f[A].width=b.width,f[A].height=b.height}h.image=f}else h.image.width=b.width,h.image.height=b.height,h.mipmaps=b.mipmaps;b.mipmapCount===1&&(h.minFilter=oi),h.format=b.format,h.needsUpdate=!0,t&&t(h)},n,s);return h}}const Ih=new WeakMap;class Mm extends Ns{constructor(e){super(e)}load(e,t,n,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=this,f=Oo.get(`image:${e}`);if(f!==void 0){if(f.complete===!0)u.manager.itemStart(e),setTimeout(function(){t&&t(f),u.manager.itemEnd(e)},0);else{let x=Ih.get(f);x===void 0&&(x=[],Ih.set(f,x)),x.push({onLoad:t,onError:s})}return f}const h=mm("img");function m(){_(),t&&t(this);const x=Ih.get(this)||[];for(let b=0;b<x.length;b++){const M=x[b];M.onLoad&&M.onLoad(this)}Ih.delete(this),u.manager.itemEnd(e)}function g(x){_(),s&&s(x),Oo.remove(`image:${e}`);const b=Ih.get(this)||[];for(let M=0;M<b.length;M++){const A=b[M];A.onError&&A.onError(x)}Ih.delete(this),u.manager.itemError(e),u.manager.itemEnd(e)}function _(){h.removeEventListener("load",m,!1),h.removeEventListener("error",g,!1)}return h.addEventListener("load",m,!1),h.addEventListener("error",g,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(h.crossOrigin=this.crossOrigin),Oo.add(`image:${e}`,h),u.manager.itemStart(e),h.src=e,h}}class BN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=new Cm;u.colorSpace=Ia;const f=new Mm(this.manager);f.setCrossOrigin(this.crossOrigin),f.setPath(this.path);let h=0;function m(g){f.load(e[g],function(_){u.images[g]=_,h++,h===6&&(u.needsUpdate=!0,t&&t(u))},void 0,s)}for(let g=0;g<e.length;++g)m(g);return u}}class FN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=new Yr,h=new Ul(this.manager);return h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setPath(this.path),h.setWithCredentials(u.withCredentials),h.load(e,function(m){let g;try{g=u.parse(m)}catch(_){if(s!==void 0)s(_);else{_(_);return}}g.image!==void 0?f.image=g.image:g.data!==void 0&&(f.image.width=g.width,f.image.height=g.height,f.image.data=g.data),f.wrapS=g.wrapS!==void 0?g.wrapS:Rs,f.wrapT=g.wrapT!==void 0?g.wrapT:Rs,f.magFilter=g.magFilter!==void 0?g.magFilter:oi,f.minFilter=g.minFilter!==void 0?g.minFilter:oi,f.anisotropy=g.anisotropy!==void 0?g.anisotropy:1,g.colorSpace!==void 0&&(f.colorSpace=g.colorSpace),g.flipY!==void 0&&(f.flipY=g.flipY),g.format!==void 0&&(f.format=g.format),g.type!==void 0&&(f.type=g.type),g.mipmaps!==void 0&&(f.mipmaps=g.mipmaps,f.minFilter=Io),g.mipmapCount===1&&(f.minFilter=oi),g.generateMipmaps!==void 0&&(f.generateMipmaps=g.generateMipmaps),f.needsUpdate=!0,t&&t(f,g)},n,s),f}}class kN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=new wi,f=new Mm(this.manager);return f.setCrossOrigin(this.crossOrigin),f.setPath(this.path),f.load(e,function(h){u.image=h,u.needsUpdate=!0,t!==void 0&&t(u)},n,s),u}}class Gu extends Cn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new yt(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 AT extends Gu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Cn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new yt(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 vx=new Xt,jM=new j,YM=new j;class Kb{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ze(512,512),this.mapType=ts,this.map=null,this.mapPass=null,this.matrix=new Xt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ad,this._frameExtents=new ze(1,1),this._viewportCount=1,this._viewports=[new jn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;jM.setFromMatrixPosition(e.matrixWorld),t.position.copy(jM),YM.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(YM),t.updateMatrixWorld(),vx.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vx,t.coordinateSystem,t.reversedDepth),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(vx)}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}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class VN extends Kb{constructor(){super(new zi(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Qh*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,u=e.distance||t.far;(n!==t.fov||s!==t.aspect||u!==t.far)&&(t.fov=n,t.aspect=s,t.far=u,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class wT extends Gu{constructor(e,t,n=0,s=Math.PI/3,u=0,f=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Cn.DEFAULT_UP),this.updateMatrix(),this.target=new Cn,this.distance=n,this.angle=s,this.penumbra=u,this.decay=f,this.map=null,this.shadow=new VN}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 HN extends Kb{constructor(){super(new zi(90,1,.5,500)),this.isPointLightShadow=!0}}class CT extends Gu{constructor(e,t,n=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new HN}get power(){return this.intensity*4*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 Dl extends Ry{constructor(e=-1,t=1,n=1,s=-1,u=.1,f=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=s,this.near=u,this.far=f,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=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,s,u,f){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=u,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(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,s=(this.top+this.bottom)/2;let u=n-e,f=n+e,h=s+t,m=s-t;if(this.view!==null&&this.view.enabled){const g=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;u+=g*this.view.offsetX,f=u+g*this.view.width,h-=_*this.view.offsetY,m=h-_*this.view.height}this.projectionMatrix.makeOrthographic(u,f,h,m,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class GN extends Kb{constructor(){super(new Dl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class RT extends Gu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Cn.DEFAULT_UP),this.updateMatrix(),this.target=new Cn,this.shadow=new GN}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 NT extends Gu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class DT extends Gu{constructor(e,t,n=10,s=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=s}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 Jb{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new j)}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,s=e.y,u=e.z,f=this.coefficients;return t.copy(f[0]).multiplyScalar(.282095),t.addScaledVector(f[1],.488603*s),t.addScaledVector(f[2],.488603*u),t.addScaledVector(f[3],.488603*n),t.addScaledVector(f[4],1.092548*(n*s)),t.addScaledVector(f[5],1.092548*(s*u)),t.addScaledVector(f[6],.315392*(3*u*u-1)),t.addScaledVector(f[7],1.092548*(n*u)),t.addScaledVector(f[8],.546274*(n*n-s*s)),t}getIrradianceAt(e,t){const n=e.x,s=e.y,u=e.z,f=this.coefficients;return t.copy(f[0]).multiplyScalar(.886227),t.addScaledVector(f[1],2*.511664*s),t.addScaledVector(f[2],2*.511664*u),t.addScaledVector(f[3],2*.511664*n),t.addScaledVector(f[4],2*.429043*n*s),t.addScaledVector(f[5],2*.429043*s*u),t.addScaledVector(f[6],.743125*u*u-.247708),t.addScaledVector(f[7],2*.429043*n*u),t.addScaledVector(f[8],.429043*(n*n-s*s)),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,t=0){const n=this.coefficients;for(let s=0;s<9;s++)n[s].fromArray(e,t+s*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let s=0;s<9;s++)n[s].toArray(e,t+s*3);return e}static getBasisAt(e,t){const n=e.x,s=e.y,u=e.z;t[0]=.282095,t[1]=.488603*s,t[2]=.488603*u,t[3]=.488603*n,t[4]=1.092548*n*s,t[5]=1.092548*s*u,t[6]=.315392*(3*u*u-1),t[7]=1.092548*n*u,t[8]=.546274*(n*n-s*s)}}class LT extends Gu{constructor(e=new Jb,t=1){super(void 0,t),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 Zy extends Ns{constructor(e){super(e),this.textures={}}load(e,t,n,s){const u=this,f=new Ul(u.manager);f.setPath(u.path),f.setRequestHeader(u.requestHeader),f.setWithCredentials(u.withCredentials),f.load(e,function(h){try{t(u.parse(JSON.parse(h)))}catch(m){s?s(m):Rt(m),u.manager.itemError(e)}},n,s)}parse(e){const t=this.textures;function n(u){return t[u]===void 0&&ft("MaterialLoader: Undefined texture",u),t[u]}const s=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(s.uuid=e.uuid),e.name!==void 0&&(s.name=e.name),e.color!==void 0&&s.color!==void 0&&s.color.setHex(e.color),e.roughness!==void 0&&(s.roughness=e.roughness),e.metalness!==void 0&&(s.metalness=e.metalness),e.sheen!==void 0&&(s.sheen=e.sheen),e.sheenColor!==void 0&&(s.sheenColor=new yt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(s.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&s.emissive!==void 0&&s.emissive.setHex(e.emissive),e.specular!==void 0&&s.specular!==void 0&&s.specular.setHex(e.specular),e.specularIntensity!==void 0&&(s.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&s.specularColor!==void 0&&s.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(s.shininess=e.shininess),e.clearcoat!==void 0&&(s.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(s.dispersion=e.dispersion),e.iridescence!==void 0&&(s.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(s.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(s.transmission=e.transmission),e.thickness!==void 0&&(s.thickness=e.thickness),e.attenuationDistance!==void 0&&(s.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&s.attenuationColor!==void 0&&s.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(s.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(s.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(s.fog=e.fog),e.flatShading!==void 0&&(s.flatShading=e.flatShading),e.blending!==void 0&&(s.blending=e.blending),e.combine!==void 0&&(s.combine=e.combine),e.side!==void 0&&(s.side=e.side),e.shadowSide!==void 0&&(s.shadowSide=e.shadowSide),e.opacity!==void 0&&(s.opacity=e.opacity),e.transparent!==void 0&&(s.transparent=e.transparent),e.alphaTest!==void 0&&(s.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(s.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(s.depthFunc=e.depthFunc),e.depthTest!==void 0&&(s.depthTest=e.depthTest),e.depthWrite!==void 0&&(s.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(s.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(s.blendSrc=e.blendSrc),e.blendDst!==void 0&&(s.blendDst=e.blendDst),e.blendEquation!==void 0&&(s.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(s.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(s.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(s.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&s.blendColor!==void 0&&s.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(s.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(s.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(s.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(s.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(s.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(s.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(s.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(s.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(s.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(s.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(s.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(s.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(s.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(s.rotation=e.rotation),e.linewidth!==void 0&&(s.linewidth=e.linewidth),e.dashSize!==void 0&&(s.dashSize=e.dashSize),e.gapSize!==void 0&&(s.gapSize=e.gapSize),e.scale!==void 0&&(s.scale=e.scale),e.polygonOffset!==void 0&&(s.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(s.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(s.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(s.dithering=e.dithering),e.alphaToCoverage!==void 0&&(s.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(s.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(s.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(s.allowOverride=e.allowOverride),e.visible!==void 0&&(s.visible=e.visible),e.toneMapped!==void 0&&(s.toneMapped=e.toneMapped),e.userData!==void 0&&(s.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?s.vertexColors=e.vertexColors>0:s.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const u in e.uniforms){const f=e.uniforms[u];switch(s.uniforms[u]={},f.type){case"t":s.uniforms[u].value=n(f.value);break;case"c":s.uniforms[u].value=new yt().setHex(f.value);break;case"v2":s.uniforms[u].value=new ze().fromArray(f.value);break;case"v3":s.uniforms[u].value=new j().fromArray(f.value);break;case"v4":s.uniforms[u].value=new jn().fromArray(f.value);break;case"m3":s.uniforms[u].value=new en().fromArray(f.value);break;case"m4":s.uniforms[u].value=new Xt().fromArray(f.value);break;default:s.uniforms[u].value=f.value}}if(e.defines!==void 0&&(s.defines=e.defines),e.vertexShader!==void 0&&(s.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(s.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(s.glslVersion=e.glslVersion),e.extensions!==void 0)for(const u in e.extensions)s.extensions[u]=e.extensions[u];if(e.lights!==void 0&&(s.lights=e.lights),e.clipping!==void 0&&(s.clipping=e.clipping),e.size!==void 0&&(s.size=e.size),e.sizeAttenuation!==void 0&&(s.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(s.map=n(e.map)),e.matcap!==void 0&&(s.matcap=n(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(s.normalMapType=e.normalMapType),e.normalScale!==void 0){let u=e.normalScale;Array.isArray(u)===!1&&(u=[u,u]),s.normalScale=new ze().fromArray(u)}return e.displacementMap!==void 0&&(s.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=n(e.envMap)),e.envMapRotation!==void 0&&s.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(s.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(s.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(s.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(s.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new ze().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(s.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=n(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Zy.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:dT,SpriteMaterial:Ub,RawShaderMaterial:Gb,ShaderMaterial:yr,PointsMaterial:Ob,MeshPhysicalMaterial:pT,MeshStandardMaterial:Xb,MeshPhongMaterial:mT,MeshToonMaterial:gT,MeshNormalMaterial:vT,MeshLambertMaterial:yT,MeshDepthMaterial:Wb,MeshDistanceMaterial:qb,MeshBasicMaterial:Vu,MeshMatcapMaterial:_T,LineDashedMaterial:xT,LineBasicMaterial:ss,Material:Ba};return new t[e]}}class Jx{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||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 UT extends Kt{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 IT extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=new Ul(u.manager);f.setPath(u.path),f.setRequestHeader(u.requestHeader),f.setWithCredentials(u.withCredentials),f.load(e,function(h){try{t(u.parse(JSON.parse(h)))}catch(m){s?s(m):Rt(m),u.manager.itemError(e)}},n,s)}parse(e){const t={},n={};function s(M,A){if(t[A]!==void 0)return t[A];const w=M.interleavedBuffers[A],E=u(M,w.buffer),N=Hh(w.type,E),D=new Ly(N,w.stride);return D.uuid=w.uuid,t[A]=D,D}function u(M,A){if(n[A]!==void 0)return n[A];const w=M.arrayBuffers[A],E=new Uint32Array(w).buffer;return n[A]=E,E}const f=e.isInstancedBufferGeometry?new UT:new Kt,h=e.data.index;if(h!==void 0){const M=Hh(h.type,h.array);f.setIndex(new Xn(M,1))}const m=e.data.attributes;for(const M in m){const A=m[M];let R;if(A.isInterleavedBufferAttribute){const w=s(e.data,A.data);R=new nf(w,A.itemSize,A.offset,A.normalized)}else{const w=Hh(A.type,A.array),E=A.isInstancedBufferAttribute?$h:Xn;R=new E(w,A.itemSize,A.normalized)}A.name!==void 0&&(R.name=A.name),A.usage!==void 0&&R.setUsage(A.usage),f.setAttribute(M,R)}const g=e.data.morphAttributes;if(g)for(const M in g){const A=g[M],R=[];for(let w=0,E=A.length;w<E;w++){const N=A[w];let D;if(N.isInterleavedBufferAttribute){const U=s(e.data,N.data);D=new nf(U,N.itemSize,N.offset,N.normalized)}else{const U=Hh(N.type,N.array);D=new Xn(U,N.itemSize,N.normalized)}N.name!==void 0&&(D.name=N.name),R.push(D)}f.morphAttributes[M]=R}e.data.morphTargetsRelative&&(f.morphTargetsRelative=!0);const x=e.data.groups||e.data.drawcalls||e.data.offsets;if(x!==void 0)for(let M=0,A=x.length;M!==A;++M){const R=x[M];f.addGroup(R.start,R.count,R.materialIndex)}const b=e.data.boundingSphere;return b!==void 0&&(f.boundingSphere=new _a().fromJSON(b)),e.name&&(f.name=e.name),e.userData&&(f.userData=e.userData),f}}class XN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=this.path===""?Jx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||f;const h=new Ul(this.manager);h.setPath(this.path),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(m){let g=null;try{g=JSON.parse(m)}catch(x){s!==void 0&&s(x),x("ObjectLoader: Can't parse "+e+".",x.message);return}const _=g.metadata;if(_===void 0||_.type===void 0||_.type.toLowerCase()==="geometry"){s!==void 0&&s(new Error("THREE.ObjectLoader: Can't load "+e)),Rt("ObjectLoader: Can't load "+e);return}u.parse(g,t)},n,s)}async loadAsync(e,t){const n=this,s=this.path===""?Jx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const u=new Ul(this.manager);u.setPath(this.path),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials);const f=await u.loadAsync(e,t),h=JSON.parse(f),m=h.metadata;if(m===void 0||m.type===void 0||m.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(h)}parse(e,t){const n=this.parseAnimations(e.animations),s=this.parseShapes(e.shapes),u=this.parseGeometries(e.geometries,s),f=this.parseImages(e.images,function(){t!==void 0&&t(g)}),h=this.parseTextures(e.textures,f),m=this.parseMaterials(e.materials,h),g=this.parseObject(e.object,u,m,h,n),_=this.parseSkeletons(e.skeletons,g);if(this.bindSkeletons(g,_),this.bindLightTargets(g),t!==void 0){let x=!1;for(const b in f)if(f[b].data instanceof HTMLImageElement){x=!0;break}x===!1&&t(g)}return g}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,n),u=await this.parseImagesAsync(e.images),f=this.parseTextures(e.textures,u),h=this.parseMaterials(e.materials,f),m=this.parseObject(e.object,s,h,f,t),g=this.parseSkeletons(e.skeletons,m);return this.bindSkeletons(m,g),this.bindLightTargets(m),m}parseShapes(e){const t={};if(e!==void 0)for(let n=0,s=e.length;n<s;n++){const u=new $c().fromJSON(e[n]);t[u.uuid]=u}return t}parseSkeletons(e,t){const n={},s={};if(t.traverse(function(u){u.isBone&&(s[u.uuid]=u)}),e!==void 0)for(let u=0,f=e.length;u<f;u++){const h=new Uy().fromJSON(e[u],s);n[h.uuid]=h}return n}parseGeometries(e,t){const n={};if(e!==void 0){const s=new IT;for(let u=0,f=e.length;u<f;u++){let h;const m=e[u];switch(m.type){case"BufferGeometry":case"InstancedBufferGeometry":h=s.parse(m);break;default:m.type in qM?h=qM[m.type].fromJSON(m,t):ft(`ObjectLoader: Unsupported geometry type "${m.type}"`)}h.uuid=m.uuid,m.name!==void 0&&(h.name=m.name),m.userData!==void 0&&(h.userData=m.userData),n[m.uuid]=h}}return n}parseMaterials(e,t){const n={},s={};if(e!==void 0){const u=new Zy;u.setTextures(t);for(let f=0,h=e.length;f<h;f++){const m=e[f];n[m.uuid]===void 0&&(n[m.uuid]=u.parse(m)),s[m.uuid]=n[m.uuid]}}return s}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const s=e[n],u=Sm.parse(s);t[u.uuid]=u}return t}parseImages(e,t){const n=this,s={};let u;function f(m){return n.manager.itemStart(m),u.load(m,function(){n.manager.itemEnd(m)},void 0,function(){n.manager.itemError(m),n.manager.itemEnd(m)})}function h(m){if(typeof m=="string"){const g=m,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(g)?g:n.resourcePath+g;return f(_)}else return m.data?{data:Hh(m.type,m.data),width:m.width,height:m.height}:null}if(e!==void 0&&e.length>0){const m=new Qb(t);u=new Mm(m),u.setCrossOrigin(this.crossOrigin);for(let g=0,_=e.length;g<_;g++){const x=e[g],b=x.url;if(Array.isArray(b)){const M=[];for(let A=0,R=b.length;A<R;A++){const w=b[A],E=h(w);E!==null&&(E instanceof HTMLImageElement?M.push(E):M.push(new Yr(E.data,E.width,E.height)))}s[x.uuid]=new Iu(M)}else{const M=h(x.url);s[x.uuid]=new Iu(M)}}}return s}async parseImagesAsync(e){const t=this,n={};let s;async function u(f){if(typeof f=="string"){const h=f,m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:t.resourcePath+h;return await s.loadAsync(m)}else return f.data?{data:Hh(f.type,f.data),width:f.width,height:f.height}:null}if(e!==void 0&&e.length>0){s=new Mm(this.manager),s.setCrossOrigin(this.crossOrigin);for(let f=0,h=e.length;f<h;f++){const m=e[f],g=m.url;if(Array.isArray(g)){const _=[];for(let x=0,b=g.length;x<b;x++){const M=g[x],A=await u(M);A!==null&&(A instanceof HTMLImageElement?_.push(A):_.push(new Yr(A.data,A.width,A.height)))}n[m.uuid]=new Iu(_)}else{const _=await u(m.url);n[m.uuid]=new Iu(_)}}}return n}parseTextures(e,t){function n(u,f){return typeof u=="number"?u:(ft("ObjectLoader.parseTexture: Constant should be in numeric form.",u),f[u])}const s={};if(e!==void 0)for(let u=0,f=e.length;u<f;u++){const h=e[u];h.image===void 0&&ft('ObjectLoader: No "image" specified for',h.uuid),t[h.image]===void 0&&ft("ObjectLoader: Undefined image",h.image);const m=t[h.image],g=m.data;let _;Array.isArray(g)?(_=new Cm,g.length===6&&(_.needsUpdate=!0)):(g&&g.data?_=new Yr:_=new wi,g&&(_.needsUpdate=!0)),_.source=m,_.uuid=h.uuid,h.name!==void 0&&(_.name=h.name),h.mapping!==void 0&&(_.mapping=n(h.mapping,WN)),h.channel!==void 0&&(_.channel=h.channel),h.offset!==void 0&&_.offset.fromArray(h.offset),h.repeat!==void 0&&_.repeat.fromArray(h.repeat),h.center!==void 0&&_.center.fromArray(h.center),h.rotation!==void 0&&(_.rotation=h.rotation),h.wrap!==void 0&&(_.wrapS=n(h.wrap[0],ZM),_.wrapT=n(h.wrap[1],ZM)),h.format!==void 0&&(_.format=h.format),h.internalFormat!==void 0&&(_.internalFormat=h.internalFormat),h.type!==void 0&&(_.type=h.type),h.colorSpace!==void 0&&(_.colorSpace=h.colorSpace),h.minFilter!==void 0&&(_.minFilter=n(h.minFilter,QM)),h.magFilter!==void 0&&(_.magFilter=n(h.magFilter,QM)),h.anisotropy!==void 0&&(_.anisotropy=h.anisotropy),h.flipY!==void 0&&(_.flipY=h.flipY),h.generateMipmaps!==void 0&&(_.generateMipmaps=h.generateMipmaps),h.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=h.premultiplyAlpha),h.unpackAlignment!==void 0&&(_.unpackAlignment=h.unpackAlignment),h.compareFunction!==void 0&&(_.compareFunction=h.compareFunction),h.userData!==void 0&&(_.userData=h.userData),s[h.uuid]=_}return s}parseObject(e,t,n,s,u){let f;function h(b){return t[b]===void 0&&ft("ObjectLoader: Undefined geometry",b),t[b]}function m(b){if(b!==void 0){if(Array.isArray(b)){const M=[];for(let A=0,R=b.length;A<R;A++){const w=b[A];n[w]===void 0&&ft("ObjectLoader: Undefined material",w),M.push(n[w])}return M}return n[b]===void 0&&ft("ObjectLoader: Undefined material",b),n[b]}}function g(b){return s[b]===void 0&&ft("ObjectLoader: Undefined texture",b),s[b]}let _,x;switch(e.type){case"Scene":f=new Lb,e.background!==void 0&&(Number.isInteger(e.background)?f.background=new yt(e.background):f.background=g(e.background)),e.environment!==void 0&&(f.environment=g(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?f.fog=new Dy(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(f.fog=new Ny(e.fog.color,e.fog.density)),e.fog.name!==""&&(f.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(f.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(f.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&f.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(f.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&f.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":f=new zi(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(f.focus=e.focus),e.zoom!==void 0&&(f.zoom=e.zoom),e.filmGauge!==void 0&&(f.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(f.filmOffset=e.filmOffset),e.view!==void 0&&(f.view=Object.assign({},e.view));break;case"OrthographicCamera":f=new Dl(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(f.zoom=e.zoom),e.view!==void 0&&(f.view=Object.assign({},e.view));break;case"AmbientLight":f=new NT(e.color,e.intensity);break;case"DirectionalLight":f=new RT(e.color,e.intensity),f.target=e.target||"";break;case"PointLight":f=new CT(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":f=new DT(e.color,e.intensity,e.width,e.height);break;case"SpotLight":f=new wT(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),f.target=e.target||"";break;case"HemisphereLight":f=new AT(e.color,e.groundColor,e.intensity);break;case"LightProbe":const b=new Jb().fromArray(e.sh);f=new LT(b,e.intensity);break;case"SkinnedMesh":_=h(e.geometry),x=m(e.material),f=new ZE(_,x),e.bindMode!==void 0&&(f.bindMode=e.bindMode),e.bindMatrix!==void 0&&f.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(f.skeleton=e.skeleton);break;case"Mesh":_=h(e.geometry),x=m(e.material),f=new Yi(_,x);break;case"InstancedMesh":_=h(e.geometry),x=m(e.material);const M=e.count,A=e.instanceMatrix,R=e.instanceColor;f=new QE(_,x,M),f.instanceMatrix=new $h(new Float32Array(A.array),16),R!==void 0&&(f.instanceColor=new $h(new Float32Array(R.array),R.itemSize));break;case"BatchedMesh":_=h(e.geometry),x=m(e.material),f=new KE(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,x),f.geometry=_,f.perObjectFrustumCulled=e.perObjectFrustumCulled,f.sortObjects=e.sortObjects,f._drawRanges=e.drawRanges,f._reservedRanges=e.reservedRanges,f._geometryInfo=e.geometryInfo.map(w=>{let E=null,N=null;return w.boundingBox!==void 0&&(E=new za().fromJSON(w.boundingBox)),w.boundingSphere!==void 0&&(N=new _a().fromJSON(w.boundingSphere)),{...w,boundingBox:E,boundingSphere:N}}),f._instanceInfo=e.instanceInfo,f._availableInstanceIds=e._availableInstanceIds,f._availableGeometryIds=e._availableGeometryIds,f._nextIndexStart=e.nextIndexStart,f._nextVertexStart=e.nextVertexStart,f._geometryCount=e.geometryCount,f._maxInstanceCount=e.maxInstanceCount,f._maxVertexCount=e.maxVertexCount,f._maxIndexCount=e.maxIndexCount,f._geometryInitialized=e.geometryInitialized,f._matricesTexture=g(e.matricesTexture.uuid),f._indirectTexture=g(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(f._colorsTexture=g(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(f.boundingSphere=new _a().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(f.boundingBox=new za().fromJSON(e.boundingBox));break;case"LOD":f=new YE;break;case"Line":f=new Fu(h(e.geometry),m(e.material));break;case"LineLoop":f=new JE(h(e.geometry),m(e.material));break;case"LineSegments":f=new Vo(h(e.geometry),m(e.material));break;case"PointCloud":case"Points":f=new $E(h(e.geometry),m(e.material));break;case"Sprite":f=new jE(m(e.material));break;case"Group":f=new Gh;break;case"Bone":f=new Ib;break;default:f=new Cn}if(f.uuid=e.uuid,e.name!==void 0&&(f.name=e.name),e.matrix!==void 0?(f.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(f.matrixAutoUpdate=e.matrixAutoUpdate),f.matrixAutoUpdate&&f.matrix.decompose(f.position,f.quaternion,f.scale)):(e.position!==void 0&&f.position.fromArray(e.position),e.rotation!==void 0&&f.rotation.fromArray(e.rotation),e.quaternion!==void 0&&f.quaternion.fromArray(e.quaternion),e.scale!==void 0&&f.scale.fromArray(e.scale)),e.up!==void 0&&f.up.fromArray(e.up),e.castShadow!==void 0&&(f.castShadow=e.castShadow),e.receiveShadow!==void 0&&(f.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(f.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(f.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(f.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(f.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&f.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(f.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(f.visible=e.visible),e.frustumCulled!==void 0&&(f.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(f.renderOrder=e.renderOrder),e.userData!==void 0&&(f.userData=e.userData),e.layers!==void 0&&(f.layers.mask=e.layers),e.children!==void 0){const b=e.children;for(let M=0;M<b.length;M++)f.add(this.parseObject(b[M],t,n,s,u))}if(e.animations!==void 0){const b=e.animations;for(let M=0;M<b.length;M++){const A=b[M];f.animations.push(u[A])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(f.autoUpdate=e.autoUpdate);const b=e.levels;for(let M=0;M<b.length;M++){const A=b[M],R=f.getObjectByProperty("uuid",A.object);R!==void 0&&f.addLevel(R,A.distance,A.hysteresis)}}return f}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const s=t[n.skeleton];s===void 0?ft("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(s,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,s=e.getObjectByProperty("uuid",n);s!==void 0?t.target=s:t.target=new Cn}})}}const WN={UVMapping:vy,CubeReflectionMapping:zo,CubeRefractionMapping:Pu,EquirectangularReflectionMapping:om,EquirectangularRefractionMapping:lm,CubeUVReflectionMapping:id},ZM={RepeatWrapping:um,ClampToEdgeWrapping:Rs,MirroredRepeatWrapping:cm},QM={NearestFilter:Bi,NearestMipmapNearestFilter:_b,NearestMipmapLinearFilter:Vh,LinearFilter:oi,LinearMipmapNearestFilter:Jp,LinearMipmapLinearFilter:Io},yx=new WeakMap;class qN extends Ns{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&ft("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ft("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=this,f=Oo.get(`image-bitmap:${e}`);if(f!==void 0){if(u.manager.itemStart(e),f.then){f.then(g=>{if(yx.has(f)===!0)s&&s(yx.get(f)),u.manager.itemError(e),u.manager.itemEnd(e);else return t&&t(g),u.manager.itemEnd(e),g});return}return setTimeout(function(){t&&t(f),u.manager.itemEnd(e)},0),f}const h={};h.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",h.headers=this.requestHeader,h.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const m=fetch(e,h).then(function(g){return g.blob()}).then(function(g){return createImageBitmap(g,Object.assign(u.options,{colorSpaceConversion:"none"}))}).then(function(g){return Oo.add(`image-bitmap:${e}`,g),t&&t(g),u.manager.itemEnd(e),g}).catch(function(g){s&&s(g),yx.set(m,g),Oo.remove(`image-bitmap:${e}`),u.manager.itemError(e),u.manager.itemEnd(e)});Oo.add(`image-bitmap:${e}`,m),u.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let ev;class $b{static getContext(){return ev===void 0&&(ev=new(window.AudioContext||window.webkitAudioContext)),ev}static setContext(e){ev=e}}class jN extends Ns{constructor(e){super(e)}load(e,t,n,s){const u=this,f=new Ul(this.manager);f.setResponseType("arraybuffer"),f.setPath(this.path),f.setRequestHeader(this.requestHeader),f.setWithCredentials(this.withCredentials),f.load(e,function(m){try{const g=m.slice(0);$b.getContext().decodeAudioData(g,function(x){t(x)}).catch(h)}catch(g){h(g)}},n,s);function h(m){s?s(m):Rt(m),u.manager.itemError(e)}}}const KM=new Xt,JM=new Xt,Oc=new Xt;class YN{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zi,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,Oc.copy(e.projectionMatrix);const s=t.eyeSep/2,u=s*t.near/t.focus,f=t.near*Math.tan(Jc*t.fov*.5)/t.zoom;let h,m;JM.elements[12]=-s,KM.elements[12]=s,h=-f*t.aspect+u,m=f*t.aspect+u,Oc.elements[0]=2*t.near/(m-h),Oc.elements[8]=(m+h)/(m-h),this.cameraL.projectionMatrix.copy(Oc),h=-f*t.aspect-u,m=f*t.aspect-u,Oc.elements[0]=2*t.near/(m-h),Oc.elements[8]=(m+h)/(m-h),this.cameraR.projectionMatrix.copy(Oc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(JM),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(KM)}}class OT extends zi{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class eS{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}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}}const Pc=new j,_x=new Pa,ZN=new j,zc=new j,Bc=new j;class QN extends Cn{constructor(){super(),this.type="AudioListener",this.context=$b.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new eS}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(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);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Pc,_x,ZN),zc.set(0,0,-1).applyQuaternion(_x),Bc.set(0,1,0).applyQuaternion(_x),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Pc.x,n),t.positionY.linearRampToValueAtTime(Pc.y,n),t.positionZ.linearRampToValueAtTime(Pc.z,n),t.forwardX.linearRampToValueAtTime(zc.x,n),t.forwardY.linearRampToValueAtTime(zc.y,n),t.forwardZ.linearRampToValueAtTime(zc.z,n),t.upX.linearRampToValueAtTime(Bc.x,n),t.upY.linearRampToValueAtTime(Bc.y,n),t.upZ.linearRampToValueAtTime(Bc.z,n)}else t.setPosition(Pc.x,Pc.y,Pc.z),t.setOrientation(zc.x,zc.y,zc.z,Bc.x,Bc.y,Bc.z)}}let PT=class extends Cn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){ft("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ft("Audio: this Audio has no playback control.");return}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(this.hasPlaybackControl===!1){ft("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ft("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){ft("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(ft("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){ft("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(ft("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}};const Fc=new j,$M=new Pa,KN=new j,kc=new j;class JN extends PT{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Fc,$M,KN),kc.set(0,0,1).applyQuaternion($M);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Fc.x,n),t.positionY.linearRampToValueAtTime(Fc.y,n),t.positionZ.linearRampToValueAtTime(Fc.z,n),t.orientationX.linearRampToValueAtTime(kc.x,n),t.orientationY.linearRampToValueAtTime(kc.y,n),t.orientationZ.linearRampToValueAtTime(kc.z,n)}else t.setPosition(Fc.x,Fc.y,Fc.z),t.setOrientation(kc.x,kc.y,kc.z)}}class $N{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class zT{constructor(e,t,n){this.binding=e,this.valueSize=n;let s,u,f;switch(t){case"quaternion":s=this._slerp,u=this._slerpAdditive,f=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,u=this._select,f=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,u=this._lerpAdditive,f=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=u,this._setIdentity=f,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,s=this.valueSize,u=e*s+s;let f=this.cumulativeWeight;if(f===0){for(let h=0;h!==s;++h)n[u+h]=n[h];f=t}else{f+=t;const h=t/f;this._mixBufferRegion(n,u,0,h,s)}this.cumulativeWeight=f}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,s=e*t+t,u=this.cumulativeWeight,f=this.cumulativeWeightAdditive,h=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,u<1){const m=t*this._origIndex;this._mixBufferRegion(n,s,m,1-u,t)}f>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*t,1,t);for(let m=t,g=t+t;m!==g;++m)if(n[m]!==n[m+t]){h.setValue(n,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,s=n*this._origIndex;e.getValue(t,s);for(let u=n,f=s;u!==f;++u)t[u]=t[s+u%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,s,u){if(s>=.5)for(let f=0;f!==u;++f)e[t+f]=e[n+f]}_slerp(e,t,n,s){Pa.slerpFlat(e,t,e,t,e,n,s)}_slerpAdditive(e,t,n,s,u){const f=this._workIndex*u;Pa.multiplyQuaternionsFlat(e,f,e,t,e,n),Pa.slerpFlat(e,t,e,t,e,f,s)}_lerp(e,t,n,s,u){const f=1-s;for(let h=0;h!==u;++h){const m=t+h;e[m]=e[m]*f+e[n+h]*s}}_lerpAdditive(e,t,n,s,u){for(let f=0;f!==u;++f){const h=t+f;e[h]=e[h]+e[n+f]*s}}}const tS="\\[\\]\\.:\\/",eD=new RegExp("["+tS+"]","g"),nS="[^"+tS+"]",tD="[^"+tS.replace("\\.","")+"]",nD=/((?:WC+[\/:])*)/.source.replace("WC",nS),iD=/(WCOD+)?/.source.replace("WCOD",tD),aD=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nS),sD=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nS),rD=new RegExp("^"+nD+iD+aD+sD+"$"),oD=["material","materials","bones","map"];class lD{constructor(e,t,n){const s=n||wn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=n.length;s!==u;++s)n[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class wn{constructor(e,t,n){this.path=t,this.parsedPath=n||wn.parseTrackName(t),this.node=wn.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 wn.Composite(e,t,n):new wn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(eD,"")}static parseTrackName(e){const t=rD.exec(e);if(t===null)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]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const u=n.nodeName.substring(s+1);oD.indexOf(u)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=u)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(u){for(let f=0;f<u.length;f++){const h=u[f];if(h.name===t||h.uuid===t)return h;const m=n(h.children);if(m)return m}return null},s=n(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let s=0,u=n.length;s!==u;++s)e[t++]=n[s]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let s=0,u=n.length;s!==u;++s)n[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,u=n.length;s!==u;++s)n[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let s=0,u=n.length;s!==u;++s)n[s]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,s=t.propertyName;let u=t.propertyIndex;if(e||(e=wn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){ft("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let g=t.objectIndex;switch(n){case"materials":if(!e.material){Rt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Rt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Rt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let _=0;_<e.length;_++)if(e[_].name===g){g=_;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Rt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Rt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Rt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(g!==void 0){if(e[g]===void 0){Rt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[g]}}const f=e[s];if(f===void 0){const g=t.nodeName;Rt("PropertyBinding: Trying to update property for track: "+g+"."+s+" but it wasn't found.",e);return}let h=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?h=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let m=this.BindingType.Direct;if(u!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){Rt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Rt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[u]!==void 0&&(u=e.morphTargetDictionary[u])}m=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=u}else f.fromArray!==void 0&&f.toArray!==void 0?(m=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(m=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=s;this.getValue=this.GetterByBindingType[m],this.setValue=this.SetterByBindingTypeAndVersioning[m][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}wn.Composite=lD;wn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};wn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};wn.prototype.GetterByBindingType=[wn.prototype._getValue_direct,wn.prototype._getValue_array,wn.prototype._getValue_arrayElement,wn.prototype._getValue_toArray];wn.prototype.SetterByBindingTypeAndVersioning=[[wn.prototype._setValue_direct,wn.prototype._setValue_direct_setNeedsUpdate,wn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[wn.prototype._setValue_array,wn.prototype._setValue_array_setNeedsUpdate,wn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[wn.prototype._setValue_arrayElement,wn.prototype._setValue_arrayElement_setNeedsUpdate,wn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[wn.prototype._setValue_fromArray,wn.prototype._setValue_fromArray_setNeedsUpdate,wn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class uD{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Vs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,s=arguments.length;n!==s;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,s=this._parsedPaths,u=this._bindings,f=u.length;let h,m=e.length,g=this.nCachedObjects_;for(let _=0,x=arguments.length;_!==x;++_){const b=arguments[_],M=b.uuid;let A=t[M];if(A===void 0){A=m++,t[M]=A,e.push(b);for(let R=0,w=f;R!==w;++R)u[R].push(new wn(b,n[R],s[R]))}else if(A<g){h=e[A];const R=--g,w=e[R];t[w.uuid]=A,e[A]=w,t[M]=R,e[R]=b;for(let E=0,N=f;E!==N;++E){const D=u[E],U=D[R];let B=D[A];D[A]=U,B===void 0&&(B=new wn(b,n[E],s[E])),D[R]=B}}else e[A]!==h&&Rt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=g}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,s=n.length;let u=this.nCachedObjects_;for(let f=0,h=arguments.length;f!==h;++f){const m=arguments[f],g=m.uuid,_=t[g];if(_!==void 0&&_>=u){const x=u++,b=e[x];t[b.uuid]=_,e[_]=b,t[g]=x,e[x]=m;for(let M=0,A=s;M!==A;++M){const R=n[M],w=R[x],E=R[_];R[_]=w,R[x]=E}}}this.nCachedObjects_=u}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,s=n.length;let u=this.nCachedObjects_,f=e.length;for(let h=0,m=arguments.length;h!==m;++h){const g=arguments[h],_=g.uuid,x=t[_];if(x!==void 0)if(delete t[_],x<u){const b=--u,M=e[b],A=--f,R=e[A];t[M.uuid]=x,e[x]=M,t[R.uuid]=b,e[b]=R,e.pop();for(let w=0,E=s;w!==E;++w){const N=n[w],D=N[b],U=N[A];N[x]=D,N[b]=U,N.pop()}}else{const b=--f,M=e[b];b>0&&(t[M.uuid]=x),e[x]=M,e.pop();for(let A=0,R=s;A!==R;++A){const w=n[A];w[x]=w[b],w.pop()}}}this.nCachedObjects_=u}subscribe_(e,t){const n=this._bindingsIndicesByPath;let s=n[e];const u=this._bindings;if(s!==void 0)return u[s];const f=this._paths,h=this._parsedPaths,m=this._objects,g=m.length,_=this.nCachedObjects_,x=new Array(g);s=u.length,n[e]=s,f.push(e),h.push(t),u.push(x);for(let b=_,M=m.length;b!==M;++b){const A=m[b];x[b]=new wn(A,e,t)}return x}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const s=this._paths,u=this._parsedPaths,f=this._bindings,h=f.length-1,m=f[h],g=e[h];t[g]=n,f[n]=m,f.pop(),u[n]=u[h],u.pop(),s[n]=s[h],s.pop()}}}class BT{constructor(e,t,n=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=s;const u=t.tracks,f=u.length,h=new Array(f),m={endingStart:Yc,endingEnd:Yc};for(let g=0;g!==f;++g){const _=u[g].createInterpolant(null);h[g]=_,_.settings=m}this._interpolantSettings=m,this._interpolants=h,this._propertyBindings=new Array(f),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=CE,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(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,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const s=this._clip.duration,u=e._clip.duration,f=u/s,h=s/u;e.warp(1,f,t),this.warp(h,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(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 s=this._mixer,u=s.time,f=this.timeScale;let h=this._timeScaleInterpolant;h===null&&(h=s._lendControlInterpolant(),this._timeScaleInterpolant=h);const m=h.parameterPositions,g=h.sampleValues;return m[0]=u,m[1]=u+n,g[0]=e/f,g[1]=t/f,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(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,s){if(!this.enabled){this._updateWeight(e);return}const u=this._startTime;if(u!==null){const m=(e-u)*n;m<0||n===0?t=0:(this._startTime=null,t=n*m)}t*=this._updateTimeScale(e);const f=this._updateTime(t),h=this._updateWeight(e);if(h>0){const m=this._interpolants,g=this._propertyBindings;switch(this.blendMode){case Ab:for(let _=0,x=m.length;_!==x;++_)m[_].evaluate(f),g[_].accumulateAdditive(h);break;case Ey:default:for(let _=0,x=m.length;_!==x;++_)m[_].evaluate(f),g[_].accumulate(s,h)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const s=n.evaluate(e)[0];t*=s,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let s=this.time+e,u=this._loopCount;const f=n===RE;if(e===0)return u===-1?s:f&&(u&1)===1?t-s:s;if(n===wE){u===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(u===-1&&(e>=0?(u=0,this._setEndings(!0,this.repetitions===0,f)):this._setEndings(this.repetitions===0,!0,f)),s>=t||s<0){const h=Math.floor(s/t);s-=t*h,u+=Math.abs(h);const m=this.repetitions-u;if(m<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(m===1){const g=e<0;this._setEndings(g,!g,f)}else this._setEndings(!1,!1,f);this._loopCount=u,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:h})}}else this.time=s;if(f&&(u&1)===1)return t-s}return s}_setEndings(e,t,n){const s=this._interpolantSettings;n?(s.endingStart=Zc,s.endingEnd=Zc):(e?s.endingStart=this.zeroSlopeAtStart?Zc:Yc:s.endingStart=hm,t?s.endingEnd=this.zeroSlopeAtEnd?Zc:Yc:s.endingEnd=hm)}_scheduleFading(e,t,n){const s=this._mixer,u=s.time;let f=this._weightInterpolant;f===null&&(f=s._lendControlInterpolant(),this._weightInterpolant=f);const h=f.parameterPositions,m=f.sampleValues;return h[0]=u,m[0]=t,h[1]=u+e,m[1]=n,this}}const cD=new Float32Array(1);class fD extends ko{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,s=e._clip.tracks,u=s.length,f=e._propertyBindings,h=e._interpolants,m=n.uuid,g=this._bindingsByRootAndName;let _=g[m];_===void 0&&(_={},g[m]=_);for(let x=0;x!==u;++x){const b=s[x],M=b.name;let A=_[M];if(A!==void 0)++A.referenceCount,f[x]=A;else{if(A=f[x],A!==void 0){A._cacheIndex===null&&(++A.referenceCount,this._addInactiveBinding(A,m,M));continue}const R=t&&t._propertyBindings[x].binding.parsedPath;A=new zT(wn.create(n,M,R),b.ValueTypeName,b.getValueSize()),++A.referenceCount,this._addInactiveBinding(A,m,M),f[x]=A}h[x].resultBuffer=A.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,s=e._clip.uuid,u=this._actionsByClip[s];this._bindAction(e,u&&u.knownActions[0]),this._addInactiveAction(e,s,n)}const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const u=t[n];u.useCount++===0&&(this._lendBinding(u),u.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const u=t[n];--u.useCount===0&&(u.restoreOriginalState(),this._takeBackBinding(u))}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 t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const s=this._actions,u=this._actionsByClip;let f=u[t];if(f===void 0)f={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,u[t]=f;else{const h=f.knownActions;e._byClipCacheIndex=h.length,h.push(e)}e._cacheIndex=s.length,s.push(e),f.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],s=e._cacheIndex;n._cacheIndex=s,t[s]=n,t.pop(),e._cacheIndex=null;const u=e._clip.uuid,f=this._actionsByClip,h=f[u],m=h.knownActions,g=m[m.length-1],_=e._byClipCacheIndex;g._byClipCacheIndex=_,m[_]=g,m.pop(),e._byClipCacheIndex=null;const x=h.actionByRoot,b=(e._localRoot||this._root).uuid;delete x[b],m.length===0&&delete f[u],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,s=t.length;n!==s;++n){const u=t[n];--u.referenceCount===0&&this._removeInactiveBinding(u)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,s=this._nActiveActions++,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=n,t[n]=u}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,s=--this._nActiveActions,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=n,t[n]=u}_addInactiveBinding(e,t,n){const s=this._bindingsByRootAndName,u=this._bindings;let f=s[t];f===void 0&&(f={},s[t]=f),f[n]=e,e._cacheIndex=u.length,u.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,s=n.rootNode.uuid,u=n.path,f=this._bindingsByRootAndName,h=f[s],m=t[t.length-1],g=e._cacheIndex;m._cacheIndex=g,t[g]=m,t.pop(),delete h[u],Object.keys(h).length===0&&delete f[s]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,s=this._nActiveBindings++,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=n,t[n]=u}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,s=--this._nActiveBindings,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=n,t[n]=u}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Yb(new Float32Array(2),new Float32Array(2),1,cD),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,s=--this._nActiveControlInterpolants,u=t[s];e.__cacheIndex=s,t[s]=e,u.__cacheIndex=n,t[n]=u}clipAction(e,t,n){const s=t||this._root,u=s.uuid;let f=typeof e=="string"?Sm.findByName(s,e):e;const h=f!==null?f.uuid:e,m=this._actionsByClip[h];let g=null;if(n===void 0&&(f!==null?n=f.blendMode:n=Ey),m!==void 0){const x=m.actionByRoot[u];if(x!==void 0&&x.blendMode===n)return x;g=m.knownActions[0],f===null&&(f=g._clip)}if(f===null)return null;const _=new BT(this,f,t,n);return this._bindAction(_,g),this._addInactiveAction(_,h,u),_}existingAction(e,t){const n=t||this._root,s=n.uuid,u=typeof e=="string"?Sm.findByName(n,e):e,f=u?u.uuid:e,h=this._actionsByClip[f];return h!==void 0&&h.actionByRoot[s]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,s=this.time+=e,u=Math.sign(e),f=this._accuIndex^=1;for(let g=0;g!==n;++g)t[g]._update(s,e,u,f);const h=this._bindings,m=this._nActiveBindings;for(let g=0;g!==m;++g)h[g].apply(f);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,s=this._actionsByClip,u=s[n];if(u!==void 0){const f=u.knownActions;for(let h=0,m=f.length;h!==m;++h){const g=f[h];this._deactivateAction(g);const _=g._cacheIndex,x=t[t.length-1];g._cacheIndex=null,g._byClipCacheIndex=null,x._cacheIndex=_,t[_]=x,t.pop(),this._removeInactiveBindingsForAction(g)}delete s[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const f in n){const h=n[f].actionByRoot,m=h[t];m!==void 0&&(this._deactivateAction(m),this._removeInactiveAction(m))}const s=this._bindingsByRootAndName,u=s[t];if(u!==void 0)for(const f in u){const h=u[f];h.restoreOriginalState(),this._removeInactiveBinding(h)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class hD extends Cb{constructor(e=1,t=1,n=1,s={}){super(e,t,s),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Cy(null,e,t,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class iS{constructor(e){this.value=e}clone(){return new iS(this.value.clone===void 0?this.value:this.value.clone())}}let dD=0;class pD extends ko{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:dD++}),this.name="",this.usage=pm,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&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,s=t.length;n<s;n++){const u=Array.isArray(t[n])?t[n]:[t[n]];for(let f=0;f<u.length;f++)this.uniforms.push(u[f].clone())}return this}clone(){return new this.constructor().copy(this)}}class mD extends Ly{constructor(e,t,n=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 gD{constructor(e,t,n,s,u,f=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=s,this.count=u,this.normalized=f,this.version=0}set needsUpdate(e){e===!0&&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 e1=new Xt;class FT{constructor(e,t,n=0,s=1/0){this.ray=new of(e,t),this.near=n,this.far=s,this.camera=null,this.layers=new Kh,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):Rt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return e1.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(e1),this}intersectObject(e,t=!0,n=[]){return $x(e,this,n,t),n.sort(t1),n}intersectObjects(e,t=!0,n=[]){for(let s=0,u=e.length;s<u;s++)$x(e[s],this,n,t);return n.sort(t1),n}}function t1(r,e){return r.distance-e.distance}function $x(r,e,t,n){let s=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(s=!1),s===!0&&n===!0){const u=r.children;for(let f=0,h=u.length;f<h;f++)$x(u[f],e,t,!0)}}class vD{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,e.hidden!==void 0&&(this._pageVisibilityHandler=yD.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(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 this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function yD(){this._document.hidden===!1&&this.reset()}class eb{constructor(e=1,t=0,n=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(){return this.phi=Ht(this.phi,1e-6,Math.PI-1e-6),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),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class _D{constructor(e=1,t=0,n=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 aS{constructor(e,t,n,s){aS.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,s){const u=this.elements;return u[0]=e,u[2]=t,u[1]=n,u[3]=s,this}}const n1=new ze;class xD{constructor(e=new ze(1/0,1/0),t=new ze(-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<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=n1.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=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,n1).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 i1=new j,tv=new j,Oh=new j,Ph=new j,xx=new j,bD=new j,SD=new j;class MD{constructor(e=new j,t=new j){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){i1.subVectors(e,this.start),tv.subVectors(this.end,this.start);const n=tv.dot(tv);let u=tv.dot(i1)/n;return t&&(u=Ht(u,0,1)),u}closestPointToPoint(e,t,n){const s=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(s).add(this.start)}distanceSqToLine3(e,t=bD,n=SD){const s=10000000000000001e-32;let u,f;const h=this.start,m=e.start,g=this.end,_=e.end;Oh.subVectors(g,h),Ph.subVectors(_,m),xx.subVectors(h,m);const x=Oh.dot(Oh),b=Ph.dot(Ph),M=Ph.dot(xx);if(x<=s&&b<=s)return t.copy(h),n.copy(m),t.sub(n),t.dot(t);if(x<=s)u=0,f=M/b,f=Ht(f,0,1);else{const A=Oh.dot(xx);if(b<=s)f=0,u=Ht(-A/x,0,1);else{const R=Oh.dot(Ph),w=x*b-R*R;w!==0?u=Ht((R*M-A*b)/w,0,1):u=0,f=(R*u+M)/b,f<0?(f=0,u=Ht(-A/x,0,1)):f>1&&(f=1,u=Ht((R-A)/x,0,1))}}return t.copy(h).add(Oh.multiplyScalar(u)),n.copy(m).add(Ph.multiplyScalar(f)),t.sub(n),t.dot(t)}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 a1=new j;class ED extends Cn{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Kt,s=[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 f=0,h=1,m=32;f<m;f++,h++){const g=f/m*Math.PI*2,_=h/m*Math.PI*2;s.push(Math.cos(g),Math.sin(g),1,Math.cos(_),Math.sin(_),1)}n.setAttribute("position",new bt(s,3));const u=new ss({fog:!1,toneMapped:!1});this.cone=new Vo(n,u),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),a1.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(a1),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ru=new j,nv=new Xt,bx=new Xt;class TD extends Vo{constructor(e){const t=kT(e),n=new Kt,s=[],u=[];for(let g=0;g<t.length;g++){const _=t[g];_.parent&&_.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),u.push(0,0,0),u.push(0,0,0))}n.setAttribute("position",new bt(s,3)),n.setAttribute("color",new bt(u,3));const f=new ss({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,f),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const h=new yt(255),m=new yt(65280);this.setColors(h,m)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,s=n.getAttribute("position");bx.copy(this.root.matrixWorld).invert();for(let u=0,f=0;u<t.length;u++){const h=t[u];h.parent&&h.parent.isBone&&(nv.multiplyMatrices(bx,h.matrixWorld),Ru.setFromMatrixPosition(nv),s.setXYZ(f,Ru.x,Ru.y,Ru.z),nv.multiplyMatrices(bx,h.parent.matrixWorld),Ru.setFromMatrixPosition(nv),s.setXYZ(f+1,Ru.x,Ru.y,Ru.z),f+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const s=this.geometry.getAttribute("color");for(let u=0;u<s.count;u+=2)s.setXYZ(u,e.r,e.g,e.b),s.setXYZ(u+1,t.r,t.g,t.b);return s.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function kT(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...kT(r.children[t]));return e}class AD extends Yi{constructor(e,t,n){const s=new Lm(t,4,2),u=new Vu({wireframe:!0,fog:!1,toneMapped:!1});super(s,u),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const wD=new j,s1=new yt,r1=new yt;class CD extends Cn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const s=new Dm(t);s.rotateY(Math.PI*.5),this.material=new Vu({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const u=s.getAttribute("position"),f=new Float32Array(u.count*3);s.setAttribute("color",new Xn(f,3)),this.add(new Yi(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");s1.copy(this.light.color),r1.copy(this.light.groundColor);for(let n=0,s=t.count;n<s;n++){const u=n<s/2?s1:r1;t.setXYZ(n,u.r,u.g,u.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(wD.setFromMatrixPosition(this.light.matrixWorld).negate())}}class RD extends Vo{constructor(e=10,t=10,n=4473924,s=8947848){n=new yt(n),s=new yt(s);const u=t/2,f=e/t,h=e/2,m=[],g=[];for(let b=0,M=0,A=-h;b<=t;b++,A+=f){m.push(-h,0,A,h,0,A),m.push(A,0,-h,A,0,h);const R=b===u?n:s;R.toArray(g,M),M+=3,R.toArray(g,M),M+=3,R.toArray(g,M),M+=3,R.toArray(g,M),M+=3}const _=new Kt;_.setAttribute("position",new bt(m,3)),_.setAttribute("color",new bt(g,3));const x=new ss({vertexColors:!0,toneMapped:!1});super(_,x),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class ND extends Vo{constructor(e=10,t=16,n=8,s=64,u=4473924,f=8947848){u=new yt(u),f=new yt(f);const h=[],m=[];if(t>1)for(let x=0;x<t;x++){const b=x/t*(Math.PI*2),M=Math.sin(b)*e,A=Math.cos(b)*e;h.push(0,0,0),h.push(M,0,A);const R=x&1?u:f;m.push(R.r,R.g,R.b),m.push(R.r,R.g,R.b)}for(let x=0;x<n;x++){const b=x&1?u:f,M=e-e/n*x;for(let A=0;A<s;A++){let R=A/s*(Math.PI*2),w=Math.sin(R)*M,E=Math.cos(R)*M;h.push(w,0,E),m.push(b.r,b.g,b.b),R=(A+1)/s*(Math.PI*2),w=Math.sin(R)*M,E=Math.cos(R)*M,h.push(w,0,E),m.push(b.r,b.g,b.b)}}const g=new Kt;g.setAttribute("position",new bt(h,3)),g.setAttribute("color",new bt(m,3));const _=new ss({vertexColors:!0,toneMapped:!1});super(g,_),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const o1=new j,iv=new j,l1=new j;class DD extends Cn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let s=new Kt;s.setAttribute("position",new bt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const u=new ss({fog:!1,toneMapped:!1});this.lightPlane=new Fu(s,u),this.add(this.lightPlane),s=new Kt,s.setAttribute("position",new bt([0,0,0,0,0,1],3)),this.targetLine=new Fu(s,u),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),o1.setFromMatrixPosition(this.light.matrixWorld),iv.setFromMatrixPosition(this.light.target.matrixWorld),l1.subVectors(iv,o1),this.lightPlane.lookAt(iv),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(iv),this.targetLine.scale.z=l1.length()}}const av=new j,Ai=new Ry;class LD extends Vo{constructor(e){const t=new Kt,n=new ss({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],u=[],f={};h("n1","n2"),h("n2","n4"),h("n4","n3"),h("n3","n1"),h("f1","f2"),h("f2","f4"),h("f4","f3"),h("f3","f1"),h("n1","f1"),h("n2","f2"),h("n3","f3"),h("n4","f4"),h("p","n1"),h("p","n2"),h("p","n3"),h("p","n4"),h("u1","u2"),h("u2","u3"),h("u3","u1"),h("c","t"),h("p","c"),h("cn1","cn2"),h("cn3","cn4"),h("cf1","cf2"),h("cf3","cf4");function h(A,R){m(A),m(R)}function m(A){s.push(0,0,0),u.push(0,0,0),f[A]===void 0&&(f[A]=[]),f[A].push(s.length/3-1)}t.setAttribute("position",new bt(s,3)),t.setAttribute("color",new bt(u,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=f,this.update();const g=new yt(16755200),_=new yt(16711680),x=new yt(43775),b=new yt(16777215),M=new yt(3355443);this.setColors(g,_,x,b,M)}setColors(e,t,n,s,u){const h=this.geometry.getAttribute("color");return h.setXYZ(0,e.r,e.g,e.b),h.setXYZ(1,e.r,e.g,e.b),h.setXYZ(2,e.r,e.g,e.b),h.setXYZ(3,e.r,e.g,e.b),h.setXYZ(4,e.r,e.g,e.b),h.setXYZ(5,e.r,e.g,e.b),h.setXYZ(6,e.r,e.g,e.b),h.setXYZ(7,e.r,e.g,e.b),h.setXYZ(8,e.r,e.g,e.b),h.setXYZ(9,e.r,e.g,e.b),h.setXYZ(10,e.r,e.g,e.b),h.setXYZ(11,e.r,e.g,e.b),h.setXYZ(12,e.r,e.g,e.b),h.setXYZ(13,e.r,e.g,e.b),h.setXYZ(14,e.r,e.g,e.b),h.setXYZ(15,e.r,e.g,e.b),h.setXYZ(16,e.r,e.g,e.b),h.setXYZ(17,e.r,e.g,e.b),h.setXYZ(18,e.r,e.g,e.b),h.setXYZ(19,e.r,e.g,e.b),h.setXYZ(20,e.r,e.g,e.b),h.setXYZ(21,e.r,e.g,e.b),h.setXYZ(22,e.r,e.g,e.b),h.setXYZ(23,e.r,e.g,e.b),h.setXYZ(24,t.r,t.g,t.b),h.setXYZ(25,t.r,t.g,t.b),h.setXYZ(26,t.r,t.g,t.b),h.setXYZ(27,t.r,t.g,t.b),h.setXYZ(28,t.r,t.g,t.b),h.setXYZ(29,t.r,t.g,t.b),h.setXYZ(30,t.r,t.g,t.b),h.setXYZ(31,t.r,t.g,t.b),h.setXYZ(32,n.r,n.g,n.b),h.setXYZ(33,n.r,n.g,n.b),h.setXYZ(34,n.r,n.g,n.b),h.setXYZ(35,n.r,n.g,n.b),h.setXYZ(36,n.r,n.g,n.b),h.setXYZ(37,n.r,n.g,n.b),h.setXYZ(38,s.r,s.g,s.b),h.setXYZ(39,s.r,s.g,s.b),h.setXYZ(40,u.r,u.g,u.b),h.setXYZ(41,u.r,u.g,u.b),h.setXYZ(42,u.r,u.g,u.b),h.setXYZ(43,u.r,u.g,u.b),h.setXYZ(44,u.r,u.g,u.b),h.setXYZ(45,u.r,u.g,u.b),h.setXYZ(46,u.r,u.g,u.b),h.setXYZ(47,u.r,u.g,u.b),h.setXYZ(48,u.r,u.g,u.b),h.setXYZ(49,u.r,u.g,u.b),h.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,s=1;let u,f;if(Ai.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)u=1,f=0;else if(this.camera.coordinateSystem===ks)u=-1,f=1;else if(this.camera.coordinateSystem===Yh)u=0,f=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Pi("c",t,e,Ai,0,0,u),Pi("t",t,e,Ai,0,0,f),Pi("n1",t,e,Ai,-n,-s,u),Pi("n2",t,e,Ai,n,-s,u),Pi("n3",t,e,Ai,-n,s,u),Pi("n4",t,e,Ai,n,s,u),Pi("f1",t,e,Ai,-n,-s,f),Pi("f2",t,e,Ai,n,-s,f),Pi("f3",t,e,Ai,-n,s,f),Pi("f4",t,e,Ai,n,s,f),Pi("u1",t,e,Ai,n*.7,s*1.1,u),Pi("u2",t,e,Ai,-n*.7,s*1.1,u),Pi("u3",t,e,Ai,0,s*2,u),Pi("cf1",t,e,Ai,-n,0,f),Pi("cf2",t,e,Ai,n,0,f),Pi("cf3",t,e,Ai,0,-s,f),Pi("cf4",t,e,Ai,0,s,f),Pi("cn1",t,e,Ai,-n,0,u),Pi("cn2",t,e,Ai,n,0,u),Pi("cn3",t,e,Ai,0,-s,u),Pi("cn4",t,e,Ai,0,s,u),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Pi(r,e,t,n,s,u,f){av.set(s,u,f).unproject(n);const h=e[r];if(h!==void 0){const m=t.getAttribute("position");for(let g=0,_=h.length;g<_;g++)m.setXYZ(h[g],av.x,av.y,av.z)}}const sv=new za;class UD extends Vo{constructor(e,t=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]),s=new Float32Array(24),u=new Kt;u.setIndex(new Xn(n,1)),u.setAttribute("position",new Xn(s,3)),super(u,new ss({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&sv.setFromObject(this.object),sv.isEmpty())return;const e=sv.min,t=sv.max,n=this.geometry.attributes.position,s=n.array;s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=e.x,s[4]=t.y,s[5]=t.z,s[6]=e.x,s[7]=e.y,s[8]=t.z,s[9]=t.x,s[10]=e.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=e.z,s[15]=e.x,s[16]=t.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=t.x,s[22]=e.y,s[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 ID extends Vo{constructor(e,t=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]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],u=new Kt;u.setIndex(new Xn(n,1)),u.setAttribute("position",new bt(s,3)),super(u,new ss({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 OD extends Fu{constructor(e,t=1,n=16776960){const s=n,u=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],f=new Kt;f.setAttribute("position",new bt(u,3)),f.computeBoundingSphere(),super(f,new ss({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const h=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],m=new Kt;m.setAttribute("position",new bt(h,3)),m.computeBoundingSphere(),this.add(new Yi(m,new Vu({color:s,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 u1=new j;let rv,Sx;class PD extends Cn{constructor(e=new j(0,0,1),t=new j(0,0,0),n=1,s=16776960,u=n*.2,f=u*.2){super(),this.type="ArrowHelper",rv===void 0&&(rv=new Kt,rv.setAttribute("position",new bt([0,0,0,0,1,0],3)),Sx=new Nm(.5,1,5,1),Sx.translate(0,-.5,0)),this.position.copy(t),this.line=new Fu(rv,new ss({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Yi(Sx,new Vu({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,u,f)}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{u1.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(u1,t)}}setLength(e,t=e*.2,n=t*.2){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 zD extends Vo{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Kt;s.setAttribute("position",new bt(t,3)),s.setAttribute("color",new bt(n,3));const u=new ss({vertexColors:!0,toneMapped:!1});super(s,u),this.type="AxesHelper"}setColors(e,t,n){const s=new yt,u=this.geometry.attributes.color.array;return s.set(e),s.toArray(u,0),s.toArray(u,3),s.set(t),s.toArray(u,6),s.toArray(u,9),s.set(n),s.toArray(u,12),s.toArray(u,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class BD{constructor(){this.type="ShapePath",this.color=new yt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ly,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,s){return this.currentPath.quadraticCurveTo(e,t,n,s),this}bezierCurveTo(e,t,n,s,u,f){return this.currentPath.bezierCurveTo(e,t,n,s,u,f),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(E){const N=[];for(let D=0,U=E.length;D<U;D++){const B=E[D],z=new $c;z.curves=B.curves,N.push(z)}return N}function n(E,N){const D=N.length;let U=!1;for(let B=D-1,z=0;z<D;B=z++){let H=N[B],W=N[z],I=W.x-H.x,P=W.y-H.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(H=N[z],I=-I,W=N[B],P=-P),E.y<H.y||E.y>W.y)continue;if(E.y===H.y){if(E.x===H.x)return!0}else{const Z=P*(E.x-H.x)-I*(E.y-H.y);if(Z===0)return!0;if(Z<0)continue;U=!U}}else{if(E.y!==H.y)continue;if(W.x<=E.x&&E.x<=H.x||H.x<=E.x&&E.x<=W.x)return!0}}return U}const s=jr.isClockWise,u=this.subPaths;if(u.length===0)return[];let f,h,m;const g=[];if(u.length===1)return h=u[0],m=new $c,m.curves=h.curves,g.push(m),g;let _=!s(u[0].getPoints());_=e?!_:_;const x=[],b=[];let M=[],A=0,R;b[A]=void 0,M[A]=[];for(let E=0,N=u.length;E<N;E++)h=u[E],R=h.getPoints(),f=s(R),f=e?!f:f,f?(!_&&b[A]&&A++,b[A]={s:new $c,p:R},b[A].s.curves=h.curves,_&&A++,M[A]=[]):M[A].push({h,p:R[0]});if(!b[0])return t(u);if(b.length>1){let E=!1,N=0;for(let D=0,U=b.length;D<U;D++)x[D]=[];for(let D=0,U=b.length;D<U;D++){const B=M[D];for(let z=0;z<B.length;z++){const H=B[z];let W=!0;for(let I=0;I<b.length;I++)n(H.p,b[I].p)&&(D!==I&&N++,W?(W=!1,x[I].push(H)):E=!0);W&&x[D].push(H)}}N>0&&E===!1&&(M=x)}let w;for(let E=0,N=b.length;E<N;E++){m=b[E].s,g.push(m),w=M[E];for(let D=0,U=w.length;D<U;D++)m.holes.push(w[D].h)}return g}}class FD extends ko{constructor(e,t=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){if(e===void 0){ft("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function kD(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function VD(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function HD(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function tb(r,e,t,n){const s=GD(n);switch(t){case Eb:return r*e;case by:return r*e/s.components*s.byteLength;case wm:return r*e/s.components*s.byteLength;case tf:return r*e*2/s.components*s.byteLength;case Sy:return r*e*2/s.components*s.byteLength;case Tb:return r*e*3/s.components*s.byteLength;case Oa:return r*e*4/s.components*s.byteLength;case My:return r*e*4/s.components*s.byteLength;case $p:case em:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case tm:case nm:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case wv:case Rv:return Math.max(r,16)*Math.max(e,8)/4;case Av:case Cv:return Math.max(r,8)*Math.max(e,8)/2;case Nv:case Dv:case Uv:case Iv:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Lv:case Ov:case Pv:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case zv:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Bv:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Fv:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case kv:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Vv:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Hv:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Gv:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Xv:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Wv:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case qv:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case jv:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Yv:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Zv:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Qv:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Kv:case Jv:case $v:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ey:case ty:return Math.ceil(r/4)*Math.ceil(e/4)*8;case ny:case iy:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function GD(r){switch(r){case ts:case xb:return{byteLength:1,components:1};case qh:case bb:case Bo:return{byteLength:2,components:1};case _y:case xy:return{byteLength:2,components:4};case vr:case yy:case is:return{byteLength:4,components:1};case Sb:case Mb:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class XD{static contain(e,t){return kD(e,t)}static cover(e,t){return VD(e,t)}static fill(e){return HD(e)}static getByteLength(e,t,n,s){return tb(e,t,n,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:my}}));typeof window<"u"&&(window.__THREE__?ft("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=my);function VT(){let r=null,e=!1,t=null,n=null;function s(u,f){t(u,f),n=r.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(s),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(u){t=u},setContext:function(u){r=u}}}function WD(r){const e=new WeakMap;function t(h,m){const g=h.array,_=h.usage,x=g.byteLength,b=r.createBuffer();r.bindBuffer(m,b),r.bufferData(m,g,_),h.onUploadCallback();let M;if(g instanceof Float32Array)M=r.FLOAT;else if(typeof Float16Array<"u"&&g instanceof Float16Array)M=r.HALF_FLOAT;else if(g instanceof Uint16Array)h.isFloat16BufferAttribute?M=r.HALF_FLOAT:M=r.UNSIGNED_SHORT;else if(g instanceof Int16Array)M=r.SHORT;else if(g instanceof Uint32Array)M=r.UNSIGNED_INT;else if(g instanceof Int32Array)M=r.INT;else if(g instanceof Int8Array)M=r.BYTE;else if(g instanceof Uint8Array)M=r.UNSIGNED_BYTE;else if(g instanceof Uint8ClampedArray)M=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+g);return{buffer:b,type:M,bytesPerElement:g.BYTES_PER_ELEMENT,version:h.version,size:x}}function n(h,m,g){const _=m.array,x=m.updateRanges;if(r.bindBuffer(g,h),x.length===0)r.bufferSubData(g,0,_);else{x.sort((M,A)=>M.start-A.start);let b=0;for(let M=1;M<x.length;M++){const A=x[b],R=x[M];R.start<=A.start+A.count+1?A.count=Math.max(A.count,R.start+R.count-A.start):(++b,x[b]=R)}x.length=b+1;for(let M=0,A=x.length;M<A;M++){const R=x[M];r.bufferSubData(g,R.start*_.BYTES_PER_ELEMENT,_,R.start,R.count)}m.clearUpdateRanges()}m.onUploadCallback()}function s(h){return h.isInterleavedBufferAttribute&&(h=h.data),e.get(h)}function u(h){h.isInterleavedBufferAttribute&&(h=h.data);const m=e.get(h);m&&(r.deleteBuffer(m.buffer),e.delete(h))}function f(h,m){if(h.isInterleavedBufferAttribute&&(h=h.data),h.isGLBufferAttribute){const _=e.get(h);(!_||_.version<h.version)&&e.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}const g=e.get(h);if(g===void 0)e.set(h,t(h,m));else if(g.version<h.version){if(g.size!==h.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(g.buffer,h,m),g.version=h.version}}return{get:s,remove:u,update:f}}var qD=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,jD=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,YD=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,ZD=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,QD=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
#endif`,KD=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,JD=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,$D=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,eL=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
#endif
uniform highp sampler2D batchingTexture;
uniform highp usampler2D batchingIdTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
float getIndirectIndex( const in int i ) {
int size = textureSize( batchingIdTexture, 0 ).x;
int x = i % size;
int y = i / size;
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
}
#endif
#ifdef USE_BATCHING_COLOR
uniform sampler2D batchingColorTexture;
vec3 getBatchingColor( const in float i ) {
int size = textureSize( batchingColorTexture, 0 ).x;
int j = int( i );
int x = j % size;
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
#endif`,tL=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,nL=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,iL=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,aL=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,sL=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,rL=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,oL=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
float clipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
if ( clipOpacity == 0.0 ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
float unionClipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
}
#pragma unroll_loop_end
clipOpacity *= 1.0 - unionClipOpacity;
#endif
diffuseColor.a *= clipOpacity;
if ( diffuseColor.a == 0.0 ) discard;
#else
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif
#endif`,lL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,uL=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,cL=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,fL=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,hL=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,dL=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
#endif`,pL=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
#endif`,mL=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,gL=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,vL=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,yL=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,_L=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,xL=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,bL=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,SL="gl_FragColor = linearToOutputTexel( gl_FragColor );",ML=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
return 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 );
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,EL=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,TL=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,AL=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,wL=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,CL=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,RL=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,NL=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,DL=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,LL=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,UL=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,IL=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,OL=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,PL=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,zL=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,BL=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
#endif`,FL=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,kL=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,VL=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,HL=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,GL=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = vec3( 0.04 );
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,XL=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
vec3 diffuseColor;
vec3 diffuseContribution;
vec3 specularColor;
vec3 specularColorBlended;
float roughness;
float metalness;
float specularF90;
float dispersion;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
vec3 iridescenceFresnelDielectric;
vec3 iridescenceFresnelMetallic;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return v;
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColorBlended;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float rInv = 1.0 / ( roughness + 0.1 );
float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
float DG = exp( a * dotNV + b );
return saturate( DG );
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
float dotNV = saturate( dot( normal, viewDir ) );
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
float Ess_V = dfgV.x + dfgV.y;
float Ess_L = dfgL.x + dfgL.y;
float Ems_V = 1.0 - Ess_V;
float Ems_L = 1.0 - Ess_L;
vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
float compensationFactor = Ems_V * Ems_L;
vec3 multiScatter = Fms * compensationFactor;
return singleScatter + multiScatter;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
irradiance *= sheenEnergyComp;
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
#ifdef USE_SHEEN
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
diffuse *= sheenEnergyComp;
#endif
reflectedLight.indirectDiffuse += diffuse;
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
#endif
vec3 singleScatteringDielectric = vec3( 0.0 );
vec3 multiScatteringDielectric = vec3( 0.0 );
vec3 singleScatteringMetallic = vec3( 0.0 );
vec3 multiScatteringMetallic = vec3( 0.0 );
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
#endif
vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
vec3 indirectSpecular = radiance * singleScattering;
indirectSpecular += multiScattering * cosineWeightedIrradiance;
vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
#ifdef USE_SHEEN
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
indirectSpecular *= sheenEnergyComp;
indirectDiffuse *= sheenEnergyComp;
#endif
reflectedLight.indirectSpecular += indirectSpecular;
reflectedLight.indirectDiffuse += indirectDiffuse;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,WL=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,qL=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,jL=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,YL=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,ZL=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,QL=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
#endif`,KL=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,JL=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,$L=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,eU=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,tU=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,nU=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,iU=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,aU=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
#endif`,sU=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,rU=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#endif`,oU=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
#endif
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#endif`,lU=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#endif`,uU=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 nonPerturbedNormal = normal;`,cU=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,fU=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,hU=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,dU=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,pU=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,mU=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,gU=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,vU=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,yU=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,_U=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xU=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
if( v <= 0.0 )
return vec4( 0., 0., 0., 0. );
if( v >= 1.0 )
return vec4( 1., 1., 1., 1. );
float vuf;
float af = modf( v * PackFactors.a, vuf );
float bf = modf( vuf * ShiftRight8, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
if( v <= 0.0 )
return vec3( 0., 0., 0. );
if( v >= 1.0 )
return vec3( 1., 1., 1. );
float vuf;
float bf = modf( v * PackFactors.b, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
if( v <= 0.0 )
return vec2( 0., 0. );
if( v >= 1.0 )
return vec2( 1., 1. );
float vuf;
float gf = modf( v * 256., vuf );
return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,bU=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,SU=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,MU=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,EU=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,TU=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,AU=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,wU=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
#else
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
#endif
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
#else
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
#elif defined( SHADOWMAP_TYPE_BASIC )
uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
#endif
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#if defined( SHADOWMAP_TYPE_PCF )
float interleavedGradientNoise( vec2 position ) {
return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
}
vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
const float goldenAngle = 2.399963229728653;
float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
float theta = float( sampleIndex ) * goldenAngle + phi;
return vec2( cos( theta ), sin( theta ) ) * r;
}
#endif
#if defined( SHADOWMAP_TYPE_PCF )
float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float radius = shadowRadius * texelSize.x;
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
shadow = (
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
) * 0.2;
}
return mix( 1.0, shadow, shadowIntensity );
}
#elif defined( SHADOWMAP_TYPE_VSM )
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
float mean = distribution.x;
float variance = distribution.y * distribution.y;
#ifdef USE_REVERSED_DEPTH_BUFFER
float hard_shadow = step( mean, shadowCoord.z );
#else
float hard_shadow = step( shadowCoord.z, mean );
#endif
if ( hard_shadow == 1.0 ) {
shadow = 1.0;
} else {
variance = max( variance, 0.0000001 );
float d = shadowCoord.z - mean;
float p_max = variance / ( variance + d * d );
p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
shadow = max( hard_shadow, p_max );
}
}
return mix( 1.0, shadow, shadowIntensity );
}
#else
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
float depth = texture2D( shadowMap, shadowCoord.xy ).r;
#ifdef USE_REVERSED_DEPTH_BUFFER
shadow = step( depth, shadowCoord.z );
#else
shadow = step( shadowCoord.z, depth );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#if defined( SHADOWMAP_TYPE_PCF )
float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
vec3 bd3D = normalize( lightToPosition );
vec3 absVec = abs( lightToPosition );
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
dp += shadowBias;
float texelSize = shadowRadius / shadowMapSize.x;
vec3 absDir = abs( bd3D );
vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
tangent = normalize( cross( bd3D, tangent ) );
vec3 bitangent = cross( bd3D, tangent );
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
shadow = (
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
) * 0.2;
}
return mix( 1.0, shadow, shadowIntensity );
}
#elif defined( SHADOWMAP_TYPE_BASIC )
float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
vec3 bd3D = normalize( lightToPosition );
vec3 absVec = abs( lightToPosition );
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
dp += shadowBias;
float depth = textureCube( shadowMap, bd3D ).r;
#ifdef USE_REVERSED_DEPTH_BUFFER
shadow = step( depth, dp );
#else
shadow = step( dp, depth );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif
#endif
#endif`,CU=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,RU=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,NU=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,DU=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,LU=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
#endif`,UU=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,IU=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,OU=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,PU=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,zU=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,BU=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
vec3( 1.6605, - 0.1246, - 0.0182 ),
vec3( - 0.5876, 1.1329, - 0.1006 ),
vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
vec3( 0.6274, 0.0691, 0.0164 ),
vec3( 0.3293, 0.9195, 0.0880 ),
vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
vec3 x2 = x * x;
vec3 x4 = x2 * x2;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
const mat3 AgXInsetMatrix = mat3(
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
);
const mat3 AgXOutsetMatrix = mat3(
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
);
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
color *= toneMappingExposure;
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
color = AgXInsetMatrix * color;
color = max( color, 1e-10 ); color = log2( color );
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
color = clamp( color, 0.0, 1.0 );
color = agxDefaultContrastApprox( color );
color = AgXOutsetMatrix * color;
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
color = clamp( color, 0.0, 1.0 );
return color;
}
vec3 NeutralToneMapping( vec3 color ) {
const float StartCompression = 0.8 - 0.04;
const float Desaturation = 0.15;
color *= toneMappingExposure;
float x = min( color.r, min( color.g, color.b ) );
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
color -= offset;
float peak = max( color.r, max( color.g, color.b ) );
if ( peak < StartCompression ) return color;
float d = 1. - StartCompression;
float newPeak = 1. - d * d / ( peak + d - StartCompression );
color *= newPeak / peak;
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,FU=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,kU=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec4 transmittedLight;
vec3 transmittance;
#ifdef USE_DISPERSION
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
for ( int i = 0; i < 3; i ++ ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
transmittedLight[ i ] = transmissionSample[ i ];
transmittedLight.a += transmissionSample.a;
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
}
transmittedLight.a /= 3.0;
#else
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
#endif
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
#endif`,VU=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,HU=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,GU=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,XU=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const WU=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,qU=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,jU=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,YU=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,ZU=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,QU=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,KU=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,JU=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
#ifdef USE_REVERSED_DEPTH_BUFFER
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
#else
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
#endif
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#elif DEPTH_PACKING == 3202
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
}`,$U=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,eI=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,tI=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,nI=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,iI=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,aI=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,sI=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,rI=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,oI=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,lI=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,uI=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,cI=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,fI=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,hI=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,dI=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,pI=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,mI=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,gI=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,vI=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,yI=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,_I=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,xI=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,bI=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,SI=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,MI=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix[ 3 ];
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,EI=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,un={alphahash_fragment:qD,alphahash_pars_fragment:jD,alphamap_fragment:YD,alphamap_pars_fragment:ZD,alphatest_fragment:QD,alphatest_pars_fragment:KD,aomap_fragment:JD,aomap_pars_fragment:$D,batching_pars_vertex:eL,batching_vertex:tL,begin_vertex:nL,beginnormal_vertex:iL,bsdfs:aL,iridescence_fragment:sL,bumpmap_pars_fragment:rL,clipping_planes_fragment:oL,clipping_planes_pars_fragment:lL,clipping_planes_pars_vertex:uL,clipping_planes_vertex:cL,color_fragment:fL,color_pars_fragment:hL,color_pars_vertex:dL,color_vertex:pL,common:mL,cube_uv_reflection_fragment:gL,defaultnormal_vertex:vL,displacementmap_pars_vertex:yL,displacementmap_vertex:_L,emissivemap_fragment:xL,emissivemap_pars_fragment:bL,colorspace_fragment:SL,colorspace_pars_fragment:ML,envmap_fragment:EL,envmap_common_pars_fragment:TL,envmap_pars_fragment:AL,envmap_pars_vertex:wL,envmap_physical_pars_fragment:BL,envmap_vertex:CL,fog_vertex:RL,fog_pars_vertex:NL,fog_fragment:DL,fog_pars_fragment:LL,gradientmap_pars_fragment:UL,lightmap_pars_fragment:IL,lights_lambert_fragment:OL,lights_lambert_pars_fragment:PL,lights_pars_begin:zL,lights_toon_fragment:FL,lights_toon_pars_fragment:kL,lights_phong_fragment:VL,lights_phong_pars_fragment:HL,lights_physical_fragment:GL,lights_physical_pars_fragment:XL,lights_fragment_begin:WL,lights_fragment_maps:qL,lights_fragment_end:jL,logdepthbuf_fragment:YL,logdepthbuf_pars_fragment:ZL,logdepthbuf_pars_vertex:QL,logdepthbuf_vertex:KL,map_fragment:JL,map_pars_fragment:$L,map_particle_fragment:eU,map_particle_pars_fragment:tU,metalnessmap_fragment:nU,metalnessmap_pars_fragment:iU,morphinstance_vertex:aU,morphcolor_vertex:sU,morphnormal_vertex:rU,morphtarget_pars_vertex:oU,morphtarget_vertex:lU,normal_fragment_begin:uU,normal_fragment_maps:cU,normal_pars_fragment:fU,normal_pars_vertex:hU,normal_vertex:dU,normalmap_pars_fragment:pU,clearcoat_normal_fragment_begin:mU,clearcoat_normal_fragment_maps:gU,clearcoat_pars_fragment:vU,iridescence_pars_fragment:yU,opaque_fragment:_U,packing:xU,premultiplied_alpha_fragment:bU,project_vertex:SU,dithering_fragment:MU,dithering_pars_fragment:EU,roughnessmap_fragment:TU,roughnessmap_pars_fragment:AU,shadowmap_pars_fragment:wU,shadowmap_pars_vertex:CU,shadowmap_vertex:RU,shadowmask_pars_fragment:NU,skinbase_vertex:DU,skinning_pars_vertex:LU,skinning_vertex:UU,skinnormal_vertex:IU,specularmap_fragment:OU,specularmap_pars_fragment:PU,tonemapping_fragment:zU,tonemapping_pars_fragment:BU,transmission_fragment:FU,transmission_pars_fragment:kU,uv_pars_fragment:VU,uv_pars_vertex:HU,uv_vertex:GU,worldpos_vertex:XU,background_vert:WU,background_frag:qU,backgroundCube_vert:jU,backgroundCube_frag:YU,cube_vert:ZU,cube_frag:QU,depth_vert:KU,depth_frag:JU,distance_vert:$U,distance_frag:eI,equirect_vert:tI,equirect_frag:nI,linedashed_vert:iI,linedashed_frag:aI,meshbasic_vert:sI,meshbasic_frag:rI,meshlambert_vert:oI,meshlambert_frag:lI,meshmatcap_vert:uI,meshmatcap_frag:cI,meshnormal_vert:fI,meshnormal_frag:hI,meshphong_vert:dI,meshphong_frag:pI,meshphysical_vert:mI,meshphysical_frag:gI,meshtoon_vert:vI,meshtoon_frag:yI,points_vert:_I,points_frag:xI,shadow_vert:bI,shadow_frag:SI,sprite_vert:MI,sprite_frag:EI},pt={common:{diffuse:{value:new yt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new en},alphaMap:{value:null},alphaMapTransform:{value:new en},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new en}},envmap:{envMap:{value:null},envMapRotation:{value:new en},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new en}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new en}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new en},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new en},normalScale:{value:new ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new en},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new en}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new en}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new en}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new yt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new yt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new en},alphaTest:{value:0},uvTransform:{value:new en}},sprite:{diffuse:{value:new yt(16777215)},opacity:{value:1},center:{value:new ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new en},alphaMap:{value:null},alphaMapTransform:{value:new en},alphaTest:{value:0}}},qr={basic:{uniforms:es([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:un.meshbasic_vert,fragmentShader:un.meshbasic_frag},lambert:{uniforms:es([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new yt(0)}}]),vertexShader:un.meshlambert_vert,fragmentShader:un.meshlambert_frag},phong:{uniforms:es([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new yt(0)},specular:{value:new yt(1118481)},shininess:{value:30}}]),vertexShader:un.meshphong_vert,fragmentShader:un.meshphong_frag},standard:{uniforms:es([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new yt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:un.meshphysical_vert,fragmentShader:un.meshphysical_frag},toon:{uniforms:es([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new yt(0)}}]),vertexShader:un.meshtoon_vert,fragmentShader:un.meshtoon_frag},matcap:{uniforms:es([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:un.meshmatcap_vert,fragmentShader:un.meshmatcap_frag},points:{uniforms:es([pt.points,pt.fog]),vertexShader:un.points_vert,fragmentShader:un.points_frag},dashed:{uniforms:es([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:un.linedashed_vert,fragmentShader:un.linedashed_frag},depth:{uniforms:es([pt.common,pt.displacementmap]),vertexShader:un.depth_vert,fragmentShader:un.depth_frag},normal:{uniforms:es([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:un.meshnormal_vert,fragmentShader:un.meshnormal_frag},sprite:{uniforms:es([pt.sprite,pt.fog]),vertexShader:un.sprite_vert,fragmentShader:un.sprite_frag},background:{uniforms:{uvTransform:{value:new en},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:un.background_vert,fragmentShader:un.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new en}},vertexShader:un.backgroundCube_vert,fragmentShader:un.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:un.cube_vert,fragmentShader:un.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:un.equirect_vert,fragmentShader:un.equirect_frag},distance:{uniforms:es([pt.common,pt.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:un.distance_vert,fragmentShader:un.distance_frag},shadow:{uniforms:es([pt.lights,pt.fog,{color:{value:new yt(0)},opacity:{value:1}}]),vertexShader:un.shadow_vert,fragmentShader:un.shadow_frag}};qr.physical={uniforms:es([qr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new en},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new en},clearcoatNormalScale:{value:new ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new en},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new en},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new en},sheen:{value:0},sheenColor:{value:new yt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new en},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new en},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new en},transmissionSamplerSize:{value:new ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new en},attenuationDistance:{value:0},attenuationColor:{value:new yt(0)},specularColor:{value:new yt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new en},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new en},anisotropyVector:{value:new ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new en}}]),vertexShader:un.meshphysical_vert,fragmentShader:un.meshphysical_frag};const ov={r:0,b:0,g:0},Vc=new Gs,TI=new Xt;function AI(r,e,t,n,s,u,f){const h=new yt(0);let m=u===!0?0:1,g,_,x=null,b=0,M=null;function A(D){let U=D.isScene===!0?D.background:null;return U&&U.isTexture&&(U=(D.backgroundBlurriness>0?t:e).get(U)),U}function R(D){let U=!1;const B=A(D);B===null?E(h,m):B&&B.isColor&&(E(B,1),U=!0);const z=r.xr.getEnvironmentBlendMode();z==="additive"?n.buffers.color.setClear(0,0,0,1,f):z==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,f),(r.autoClear||U)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function w(D,U){const B=A(U);B&&(B.isCubeTexture||B.mapping===id)?(_===void 0&&(_=new Yi(new lf(1,1,1),new yr({name:"BackgroundCubeMaterial",uniforms:Jh(qr.backgroundCube.uniforms),vertexShader:qr.backgroundCube.vertexShader,fragmentShader:qr.backgroundCube.fragmentShader,side:as,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),_.geometry.deleteAttribute("normal"),_.geometry.deleteAttribute("uv"),_.onBeforeRender=function(z,H,W){this.matrixWorld.copyPosition(W.matrixWorld)},Object.defineProperty(_.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(_)),Vc.copy(U.backgroundRotation),Vc.x*=-1,Vc.y*=-1,Vc.z*=-1,B.isCubeTexture&&B.isRenderTargetTexture===!1&&(Vc.y*=-1,Vc.z*=-1),_.material.uniforms.envMap.value=B,_.material.uniforms.flipEnvMap.value=B.isCubeTexture&&B.isRenderTargetTexture===!1?-1:1,_.material.uniforms.backgroundBlurriness.value=U.backgroundBlurriness,_.material.uniforms.backgroundIntensity.value=U.backgroundIntensity,_.material.uniforms.backgroundRotation.value.setFromMatrix4(TI.makeRotationFromEuler(Vc)),_.material.toneMapped=Sn.getTransfer(B.colorSpace)!==zn,(x!==B||b!==B.version||M!==r.toneMapping)&&(_.material.needsUpdate=!0,x=B,b=B.version,M=r.toneMapping),_.layers.enableAll(),D.unshift(_,_.geometry,_.material,0,0,null)):B&&B.isTexture&&(g===void 0&&(g=new Yi(new sd(2,2),new yr({name:"BackgroundMaterial",uniforms:Jh(qr.background.uniforms),vertexShader:qr.background.vertexShader,fragmentShader:qr.background.fragmentShader,side:Ll,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),g.geometry.deleteAttribute("normal"),Object.defineProperty(g.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(g)),g.material.uniforms.t2D.value=B,g.material.uniforms.backgroundIntensity.value=U.backgroundIntensity,g.material.toneMapped=Sn.getTransfer(B.colorSpace)!==zn,B.matrixAutoUpdate===!0&&B.updateMatrix(),g.material.uniforms.uvTransform.value.copy(B.matrix),(x!==B||b!==B.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,x=B,b=B.version,M=r.toneMapping),g.layers.enableAll(),D.unshift(g,g.geometry,g.material,0,0,null))}function E(D,U){D.getRGB(ov,GE(r)),n.buffers.color.setClear(ov.r,ov.g,ov.b,U,f)}function N(){_!==void 0&&(_.geometry.dispose(),_.material.dispose(),_=void 0),g!==void 0&&(g.geometry.dispose(),g.material.dispose(),g=void 0)}return{getClearColor:function(){return h},setClearColor:function(D,U=1){h.set(D),m=U,E(h,m)},getClearAlpha:function(){return m},setClearAlpha:function(D){m=D,E(h,m)},render:R,addToRenderList:w,dispose:N}}function wI(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},s=b(null);let u=s,f=!1;function h(P,Z,se,te,fe){let pe=!1;const Y=x(te,se,Z);u!==Y&&(u=Y,g(u.object)),pe=M(P,te,se,fe),pe&&A(P,te,se,fe),fe!==null&&e.update(fe,r.ELEMENT_ARRAY_BUFFER),(pe||f)&&(f=!1,U(P,Z,se,te),fe!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(fe).buffer))}function m(){return r.createVertexArray()}function g(P){return r.bindVertexArray(P)}function _(P){return r.deleteVertexArray(P)}function x(P,Z,se){const te=se.wireframe===!0;let fe=n[P.id];fe===void 0&&(fe={},n[P.id]=fe);let pe=fe[Z.id];pe===void 0&&(pe={},fe[Z.id]=pe);let Y=pe[te];return Y===void 0&&(Y=b(m()),pe[te]=Y),Y}function b(P){const Z=[],se=[],te=[];for(let fe=0;fe<t;fe++)Z[fe]=0,se[fe]=0,te[fe]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Z,enabledAttributes:se,attributeDivisors:te,object:P,attributes:{},index:null}}function M(P,Z,se,te){const fe=u.attributes,pe=Z.attributes;let Y=0;const q=se.getAttributes();for(const ne in q)if(q[ne].location>=0){const Ne=fe[ne];let X=pe[ne];if(X===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(X=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(X=P.instanceColor)),Ne===void 0||Ne.attribute!==X||X&&Ne.data!==X.data)return!0;Y++}return u.attributesNum!==Y||u.index!==te}function A(P,Z,se,te){const fe={},pe=Z.attributes;let Y=0;const q=se.getAttributes();for(const ne in q)if(q[ne].location>=0){let Ne=pe[ne];Ne===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(Ne=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(Ne=P.instanceColor));const X={};X.attribute=Ne,Ne&&Ne.data&&(X.data=Ne.data),fe[ne]=X,Y++}u.attributes=fe,u.attributesNum=Y,u.index=te}function R(){const P=u.newAttributes;for(let Z=0,se=P.length;Z<se;Z++)P[Z]=0}function w(P){E(P,0)}function E(P,Z){const se=u.newAttributes,te=u.enabledAttributes,fe=u.attributeDivisors;se[P]=1,te[P]===0&&(r.enableVertexAttribArray(P),te[P]=1),fe[P]!==Z&&(r.vertexAttribDivisor(P,Z),fe[P]=Z)}function N(){const P=u.newAttributes,Z=u.enabledAttributes;for(let se=0,te=Z.length;se<te;se++)Z[se]!==P[se]&&(r.disableVertexAttribArray(se),Z[se]=0)}function D(P,Z,se,te,fe,pe,Y){Y===!0?r.vertexAttribIPointer(P,Z,se,fe,pe):r.vertexAttribPointer(P,Z,se,te,fe,pe)}function U(P,Z,se,te){R();const fe=te.attributes,pe=se.getAttributes(),Y=Z.defaultAttributeValues;for(const q in pe){const ne=pe[q];if(ne.location>=0){let be=fe[q];if(be===void 0&&(q==="instanceMatrix"&&P.instanceMatrix&&(be=P.instanceMatrix),q==="instanceColor"&&P.instanceColor&&(be=P.instanceColor)),be!==void 0){const Ne=be.normalized,X=be.itemSize,oe=e.get(be);if(oe===void 0)continue;const Ae=oe.buffer,Fe=oe.type,lt=oe.bytesPerElement,de=Fe===r.INT||Fe===r.UNSIGNED_INT||be.gpuType===yy;if(be.isInterleavedBufferAttribute){const Re=be.data,tt=Re.stride,st=be.offset;if(Re.isInstancedInterleavedBuffer){for(let ht=0;ht<ne.locationSize;ht++)E(ne.location+ht,Re.meshPerAttribute);P.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=Re.meshPerAttribute*Re.count)}else for(let ht=0;ht<ne.locationSize;ht++)w(ne.location+ht);r.bindBuffer(r.ARRAY_BUFFER,Ae);for(let ht=0;ht<ne.locationSize;ht++)D(ne.location+ht,X/ne.locationSize,Fe,Ne,tt*lt,(st+X/ne.locationSize*ht)*lt,de)}else{if(be.isInstancedBufferAttribute){for(let Re=0;Re<ne.locationSize;Re++)E(ne.location+Re,be.meshPerAttribute);P.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let Re=0;Re<ne.locationSize;Re++)w(ne.location+Re);r.bindBuffer(r.ARRAY_BUFFER,Ae);for(let Re=0;Re<ne.locationSize;Re++)D(ne.location+Re,X/ne.locationSize,Fe,Ne,X*lt,X/ne.locationSize*Re*lt,de)}}else if(Y!==void 0){const Ne=Y[q];if(Ne!==void 0)switch(Ne.length){case 2:r.vertexAttrib2fv(ne.location,Ne);break;case 3:r.vertexAttrib3fv(ne.location,Ne);break;case 4:r.vertexAttrib4fv(ne.location,Ne);break;default:r.vertexAttrib1fv(ne.location,Ne)}}}}N()}function B(){W();for(const P in n){const Z=n[P];for(const se in Z){const te=Z[se];for(const fe in te)_(te[fe].object),delete te[fe];delete Z[se]}delete n[P]}}function z(P){if(n[P.id]===void 0)return;const Z=n[P.id];for(const se in Z){const te=Z[se];for(const fe in te)_(te[fe].object),delete te[fe];delete Z[se]}delete n[P.id]}function H(P){for(const Z in n){const se=n[Z];if(se[P.id]===void 0)continue;const te=se[P.id];for(const fe in te)_(te[fe].object),delete te[fe];delete se[P.id]}}function W(){I(),f=!0,u!==s&&(u=s,g(u.object))}function I(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:h,reset:W,resetDefaultState:I,dispose:B,releaseStatesOfGeometry:z,releaseStatesOfProgram:H,initAttributes:R,enableAttribute:w,disableUnusedAttributes:N}}function CI(r,e,t){let n;function s(g){n=g}function u(g,_){r.drawArrays(n,g,_),t.update(_,n,1)}function f(g,_,x){x!==0&&(r.drawArraysInstanced(n,g,_,x),t.update(_,n,x))}function h(g,_,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,g,0,_,0,x);let M=0;for(let A=0;A<x;A++)M+=_[A];t.update(M,n,1)}function m(g,_,x,b){if(x===0)return;const M=e.get("WEBGL_multi_draw");if(M===null)for(let A=0;A<g.length;A++)f(g[A],_[A],b[A]);else{M.multiDrawArraysInstancedWEBGL(n,g,0,_,0,b,0,x);let A=0;for(let R=0;R<x;R++)A+=_[R]*b[R];t.update(A,n,1)}}this.setMode=s,this.render=u,this.renderInstances=f,this.renderMultiDraw=h,this.renderMultiDrawInstances=m}function RI(r,e,t,n){let s;function u(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const H=e.get("EXT_texture_filter_anisotropic");s=r.getParameter(H.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function f(H){return!(H!==Oa&&n.convert(H)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function h(H){const W=H===Bo&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(H!==ts&&n.convert(H)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&H!==is&&!W)}function m(H){if(H==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";H="mediump"}return H==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let g=t.precision!==void 0?t.precision:"highp";const _=m(g);_!==g&&(ft("WebGLRenderer:",g,"not supported, using",_,"instead."),g=_);const x=t.logarithmicDepthBuffer===!0,b=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),M=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),A=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),R=r.getParameter(r.MAX_TEXTURE_SIZE),w=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),E=r.getParameter(r.MAX_VERTEX_ATTRIBS),N=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),D=r.getParameter(r.MAX_VARYING_VECTORS),U=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),B=r.getParameter(r.MAX_SAMPLES),z=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:u,getMaxPrecision:m,textureFormatReadable:f,textureTypeReadable:h,precision:g,logarithmicDepthBuffer:x,reversedDepthBuffer:b,maxTextures:M,maxVertexTextures:A,maxTextureSize:R,maxCubemapSize:w,maxAttributes:E,maxVertexUniforms:N,maxVaryings:D,maxFragmentUniforms:U,maxSamples:B,samples:z}}function NI(r){const e=this;let t=null,n=0,s=!1,u=!1;const f=new wl,h=new en,m={value:null,needsUpdate:!1};this.uniform=m,this.numPlanes=0,this.numIntersection=0,this.init=function(x,b){const M=x.length!==0||b||n!==0||s;return s=b,n=x.length,M},this.beginShadows=function(){u=!0,_(null)},this.endShadows=function(){u=!1},this.setGlobalState=function(x,b){t=_(x,b,0)},this.setState=function(x,b,M){const A=x.clippingPlanes,R=x.clipIntersection,w=x.clipShadows,E=r.get(x);if(!s||A===null||A.length===0||u&&!w)u?_(null):g();else{const N=u?0:n,D=N*4;let U=E.clippingState||null;m.value=U,U=_(A,b,D,M);for(let B=0;B!==D;++B)U[B]=t[B];E.clippingState=U,this.numIntersection=R?this.numPlanes:0,this.numPlanes+=N}};function g(){m.value!==t&&(m.value=t,m.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function _(x,b,M,A){const R=x!==null?x.length:0;let w=null;if(R!==0){if(w=m.value,A!==!0||w===null){const E=M+R*4,N=b.matrixWorldInverse;h.getNormalMatrix(N),(w===null||w.length<E)&&(w=new Float32Array(E));for(let D=0,U=M;D!==R;++D,U+=4)f.copy(x[D]).applyMatrix4(N,h),f.normal.toArray(w,U),w[U+3]=f.constant}m.value=w,m.needsUpdate=!0}return e.numPlanes=R,e.numIntersection=0,w}}function DI(r){let e=new WeakMap;function t(f,h){return h===om?f.mapping=zo:h===lm&&(f.mapping=Pu),f}function n(f){if(f&&f.isTexture){const h=f.mapping;if(h===om||h===lm)if(e.has(f)){const m=e.get(f).texture;return t(m,f.mapping)}else{const m=f.image;if(m&&m.height>0){const g=new Db(m.height);return g.fromEquirectangularTexture(r,f),e.set(f,g),f.addEventListener("dispose",s),t(g.texture,f.mapping)}else return null}}return f}function s(f){const h=f.target;h.removeEventListener("dispose",s);const m=e.get(h);m!==void 0&&(e.delete(h),m.dispose())}function u(){e=new WeakMap}return{get:n,dispose:u}}const Ou=4,c1=[.125,.215,.35,.446,.526,.582],qc=20,LI=256,Wp=new Dl,f1=new yt;let Mx=null,Ex=0,Tx=0,Ax=!1;const UI=new j;class nb{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,t=0,n=.1,s=100,u={}){const{size:f=256,position:h=UI}=u;Mx=this._renderer.getRenderTarget(),Ex=this._renderer.getActiveCubeFace(),Tx=this._renderer.getActiveMipmapLevel(),Ax=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(f);const m=this._allocateTargets();return m.depthBuffer=!0,this._sceneToCubeUV(e,n,s,m,h),t>0&&this._blur(m,0,0,t),this._applyPMREM(m),this._cleanup(m),m}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=p1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=d1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(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(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Mx,Ex,Tx),this._renderer.xr.enabled=Ax,e.scissorTest=!1,zh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===zo||e.mapping===Pu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Mx=this._renderer.getRenderTarget(),Ex=this._renderer.getActiveCubeFace(),Tx=this._renderer.getActiveMipmapLevel(),Ax=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:oi,minFilter:oi,generateMipmaps:!1,type:Bo,format:Oa,colorSpace:zu,depthBuffer:!1},s=h1(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=h1(e,t,n);const{_lodMax:u}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=II(u)),this._blurMaterial=PI(u,e,t),this._ggxMaterial=OI(u,e,t)}return s}_compileMaterial(e){const t=new Yi(new Kt,e);this._renderer.compile(t,Wp)}_sceneToCubeUV(e,t,n,s,u){const m=new zi(90,1,t,n),g=[1,-1,1,1,1,1],_=[1,1,1,-1,-1,-1],x=this._renderer,b=x.autoClear,M=x.toneMapping;x.getClearColor(f1),x.toneMapping=gr,x.autoClear=!1,x.state.buffers.depth.getReversed()&&(x.setRenderTarget(s),x.clearDepth(),x.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Yi(new lf,new Vu({name:"PMREM.Background",side:as,depthWrite:!1,depthTest:!1})));const R=this._backgroundBox,w=R.material;let E=!1;const N=e.background;N?N.isColor&&(w.color.copy(N),e.background=null,E=!0):(w.color.copy(f1),E=!0);for(let D=0;D<6;D++){const U=D%3;U===0?(m.up.set(0,g[D],0),m.position.set(u.x,u.y,u.z),m.lookAt(u.x+_[D],u.y,u.z)):U===1?(m.up.set(0,0,g[D]),m.position.set(u.x,u.y,u.z),m.lookAt(u.x,u.y+_[D],u.z)):(m.up.set(0,g[D],0),m.position.set(u.x,u.y,u.z),m.lookAt(u.x,u.y,u.z+_[D]));const B=this._cubeSize;zh(s,U*B,D>2?B:0,B,B),x.setRenderTarget(s),E&&x.render(R,m),x.render(e,m)}x.toneMapping=M,x.autoClear=b,e.background=N}_textureToCubeUV(e,t){const n=this._renderer,s=e.mapping===zo||e.mapping===Pu;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=p1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=d1());const u=s?this._cubemapMaterial:this._equirectMaterial,f=this._lodMeshes[0];f.material=u;const h=u.uniforms;h.envMap.value=e;const m=this._cubeSize;zh(t,0,0,3*m,2*m),n.setRenderTarget(t),n.render(f,Wp)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let u=1;u<s;u++)this._applyGGXFilter(e,u-1,u);t.autoClear=n}_applyGGXFilter(e,t,n){const s=this._renderer,u=this._pingPongRenderTarget,f=this._ggxMaterial,h=this._lodMeshes[n];h.material=f;const m=f.uniforms,g=n/(this._lodMeshes.length-1),_=t/(this._lodMeshes.length-1),x=Math.sqrt(g*g-_*_),b=0+g*1.25,M=x*b,{_lodMax:A}=this,R=this._sizeLods[n],w=3*R*(n>A-Ou?n-A+Ou:0),E=4*(this._cubeSize-R);m.envMap.value=e.texture,m.roughness.value=M,m.mipInt.value=A-t,zh(u,w,E,3*R,2*R),s.setRenderTarget(u),s.render(h,Wp),m.envMap.value=u.texture,m.roughness.value=0,m.mipInt.value=A-n,zh(e,w,E,3*R,2*R),s.setRenderTarget(e),s.render(h,Wp)}_blur(e,t,n,s,u){const f=this._pingPongRenderTarget;this._halfBlur(e,f,t,n,s,"latitudinal",u),this._halfBlur(f,e,n,n,s,"longitudinal",u)}_halfBlur(e,t,n,s,u,f,h){const m=this._renderer,g=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&Rt("blur direction must be either latitudinal or longitudinal!");const _=3,x=this._lodMeshes[s];x.material=g;const b=g.uniforms,M=this._sizeLods[n]-1,A=isFinite(u)?Math.PI/(2*M):2*Math.PI/(2*qc-1),R=u/A,w=isFinite(u)?1+Math.floor(_*R):qc;w>qc&&ft(`sigmaRadians, ${u}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${qc}`);const E=[];let N=0;for(let H=0;H<qc;++H){const W=H/R,I=Math.exp(-W*W/2);E.push(I),H===0?N+=I:H<w&&(N+=2*I)}for(let H=0;H<E.length;H++)E[H]=E[H]/N;b.envMap.value=e.texture,b.samples.value=w,b.weights.value=E,b.latitudinal.value=f==="latitudinal",h&&(b.poleAxis.value=h);const{_lodMax:D}=this;b.dTheta.value=A,b.mipInt.value=D-n;const U=this._sizeLods[s],B=3*U*(s>D-Ou?s-D+Ou:0),z=4*(this._cubeSize-U);zh(t,B,z,3*U,2*U),m.setRenderTarget(t),m.render(x,Wp)}}function II(r){const e=[],t=[],n=[];let s=r;const u=r-Ou+1+c1.length;for(let f=0;f<u;f++){const h=Math.pow(2,s);e.push(h);let m=1/h;f>r-Ou?m=c1[f-r+Ou-1]:f===0&&(m=0),t.push(m);const g=1/(h-2),_=-g,x=1+g,b=[_,_,x,_,x,x,_,_,x,x,_,x],M=6,A=6,R=3,w=2,E=1,N=new Float32Array(R*A*M),D=new Float32Array(w*A*M),U=new Float32Array(E*A*M);for(let z=0;z<M;z++){const H=z%3*2/3-1,W=z>2?0:-1,I=[H,W,0,H+2/3,W,0,H+2/3,W+1,0,H,W,0,H+2/3,W+1,0,H,W+1,0];N.set(I,R*A*z),D.set(b,w*A*z);const P=[z,z,z,z,z,z];U.set(P,E*A*z)}const B=new Kt;B.setAttribute("position",new Xn(N,R)),B.setAttribute("uv",new Xn(D,w)),B.setAttribute("faceIndex",new Xn(U,E)),n.push(new Yi(B,null)),s>Ou&&s--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function h1(r,e,t){const n=new Hs(r,e,t);return n.texture.mapping=id,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function zh(r,e,t,n,s){r.viewport.set(e,t,n,s),r.scissor.set(e,t,n,s)}function OI(r,e,t){return new yr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:LI,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Qy(),fragmentShader:`
precision highp float;
precision highp int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform float roughness;
uniform float mipInt;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
#define PI 3.14159265359
// Van der Corput radical inverse
float radicalInverse_VdC(uint bits) {
bits = (bits << 16u) | (bits >> 16u);
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
}
// Hammersley sequence
vec2 hammersley(uint i, uint N) {
return vec2(float(i) / float(N), radicalInverse_VdC(i));
}
// GGX VNDF importance sampling (Eric Heitz 2018)
// "Sampling the GGX Distribution of Visible Normals"
// https://jcgt.org/published/0007/04/01/
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
float alpha = roughness * roughness;
// Section 3.2: Transform view direction to hemisphere configuration
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
// Section 4.1: Orthonormal basis
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
vec3 T2 = cross(Vh, T1);
// Section 4.2: Parameterization of projected area
float r = sqrt(Xi.x);
float phi = 2.0 * PI * Xi.y;
float t1 = r * cos(phi);
float t2 = r * sin(phi);
float s = 0.5 * (1.0 + Vh.z);
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
// Section 4.3: Reprojection onto hemisphere
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
// Section 3.4: Transform back to ellipsoid configuration
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
}
void main() {
vec3 N = normalize(vOutputDirection);
vec3 V = N; // Assume view direction equals normal for pre-filtering
vec3 prefilteredColor = vec3(0.0);
float totalWeight = 0.0;
// For very low roughness, just sample the environment directly
if (roughness < 0.001) {
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
return;
}
// Tangent space basis for VNDF sampling
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 tangent = normalize(cross(up, N));
vec3 bitangent = cross(N, tangent);
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
// Transform H back to world space
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
vec3 L = normalize(2.0 * dot(V, H) * H - V);
float NdotL = max(dot(N, L), 0.0);
if(NdotL > 0.0) {
// Sample environment at fixed mip level
// VNDF importance sampling handles the distribution filtering
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
// Weight by NdotL for the split-sum approximation
// VNDF PDF naturally accounts for the visible microfacet distribution
prefilteredColor += sampleColor * NdotL;
totalWeight += NdotL;
}
}
if (totalWeight > 0.0) {
prefilteredColor = prefilteredColor / totalWeight;
}
gl_FragColor = vec4(prefilteredColor, 1.0);
}
`,blending:Po,depthTest:!1,depthWrite:!1})}function PI(r,e,t){const n=new Float32Array(qc),s=new j(0,1,0);return new yr({name:"SphericalGaussianBlur",defines:{n:qc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Qy(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:Po,depthTest:!1,depthWrite:!1})}function d1(){return new yr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Qy(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:Po,depthTest:!1,depthWrite:!1})}function p1(){return new yr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Qy(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:Po,depthTest:!1,depthWrite:!1})}function Qy(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function zI(r){let e=new WeakMap,t=null;function n(h){if(h&&h.isTexture){const m=h.mapping,g=m===om||m===lm,_=m===zo||m===Pu;if(g||_){let x=e.get(h);const b=x!==void 0?x.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==b)return t===null&&(t=new nb(r)),x=g?t.fromEquirectangular(h,x):t.fromCubemap(h,x),x.texture.pmremVersion=h.pmremVersion,e.set(h,x),x.texture;if(x!==void 0)return x.texture;{const M=h.image;return g&&M&&M.height>0||_&&M&&s(M)?(t===null&&(t=new nb(r)),x=g?t.fromEquirectangular(h):t.fromCubemap(h),x.texture.pmremVersion=h.pmremVersion,e.set(h,x),h.addEventListener("dispose",u),x.texture):null}}}return h}function s(h){let m=0;const g=6;for(let _=0;_<g;_++)h[_]!==void 0&&m++;return m===g}function u(h){const m=h.target;m.removeEventListener("dispose",u);const g=e.get(m);g!==void 0&&(e.delete(m),g.dispose())}function f(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:f}}function BI(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const s=r.getExtension(n);return e[n]=s,s}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const s=t(n);return s===null&&Zh("WebGLRenderer: "+n+" extension not supported."),s}}}function FI(r,e,t,n){const s={},u=new WeakMap;function f(x){const b=x.target;b.index!==null&&e.remove(b.index);for(const A in b.attributes)e.remove(b.attributes[A]);b.removeEventListener("dispose",f),delete s[b.id];const M=u.get(b);M&&(e.remove(M),u.delete(b)),n.releaseStatesOfGeometry(b),b.isInstancedBufferGeometry===!0&&delete b._maxInstanceCount,t.memory.geometries--}function h(x,b){return s[b.id]===!0||(b.addEventListener("dispose",f),s[b.id]=!0,t.memory.geometries++),b}function m(x){const b=x.attributes;for(const M in b)e.update(b[M],r.ARRAY_BUFFER)}function g(x){const b=[],M=x.index,A=x.attributes.position;let R=0;if(M!==null){const N=M.array;R=M.version;for(let D=0,U=N.length;D<U;D+=3){const B=N[D+0],z=N[D+1],H=N[D+2];b.push(B,z,z,H,H,B)}}else if(A!==void 0){const N=A.array;R=A.version;for(let D=0,U=N.length/3-1;D<U;D+=3){const B=D+0,z=D+1,H=D+2;b.push(B,z,z,H,H,B)}}else return;const w=new(BE(b)?Nb:Rb)(b,1);w.version=R;const E=u.get(x);E&&e.remove(E),u.set(x,w)}function _(x){const b=u.get(x);if(b){const M=x.index;M!==null&&b.version<M.version&&g(x)}else g(x);return u.get(x)}return{get:h,update:m,getWireframeAttribute:_}}function kI(r,e,t){let n;function s(b){n=b}let u,f;function h(b){u=b.type,f=b.bytesPerElement}function m(b,M){r.drawElements(n,M,u,b*f),t.update(M,n,1)}function g(b,M,A){A!==0&&(r.drawElementsInstanced(n,M,u,b*f,A),t.update(M,n,A))}function _(b,M,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,M,0,u,b,0,A);let w=0;for(let E=0;E<A;E++)w+=M[E];t.update(w,n,1)}function x(b,M,A,R){if(A===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let E=0;E<b.length;E++)g(b[E]/f,M[E],R[E]);else{w.multiDrawElementsInstancedWEBGL(n,M,0,u,b,0,R,0,A);let E=0;for(let N=0;N<A;N++)E+=M[N]*R[N];t.update(E,n,1)}}this.setMode=s,this.setIndex=h,this.render=m,this.renderInstances=g,this.renderMultiDraw=_,this.renderMultiDrawInstances=x}function VI(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(u,f,h){switch(t.calls++,f){case r.TRIANGLES:t.triangles+=h*(u/3);break;case r.LINES:t.lines+=h*(u/2);break;case r.LINE_STRIP:t.lines+=h*(u-1);break;case r.LINE_LOOP:t.lines+=h*u;break;case r.POINTS:t.points+=h*u;break;default:Rt("WebGLInfo: Unknown draw mode:",f);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function HI(r,e,t){const n=new WeakMap,s=new jn;function u(f,h,m){const g=f.morphTargetInfluences,_=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,x=_!==void 0?_.length:0;let b=n.get(h);if(b===void 0||b.count!==x){let I=function(){H.dispose(),n.delete(h),h.removeEventListener("dispose",I)};b!==void 0&&b.texture.dispose();const M=h.morphAttributes.position!==void 0,A=h.morphAttributes.normal!==void 0,R=h.morphAttributes.color!==void 0,w=h.morphAttributes.position||[],E=h.morphAttributes.normal||[],N=h.morphAttributes.color||[];let D=0;M===!0&&(D=1),A===!0&&(D=2),R===!0&&(D=3);let U=h.attributes.position.count*D,B=1;U>e.maxTextureSize&&(B=Math.ceil(U/e.maxTextureSize),U=e.maxTextureSize);const z=new Float32Array(U*B*4*x),H=new wy(z,U,B,x);H.type=is,H.needsUpdate=!0;const W=D*4;for(let P=0;P<x;P++){const Z=w[P],se=E[P],te=N[P],fe=U*B*4*P;for(let pe=0;pe<Z.count;pe++){const Y=pe*W;M===!0&&(s.fromBufferAttribute(Z,pe),z[fe+Y+0]=s.x,z[fe+Y+1]=s.y,z[fe+Y+2]=s.z,z[fe+Y+3]=0),A===!0&&(s.fromBufferAttribute(se,pe),z[fe+Y+4]=s.x,z[fe+Y+5]=s.y,z[fe+Y+6]=s.z,z[fe+Y+7]=0),R===!0&&(s.fromBufferAttribute(te,pe),z[fe+Y+8]=s.x,z[fe+Y+9]=s.y,z[fe+Y+10]=s.z,z[fe+Y+11]=te.itemSize===4?s.w:1)}}b={count:x,texture:H,size:new ze(U,B)},n.set(h,b),h.addEventListener("dispose",I)}if(f.isInstancedMesh===!0&&f.morphTexture!==null)m.getUniforms().setValue(r,"morphTexture",f.morphTexture,t);else{let M=0;for(let R=0;R<g.length;R++)M+=g[R];const A=h.morphTargetsRelative?1:1-M;m.getUniforms().setValue(r,"morphTargetBaseInfluence",A),m.getUniforms().setValue(r,"morphTargetInfluences",g)}m.getUniforms().setValue(r,"morphTargetsTexture",b.texture,t),m.getUniforms().setValue(r,"morphTargetsTextureSize",b.size)}return{update:u}}function GI(r,e,t,n){let s=new WeakMap;function u(m){const g=n.render.frame,_=m.geometry,x=e.get(m,_);if(s.get(x)!==g&&(e.update(x),s.set(x,g)),m.isInstancedMesh&&(m.hasEventListener("dispose",h)===!1&&m.addEventListener("dispose",h),s.get(m)!==g&&(t.update(m.instanceMatrix,r.ARRAY_BUFFER),m.instanceColor!==null&&t.update(m.instanceColor,r.ARRAY_BUFFER),s.set(m,g))),m.isSkinnedMesh){const b=m.skeleton;s.get(b)!==g&&(b.update(),s.set(b,g))}return x}function f(){s=new WeakMap}function h(m){const g=m.target;g.removeEventListener("dispose",h),t.remove(g.instanceMatrix),g.instanceColor!==null&&t.remove(g.instanceColor)}return{update:u,dispose:f}}const XI={[db]:"LINEAR_TONE_MAPPING",[pb]:"REINHARD_TONE_MAPPING",[mb]:"CINEON_TONE_MAPPING",[gy]:"ACES_FILMIC_TONE_MAPPING",[vb]:"AGX_TONE_MAPPING",[yb]:"NEUTRAL_TONE_MAPPING",[gb]:"CUSTOM_TONE_MAPPING"};function WI(r,e,t,n,s){const u=new Hs(e,t,{type:r,depthBuffer:n,stencilBuffer:s}),f=new Hs(e,t,{type:Bo,depthBuffer:!1,stencilBuffer:!1}),h=new Kt;h.setAttribute("position",new bt([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new bt([0,2,0,0,2,0],2));const m=new Gb({uniforms:{tDiffuse:{value:null}},vertexShader:`
precision highp float;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
precision highp float;
uniform sampler2D tDiffuse;
varying vec2 vUv;
#include <tonemapping_pars_fragment>
#include <colorspace_pars_fragment>
void main() {
gl_FragColor = texture2D( tDiffuse, vUv );
#ifdef LINEAR_TONE_MAPPING
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
#elif defined( REINHARD_TONE_MAPPING )
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
#elif defined( CINEON_TONE_MAPPING )
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
#elif defined( ACES_FILMIC_TONE_MAPPING )
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
#elif defined( AGX_TONE_MAPPING )
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
#elif defined( NEUTRAL_TONE_MAPPING )
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
#elif defined( CUSTOM_TONE_MAPPING )
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
#endif
#ifdef SRGB_TRANSFER
gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif
}`,depthTest:!1,depthWrite:!1}),g=new Yi(h,m),_=new Dl(-1,1,1,-1,0,1);let x=null,b=null,M=!1,A,R=null,w=[],E=!1;this.setSize=function(N,D){u.setSize(N,D),f.setSize(N,D);for(let U=0;U<w.length;U++){const B=w[U];B.setSize&&B.setSize(N,D)}},this.setEffects=function(N){w=N,E=w.length>0&&w[0].isRenderPass===!0;const D=u.width,U=u.height;for(let B=0;B<w.length;B++){const z=w[B];z.setSize&&z.setSize(D,U)}},this.begin=function(N,D){if(M||N.toneMapping===gr&&w.length===0)return!1;if(R=D,D!==null){const U=D.width,B=D.height;(u.width!==U||u.height!==B)&&this.setSize(U,B)}return E===!1&&N.setRenderTarget(u),A=N.toneMapping,N.toneMapping=gr,!0},this.hasRenderPass=function(){return E},this.end=function(N,D){N.toneMapping=A,M=!0;let U=u,B=f;for(let z=0;z<w.length;z++){const H=w[z];if(H.enabled!==!1&&(H.render(N,B,U,D),H.needsSwap!==!1)){const W=U;U=B,B=W}}if(x!==N.outputColorSpace||b!==N.toneMapping){x=N.outputColorSpace,b=N.toneMapping,m.defines={},Sn.getTransfer(x)===zn&&(m.defines.SRGB_TRANSFER="");const z=XI[b];z&&(m.defines[z]=""),m.needsUpdate=!0}m.uniforms.tDiffuse.value=U.texture,N.setRenderTarget(R),N.render(g,_),R=null,M=!1},this.isCompositing=function(){return M},this.dispose=function(){u.dispose(),f.dispose(),h.dispose(),m.dispose()}}const HT=new wi,ib=new ed(1,1),GT=new wy,XT=new Cy,WT=new Cm,m1=[],g1=[],v1=new Float32Array(16),y1=new Float32Array(9),_1=new Float32Array(4);function rd(r,e,t){const n=r[0];if(n<=0||n>0)return r;const s=e*t;let u=m1[s];if(u===void 0&&(u=new Float32Array(s),m1[s]=u),e!==0){n.toArray(u,0);for(let f=1,h=0;f!==e;++f)h+=t,r[f].toArray(u,h)}return u}function ea(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function ta(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ky(r,e){let t=g1[e];t===void 0&&(t=new Int32Array(e),g1[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function qI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function jI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ea(t,e))return;r.uniform2fv(this.addr,e),ta(t,e)}}function YI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ea(t,e))return;r.uniform3fv(this.addr,e),ta(t,e)}}function ZI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ea(t,e))return;r.uniform4fv(this.addr,e),ta(t,e)}}function QI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(ea(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),ta(t,e)}else{if(ea(t,n))return;_1.set(n),r.uniformMatrix2fv(this.addr,!1,_1),ta(t,n)}}function KI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(ea(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),ta(t,e)}else{if(ea(t,n))return;y1.set(n),r.uniformMatrix3fv(this.addr,!1,y1),ta(t,n)}}function JI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(ea(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),ta(t,e)}else{if(ea(t,n))return;v1.set(n),r.uniformMatrix4fv(this.addr,!1,v1),ta(t,n)}}function $I(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function eO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ea(t,e))return;r.uniform2iv(this.addr,e),ta(t,e)}}function tO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ea(t,e))return;r.uniform3iv(this.addr,e),ta(t,e)}}function nO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ea(t,e))return;r.uniform4iv(this.addr,e),ta(t,e)}}function iO(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function aO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ea(t,e))return;r.uniform2uiv(this.addr,e),ta(t,e)}}function sO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ea(t,e))return;r.uniform3uiv(this.addr,e),ta(t,e)}}function rO(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ea(t,e))return;r.uniform4uiv(this.addr,e),ta(t,e)}}function oO(r,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(r.uniform1i(this.addr,s),n[0]=s);let u;this.type===r.SAMPLER_2D_SHADOW?(ib.compareFunction=t.isReversedDepthBuffer()?Ay:Ty,u=ib):u=HT,t.setTexture2D(e||u,s)}function lO(r,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(r.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||XT,s)}function uO(r,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(r.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||WT,s)}function cO(r,e,t){const n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(r.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||GT,s)}function fO(r){switch(r){case 5126:return qI;case 35664:return jI;case 35665:return YI;case 35666:return ZI;case 35674:return QI;case 35675:return KI;case 35676:return JI;case 5124:case 35670:return $I;case 35667:case 35671:return eO;case 35668:case 35672:return tO;case 35669:case 35673:return nO;case 5125:return iO;case 36294:return aO;case 36295:return sO;case 36296:return rO;case 35678:case 36198:case 36298:case 36306:case 35682:return oO;case 35679:case 36299:case 36307:return lO;case 35680:case 36300:case 36308:case 36293:return uO;case 36289:case 36303:case 36311:case 36292:return cO}}function hO(r,e){r.uniform1fv(this.addr,e)}function dO(r,e){const t=rd(e,this.size,2);r.uniform2fv(this.addr,t)}function pO(r,e){const t=rd(e,this.size,3);r.uniform3fv(this.addr,t)}function mO(r,e){const t=rd(e,this.size,4);r.uniform4fv(this.addr,t)}function gO(r,e){const t=rd(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function vO(r,e){const t=rd(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function yO(r,e){const t=rd(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function _O(r,e){r.uniform1iv(this.addr,e)}function xO(r,e){r.uniform2iv(this.addr,e)}function bO(r,e){r.uniform3iv(this.addr,e)}function SO(r,e){r.uniform4iv(this.addr,e)}function MO(r,e){r.uniform1uiv(this.addr,e)}function EO(r,e){r.uniform2uiv(this.addr,e)}function TO(r,e){r.uniform3uiv(this.addr,e)}function AO(r,e){r.uniform4uiv(this.addr,e)}function wO(r,e,t){const n=this.cache,s=e.length,u=Ky(t,s);ea(n,u)||(r.uniform1iv(this.addr,u),ta(n,u));let f;this.type===r.SAMPLER_2D_SHADOW?f=ib:f=HT;for(let h=0;h!==s;++h)t.setTexture2D(e[h]||f,u[h])}function CO(r,e,t){const n=this.cache,s=e.length,u=Ky(t,s);ea(n,u)||(r.uniform1iv(this.addr,u),ta(n,u));for(let f=0;f!==s;++f)t.setTexture3D(e[f]||XT,u[f])}function RO(r,e,t){const n=this.cache,s=e.length,u=Ky(t,s);ea(n,u)||(r.uniform1iv(this.addr,u),ta(n,u));for(let f=0;f!==s;++f)t.setTextureCube(e[f]||WT,u[f])}function NO(r,e,t){const n=this.cache,s=e.length,u=Ky(t,s);ea(n,u)||(r.uniform1iv(this.addr,u),ta(n,u));for(let f=0;f!==s;++f)t.setTexture2DArray(e[f]||GT,u[f])}function DO(r){switch(r){case 5126:return hO;case 35664:return dO;case 35665:return pO;case 35666:return mO;case 35674:return gO;case 35675:return vO;case 35676:return yO;case 5124:case 35670:return _O;case 35667:case 35671:return xO;case 35668:case 35672:return bO;case 35669:case 35673:return SO;case 5125:return MO;case 36294:return EO;case 36295:return TO;case 36296:return AO;case 35678:case 36198:case 36298:case 36306:case 35682:return wO;case 35679:case 36299:case 36307:return CO;case 35680:case 36300:case 36308:case 36293:return RO;case 36289:case 36303:case 36311:case 36292:return NO}}class LO{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=fO(t.type)}}class UO{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=DO(t.type)}}class IO{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const s=this.seq;for(let u=0,f=s.length;u!==f;++u){const h=s[u];h.setValue(e,t[h.id],n)}}}const wx=/(\w+)(\])?(\[|\.)?/g;function x1(r,e){r.seq.push(e),r.map[e.id]=e}function OO(r,e,t){const n=r.name,s=n.length;for(wx.lastIndex=0;;){const u=wx.exec(n),f=wx.lastIndex;let h=u[1];const m=u[2]==="]",g=u[3];if(m&&(h=h|0),g===void 0||g==="["&&f+2===s){x1(t,g===void 0?new LO(h,r,e):new UO(h,r,e));break}else{let x=t.map[h];x===void 0&&(x=new IO(h),x1(t,x)),t=x}}}class mv{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let f=0;f<n;++f){const h=e.getActiveUniform(t,f),m=e.getUniformLocation(t,h.name);OO(h,m,this)}const s=[],u=[];for(const f of this.seq)f.type===e.SAMPLER_2D_SHADOW||f.type===e.SAMPLER_CUBE_SHADOW||f.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(f):u.push(f);s.length>0&&(this.seq=s.concat(u))}setValue(e,t,n,s){const u=this.map[t];u!==void 0&&u.setValue(e,n,s)}setOptional(e,t,n){const s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let u=0,f=t.length;u!==f;++u){const h=t[u],m=n[h.id];m.needsUpdate!==!1&&h.setValue(e,m.value,s)}}static seqWithValue(e,t){const n=[];for(let s=0,u=e.length;s!==u;++s){const f=e[s];f.id in t&&n.push(f)}return n}}function b1(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const PO=37297;let zO=0;function BO(r,e){const t=r.split(`
`),n=[],s=Math.max(e-6,0),u=Math.min(e+6,t.length);for(let f=s;f<u;f++){const h=f+1;n.push(`${h===e?">":" "} ${h}: ${t[f]}`)}return n.join(`
`)}const S1=new en;function FO(r){Sn._getMatrix(S1,Sn.workingColorSpace,r);const e=`mat3( ${S1.elements.map(t=>t.toFixed(4))} )`;switch(Sn.getTransfer(r)){case dm:return[e,"LinearTransferOETF"];case zn:return[e,"sRGBTransferOETF"];default:return ft("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function M1(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),u=(r.getShaderInfoLog(e)||"").trim();if(n&&u==="")return"";const f=/ERROR: 0:(\d+)/.exec(u);if(f){const h=parseInt(f[1]);return t.toUpperCase()+`
`+u+`
`+BO(r.getShaderSource(e),h)}else return u}function kO(r,e){const t=FO(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}const VO={[db]:"Linear",[pb]:"Reinhard",[mb]:"Cineon",[gy]:"ACESFilmic",[vb]:"AgX",[yb]:"Neutral",[gb]:"Custom"};function HO(r,e){const t=VO[e];return t===void 0?(ft("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const lv=new j;function GO(){Sn.getLuminanceCoefficients(lv);const r=lv.x.toFixed(4),e=lv.y.toFixed(4),t=lv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
`)}function XO(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Qp).join(`
`)}function WO(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function qO(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const u=r.getActiveAttrib(e,s),f=u.name;let h=1;u.type===r.FLOAT_MAT2&&(h=2),u.type===r.FLOAT_MAT3&&(h=3),u.type===r.FLOAT_MAT4&&(h=4),t[f]={type:u.type,location:r.getAttribLocation(e,f),locationSize:h}}return t}function Qp(r){return r!==""}function E1(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function T1(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const jO=/^[ \t]*#include +<([\w\d./]+)>/gm;function ab(r){return r.replace(jO,ZO)}const YO=new Map;function ZO(r,e){let t=un[e];if(t===void 0){const n=YO.get(e);if(n!==void 0)t=un[n],ft('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return ab(t)}const QO=/#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 A1(r){return r.replace(QO,KO)}function KO(r,e,t,n){let s="";for(let u=parseInt(e);u<parseInt(t);u++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+u+" ]").replace(/UNROLLED_LOOP_INDEX/g,u);return s}function w1(r){let e=`precision ${r.precision} float;
precision ${r.precision} int;
precision ${r.precision} sampler2D;
precision ${r.precision} samplerCube;
precision ${r.precision} sampler3D;
precision ${r.precision} sampler2DArray;
precision ${r.precision} sampler2DShadow;
precision ${r.precision} samplerCubeShadow;
precision ${r.precision} sampler2DArrayShadow;
precision ${r.precision} isampler2D;
precision ${r.precision} isampler3D;
precision ${r.precision} isamplerCube;
precision ${r.precision} isampler2DArray;
precision ${r.precision} usampler2D;
precision ${r.precision} usampler3D;
precision ${r.precision} usamplerCube;
precision ${r.precision} usampler2DArray;
`;return r.precision==="highp"?e+=`
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}const JO={[Xh]:"SHADOWMAP_TYPE_PCF",[jc]:"SHADOWMAP_TYPE_VSM"};function $O(r){return JO[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const eP={[zo]:"ENVMAP_TYPE_CUBE",[Pu]:"ENVMAP_TYPE_CUBE",[id]:"ENVMAP_TYPE_CUBE_UV"};function tP(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":eP[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const nP={[Pu]:"ENVMAP_MODE_REFRACTION"};function iP(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":nP[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const aP={[Am]:"ENVMAP_BLENDING_MULTIPLY",[EE]:"ENVMAP_BLENDING_MIX",[TE]:"ENVMAP_BLENDING_ADD"};function sP(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":aP[r.combine]||"ENVMAP_BLENDING_NONE"}function rP(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function oP(r,e,t,n){const s=r.getContext(),u=t.defines;let f=t.vertexShader,h=t.fragmentShader;const m=$O(t),g=tP(t),_=iP(t),x=sP(t),b=rP(t),M=XO(t),A=WO(u),R=s.createProgram();let w,E,N=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(w=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(Qp).join(`
`),w.length>0&&(w+=`
`),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(Qp).join(`
`),E.length>0&&(E+=`
`)):(w=[w1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+_:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+m:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(Qp).join(`
`),E=[w1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+g:"",t.envMap?"#define "+_:"",t.envMap?"#define "+x:"",b?"#define CUBEUV_TEXEL_WIDTH "+b.texelWidth:"",b?"#define CUBEUV_TEXEL_HEIGHT "+b.texelHeight:"",b?"#define CUBEUV_MAX_MIP "+b.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+m:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==gr?"#define TONE_MAPPING":"",t.toneMapping!==gr?un.tonemapping_pars_fragment:"",t.toneMapping!==gr?HO("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",un.colorspace_pars_fragment,kO("linearToOutputTexel",t.outputColorSpace),GO(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Qp).join(`
`)),f=ab(f),f=E1(f,t),f=T1(f,t),h=ab(h),h=E1(h,t),h=T1(h,t),f=A1(f),h=A1(h),t.isRawShaderMaterial!==!0&&(N=`#version 300 es
`,w=[M,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,E=["#define varying in",t.glslVersion===jx?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===jx?"":"#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(`
`)+`
`+E);const D=N+w+f,U=N+E+h,B=b1(s,s.VERTEX_SHADER,D),z=b1(s,s.FRAGMENT_SHADER,U);s.attachShader(R,B),s.attachShader(R,z),t.index0AttributeName!==void 0?s.bindAttribLocation(R,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(R,0,"position"),s.linkProgram(R);function H(Z){if(r.debug.checkShaderErrors){const se=s.getProgramInfoLog(R)||"",te=s.getShaderInfoLog(B)||"",fe=s.getShaderInfoLog(z)||"",pe=se.trim(),Y=te.trim(),q=fe.trim();let ne=!0,be=!0;if(s.getProgramParameter(R,s.LINK_STATUS)===!1)if(ne=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(s,R,B,z);else{const Ne=M1(s,B,"vertex"),X=M1(s,z,"fragment");Rt("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(R,s.VALIDATE_STATUS)+`
Material Name: `+Z.name+`
Material Type: `+Z.type+`
Program Info Log: `+pe+`
`+Ne+`
`+X)}else pe!==""?ft("WebGLProgram: Program Info Log:",pe):(Y===""||q==="")&&(be=!1);be&&(Z.diagnostics={runnable:ne,programLog:pe,vertexShader:{log:Y,prefix:w},fragmentShader:{log:q,prefix:E}})}s.deleteShader(B),s.deleteShader(z),W=new mv(s,R),I=qO(s,R)}let W;this.getUniforms=function(){return W===void 0&&H(this),W};let I;this.getAttributes=function(){return I===void 0&&H(this),I};let P=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=s.getProgramParameter(R,PO)),P},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=zO++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=B,this.fragmentShader=z,this}let lP=0;class uP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,s=this._getShaderStage(t),u=this._getShaderStage(n),f=this._getShaderCacheForMaterial(e);return f.has(s)===!1&&(f.add(s),s.usedTimes++),f.has(u)===!1&&(f.add(u),u.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new cP(e),t.set(e,n)),n}}class cP{constructor(e){this.id=lP++,this.code=e,this.usedTimes=0}}function fP(r,e,t,n,s,u,f){const h=new Kh,m=new uP,g=new Set,_=[],x=new Map,b=s.logarithmicDepthBuffer;let M=s.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function R(I){return g.add(I),I===0?"uv":`uv${I}`}function w(I,P,Z,se,te){const fe=se.fog,pe=te.geometry,Y=I.isMeshStandardMaterial?se.environment:null,q=(I.isMeshStandardMaterial?t:e).get(I.envMap||Y),ne=q&&q.mapping===id?q.image.height:null,be=A[I.type];I.precision!==null&&(M=s.getMaxPrecision(I.precision),M!==I.precision&&ft("WebGLProgram.getParameters:",I.precision,"not supported, using",M,"instead."));const Ne=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,X=Ne!==void 0?Ne.length:0;let oe=0;pe.morphAttributes.position!==void 0&&(oe=1),pe.morphAttributes.normal!==void 0&&(oe=2),pe.morphAttributes.color!==void 0&&(oe=3);let Ae,Fe,lt,de;if(be){const nn=qr[be];Ae=nn.vertexShader,Fe=nn.fragmentShader}else Ae=I.vertexShader,Fe=I.fragmentShader,m.update(I),lt=m.getVertexShaderID(I),de=m.getFragmentShaderID(I);const Re=r.getRenderTarget(),tt=r.state.buffers.depth.getReversed(),st=te.isInstancedMesh===!0,ht=te.isBatchedMesh===!0,jt=!!I.map,tn=!!I.matcap,Nt=!!q,Le=!!I.aoMap,He=!!I.lightMap,Oe=!!I.bumpMap,nt=!!I.normalMap,Q=!!I.displacementMap,Et=!!I.emissiveMap,ot=!!I.metalnessMap,Tt=!!I.roughnessMap,Qe=I.anisotropy>0,G=I.clearcoat>0,O=I.dispersion>0,ae=I.iridescence>0,Te=I.sheen>0,Ie=I.transmission>0,Ee=Qe&&!!I.anisotropyMap,dt=G&&!!I.clearcoatMap,Ke=G&&!!I.clearcoatNormalMap,vt=G&&!!I.clearcoatRoughnessMap,Dt=ae&&!!I.iridescenceMap,Ve=ae&&!!I.iridescenceThicknessMap,Ze=Te&&!!I.sheenColorMap,ct=Te&&!!I.sheenRoughnessMap,K=!!I.specularMap,me=!!I.specularColorMap,et=!!I.specularIntensityMap,J=Ie&&!!I.transmissionMap,je=Ie&&!!I.thicknessMap,Ge=!!I.gradientMap,at=!!I.alphaMap,Xe=I.alphaTest>0,Ue=!!I.alphaHash,Ye=!!I.extensions;let Ct=gr;I.toneMapped&&(Re===null||Re.isXRRenderTarget===!0)&&(Ct=r.toneMapping);const Jt={shaderID:be,shaderType:I.type,shaderName:I.name,vertexShader:Ae,fragmentShader:Fe,defines:I.defines,customVertexShaderID:lt,customFragmentShaderID:de,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:M,batching:ht,batchingColor:ht&&te._colorsTexture!==null,instancing:st,instancingColor:st&&te.instanceColor!==null,instancingMorph:st&&te.morphTexture!==null,outputColorSpace:Re===null?r.outputColorSpace:Re.isXRRenderTarget===!0?Re.texture.colorSpace:zu,alphaToCoverage:!!I.alphaToCoverage,map:jt,matcap:tn,envMap:Nt,envMapMode:Nt&&q.mapping,envMapCubeUVHeight:ne,aoMap:Le,lightMap:He,bumpMap:Oe,normalMap:nt,displacementMap:Q,emissiveMap:Et,normalMapObjectSpace:nt&&I.normalMapType===DE,normalMapTangentSpace:nt&&I.normalMapType===ku,metalnessMap:ot,roughnessMap:Tt,anisotropy:Qe,anisotropyMap:Ee,clearcoat:G,clearcoatMap:dt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:vt,dispersion:O,iridescence:ae,iridescenceMap:Dt,iridescenceThicknessMap:Ve,sheen:Te,sheenColorMap:Ze,sheenRoughnessMap:ct,specularMap:K,specularColorMap:me,specularIntensityMap:et,transmission:Ie,transmissionMap:J,thicknessMap:je,gradientMap:Ge,opaque:I.transparent===!1&&I.blending===Kc&&I.alphaToCoverage===!1,alphaMap:at,alphaTest:Xe,alphaHash:Ue,combine:I.combine,mapUv:jt&&R(I.map.channel),aoMapUv:Le&&R(I.aoMap.channel),lightMapUv:He&&R(I.lightMap.channel),bumpMapUv:Oe&&R(I.bumpMap.channel),normalMapUv:nt&&R(I.normalMap.channel),displacementMapUv:Q&&R(I.displacementMap.channel),emissiveMapUv:Et&&R(I.emissiveMap.channel),metalnessMapUv:ot&&R(I.metalnessMap.channel),roughnessMapUv:Tt&&R(I.roughnessMap.channel),anisotropyMapUv:Ee&&R(I.anisotropyMap.channel),clearcoatMapUv:dt&&R(I.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&R(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:vt&&R(I.clearcoatRoughnessMap.channel),iridescenceMapUv:Dt&&R(I.iridescenceMap.channel),iridescenceThicknessMapUv:Ve&&R(I.iridescenceThicknessMap.channel),sheenColorMapUv:Ze&&R(I.sheenColorMap.channel),sheenRoughnessMapUv:ct&&R(I.sheenRoughnessMap.channel),specularMapUv:K&&R(I.specularMap.channel),specularColorMapUv:me&&R(I.specularColorMap.channel),specularIntensityMapUv:et&&R(I.specularIntensityMap.channel),transmissionMapUv:J&&R(I.transmissionMap.channel),thicknessMapUv:je&&R(I.thicknessMap.channel),alphaMapUv:at&&R(I.alphaMap.channel),vertexTangents:!!pe.attributes.tangent&&(nt||Qe),vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!pe.attributes.uv&&(jt||at),fog:!!fe,useFog:I.fog===!0,fogExp2:!!fe&&fe.isFogExp2,flatShading:I.flatShading===!0&&I.wireframe===!1,sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:b,reversedDepthBuffer:tt,skinning:te.isSkinnedMesh===!0,morphTargets:pe.morphAttributes.position!==void 0,morphNormals:pe.morphAttributes.normal!==void 0,morphColors:pe.morphAttributes.color!==void 0,morphTargetsCount:X,morphTextureStride:oe,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:f.numPlanes,numClipIntersection:f.numIntersection,dithering:I.dithering,shadowMapEnabled:r.shadowMap.enabled&&Z.length>0,shadowMapType:r.shadowMap.type,toneMapping:Ct,decodeVideoTexture:jt&&I.map.isVideoTexture===!0&&Sn.getTransfer(I.map.colorSpace)===zn,decodeVideoTextureEmissive:Et&&I.emissiveMap.isVideoTexture===!0&&Sn.getTransfer(I.emissiveMap.colorSpace)===zn,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===Uo,flipSided:I.side===as,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionClipCullDistance:Ye&&I.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ye&&I.extensions.multiDraw===!0||ht)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:I.customProgramCacheKey()};return Jt.vertexUv1s=g.has(1),Jt.vertexUv2s=g.has(2),Jt.vertexUv3s=g.has(3),g.clear(),Jt}function E(I){const P=[];if(I.shaderID?P.push(I.shaderID):(P.push(I.customVertexShaderID),P.push(I.customFragmentShaderID)),I.defines!==void 0)for(const Z in I.defines)P.push(Z),P.push(I.defines[Z]);return I.isRawShaderMaterial===!1&&(N(P,I),D(P,I),P.push(r.outputColorSpace)),P.push(I.customProgramCacheKey),P.join()}function N(I,P){I.push(P.precision),I.push(P.outputColorSpace),I.push(P.envMapMode),I.push(P.envMapCubeUVHeight),I.push(P.mapUv),I.push(P.alphaMapUv),I.push(P.lightMapUv),I.push(P.aoMapUv),I.push(P.bumpMapUv),I.push(P.normalMapUv),I.push(P.displacementMapUv),I.push(P.emissiveMapUv),I.push(P.metalnessMapUv),I.push(P.roughnessMapUv),I.push(P.anisotropyMapUv),I.push(P.clearcoatMapUv),I.push(P.clearcoatNormalMapUv),I.push(P.clearcoatRoughnessMapUv),I.push(P.iridescenceMapUv),I.push(P.iridescenceThicknessMapUv),I.push(P.sheenColorMapUv),I.push(P.sheenRoughnessMapUv),I.push(P.specularMapUv),I.push(P.specularColorMapUv),I.push(P.specularIntensityMapUv),I.push(P.transmissionMapUv),I.push(P.thicknessMapUv),I.push(P.combine),I.push(P.fogExp2),I.push(P.sizeAttenuation),I.push(P.morphTargetsCount),I.push(P.morphAttributeCount),I.push(P.numDirLights),I.push(P.numPointLights),I.push(P.numSpotLights),I.push(P.numSpotLightMaps),I.push(P.numHemiLights),I.push(P.numRectAreaLights),I.push(P.numDirLightShadows),I.push(P.numPointLightShadows),I.push(P.numSpotLightShadows),I.push(P.numSpotLightShadowsWithMaps),I.push(P.numLightProbes),I.push(P.shadowMapType),I.push(P.toneMapping),I.push(P.numClippingPlanes),I.push(P.numClipIntersection),I.push(P.depthPacking)}function D(I,P){h.disableAll(),P.instancing&&h.enable(0),P.instancingColor&&h.enable(1),P.instancingMorph&&h.enable(2),P.matcap&&h.enable(3),P.envMap&&h.enable(4),P.normalMapObjectSpace&&h.enable(5),P.normalMapTangentSpace&&h.enable(6),P.clearcoat&&h.enable(7),P.iridescence&&h.enable(8),P.alphaTest&&h.enable(9),P.vertexColors&&h.enable(10),P.vertexAlphas&&h.enable(11),P.vertexUv1s&&h.enable(12),P.vertexUv2s&&h.enable(13),P.vertexUv3s&&h.enable(14),P.vertexTangents&&h.enable(15),P.anisotropy&&h.enable(16),P.alphaHash&&h.enable(17),P.batching&&h.enable(18),P.dispersion&&h.enable(19),P.batchingColor&&h.enable(20),P.gradientMap&&h.enable(21),I.push(h.mask),h.disableAll(),P.fog&&h.enable(0),P.useFog&&h.enable(1),P.flatShading&&h.enable(2),P.logarithmicDepthBuffer&&h.enable(3),P.reversedDepthBuffer&&h.enable(4),P.skinning&&h.enable(5),P.morphTargets&&h.enable(6),P.morphNormals&&h.enable(7),P.morphColors&&h.enable(8),P.premultipliedAlpha&&h.enable(9),P.shadowMapEnabled&&h.enable(10),P.doubleSided&&h.enable(11),P.flipSided&&h.enable(12),P.useDepthPacking&&h.enable(13),P.dithering&&h.enable(14),P.transmission&&h.enable(15),P.sheen&&h.enable(16),P.opaque&&h.enable(17),P.pointsUvs&&h.enable(18),P.decodeVideoTexture&&h.enable(19),P.decodeVideoTextureEmissive&&h.enable(20),P.alphaToCoverage&&h.enable(21),I.push(h.mask)}function U(I){const P=A[I.type];let Z;if(P){const se=qr[P];Z=XE.clone(se.uniforms)}else Z=I.uniforms;return Z}function B(I,P){let Z=x.get(P);return Z!==void 0?++Z.usedTimes:(Z=new oP(r,P,I,u),_.push(Z),x.set(P,Z)),Z}function z(I){if(--I.usedTimes===0){const P=_.indexOf(I);_[P]=_[_.length-1],_.pop(),x.delete(I.cacheKey),I.destroy()}}function H(I){m.remove(I)}function W(){m.dispose()}return{getParameters:w,getProgramCacheKey:E,getUniforms:U,acquireProgram:B,releaseProgram:z,releaseShaderCache:H,programs:_,dispose:W}}function hP(){let r=new WeakMap;function e(f){return r.has(f)}function t(f){let h=r.get(f);return h===void 0&&(h={},r.set(f,h)),h}function n(f){r.delete(f)}function s(f,h,m){r.get(f)[h]=m}function u(){r=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:u}}function dP(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function C1(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function R1(){const r=[];let e=0;const t=[],n=[],s=[];function u(){e=0,t.length=0,n.length=0,s.length=0}function f(x,b,M,A,R,w){let E=r[e];return E===void 0?(E={id:x.id,object:x,geometry:b,material:M,groupOrder:A,renderOrder:x.renderOrder,z:R,group:w},r[e]=E):(E.id=x.id,E.object=x,E.geometry=b,E.material=M,E.groupOrder=A,E.renderOrder=x.renderOrder,E.z=R,E.group=w),e++,E}function h(x,b,M,A,R,w){const E=f(x,b,M,A,R,w);M.transmission>0?n.push(E):M.transparent===!0?s.push(E):t.push(E)}function m(x,b,M,A,R,w){const E=f(x,b,M,A,R,w);M.transmission>0?n.unshift(E):M.transparent===!0?s.unshift(E):t.unshift(E)}function g(x,b){t.length>1&&t.sort(x||dP),n.length>1&&n.sort(b||C1),s.length>1&&s.sort(b||C1)}function _(){for(let x=e,b=r.length;x<b;x++){const M=r[x];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:t,transmissive:n,transparent:s,init:u,push:h,unshift:m,finish:_,sort:g}}function pP(){let r=new WeakMap;function e(n,s){const u=r.get(n);let f;return u===void 0?(f=new R1,r.set(n,[f])):s>=u.length?(f=new R1,u.push(f)):f=u[s],f}function t(){r=new WeakMap}return{get:e,dispose:t}}function mP(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new j,color:new yt};break;case"SpotLight":t={position:new j,direction:new j,color:new yt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new j,color:new yt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new j,skyColor:new yt,groundColor:new yt};break;case"RectAreaLight":t={color:new yt,position:new j,halfWidth:new j,halfHeight:new j};break}return r[e.id]=t,t}}}function gP(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ze};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ze};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let vP=0;function yP(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function _P(r){const e=new mP,t=gP(),n={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 g=0;g<9;g++)n.probe.push(new j);const s=new j,u=new Xt,f=new Xt;function h(g){let _=0,x=0,b=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let M=0,A=0,R=0,w=0,E=0,N=0,D=0,U=0,B=0,z=0,H=0;g.sort(yP);for(let I=0,P=g.length;I<P;I++){const Z=g[I],se=Z.color,te=Z.intensity,fe=Z.distance;let pe=null;if(Z.shadow&&Z.shadow.map&&(Z.shadow.map.texture.format===tf?pe=Z.shadow.map.texture:pe=Z.shadow.map.depthTexture||Z.shadow.map.texture),Z.isAmbientLight)_+=se.r*te,x+=se.g*te,b+=se.b*te;else if(Z.isLightProbe){for(let Y=0;Y<9;Y++)n.probe[Y].addScaledVector(Z.sh.coefficients[Y],te);H++}else if(Z.isDirectionalLight){const Y=e.get(Z);if(Y.color.copy(Z.color).multiplyScalar(Z.intensity),Z.castShadow){const q=Z.shadow,ne=t.get(Z);ne.shadowIntensity=q.intensity,ne.shadowBias=q.bias,ne.shadowNormalBias=q.normalBias,ne.shadowRadius=q.radius,ne.shadowMapSize=q.mapSize,n.directionalShadow[M]=ne,n.directionalShadowMap[M]=pe,n.directionalShadowMatrix[M]=Z.shadow.matrix,N++}n.directional[M]=Y,M++}else if(Z.isSpotLight){const Y=e.get(Z);Y.position.setFromMatrixPosition(Z.matrixWorld),Y.color.copy(se).multiplyScalar(te),Y.distance=fe,Y.coneCos=Math.cos(Z.angle),Y.penumbraCos=Math.cos(Z.angle*(1-Z.penumbra)),Y.decay=Z.decay,n.spot[R]=Y;const q=Z.shadow;if(Z.map&&(n.spotLightMap[B]=Z.map,B++,q.updateMatrices(Z),Z.castShadow&&z++),n.spotLightMatrix[R]=q.matrix,Z.castShadow){const ne=t.get(Z);ne.shadowIntensity=q.intensity,ne.shadowBias=q.bias,ne.shadowNormalBias=q.normalBias,ne.shadowRadius=q.radius,ne.shadowMapSize=q.mapSize,n.spotShadow[R]=ne,n.spotShadowMap[R]=pe,U++}R++}else if(Z.isRectAreaLight){const Y=e.get(Z);Y.color.copy(se).multiplyScalar(te),Y.halfWidth.set(Z.width*.5,0,0),Y.halfHeight.set(0,Z.height*.5,0),n.rectArea[w]=Y,w++}else if(Z.isPointLight){const Y=e.get(Z);if(Y.color.copy(Z.color).multiplyScalar(Z.intensity),Y.distance=Z.distance,Y.decay=Z.decay,Z.castShadow){const q=Z.shadow,ne=t.get(Z);ne.shadowIntensity=q.intensity,ne.shadowBias=q.bias,ne.shadowNormalBias=q.normalBias,ne.shadowRadius=q.radius,ne.shadowMapSize=q.mapSize,ne.shadowCameraNear=q.camera.near,ne.shadowCameraFar=q.camera.far,n.pointShadow[A]=ne,n.pointShadowMap[A]=pe,n.pointShadowMatrix[A]=Z.shadow.matrix,D++}n.point[A]=Y,A++}else if(Z.isHemisphereLight){const Y=e.get(Z);Y.skyColor.copy(Z.color).multiplyScalar(te),Y.groundColor.copy(Z.groundColor).multiplyScalar(te),n.hemi[E]=Y,E++}}w>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pt.LTC_FLOAT_1,n.rectAreaLTC2=pt.LTC_FLOAT_2):(n.rectAreaLTC1=pt.LTC_HALF_1,n.rectAreaLTC2=pt.LTC_HALF_2)),n.ambient[0]=_,n.ambient[1]=x,n.ambient[2]=b;const W=n.hash;(W.directionalLength!==M||W.pointLength!==A||W.spotLength!==R||W.rectAreaLength!==w||W.hemiLength!==E||W.numDirectionalShadows!==N||W.numPointShadows!==D||W.numSpotShadows!==U||W.numSpotMaps!==B||W.numLightProbes!==H)&&(n.directional.length=M,n.spot.length=R,n.rectArea.length=w,n.point.length=A,n.hemi.length=E,n.directionalShadow.length=N,n.directionalShadowMap.length=N,n.pointShadow.length=D,n.pointShadowMap.length=D,n.spotShadow.length=U,n.spotShadowMap.length=U,n.directionalShadowMatrix.length=N,n.pointShadowMatrix.length=D,n.spotLightMatrix.length=U+B-z,n.spotLightMap.length=B,n.numSpotLightShadowsWithMaps=z,n.numLightProbes=H,W.directionalLength=M,W.pointLength=A,W.spotLength=R,W.rectAreaLength=w,W.hemiLength=E,W.numDirectionalShadows=N,W.numPointShadows=D,W.numSpotShadows=U,W.numSpotMaps=B,W.numLightProbes=H,n.version=vP++)}function m(g,_){let x=0,b=0,M=0,A=0,R=0;const w=_.matrixWorldInverse;for(let E=0,N=g.length;E<N;E++){const D=g[E];if(D.isDirectionalLight){const U=n.directional[x];U.direction.setFromMatrixPosition(D.matrixWorld),s.setFromMatrixPosition(D.target.matrixWorld),U.direction.sub(s),U.direction.transformDirection(w),x++}else if(D.isSpotLight){const U=n.spot[M];U.position.setFromMatrixPosition(D.matrixWorld),U.position.applyMatrix4(w),U.direction.setFromMatrixPosition(D.matrixWorld),s.setFromMatrixPosition(D.target.matrixWorld),U.direction.sub(s),U.direction.transformDirection(w),M++}else if(D.isRectAreaLight){const U=n.rectArea[A];U.position.setFromMatrixPosition(D.matrixWorld),U.position.applyMatrix4(w),f.identity(),u.copy(D.matrixWorld),u.premultiply(w),f.extractRotation(u),U.halfWidth.set(D.width*.5,0,0),U.halfHeight.set(0,D.height*.5,0),U.halfWidth.applyMatrix4(f),U.halfHeight.applyMatrix4(f),A++}else if(D.isPointLight){const U=n.point[b];U.position.setFromMatrixPosition(D.matrixWorld),U.position.applyMatrix4(w),b++}else if(D.isHemisphereLight){const U=n.hemi[R];U.direction.setFromMatrixPosition(D.matrixWorld),U.direction.transformDirection(w),R++}}}return{setup:h,setupView:m,state:n}}function N1(r){const e=new _P(r),t=[],n=[];function s(_){g.camera=_,t.length=0,n.length=0}function u(_){t.push(_)}function f(_){n.push(_)}function h(){e.setup(t)}function m(_){e.setupView(t,_)}const g={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:g,setupLights:h,setupLightsView:m,pushLight:u,pushShadow:f}}function xP(r){let e=new WeakMap;function t(s,u=0){const f=e.get(s);let h;return f===void 0?(h=new N1(r),e.set(s,[h])):u>=f.length?(h=new N1(r),f.push(h)):h=f[u],h}function n(){e=new WeakMap}return{get:t,dispose:n}}const bP=`void main() {
gl_Position = vec4( position, 1.0 );
}`,SP=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,MP=[new j(1,0,0),new j(-1,0,0),new j(0,1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1)],EP=[new j(0,-1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1),new j(0,-1,0),new j(0,-1,0)],D1=new Xt,qp=new j,Cx=new j;function TP(r,e,t){let n=new ad;const s=new ze,u=new ze,f=new jn,h=new Wb,m=new qb,g={},_=t.maxTextureSize,x={[Ll]:as,[as]:Ll,[Uo]:Uo},b=new yr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ze},radius:{value:4}},vertexShader:bP,fragmentShader:SP}),M=b.clone();M.defines.HORIZONTAL_PASS=1;const A=new Kt;A.setAttribute("position",new Xn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new Yi(A,b),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Xh;let E=this.type;this.render=function(z,H,W){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||z.length===0)return;z.type===Kp&&(ft("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),z.type=Xh);const I=r.getRenderTarget(),P=r.getActiveCubeFace(),Z=r.getActiveMipmapLevel(),se=r.state;se.setBlending(Po),se.buffers.depth.getReversed()===!0?se.buffers.color.setClear(0,0,0,0):se.buffers.color.setClear(1,1,1,1),se.buffers.depth.setTest(!0),se.setScissorTest(!1);const te=E!==this.type;te&&H.traverse(function(fe){fe.material&&(Array.isArray(fe.material)?fe.material.forEach(pe=>pe.needsUpdate=!0):fe.material.needsUpdate=!0)});for(let fe=0,pe=z.length;fe<pe;fe++){const Y=z[fe],q=Y.shadow;if(q===void 0){ft("WebGLShadowMap:",Y,"has no shadow.");continue}if(q.autoUpdate===!1&&q.needsUpdate===!1)continue;s.copy(q.mapSize);const ne=q.getFrameExtents();if(s.multiply(ne),u.copy(q.mapSize),(s.x>_||s.y>_)&&(s.x>_&&(u.x=Math.floor(_/ne.x),s.x=u.x*ne.x,q.mapSize.x=u.x),s.y>_&&(u.y=Math.floor(_/ne.y),s.y=u.y*ne.y,q.mapSize.y=u.y)),q.map===null||te===!0){if(q.map!==null&&(q.map.depthTexture!==null&&(q.map.depthTexture.dispose(),q.map.depthTexture=null),q.map.dispose()),this.type===jc){if(Y.isPointLight){ft("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}q.map=new Hs(s.x,s.y,{format:tf,type:Bo,minFilter:oi,magFilter:oi,generateMipmaps:!1}),q.map.texture.name=Y.name+".shadowMap",q.map.depthTexture=new ed(s.x,s.y,is),q.map.depthTexture.name=Y.name+".shadowMapDepth",q.map.depthTexture.format=Fo,q.map.depthTexture.compareFunction=null,q.map.depthTexture.minFilter=Bi,q.map.depthTexture.magFilter=Bi}else{Y.isPointLight?(q.map=new Db(s.x),q.map.depthTexture=new tT(s.x,vr)):(q.map=new Hs(s.x,s.y),q.map.depthTexture=new ed(s.x,s.y,vr)),q.map.depthTexture.name=Y.name+".shadowMap",q.map.depthTexture.format=Fo;const Ne=r.state.buffers.depth.getReversed();this.type===Xh?(q.map.depthTexture.compareFunction=Ne?Ay:Ty,q.map.depthTexture.minFilter=oi,q.map.depthTexture.magFilter=oi):(q.map.depthTexture.compareFunction=null,q.map.depthTexture.minFilter=Bi,q.map.depthTexture.magFilter=Bi)}q.camera.updateProjectionMatrix()}const be=q.map.isWebGLCubeRenderTarget?6:1;for(let Ne=0;Ne<be;Ne++){if(q.map.isWebGLCubeRenderTarget)r.setRenderTarget(q.map,Ne),r.clear();else{Ne===0&&(r.setRenderTarget(q.map),r.clear());const X=q.getViewport(Ne);f.set(u.x*X.x,u.y*X.y,u.x*X.z,u.y*X.w),se.viewport(f)}if(Y.isPointLight){const X=q.camera,oe=q.matrix,Ae=Y.distance||X.far;Ae!==X.far&&(X.far=Ae,X.updateProjectionMatrix()),qp.setFromMatrixPosition(Y.matrixWorld),X.position.copy(qp),Cx.copy(X.position),Cx.add(MP[Ne]),X.up.copy(EP[Ne]),X.lookAt(Cx),X.updateMatrixWorld(),oe.makeTranslation(-qp.x,-qp.y,-qp.z),D1.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),q._frustum.setFromProjectionMatrix(D1,X.coordinateSystem,X.reversedDepth)}else q.updateMatrices(Y);n=q.getFrustum(),U(H,W,q.camera,Y,this.type)}q.isPointLightShadow!==!0&&this.type===jc&&N(q,W),q.needsUpdate=!1}E=this.type,w.needsUpdate=!1,r.setRenderTarget(I,P,Z)};function N(z,H){const W=e.update(R);b.defines.VSM_SAMPLES!==z.blurSamples&&(b.defines.VSM_SAMPLES=z.blurSamples,M.defines.VSM_SAMPLES=z.blurSamples,b.needsUpdate=!0,M.needsUpdate=!0),z.mapPass===null&&(z.mapPass=new Hs(s.x,s.y,{format:tf,type:Bo})),b.uniforms.shadow_pass.value=z.map.depthTexture,b.uniforms.resolution.value=z.mapSize,b.uniforms.radius.value=z.radius,r.setRenderTarget(z.mapPass),r.clear(),r.renderBufferDirect(H,null,W,b,R,null),M.uniforms.shadow_pass.value=z.mapPass.texture,M.uniforms.resolution.value=z.mapSize,M.uniforms.radius.value=z.radius,r.setRenderTarget(z.map),r.clear(),r.renderBufferDirect(H,null,W,M,R,null)}function D(z,H,W,I){let P=null;const Z=W.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(Z!==void 0)P=Z;else if(P=W.isPointLight===!0?m:h,r.localClippingEnabled&&H.clipShadows===!0&&Array.isArray(H.clippingPlanes)&&H.clippingPlanes.length!==0||H.displacementMap&&H.displacementScale!==0||H.alphaMap&&H.alphaTest>0||H.map&&H.alphaTest>0||H.alphaToCoverage===!0){const se=P.uuid,te=H.uuid;let fe=g[se];fe===void 0&&(fe={},g[se]=fe);let pe=fe[te];pe===void 0&&(pe=P.clone(),fe[te]=pe,H.addEventListener("dispose",B)),P=pe}if(P.visible=H.visible,P.wireframe=H.wireframe,I===jc?P.side=H.shadowSide!==null?H.shadowSide:H.side:P.side=H.shadowSide!==null?H.shadowSide:x[H.side],P.alphaMap=H.alphaMap,P.alphaTest=H.alphaToCoverage===!0?.5:H.alphaTest,P.map=H.map,P.clipShadows=H.clipShadows,P.clippingPlanes=H.clippingPlanes,P.clipIntersection=H.clipIntersection,P.displacementMap=H.displacementMap,P.displacementScale=H.displacementScale,P.displacementBias=H.displacementBias,P.wireframeLinewidth=H.wireframeLinewidth,P.linewidth=H.linewidth,W.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const se=r.properties.get(P);se.light=W}return P}function U(z,H,W,I,P){if(z.visible===!1)return;if(z.layers.test(H.layers)&&(z.isMesh||z.isLine||z.isPoints)&&(z.castShadow||z.receiveShadow&&P===jc)&&(!z.frustumCulled||n.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,z.matrixWorld);const te=e.update(z),fe=z.material;if(Array.isArray(fe)){const pe=te.groups;for(let Y=0,q=pe.length;Y<q;Y++){const ne=pe[Y],be=fe[ne.materialIndex];if(be&&be.visible){const Ne=D(z,be,I,P);z.onBeforeShadow(r,z,H,W,te,Ne,ne),r.renderBufferDirect(W,null,te,Ne,z,ne),z.onAfterShadow(r,z,H,W,te,Ne,ne)}}}else if(fe.visible){const pe=D(z,fe,I,P);z.onBeforeShadow(r,z,H,W,te,pe,null),r.renderBufferDirect(W,null,te,pe,z,null),z.onAfterShadow(r,z,H,W,te,pe,null)}}const se=z.children;for(let te=0,fe=se.length;te<fe;te++)U(se[te],H,W,I,P)}function B(z){z.target.removeEventListener("dispose",B);for(const W in g){const I=g[W],P=z.target.uuid;P in I&&(I[P].dispose(),delete I[P])}}}const AP={[_v]:xv,[bv]:Ev,[Sv]:Tv,[ef]:Mv,[xv]:_v,[Ev]:bv,[Tv]:Sv,[Mv]:ef};function wP(r,e){function t(){let J=!1;const je=new jn;let Ge=null;const at=new jn(0,0,0,0);return{setMask:function(Xe){Ge!==Xe&&!J&&(r.colorMask(Xe,Xe,Xe,Xe),Ge=Xe)},setLocked:function(Xe){J=Xe},setClear:function(Xe,Ue,Ye,Ct,Jt){Jt===!0&&(Xe*=Ct,Ue*=Ct,Ye*=Ct),je.set(Xe,Ue,Ye,Ct),at.equals(je)===!1&&(r.clearColor(Xe,Ue,Ye,Ct),at.copy(je))},reset:function(){J=!1,Ge=null,at.set(-1,0,0,0)}}}function n(){let J=!1,je=!1,Ge=null,at=null,Xe=null;return{setReversed:function(Ue){if(je!==Ue){const Ye=e.get("EXT_clip_control");Ue?Ye.clipControlEXT(Ye.LOWER_LEFT_EXT,Ye.ZERO_TO_ONE_EXT):Ye.clipControlEXT(Ye.LOWER_LEFT_EXT,Ye.NEGATIVE_ONE_TO_ONE_EXT),je=Ue;const Ct=Xe;Xe=null,this.setClear(Ct)}},getReversed:function(){return je},setTest:function(Ue){Ue?Re(r.DEPTH_TEST):tt(r.DEPTH_TEST)},setMask:function(Ue){Ge!==Ue&&!J&&(r.depthMask(Ue),Ge=Ue)},setFunc:function(Ue){if(je&&(Ue=AP[Ue]),at!==Ue){switch(Ue){case _v:r.depthFunc(r.NEVER);break;case xv:r.depthFunc(r.ALWAYS);break;case bv:r.depthFunc(r.LESS);break;case ef:r.depthFunc(r.LEQUAL);break;case Sv:r.depthFunc(r.EQUAL);break;case Mv:r.depthFunc(r.GEQUAL);break;case Ev:r.depthFunc(r.GREATER);break;case Tv:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}at=Ue}},setLocked:function(Ue){J=Ue},setClear:function(Ue){Xe!==Ue&&(je&&(Ue=1-Ue),r.clearDepth(Ue),Xe=Ue)},reset:function(){J=!1,Ge=null,at=null,Xe=null,je=!1}}}function s(){let J=!1,je=null,Ge=null,at=null,Xe=null,Ue=null,Ye=null,Ct=null,Jt=null;return{setTest:function(nn){J||(nn?Re(r.STENCIL_TEST):tt(r.STENCIL_TEST))},setMask:function(nn){je!==nn&&!J&&(r.stencilMask(nn),je=nn)},setFunc:function(nn,Jn,Ci){(Ge!==nn||at!==Jn||Xe!==Ci)&&(r.stencilFunc(nn,Jn,Ci),Ge=nn,at=Jn,Xe=Ci)},setOp:function(nn,Jn,Ci){(Ue!==nn||Ye!==Jn||Ct!==Ci)&&(r.stencilOp(nn,Jn,Ci),Ue=nn,Ye=Jn,Ct=Ci)},setLocked:function(nn){J=nn},setClear:function(nn){Jt!==nn&&(r.clearStencil(nn),Jt=nn)},reset:function(){J=!1,je=null,Ge=null,at=null,Xe=null,Ue=null,Ye=null,Ct=null,Jt=null}}}const u=new t,f=new n,h=new s,m=new WeakMap,g=new WeakMap;let _={},x={},b=new WeakMap,M=[],A=null,R=!1,w=null,E=null,N=null,D=null,U=null,B=null,z=null,H=new yt(0,0,0),W=0,I=!1,P=null,Z=null,se=null,te=null,fe=null;const pe=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,q=0;const ne=r.getParameter(r.VERSION);ne.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(ne)[1]),Y=q>=1):ne.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),Y=q>=2);let be=null,Ne={};const X=r.getParameter(r.SCISSOR_BOX),oe=r.getParameter(r.VIEWPORT),Ae=new jn().fromArray(X),Fe=new jn().fromArray(oe);function lt(J,je,Ge,at){const Xe=new Uint8Array(4),Ue=r.createTexture();r.bindTexture(J,Ue),r.texParameteri(J,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(J,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ye=0;Ye<Ge;Ye++)J===r.TEXTURE_3D||J===r.TEXTURE_2D_ARRAY?r.texImage3D(je,0,r.RGBA,1,1,at,0,r.RGBA,r.UNSIGNED_BYTE,Xe):r.texImage2D(je+Ye,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Xe);return Ue}const de={};de[r.TEXTURE_2D]=lt(r.TEXTURE_2D,r.TEXTURE_2D,1),de[r.TEXTURE_CUBE_MAP]=lt(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),de[r.TEXTURE_2D_ARRAY]=lt(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),de[r.TEXTURE_3D]=lt(r.TEXTURE_3D,r.TEXTURE_3D,1,1),u.setClear(0,0,0,1),f.setClear(1),h.setClear(0),Re(r.DEPTH_TEST),f.setFunc(ef),Oe(!1),nt(Vx),Re(r.CULL_FACE),Le(Po);function Re(J){_[J]!==!0&&(r.enable(J),_[J]=!0)}function tt(J){_[J]!==!1&&(r.disable(J),_[J]=!1)}function st(J,je){return x[J]!==je?(r.bindFramebuffer(J,je),x[J]=je,J===r.DRAW_FRAMEBUFFER&&(x[r.FRAMEBUFFER]=je),J===r.FRAMEBUFFER&&(x[r.DRAW_FRAMEBUFFER]=je),!0):!1}function ht(J,je){let Ge=M,at=!1;if(J){Ge=b.get(je),Ge===void 0&&(Ge=[],b.set(je,Ge));const Xe=J.textures;if(Ge.length!==Xe.length||Ge[0]!==r.COLOR_ATTACHMENT0){for(let Ue=0,Ye=Xe.length;Ue<Ye;Ue++)Ge[Ue]=r.COLOR_ATTACHMENT0+Ue;Ge.length=Xe.length,at=!0}}else Ge[0]!==r.BACK&&(Ge[0]=r.BACK,at=!0);at&&r.drawBuffers(Ge)}function jt(J){return A!==J?(r.useProgram(J),A=J,!0):!1}const tn={[Du]:r.FUNC_ADD,[oE]:r.FUNC_SUBTRACT,[lE]:r.FUNC_REVERSE_SUBTRACT};tn[uE]=r.MIN,tn[cE]=r.MAX;const Nt={[fE]:r.ZERO,[hE]:r.ONE,[dE]:r.SRC_COLOR,[vv]:r.SRC_ALPHA,[_E]:r.SRC_ALPHA_SATURATE,[vE]:r.DST_COLOR,[mE]:r.DST_ALPHA,[pE]:r.ONE_MINUS_SRC_COLOR,[yv]:r.ONE_MINUS_SRC_ALPHA,[yE]:r.ONE_MINUS_DST_COLOR,[gE]:r.ONE_MINUS_DST_ALPHA,[xE]:r.CONSTANT_COLOR,[bE]:r.ONE_MINUS_CONSTANT_COLOR,[SE]:r.CONSTANT_ALPHA,[ME]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(J,je,Ge,at,Xe,Ue,Ye,Ct,Jt,nn){if(J===Po){R===!0&&(tt(r.BLEND),R=!1);return}if(R===!1&&(Re(r.BLEND),R=!0),J!==rE){if(J!==w||nn!==I){if((E!==Du||U!==Du)&&(r.blendEquation(r.FUNC_ADD),E=Du,U=Du),nn)switch(J){case Kc:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Hx:r.blendFunc(r.ONE,r.ONE);break;case Gx:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Xx:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Rt("WebGLState: Invalid blending: ",J);break}else switch(J){case Kc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Hx:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Gx:Rt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Xx:Rt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Rt("WebGLState: Invalid blending: ",J);break}N=null,D=null,B=null,z=null,H.set(0,0,0),W=0,w=J,I=nn}return}Xe=Xe||je,Ue=Ue||Ge,Ye=Ye||at,(je!==E||Xe!==U)&&(r.blendEquationSeparate(tn[je],tn[Xe]),E=je,U=Xe),(Ge!==N||at!==D||Ue!==B||Ye!==z)&&(r.blendFuncSeparate(Nt[Ge],Nt[at],Nt[Ue],Nt[Ye]),N=Ge,D=at,B=Ue,z=Ye),(Ct.equals(H)===!1||Jt!==W)&&(r.blendColor(Ct.r,Ct.g,Ct.b,Jt),H.copy(Ct),W=Jt),w=J,I=!1}function He(J,je){J.side===Uo?tt(r.CULL_FACE):Re(r.CULL_FACE);let Ge=J.side===as;je&&(Ge=!Ge),Oe(Ge),J.blending===Kc&&J.transparent===!1?Le(Po):Le(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.blendColor,J.blendAlpha,J.premultipliedAlpha),f.setFunc(J.depthFunc),f.setTest(J.depthTest),f.setMask(J.depthWrite),u.setMask(J.colorWrite);const at=J.stencilWrite;h.setTest(at),at&&(h.setMask(J.stencilWriteMask),h.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),h.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),Et(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?Re(r.SAMPLE_ALPHA_TO_COVERAGE):tt(r.SAMPLE_ALPHA_TO_COVERAGE)}function Oe(J){P!==J&&(J?r.frontFace(r.CW):r.frontFace(r.CCW),P=J)}function nt(J){J!==iE?(Re(r.CULL_FACE),J!==Z&&(J===Vx?r.cullFace(r.BACK):J===aE?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):tt(r.CULL_FACE),Z=J}function Q(J){J!==se&&(Y&&r.lineWidth(J),se=J)}function Et(J,je,Ge){J?(Re(r.POLYGON_OFFSET_FILL),(te!==je||fe!==Ge)&&(r.polygonOffset(je,Ge),te=je,fe=Ge)):tt(r.POLYGON_OFFSET_FILL)}function ot(J){J?Re(r.SCISSOR_TEST):tt(r.SCISSOR_TEST)}function Tt(J){J===void 0&&(J=r.TEXTURE0+pe-1),be!==J&&(r.activeTexture(J),be=J)}function Qe(J,je,Ge){Ge===void 0&&(be===null?Ge=r.TEXTURE0+pe-1:Ge=be);let at=Ne[Ge];at===void 0&&(at={type:void 0,texture:void 0},Ne[Ge]=at),(at.type!==J||at.texture!==je)&&(be!==Ge&&(r.activeTexture(Ge),be=Ge),r.bindTexture(J,je||de[J]),at.type=J,at.texture=je)}function G(){const J=Ne[be];J!==void 0&&J.type!==void 0&&(r.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function O(){try{r.compressedTexImage2D(...arguments)}catch(J){Rt("WebGLState:",J)}}function ae(){try{r.compressedTexImage3D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Te(){try{r.texSubImage2D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Ie(){try{r.texSubImage3D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Ee(){try{r.compressedTexSubImage2D(...arguments)}catch(J){Rt("WebGLState:",J)}}function dt(){try{r.compressedTexSubImage3D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Ke(){try{r.texStorage2D(...arguments)}catch(J){Rt("WebGLState:",J)}}function vt(){try{r.texStorage3D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Dt(){try{r.texImage2D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Ve(){try{r.texImage3D(...arguments)}catch(J){Rt("WebGLState:",J)}}function Ze(J){Ae.equals(J)===!1&&(r.scissor(J.x,J.y,J.z,J.w),Ae.copy(J))}function ct(J){Fe.equals(J)===!1&&(r.viewport(J.x,J.y,J.z,J.w),Fe.copy(J))}function K(J,je){let Ge=g.get(je);Ge===void 0&&(Ge=new WeakMap,g.set(je,Ge));let at=Ge.get(J);at===void 0&&(at=r.getUniformBlockIndex(je,J.name),Ge.set(J,at))}function me(J,je){const at=g.get(je).get(J);m.get(je)!==at&&(r.uniformBlockBinding(je,at,J.__bindingPointIndex),m.set(je,at))}function et(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),f.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),_={},be=null,Ne={},x={},b=new WeakMap,M=[],A=null,R=!1,w=null,E=null,N=null,D=null,U=null,B=null,z=null,H=new yt(0,0,0),W=0,I=!1,P=null,Z=null,se=null,te=null,fe=null,Ae.set(0,0,r.canvas.width,r.canvas.height),Fe.set(0,0,r.canvas.width,r.canvas.height),u.reset(),f.reset(),h.reset()}return{buffers:{color:u,depth:f,stencil:h},enable:Re,disable:tt,bindFramebuffer:st,drawBuffers:ht,useProgram:jt,setBlending:Le,setMaterial:He,setFlipSided:Oe,setCullFace:nt,setLineWidth:Q,setPolygonOffset:Et,setScissorTest:ot,activeTexture:Tt,bindTexture:Qe,unbindTexture:G,compressedTexImage2D:O,compressedTexImage3D:ae,texImage2D:Dt,texImage3D:Ve,updateUBOMapping:K,uniformBlockBinding:me,texStorage2D:Ke,texStorage3D:vt,texSubImage2D:Te,texSubImage3D:Ie,compressedTexSubImage2D:Ee,compressedTexSubImage3D:dt,scissor:Ze,viewport:ct,reset:et}}function CP(r,e,t,n,s,u,f){const h=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new ze,_=new WeakMap;let x;const b=new WeakMap;let M=!1;try{M=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function A(G,O){return M?new OffscreenCanvas(G,O):mm("canvas")}function R(G,O,ae){let Te=1;const Ie=Qe(G);if((Ie.width>ae||Ie.height>ae)&&(Te=ae/Math.max(Ie.width,Ie.height)),Te<1)if(typeof HTMLImageElement<"u"&&G instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&G instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&G instanceof ImageBitmap||typeof VideoFrame<"u"&&G instanceof VideoFrame){const Ee=Math.floor(Te*Ie.width),dt=Math.floor(Te*Ie.height);x===void 0&&(x=A(Ee,dt));const Ke=O?A(Ee,dt):x;return Ke.width=Ee,Ke.height=dt,Ke.getContext("2d").drawImage(G,0,0,Ee,dt),ft("WebGLRenderer: Texture has been resized from ("+Ie.width+"x"+Ie.height+") to ("+Ee+"x"+dt+")."),Ke}else return"data"in G&&ft("WebGLRenderer: Image in DataTexture is too big ("+Ie.width+"x"+Ie.height+")."),G;return G}function w(G){return G.generateMipmaps}function E(G){r.generateMipmap(G)}function N(G){return G.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:G.isWebGL3DRenderTarget?r.TEXTURE_3D:G.isWebGLArrayRenderTarget||G.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function D(G,O,ae,Te,Ie=!1){if(G!==null){if(r[G]!==void 0)return r[G];ft("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+G+"'")}let Ee=O;if(O===r.RED&&(ae===r.FLOAT&&(Ee=r.R32F),ae===r.HALF_FLOAT&&(Ee=r.R16F),ae===r.UNSIGNED_BYTE&&(Ee=r.R8)),O===r.RED_INTEGER&&(ae===r.UNSIGNED_BYTE&&(Ee=r.R8UI),ae===r.UNSIGNED_SHORT&&(Ee=r.R16UI),ae===r.UNSIGNED_INT&&(Ee=r.R32UI),ae===r.BYTE&&(Ee=r.R8I),ae===r.SHORT&&(Ee=r.R16I),ae===r.INT&&(Ee=r.R32I)),O===r.RG&&(ae===r.FLOAT&&(Ee=r.RG32F),ae===r.HALF_FLOAT&&(Ee=r.RG16F),ae===r.UNSIGNED_BYTE&&(Ee=r.RG8)),O===r.RG_INTEGER&&(ae===r.UNSIGNED_BYTE&&(Ee=r.RG8UI),ae===r.UNSIGNED_SHORT&&(Ee=r.RG16UI),ae===r.UNSIGNED_INT&&(Ee=r.RG32UI),ae===r.BYTE&&(Ee=r.RG8I),ae===r.SHORT&&(Ee=r.RG16I),ae===r.INT&&(Ee=r.RG32I)),O===r.RGB_INTEGER&&(ae===r.UNSIGNED_BYTE&&(Ee=r.RGB8UI),ae===r.UNSIGNED_SHORT&&(Ee=r.RGB16UI),ae===r.UNSIGNED_INT&&(Ee=r.RGB32UI),ae===r.BYTE&&(Ee=r.RGB8I),ae===r.SHORT&&(Ee=r.RGB16I),ae===r.INT&&(Ee=r.RGB32I)),O===r.RGBA_INTEGER&&(ae===r.UNSIGNED_BYTE&&(Ee=r.RGBA8UI),ae===r.UNSIGNED_SHORT&&(Ee=r.RGBA16UI),ae===r.UNSIGNED_INT&&(Ee=r.RGBA32UI),ae===r.BYTE&&(Ee=r.RGBA8I),ae===r.SHORT&&(Ee=r.RGBA16I),ae===r.INT&&(Ee=r.RGBA32I)),O===r.RGB&&(ae===r.UNSIGNED_INT_5_9_9_9_REV&&(Ee=r.RGB9_E5),ae===r.UNSIGNED_INT_10F_11F_11F_REV&&(Ee=r.R11F_G11F_B10F)),O===r.RGBA){const dt=Ie?dm:Sn.getTransfer(Te);ae===r.FLOAT&&(Ee=r.RGBA32F),ae===r.HALF_FLOAT&&(Ee=r.RGBA16F),ae===r.UNSIGNED_BYTE&&(Ee=dt===zn?r.SRGB8_ALPHA8:r.RGBA8),ae===r.UNSIGNED_SHORT_4_4_4_4&&(Ee=r.RGBA4),ae===r.UNSIGNED_SHORT_5_5_5_1&&(Ee=r.RGB5_A1)}return(Ee===r.R16F||Ee===r.R32F||Ee===r.RG16F||Ee===r.RG32F||Ee===r.RGBA16F||Ee===r.RGBA32F)&&e.get("EXT_color_buffer_float"),Ee}function U(G,O){let ae;return G?O===null||O===vr||O===jh?ae=r.DEPTH24_STENCIL8:O===is?ae=r.DEPTH32F_STENCIL8:O===qh&&(ae=r.DEPTH24_STENCIL8,ft("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):O===null||O===vr||O===jh?ae=r.DEPTH_COMPONENT24:O===is?ae=r.DEPTH_COMPONENT32F:O===qh&&(ae=r.DEPTH_COMPONENT16),ae}function B(G,O){return w(G)===!0||G.isFramebufferTexture&&G.minFilter!==Bi&&G.minFilter!==oi?Math.log2(Math.max(O.width,O.height))+1:G.mipmaps!==void 0&&G.mipmaps.length>0?G.mipmaps.length:G.isCompressedTexture&&Array.isArray(G.image)?O.mipmaps.length:1}function z(G){const O=G.target;O.removeEventListener("dispose",z),W(O),O.isVideoTexture&&_.delete(O)}function H(G){const O=G.target;O.removeEventListener("dispose",H),P(O)}function W(G){const O=n.get(G);if(O.__webglInit===void 0)return;const ae=G.source,Te=b.get(ae);if(Te){const Ie=Te[O.__cacheKey];Ie.usedTimes--,Ie.usedTimes===0&&I(G),Object.keys(Te).length===0&&b.delete(ae)}n.remove(G)}function I(G){const O=n.get(G);r.deleteTexture(O.__webglTexture);const ae=G.source,Te=b.get(ae);delete Te[O.__cacheKey],f.memory.textures--}function P(G){const O=n.get(G);if(G.depthTexture&&(G.depthTexture.dispose(),n.remove(G.depthTexture)),G.isWebGLCubeRenderTarget)for(let Te=0;Te<6;Te++){if(Array.isArray(O.__webglFramebuffer[Te]))for(let Ie=0;Ie<O.__webglFramebuffer[Te].length;Ie++)r.deleteFramebuffer(O.__webglFramebuffer[Te][Ie]);else r.deleteFramebuffer(O.__webglFramebuffer[Te]);O.__webglDepthbuffer&&r.deleteRenderbuffer(O.__webglDepthbuffer[Te])}else{if(Array.isArray(O.__webglFramebuffer))for(let Te=0;Te<O.__webglFramebuffer.length;Te++)r.deleteFramebuffer(O.__webglFramebuffer[Te]);else r.deleteFramebuffer(O.__webglFramebuffer);if(O.__webglDepthbuffer&&r.deleteRenderbuffer(O.__webglDepthbuffer),O.__webglMultisampledFramebuffer&&r.deleteFramebuffer(O.__webglMultisampledFramebuffer),O.__webglColorRenderbuffer)for(let Te=0;Te<O.__webglColorRenderbuffer.length;Te++)O.__webglColorRenderbuffer[Te]&&r.deleteRenderbuffer(O.__webglColorRenderbuffer[Te]);O.__webglDepthRenderbuffer&&r.deleteRenderbuffer(O.__webglDepthRenderbuffer)}const ae=G.textures;for(let Te=0,Ie=ae.length;Te<Ie;Te++){const Ee=n.get(ae[Te]);Ee.__webglTexture&&(r.deleteTexture(Ee.__webglTexture),f.memory.textures--),n.remove(ae[Te])}n.remove(G)}let Z=0;function se(){Z=0}function te(){const G=Z;return G>=s.maxTextures&&ft("WebGLTextures: Trying to use "+G+" texture units while this GPU supports only "+s.maxTextures),Z+=1,G}function fe(G){const O=[];return O.push(G.wrapS),O.push(G.wrapT),O.push(G.wrapR||0),O.push(G.magFilter),O.push(G.minFilter),O.push(G.anisotropy),O.push(G.internalFormat),O.push(G.format),O.push(G.type),O.push(G.generateMipmaps),O.push(G.premultiplyAlpha),O.push(G.flipY),O.push(G.unpackAlignment),O.push(G.colorSpace),O.join()}function pe(G,O){const ae=n.get(G);if(G.isVideoTexture&&ot(G),G.isRenderTargetTexture===!1&&G.isExternalTexture!==!0&&G.version>0&&ae.__version!==G.version){const Te=G.image;if(Te===null)ft("WebGLRenderer: Texture marked for update but no image data found.");else if(Te.complete===!1)ft("WebGLRenderer: Texture marked for update but image is incomplete");else{de(ae,G,O);return}}else G.isExternalTexture&&(ae.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,ae.__webglTexture,r.TEXTURE0+O)}function Y(G,O){const ae=n.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ae.__version!==G.version){de(ae,G,O);return}else G.isExternalTexture&&(ae.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,ae.__webglTexture,r.TEXTURE0+O)}function q(G,O){const ae=n.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ae.__version!==G.version){de(ae,G,O);return}t.bindTexture(r.TEXTURE_3D,ae.__webglTexture,r.TEXTURE0+O)}function ne(G,O){const ae=n.get(G);if(G.isCubeDepthTexture!==!0&&G.version>0&&ae.__version!==G.version){Re(ae,G,O);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ae.__webglTexture,r.TEXTURE0+O)}const be={[um]:r.REPEAT,[Rs]:r.CLAMP_TO_EDGE,[cm]:r.MIRRORED_REPEAT},Ne={[Bi]:r.NEAREST,[_b]:r.NEAREST_MIPMAP_NEAREST,[Vh]:r.NEAREST_MIPMAP_LINEAR,[oi]:r.LINEAR,[Jp]:r.LINEAR_MIPMAP_NEAREST,[Io]:r.LINEAR_MIPMAP_LINEAR},X={[LE]:r.NEVER,[zE]:r.ALWAYS,[UE]:r.LESS,[Ty]:r.LEQUAL,[IE]:r.EQUAL,[Ay]:r.GEQUAL,[OE]:r.GREATER,[PE]:r.NOTEQUAL};function oe(G,O){if(O.type===is&&e.has("OES_texture_float_linear")===!1&&(O.magFilter===oi||O.magFilter===Jp||O.magFilter===Vh||O.magFilter===Io||O.minFilter===oi||O.minFilter===Jp||O.minFilter===Vh||O.minFilter===Io)&&ft("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(G,r.TEXTURE_WRAP_S,be[O.wrapS]),r.texParameteri(G,r.TEXTURE_WRAP_T,be[O.wrapT]),(G===r.TEXTURE_3D||G===r.TEXTURE_2D_ARRAY)&&r.texParameteri(G,r.TEXTURE_WRAP_R,be[O.wrapR]),r.texParameteri(G,r.TEXTURE_MAG_FILTER,Ne[O.magFilter]),r.texParameteri(G,r.TEXTURE_MIN_FILTER,Ne[O.minFilter]),O.compareFunction&&(r.texParameteri(G,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(G,r.TEXTURE_COMPARE_FUNC,X[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(O.magFilter===Bi||O.minFilter!==Vh&&O.minFilter!==Io||O.type===is&&e.has("OES_texture_float_linear")===!1)return;if(O.anisotropy>1||n.get(O).__currentAnisotropy){const ae=e.get("EXT_texture_filter_anisotropic");r.texParameterf(G,ae.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,s.getMaxAnisotropy())),n.get(O).__currentAnisotropy=O.anisotropy}}}function Ae(G,O){let ae=!1;G.__webglInit===void 0&&(G.__webglInit=!0,O.addEventListener("dispose",z));const Te=O.source;let Ie=b.get(Te);Ie===void 0&&(Ie={},b.set(Te,Ie));const Ee=fe(O);if(Ee!==G.__cacheKey){Ie[Ee]===void 0&&(Ie[Ee]={texture:r.createTexture(),usedTimes:0},f.memory.textures++,ae=!0),Ie[Ee].usedTimes++;const dt=Ie[G.__cacheKey];dt!==void 0&&(Ie[G.__cacheKey].usedTimes--,dt.usedTimes===0&&I(O)),G.__cacheKey=Ee,G.__webglTexture=Ie[Ee].texture}return ae}function Fe(G,O,ae){return Math.floor(Math.floor(G/ae)/O)}function lt(G,O,ae,Te){const Ee=G.updateRanges;if(Ee.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,O.width,O.height,ae,Te,O.data);else{Ee.sort((Ve,Ze)=>Ve.start-Ze.start);let dt=0;for(let Ve=1;Ve<Ee.length;Ve++){const Ze=Ee[dt],ct=Ee[Ve],K=Ze.start+Ze.count,me=Fe(ct.start,O.width,4),et=Fe(Ze.start,O.width,4);ct.start<=K+1&&me===et&&Fe(ct.start+ct.count-1,O.width,4)===me?Ze.count=Math.max(Ze.count,ct.start+ct.count-Ze.start):(++dt,Ee[dt]=ct)}Ee.length=dt+1;const Ke=r.getParameter(r.UNPACK_ROW_LENGTH),vt=r.getParameter(r.UNPACK_SKIP_PIXELS),Dt=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,O.width);for(let Ve=0,Ze=Ee.length;Ve<Ze;Ve++){const ct=Ee[Ve],K=Math.floor(ct.start/4),me=Math.ceil(ct.count/4),et=K%O.width,J=Math.floor(K/O.width),je=me,Ge=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,et),r.pixelStorei(r.UNPACK_SKIP_ROWS,J),t.texSubImage2D(r.TEXTURE_2D,0,et,J,je,Ge,ae,Te,O.data)}G.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Ke),r.pixelStorei(r.UNPACK_SKIP_PIXELS,vt),r.pixelStorei(r.UNPACK_SKIP_ROWS,Dt)}}function de(G,O,ae){let Te=r.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(Te=r.TEXTURE_2D_ARRAY),O.isData3DTexture&&(Te=r.TEXTURE_3D);const Ie=Ae(G,O),Ee=O.source;t.bindTexture(Te,G.__webglTexture,r.TEXTURE0+ae);const dt=n.get(Ee);if(Ee.version!==dt.__version||Ie===!0){t.activeTexture(r.TEXTURE0+ae);const Ke=Sn.getPrimaries(Sn.workingColorSpace),vt=O.colorSpace===Cl?null:Sn.getPrimaries(O.colorSpace),Dt=O.colorSpace===Cl||Ke===vt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,O.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,O.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt);let Ve=R(O.image,!1,s.maxTextureSize);Ve=Tt(O,Ve);const Ze=u.convert(O.format,O.colorSpace),ct=u.convert(O.type);let K=D(O.internalFormat,Ze,ct,O.colorSpace,O.isVideoTexture);oe(Te,O);let me;const et=O.mipmaps,J=O.isVideoTexture!==!0,je=dt.__version===void 0||Ie===!0,Ge=Ee.dataReady,at=B(O,Ve);if(O.isDepthTexture)K=U(O.format===Uu,O.type),je&&(J?t.texStorage2D(r.TEXTURE_2D,1,K,Ve.width,Ve.height):t.texImage2D(r.TEXTURE_2D,0,K,Ve.width,Ve.height,0,Ze,ct,null));else if(O.isDataTexture)if(et.length>0){J&&je&&t.texStorage2D(r.TEXTURE_2D,at,K,et[0].width,et[0].height);for(let Xe=0,Ue=et.length;Xe<Ue;Xe++)me=et[Xe],J?Ge&&t.texSubImage2D(r.TEXTURE_2D,Xe,0,0,me.width,me.height,Ze,ct,me.data):t.texImage2D(r.TEXTURE_2D,Xe,K,me.width,me.height,0,Ze,ct,me.data);O.generateMipmaps=!1}else J?(je&&t.texStorage2D(r.TEXTURE_2D,at,K,Ve.width,Ve.height),Ge&&lt(O,Ve,Ze,ct)):t.texImage2D(r.TEXTURE_2D,0,K,Ve.width,Ve.height,0,Ze,ct,Ve.data);else if(O.isCompressedTexture)if(O.isCompressedArrayTexture){J&&je&&t.texStorage3D(r.TEXTURE_2D_ARRAY,at,K,et[0].width,et[0].height,Ve.depth);for(let Xe=0,Ue=et.length;Xe<Ue;Xe++)if(me=et[Xe],O.format!==Oa)if(Ze!==null)if(J){if(Ge)if(O.layerUpdates.size>0){const Ye=tb(me.width,me.height,O.format,O.type);for(const Ct of O.layerUpdates){const Jt=me.data.subarray(Ct*Ye/me.data.BYTES_PER_ELEMENT,(Ct+1)*Ye/me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Xe,0,0,Ct,me.width,me.height,1,Ze,Jt)}O.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Xe,0,0,0,me.width,me.height,Ve.depth,Ze,me.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Xe,K,me.width,me.height,Ve.depth,0,me.data,0,0);else ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else J?Ge&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Xe,0,0,0,me.width,me.height,Ve.depth,Ze,ct,me.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Xe,K,me.width,me.height,Ve.depth,0,Ze,ct,me.data)}else{J&&je&&t.texStorage2D(r.TEXTURE_2D,at,K,et[0].width,et[0].height);for(let Xe=0,Ue=et.length;Xe<Ue;Xe++)me=et[Xe],O.format!==Oa?Ze!==null?J?Ge&&t.compressedTexSubImage2D(r.TEXTURE_2D,Xe,0,0,me.width,me.height,Ze,me.data):t.compressedTexImage2D(r.TEXTURE_2D,Xe,K,me.width,me.height,0,me.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):J?Ge&&t.texSubImage2D(r.TEXTURE_2D,Xe,0,0,me.width,me.height,Ze,ct,me.data):t.texImage2D(r.TEXTURE_2D,Xe,K,me.width,me.height,0,Ze,ct,me.data)}else if(O.isDataArrayTexture)if(J){if(je&&t.texStorage3D(r.TEXTURE_2D_ARRAY,at,K,Ve.width,Ve.height,Ve.depth),Ge)if(O.layerUpdates.size>0){const Xe=tb(Ve.width,Ve.height,O.format,O.type);for(const Ue of O.layerUpdates){const Ye=Ve.data.subarray(Ue*Xe/Ve.data.BYTES_PER_ELEMENT,(Ue+1)*Xe/Ve.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Ue,Ve.width,Ve.height,1,Ze,ct,Ye)}O.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Ve.width,Ve.height,Ve.depth,Ze,ct,Ve.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,K,Ve.width,Ve.height,Ve.depth,0,Ze,ct,Ve.data);else if(O.isData3DTexture)J?(je&&t.texStorage3D(r.TEXTURE_3D,at,K,Ve.width,Ve.height,Ve.depth),Ge&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Ve.width,Ve.height,Ve.depth,Ze,ct,Ve.data)):t.texImage3D(r.TEXTURE_3D,0,K,Ve.width,Ve.height,Ve.depth,0,Ze,ct,Ve.data);else if(O.isFramebufferTexture){if(je)if(J)t.texStorage2D(r.TEXTURE_2D,at,K,Ve.width,Ve.height);else{let Xe=Ve.width,Ue=Ve.height;for(let Ye=0;Ye<at;Ye++)t.texImage2D(r.TEXTURE_2D,Ye,K,Xe,Ue,0,Ze,ct,null),Xe>>=1,Ue>>=1}}else if(et.length>0){if(J&&je){const Xe=Qe(et[0]);t.texStorage2D(r.TEXTURE_2D,at,K,Xe.width,Xe.height)}for(let Xe=0,Ue=et.length;Xe<Ue;Xe++)me=et[Xe],J?Ge&&t.texSubImage2D(r.TEXTURE_2D,Xe,0,0,Ze,ct,me):t.texImage2D(r.TEXTURE_2D,Xe,K,Ze,ct,me);O.generateMipmaps=!1}else if(J){if(je){const Xe=Qe(Ve);t.texStorage2D(r.TEXTURE_2D,at,K,Xe.width,Xe.height)}Ge&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Ze,ct,Ve)}else t.texImage2D(r.TEXTURE_2D,0,K,Ze,ct,Ve);w(O)&&E(Te),dt.__version=Ee.version,O.onUpdate&&O.onUpdate(O)}G.__version=O.version}function Re(G,O,ae){if(O.image.length!==6)return;const Te=Ae(G,O),Ie=O.source;t.bindTexture(r.TEXTURE_CUBE_MAP,G.__webglTexture,r.TEXTURE0+ae);const Ee=n.get(Ie);if(Ie.version!==Ee.__version||Te===!0){t.activeTexture(r.TEXTURE0+ae);const dt=Sn.getPrimaries(Sn.workingColorSpace),Ke=O.colorSpace===Cl?null:Sn.getPrimaries(O.colorSpace),vt=O.colorSpace===Cl||dt===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,O.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,O.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,vt);const Dt=O.isCompressedTexture||O.image[0].isCompressedTexture,Ve=O.image[0]&&O.image[0].isDataTexture,Ze=[];for(let Ue=0;Ue<6;Ue++)!Dt&&!Ve?Ze[Ue]=R(O.image[Ue],!0,s.maxCubemapSize):Ze[Ue]=Ve?O.image[Ue].image:O.image[Ue],Ze[Ue]=Tt(O,Ze[Ue]);const ct=Ze[0],K=u.convert(O.format,O.colorSpace),me=u.convert(O.type),et=D(O.internalFormat,K,me,O.colorSpace),J=O.isVideoTexture!==!0,je=Ee.__version===void 0||Te===!0,Ge=Ie.dataReady;let at=B(O,ct);oe(r.TEXTURE_CUBE_MAP,O);let Xe;if(Dt){J&&je&&t.texStorage2D(r.TEXTURE_CUBE_MAP,at,et,ct.width,ct.height);for(let Ue=0;Ue<6;Ue++){Xe=Ze[Ue].mipmaps;for(let Ye=0;Ye<Xe.length;Ye++){const Ct=Xe[Ye];O.format!==Oa?K!==null?J?Ge&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye,0,0,Ct.width,Ct.height,K,Ct.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye,et,Ct.width,Ct.height,0,Ct.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):J?Ge&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye,0,0,Ct.width,Ct.height,K,me,Ct.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye,et,Ct.width,Ct.height,0,K,me,Ct.data)}}}else{if(Xe=O.mipmaps,J&&je){Xe.length>0&&at++;const Ue=Qe(Ze[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,at,et,Ue.width,Ue.height)}for(let Ue=0;Ue<6;Ue++)if(Ve){J?Ge&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,0,0,0,Ze[Ue].width,Ze[Ue].height,K,me,Ze[Ue].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,0,et,Ze[Ue].width,Ze[Ue].height,0,K,me,Ze[Ue].data);for(let Ye=0;Ye<Xe.length;Ye++){const Jt=Xe[Ye].image[Ue].image;J?Ge&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye+1,0,0,Jt.width,Jt.height,K,me,Jt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye+1,et,Jt.width,Jt.height,0,K,me,Jt.data)}}else{J?Ge&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,0,0,0,K,me,Ze[Ue]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,0,et,K,me,Ze[Ue]);for(let Ye=0;Ye<Xe.length;Ye++){const Ct=Xe[Ye];J?Ge&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye+1,0,0,K,me,Ct.image[Ue]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ye+1,et,K,me,Ct.image[Ue])}}}w(O)&&E(r.TEXTURE_CUBE_MAP),Ee.__version=Ie.version,O.onUpdate&&O.onUpdate(O)}G.__version=O.version}function tt(G,O,ae,Te,Ie,Ee){const dt=u.convert(ae.format,ae.colorSpace),Ke=u.convert(ae.type),vt=D(ae.internalFormat,dt,Ke,ae.colorSpace),Dt=n.get(O),Ve=n.get(ae);if(Ve.__renderTarget=O,!Dt.__hasExternalTextures){const Ze=Math.max(1,O.width>>Ee),ct=Math.max(1,O.height>>Ee);Ie===r.TEXTURE_3D||Ie===r.TEXTURE_2D_ARRAY?t.texImage3D(Ie,Ee,vt,Ze,ct,O.depth,0,dt,Ke,null):t.texImage2D(Ie,Ee,vt,Ze,ct,0,dt,Ke,null)}t.bindFramebuffer(r.FRAMEBUFFER,G),Et(O)?h.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Te,Ie,Ve.__webglTexture,0,Q(O)):(Ie===r.TEXTURE_2D||Ie>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&Ie<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Te,Ie,Ve.__webglTexture,Ee),t.bindFramebuffer(r.FRAMEBUFFER,null)}function st(G,O,ae){if(r.bindRenderbuffer(r.RENDERBUFFER,G),O.depthBuffer){const Te=O.depthTexture,Ie=Te&&Te.isDepthTexture?Te.type:null,Ee=U(O.stencilBuffer,Ie),dt=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Et(O)?h.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Q(O),Ee,O.width,O.height):ae?r.renderbufferStorageMultisample(r.RENDERBUFFER,Q(O),Ee,O.width,O.height):r.renderbufferStorage(r.RENDERBUFFER,Ee,O.width,O.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,dt,r.RENDERBUFFER,G)}else{const Te=O.textures;for(let Ie=0;Ie<Te.length;Ie++){const Ee=Te[Ie],dt=u.convert(Ee.format,Ee.colorSpace),Ke=u.convert(Ee.type),vt=D(Ee.internalFormat,dt,Ke,Ee.colorSpace);Et(O)?h.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Q(O),vt,O.width,O.height):ae?r.renderbufferStorageMultisample(r.RENDERBUFFER,Q(O),vt,O.width,O.height):r.renderbufferStorage(r.RENDERBUFFER,vt,O.width,O.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function ht(G,O,ae){const Te=O.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,G),!(O.depthTexture&&O.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Ie=n.get(O.depthTexture);if(Ie.__renderTarget=O,(!Ie.__webglTexture||O.depthTexture.image.width!==O.width||O.depthTexture.image.height!==O.height)&&(O.depthTexture.image.width=O.width,O.depthTexture.image.height=O.height,O.depthTexture.needsUpdate=!0),Te){if(Ie.__webglInit===void 0&&(Ie.__webglInit=!0,O.depthTexture.addEventListener("dispose",z)),Ie.__webglTexture===void 0){Ie.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,Ie.__webglTexture),oe(r.TEXTURE_CUBE_MAP,O.depthTexture);const Dt=u.convert(O.depthTexture.format),Ve=u.convert(O.depthTexture.type);let Ze;O.depthTexture.format===Fo?Ze=r.DEPTH_COMPONENT24:O.depthTexture.format===Uu&&(Ze=r.DEPTH24_STENCIL8);for(let ct=0;ct<6;ct++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Ze,O.width,O.height,0,Dt,Ve,null)}}else pe(O.depthTexture,0);const Ee=Ie.__webglTexture,dt=Q(O),Ke=Te?r.TEXTURE_CUBE_MAP_POSITIVE_X+ae:r.TEXTURE_2D,vt=O.depthTexture.format===Uu?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(O.depthTexture.format===Fo)Et(O)?h.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,vt,Ke,Ee,0,dt):r.framebufferTexture2D(r.FRAMEBUFFER,vt,Ke,Ee,0);else if(O.depthTexture.format===Uu)Et(O)?h.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,vt,Ke,Ee,0,dt):r.framebufferTexture2D(r.FRAMEBUFFER,vt,Ke,Ee,0);else throw new Error("Unknown depthTexture format")}function jt(G){const O=n.get(G),ae=G.isWebGLCubeRenderTarget===!0;if(O.__boundDepthTexture!==G.depthTexture){const Te=G.depthTexture;if(O.__depthDisposeCallback&&O.__depthDisposeCallback(),Te){const Ie=()=>{delete O.__boundDepthTexture,delete O.__depthDisposeCallback,Te.removeEventListener("dispose",Ie)};Te.addEventListener("dispose",Ie),O.__depthDisposeCallback=Ie}O.__boundDepthTexture=Te}if(G.depthTexture&&!O.__autoAllocateDepthBuffer)if(ae)for(let Te=0;Te<6;Te++)ht(O.__webglFramebuffer[Te],G,Te);else{const Te=G.texture.mipmaps;Te&&Te.length>0?ht(O.__webglFramebuffer[0],G,0):ht(O.__webglFramebuffer,G,0)}else if(ae){O.__webglDepthbuffer=[];for(let Te=0;Te<6;Te++)if(t.bindFramebuffer(r.FRAMEBUFFER,O.__webglFramebuffer[Te]),O.__webglDepthbuffer[Te]===void 0)O.__webglDepthbuffer[Te]=r.createRenderbuffer(),st(O.__webglDepthbuffer[Te],G,!1);else{const Ie=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ee=O.__webglDepthbuffer[Te];r.bindRenderbuffer(r.RENDERBUFFER,Ee),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ie,r.RENDERBUFFER,Ee)}}else{const Te=G.texture.mipmaps;if(Te&&Te.length>0?t.bindFramebuffer(r.FRAMEBUFFER,O.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer===void 0)O.__webglDepthbuffer=r.createRenderbuffer(),st(O.__webglDepthbuffer,G,!1);else{const Ie=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ee=O.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,Ee),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ie,r.RENDERBUFFER,Ee)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function tn(G,O,ae){const Te=n.get(G);O!==void 0&&tt(Te.__webglFramebuffer,G,G.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ae!==void 0&&jt(G)}function Nt(G){const O=G.texture,ae=n.get(G),Te=n.get(O);G.addEventListener("dispose",H);const Ie=G.textures,Ee=G.isWebGLCubeRenderTarget===!0,dt=Ie.length>1;if(dt||(Te.__webglTexture===void 0&&(Te.__webglTexture=r.createTexture()),Te.__version=O.version,f.memory.textures++),Ee){ae.__webglFramebuffer=[];for(let Ke=0;Ke<6;Ke++)if(O.mipmaps&&O.mipmaps.length>0){ae.__webglFramebuffer[Ke]=[];for(let vt=0;vt<O.mipmaps.length;vt++)ae.__webglFramebuffer[Ke][vt]=r.createFramebuffer()}else ae.__webglFramebuffer[Ke]=r.createFramebuffer()}else{if(O.mipmaps&&O.mipmaps.length>0){ae.__webglFramebuffer=[];for(let Ke=0;Ke<O.mipmaps.length;Ke++)ae.__webglFramebuffer[Ke]=r.createFramebuffer()}else ae.__webglFramebuffer=r.createFramebuffer();if(dt)for(let Ke=0,vt=Ie.length;Ke<vt;Ke++){const Dt=n.get(Ie[Ke]);Dt.__webglTexture===void 0&&(Dt.__webglTexture=r.createTexture(),f.memory.textures++)}if(G.samples>0&&Et(G)===!1){ae.__webglMultisampledFramebuffer=r.createFramebuffer(),ae.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ae.__webglMultisampledFramebuffer);for(let Ke=0;Ke<Ie.length;Ke++){const vt=Ie[Ke];ae.__webglColorRenderbuffer[Ke]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ae.__webglColorRenderbuffer[Ke]);const Dt=u.convert(vt.format,vt.colorSpace),Ve=u.convert(vt.type),Ze=D(vt.internalFormat,Dt,Ve,vt.colorSpace,G.isXRRenderTarget===!0),ct=Q(G);r.renderbufferStorageMultisample(r.RENDERBUFFER,ct,Ze,G.width,G.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ke,r.RENDERBUFFER,ae.__webglColorRenderbuffer[Ke])}r.bindRenderbuffer(r.RENDERBUFFER,null),G.depthBuffer&&(ae.__webglDepthRenderbuffer=r.createRenderbuffer(),st(ae.__webglDepthRenderbuffer,G,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(Ee){t.bindTexture(r.TEXTURE_CUBE_MAP,Te.__webglTexture),oe(r.TEXTURE_CUBE_MAP,O);for(let Ke=0;Ke<6;Ke++)if(O.mipmaps&&O.mipmaps.length>0)for(let vt=0;vt<O.mipmaps.length;vt++)tt(ae.__webglFramebuffer[Ke][vt],G,O,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,vt);else tt(ae.__webglFramebuffer[Ke],G,O,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0);w(O)&&E(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(dt){for(let Ke=0,vt=Ie.length;Ke<vt;Ke++){const Dt=Ie[Ke],Ve=n.get(Dt);let Ze=r.TEXTURE_2D;(G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Ze=G.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ze,Ve.__webglTexture),oe(Ze,Dt),tt(ae.__webglFramebuffer,G,Dt,r.COLOR_ATTACHMENT0+Ke,Ze,0),w(Dt)&&E(Ze)}t.unbindTexture()}else{let Ke=r.TEXTURE_2D;if((G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Ke=G.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ke,Te.__webglTexture),oe(Ke,O),O.mipmaps&&O.mipmaps.length>0)for(let vt=0;vt<O.mipmaps.length;vt++)tt(ae.__webglFramebuffer[vt],G,O,r.COLOR_ATTACHMENT0,Ke,vt);else tt(ae.__webglFramebuffer,G,O,r.COLOR_ATTACHMENT0,Ke,0);w(O)&&E(Ke),t.unbindTexture()}G.depthBuffer&&jt(G)}function Le(G){const O=G.textures;for(let ae=0,Te=O.length;ae<Te;ae++){const Ie=O[ae];if(w(Ie)){const Ee=N(G),dt=n.get(Ie).__webglTexture;t.bindTexture(Ee,dt),E(Ee),t.unbindTexture()}}}const He=[],Oe=[];function nt(G){if(G.samples>0){if(Et(G)===!1){const O=G.textures,ae=G.width,Te=G.height;let Ie=r.COLOR_BUFFER_BIT;const Ee=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,dt=n.get(G),Ke=O.length>1;if(Ke)for(let Dt=0;Dt<O.length;Dt++)t.bindFramebuffer(r.FRAMEBUFFER,dt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,dt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,dt.__webglMultisampledFramebuffer);const vt=G.texture.mipmaps;vt&&vt.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,dt.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,dt.__webglFramebuffer);for(let Dt=0;Dt<O.length;Dt++){if(G.resolveDepthBuffer&&(G.depthBuffer&&(Ie|=r.DEPTH_BUFFER_BIT),G.stencilBuffer&&G.resolveStencilBuffer&&(Ie|=r.STENCIL_BUFFER_BIT)),Ke){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,dt.__webglColorRenderbuffer[Dt]);const Ve=n.get(O[Dt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Ve,0)}r.blitFramebuffer(0,0,ae,Te,0,0,ae,Te,Ie,r.NEAREST),m===!0&&(He.length=0,Oe.length=0,He.push(r.COLOR_ATTACHMENT0+Dt),G.depthBuffer&&G.resolveDepthBuffer===!1&&(He.push(Ee),Oe.push(Ee),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Oe)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,He))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ke)for(let Dt=0;Dt<O.length;Dt++){t.bindFramebuffer(r.FRAMEBUFFER,dt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.RENDERBUFFER,dt.__webglColorRenderbuffer[Dt]);const Ve=n.get(O[Dt]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,dt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.TEXTURE_2D,Ve,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,dt.__webglMultisampledFramebuffer)}else if(G.depthBuffer&&G.resolveDepthBuffer===!1&&m){const O=G.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[O])}}}function Q(G){return Math.min(s.maxSamples,G.samples)}function Et(G){const O=n.get(G);return G.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function ot(G){const O=f.render.frame;_.get(G)!==O&&(_.set(G,O),G.update())}function Tt(G,O){const ae=G.colorSpace,Te=G.format,Ie=G.type;return G.isCompressedTexture===!0||G.isVideoTexture===!0||ae!==zu&&ae!==Cl&&(Sn.getTransfer(ae)===zn?(Te!==Oa||Ie!==ts)&&ft("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Rt("WebGLTextures: Unsupported texture color space:",ae)),O}function Qe(G){return typeof HTMLImageElement<"u"&&G instanceof HTMLImageElement?(g.width=G.naturalWidth||G.width,g.height=G.naturalHeight||G.height):typeof VideoFrame<"u"&&G instanceof VideoFrame?(g.width=G.displayWidth,g.height=G.displayHeight):(g.width=G.width,g.height=G.height),g}this.allocateTextureUnit=te,this.resetTextureUnits=se,this.setTexture2D=pe,this.setTexture2DArray=Y,this.setTexture3D=q,this.setTextureCube=ne,this.rebindTextures=tn,this.setupRenderTarget=Nt,this.updateRenderTargetMipmap=Le,this.updateMultisampleRenderTarget=nt,this.setupDepthRenderbuffer=jt,this.setupFrameBufferTexture=tt,this.useMultisampledRTT=Et,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qT(r,e){function t(n,s=Cl){let u;const f=Sn.getTransfer(s);if(n===ts)return r.UNSIGNED_BYTE;if(n===_y)return r.UNSIGNED_SHORT_4_4_4_4;if(n===xy)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Sb)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Mb)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===xb)return r.BYTE;if(n===bb)return r.SHORT;if(n===qh)return r.UNSIGNED_SHORT;if(n===yy)return r.INT;if(n===vr)return r.UNSIGNED_INT;if(n===is)return r.FLOAT;if(n===Bo)return r.HALF_FLOAT;if(n===Eb)return r.ALPHA;if(n===Tb)return r.RGB;if(n===Oa)return r.RGBA;if(n===Fo)return r.DEPTH_COMPONENT;if(n===Uu)return r.DEPTH_STENCIL;if(n===by)return r.RED;if(n===wm)return r.RED_INTEGER;if(n===tf)return r.RG;if(n===Sy)return r.RG_INTEGER;if(n===My)return r.RGBA_INTEGER;if(n===$p||n===em||n===tm||n===nm)if(f===zn)if(u=e.get("WEBGL_compressed_texture_s3tc_srgb"),u!==null){if(n===$p)return u.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===em)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===tm)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===nm)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(u=e.get("WEBGL_compressed_texture_s3tc"),u!==null){if(n===$p)return u.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===em)return u.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===tm)return u.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===nm)return u.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Av||n===wv||n===Cv||n===Rv)if(u=e.get("WEBGL_compressed_texture_pvrtc"),u!==null){if(n===Av)return u.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===wv)return u.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Cv)return u.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Rv)return u.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Nv||n===Dv||n===Lv||n===Uv||n===Iv||n===Ov||n===Pv)if(u=e.get("WEBGL_compressed_texture_etc"),u!==null){if(n===Nv||n===Dv)return f===zn?u.COMPRESSED_SRGB8_ETC2:u.COMPRESSED_RGB8_ETC2;if(n===Lv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:u.COMPRESSED_RGBA8_ETC2_EAC;if(n===Uv)return u.COMPRESSED_R11_EAC;if(n===Iv)return u.COMPRESSED_SIGNED_R11_EAC;if(n===Ov)return u.COMPRESSED_RG11_EAC;if(n===Pv)return u.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===zv||n===Bv||n===Fv||n===kv||n===Vv||n===Hv||n===Gv||n===Xv||n===Wv||n===qv||n===jv||n===Yv||n===Zv||n===Qv)if(u=e.get("WEBGL_compressed_texture_astc"),u!==null){if(n===zv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:u.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Bv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:u.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Fv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:u.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===kv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:u.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Vv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:u.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Hv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:u.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Gv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:u.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Xv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:u.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:u.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===qv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:u.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===jv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:u.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Yv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:u.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Zv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:u.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Qv)return f===zn?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:u.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Kv||n===Jv||n===$v)if(u=e.get("EXT_texture_compression_bptc"),u!==null){if(n===Kv)return f===zn?u.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:u.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Jv)return u.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===$v)return u.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ey||n===ty||n===ny||n===iy)if(u=e.get("EXT_texture_compression_rgtc"),u!==null){if(n===ey)return u.COMPRESSED_RED_RGTC1_EXT;if(n===ty)return u.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ny)return u.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===iy)return u.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===jh?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const RP=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,NP=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
void main() {
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
if ( coord.x >= 1.0 ) {
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
} else {
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
}
}`;class DP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Pb(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new yr({vertexShader:RP,fragmentShader:NP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Yi(new sd(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class LP extends ko{constructor(e,t){super();const n=this;let s=null,u=1,f=null,h="local-floor",m=1,g=null,_=null,x=null,b=null,M=null,A=null;const R=typeof XRWebGLBinding<"u",w=new DP,E={},N=t.getContextAttributes();let D=null,U=null;const B=[],z=[],H=new ze;let W=null;const I=new zi;I.viewport=new jn;const P=new zi;P.viewport=new jn;const Z=[I,P],se=new OT;let te=null,fe=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(de){let Re=B[de];return Re===void 0&&(Re=new pv,B[de]=Re),Re.getTargetRaySpace()},this.getControllerGrip=function(de){let Re=B[de];return Re===void 0&&(Re=new pv,B[de]=Re),Re.getGripSpace()},this.getHand=function(de){let Re=B[de];return Re===void 0&&(Re=new pv,B[de]=Re),Re.getHandSpace()};function pe(de){const Re=z.indexOf(de.inputSource);if(Re===-1)return;const tt=B[Re];tt!==void 0&&(tt.update(de.inputSource,de.frame,g||f),tt.dispatchEvent({type:de.type,data:de.inputSource}))}function Y(){s.removeEventListener("select",pe),s.removeEventListener("selectstart",pe),s.removeEventListener("selectend",pe),s.removeEventListener("squeeze",pe),s.removeEventListener("squeezestart",pe),s.removeEventListener("squeezeend",pe),s.removeEventListener("end",Y),s.removeEventListener("inputsourceschange",q);for(let de=0;de<B.length;de++){const Re=z[de];Re!==null&&(z[de]=null,B[de].disconnect(Re))}te=null,fe=null,w.reset();for(const de in E)delete E[de];e.setRenderTarget(D),M=null,b=null,x=null,s=null,U=null,lt.stop(),n.isPresenting=!1,e.setPixelRatio(W),e.setSize(H.width,H.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(de){u=de,n.isPresenting===!0&&ft("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(de){h=de,n.isPresenting===!0&&ft("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return g||f},this.setReferenceSpace=function(de){g=de},this.getBaseLayer=function(){return b!==null?b:M},this.getBinding=function(){return x===null&&R&&(x=new XRWebGLBinding(s,t)),x},this.getFrame=function(){return A},this.getSession=function(){return s},this.setSession=async function(de){if(s=de,s!==null){if(D=e.getRenderTarget(),s.addEventListener("select",pe),s.addEventListener("selectstart",pe),s.addEventListener("selectend",pe),s.addEventListener("squeeze",pe),s.addEventListener("squeezestart",pe),s.addEventListener("squeezeend",pe),s.addEventListener("end",Y),s.addEventListener("inputsourceschange",q),N.xrCompatible!==!0&&await t.makeXRCompatible(),W=e.getPixelRatio(),e.getSize(H),R&&"createProjectionLayer"in XRWebGLBinding.prototype){let tt=null,st=null,ht=null;N.depth&&(ht=N.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,tt=N.stencil?Uu:Fo,st=N.stencil?jh:vr);const jt={colorFormat:t.RGBA8,depthFormat:ht,scaleFactor:u};x=this.getBinding(),b=x.createProjectionLayer(jt),s.updateRenderState({layers:[b]}),e.setPixelRatio(1),e.setSize(b.textureWidth,b.textureHeight,!1),U=new Hs(b.textureWidth,b.textureHeight,{format:Oa,type:ts,depthTexture:new ed(b.textureWidth,b.textureHeight,st,void 0,void 0,void 0,void 0,void 0,void 0,tt),stencilBuffer:N.stencil,colorSpace:e.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:b.ignoreDepthValues===!1,resolveStencilBuffer:b.ignoreDepthValues===!1})}else{const tt={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:u};M=new XRWebGLLayer(s,t,tt),s.updateRenderState({baseLayer:M}),e.setPixelRatio(1),e.setSize(M.framebufferWidth,M.framebufferHeight,!1),U=new Hs(M.framebufferWidth,M.framebufferHeight,{format:Oa,type:ts,colorSpace:e.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:M.ignoreDepthValues===!1,resolveStencilBuffer:M.ignoreDepthValues===!1})}U.isXRRenderTarget=!0,this.setFoveation(m),g=null,f=await s.requestReferenceSpace(h),lt.setContext(s),lt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return w.getDepthTexture()};function q(de){for(let Re=0;Re<de.removed.length;Re++){const tt=de.removed[Re],st=z.indexOf(tt);st>=0&&(z[st]=null,B[st].disconnect(tt))}for(let Re=0;Re<de.added.length;Re++){const tt=de.added[Re];let st=z.indexOf(tt);if(st===-1){for(let jt=0;jt<B.length;jt++)if(jt>=z.length){z.push(tt),st=jt;break}else if(z[jt]===null){z[jt]=tt,st=jt;break}if(st===-1)break}const ht=B[st];ht&&ht.connect(tt)}}const ne=new j,be=new j;function Ne(de,Re,tt){ne.setFromMatrixPosition(Re.matrixWorld),be.setFromMatrixPosition(tt.matrixWorld);const st=ne.distanceTo(be),ht=Re.projectionMatrix.elements,jt=tt.projectionMatrix.elements,tn=ht[14]/(ht[10]-1),Nt=ht[14]/(ht[10]+1),Le=(ht[9]+1)/ht[5],He=(ht[9]-1)/ht[5],Oe=(ht[8]-1)/ht[0],nt=(jt[8]+1)/jt[0],Q=tn*Oe,Et=tn*nt,ot=st/(-Oe+nt),Tt=ot*-Oe;if(Re.matrixWorld.decompose(de.position,de.quaternion,de.scale),de.translateX(Tt),de.translateZ(ot),de.matrixWorld.compose(de.position,de.quaternion,de.scale),de.matrixWorldInverse.copy(de.matrixWorld).invert(),ht[10]===-1)de.projectionMatrix.copy(Re.projectionMatrix),de.projectionMatrixInverse.copy(Re.projectionMatrixInverse);else{const Qe=tn+ot,G=Nt+ot,O=Q-Tt,ae=Et+(st-Tt),Te=Le*Nt/G*Qe,Ie=He*Nt/G*Qe;de.projectionMatrix.makePerspective(O,ae,Te,Ie,Qe,G),de.projectionMatrixInverse.copy(de.projectionMatrix).invert()}}function X(de,Re){Re===null?de.matrixWorld.copy(de.matrix):de.matrixWorld.multiplyMatrices(Re.matrixWorld,de.matrix),de.matrixWorldInverse.copy(de.matrixWorld).invert()}this.updateCamera=function(de){if(s===null)return;let Re=de.near,tt=de.far;w.texture!==null&&(w.depthNear>0&&(Re=w.depthNear),w.depthFar>0&&(tt=w.depthFar)),se.near=P.near=I.near=Re,se.far=P.far=I.far=tt,(te!==se.near||fe!==se.far)&&(s.updateRenderState({depthNear:se.near,depthFar:se.far}),te=se.near,fe=se.far),se.layers.mask=de.layers.mask|6,I.layers.mask=se.layers.mask&3,P.layers.mask=se.layers.mask&5;const st=de.parent,ht=se.cameras;X(se,st);for(let jt=0;jt<ht.length;jt++)X(ht[jt],st);ht.length===2?Ne(se,I,P):se.projectionMatrix.copy(I.projectionMatrix),oe(de,se,st)};function oe(de,Re,tt){tt===null?de.matrix.copy(Re.matrixWorld):(de.matrix.copy(tt.matrixWorld),de.matrix.invert(),de.matrix.multiply(Re.matrixWorld)),de.matrix.decompose(de.position,de.quaternion,de.scale),de.updateMatrixWorld(!0),de.projectionMatrix.copy(Re.projectionMatrix),de.projectionMatrixInverse.copy(Re.projectionMatrixInverse),de.isPerspectiveCamera&&(de.fov=Qh*2*Math.atan(1/de.projectionMatrix.elements[5]),de.zoom=1)}this.getCamera=function(){return se},this.getFoveation=function(){if(!(b===null&&M===null))return m},this.setFoveation=function(de){m=de,b!==null&&(b.fixedFoveation=de),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=de)},this.hasDepthSensing=function(){return w.texture!==null},this.getDepthSensingMesh=function(){return w.getMesh(se)},this.getCameraTexture=function(de){return E[de]};let Ae=null;function Fe(de,Re){if(_=Re.getViewerPose(g||f),A=Re,_!==null){const tt=_.views;M!==null&&(e.setRenderTargetFramebuffer(U,M.framebuffer),e.setRenderTarget(U));let st=!1;tt.length!==se.cameras.length&&(se.cameras.length=0,st=!0);for(let Nt=0;Nt<tt.length;Nt++){const Le=tt[Nt];let He=null;if(M!==null)He=M.getViewport(Le);else{const nt=x.getViewSubImage(b,Le);He=nt.viewport,Nt===0&&(e.setRenderTargetTextures(U,nt.colorTexture,nt.depthStencilTexture),e.setRenderTarget(U))}let Oe=Z[Nt];Oe===void 0&&(Oe=new zi,Oe.layers.enable(Nt),Oe.viewport=new jn,Z[Nt]=Oe),Oe.matrix.fromArray(Le.transform.matrix),Oe.matrix.decompose(Oe.position,Oe.quaternion,Oe.scale),Oe.projectionMatrix.fromArray(Le.projectionMatrix),Oe.projectionMatrixInverse.copy(Oe.projectionMatrix).invert(),Oe.viewport.set(He.x,He.y,He.width,He.height),Nt===0&&(se.matrix.copy(Oe.matrix),se.matrix.decompose(se.position,se.quaternion,se.scale)),st===!0&&se.cameras.push(Oe)}const ht=s.enabledFeatures;if(ht&&ht.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&R){x=n.getBinding();const Nt=x.getDepthInformation(tt[0]);Nt&&Nt.isValid&&Nt.texture&&w.init(Nt,s.renderState)}if(ht&&ht.includes("camera-access")&&R){e.state.unbindTexture(),x=n.getBinding();for(let Nt=0;Nt<tt.length;Nt++){const Le=tt[Nt].camera;if(Le){let He=E[Le];He||(He=new Pb,E[Le]=He);const Oe=x.getCameraImage(Le);He.sourceTexture=Oe}}}}for(let tt=0;tt<B.length;tt++){const st=z[tt],ht=B[tt];st!==null&&ht!==void 0&&ht.update(st,Re,g||f)}Ae&&Ae(de,Re),Re.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Re}),A=null}const lt=new VT;lt.setAnimationLoop(Fe),this.setAnimationLoop=function(de){Ae=de},this.dispose=function(){}}}const Hc=new Gs,UP=new Xt;function IP(r,e){function t(w,E){w.matrixAutoUpdate===!0&&w.updateMatrix(),E.value.copy(w.matrix)}function n(w,E){E.color.getRGB(w.fogColor.value,GE(r)),E.isFog?(w.fogNear.value=E.near,w.fogFar.value=E.far):E.isFogExp2&&(w.fogDensity.value=E.density)}function s(w,E,N,D,U){E.isMeshBasicMaterial||E.isMeshLambertMaterial?u(w,E):E.isMeshToonMaterial?(u(w,E),x(w,E)):E.isMeshPhongMaterial?(u(w,E),_(w,E)):E.isMeshStandardMaterial?(u(w,E),b(w,E),E.isMeshPhysicalMaterial&&M(w,E,U)):E.isMeshMatcapMaterial?(u(w,E),A(w,E)):E.isMeshDepthMaterial?u(w,E):E.isMeshDistanceMaterial?(u(w,E),R(w,E)):E.isMeshNormalMaterial?u(w,E):E.isLineBasicMaterial?(f(w,E),E.isLineDashedMaterial&&h(w,E)):E.isPointsMaterial?m(w,E,N,D):E.isSpriteMaterial?g(w,E):E.isShadowMaterial?(w.color.value.copy(E.color),w.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function u(w,E){w.opacity.value=E.opacity,E.color&&w.diffuse.value.copy(E.color),E.emissive&&w.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(w.map.value=E.map,t(E.map,w.mapTransform)),E.alphaMap&&(w.alphaMap.value=E.alphaMap,t(E.alphaMap,w.alphaMapTransform)),E.bumpMap&&(w.bumpMap.value=E.bumpMap,t(E.bumpMap,w.bumpMapTransform),w.bumpScale.value=E.bumpScale,E.side===as&&(w.bumpScale.value*=-1)),E.normalMap&&(w.normalMap.value=E.normalMap,t(E.normalMap,w.normalMapTransform),w.normalScale.value.copy(E.normalScale),E.side===as&&w.normalScale.value.negate()),E.displacementMap&&(w.displacementMap.value=E.displacementMap,t(E.displacementMap,w.displacementMapTransform),w.displacementScale.value=E.displacementScale,w.displacementBias.value=E.displacementBias),E.emissiveMap&&(w.emissiveMap.value=E.emissiveMap,t(E.emissiveMap,w.emissiveMapTransform)),E.specularMap&&(w.specularMap.value=E.specularMap,t(E.specularMap,w.specularMapTransform)),E.alphaTest>0&&(w.alphaTest.value=E.alphaTest);const N=e.get(E),D=N.envMap,U=N.envMapRotation;D&&(w.envMap.value=D,Hc.copy(U),Hc.x*=-1,Hc.y*=-1,Hc.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Hc.y*=-1,Hc.z*=-1),w.envMapRotation.value.setFromMatrix4(UP.makeRotationFromEuler(Hc)),w.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=E.reflectivity,w.ior.value=E.ior,w.refractionRatio.value=E.refractionRatio),E.lightMap&&(w.lightMap.value=E.lightMap,w.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,w.lightMapTransform)),E.aoMap&&(w.aoMap.value=E.aoMap,w.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,w.aoMapTransform))}function f(w,E){w.diffuse.value.copy(E.color),w.opacity.value=E.opacity,E.map&&(w.map.value=E.map,t(E.map,w.mapTransform))}function h(w,E){w.dashSize.value=E.dashSize,w.totalSize.value=E.dashSize+E.gapSize,w.scale.value=E.scale}function m(w,E,N,D){w.diffuse.value.copy(E.color),w.opacity.value=E.opacity,w.size.value=E.size*N,w.scale.value=D*.5,E.map&&(w.map.value=E.map,t(E.map,w.uvTransform)),E.alphaMap&&(w.alphaMap.value=E.alphaMap,t(E.alphaMap,w.alphaMapTransform)),E.alphaTest>0&&(w.alphaTest.value=E.alphaTest)}function g(w,E){w.diffuse.value.copy(E.color),w.opacity.value=E.opacity,w.rotation.value=E.rotation,E.map&&(w.map.value=E.map,t(E.map,w.mapTransform)),E.alphaMap&&(w.alphaMap.value=E.alphaMap,t(E.alphaMap,w.alphaMapTransform)),E.alphaTest>0&&(w.alphaTest.value=E.alphaTest)}function _(w,E){w.specular.value.copy(E.specular),w.shininess.value=Math.max(E.shininess,1e-4)}function x(w,E){E.gradientMap&&(w.gradientMap.value=E.gradientMap)}function b(w,E){w.metalness.value=E.metalness,E.metalnessMap&&(w.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,w.metalnessMapTransform)),w.roughness.value=E.roughness,E.roughnessMap&&(w.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,w.roughnessMapTransform)),E.envMap&&(w.envMapIntensity.value=E.envMapIntensity)}function M(w,E,N){w.ior.value=E.ior,E.sheen>0&&(w.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),w.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(w.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,w.sheenColorMapTransform)),E.sheenRoughnessMap&&(w.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,w.sheenRoughnessMapTransform))),E.clearcoat>0&&(w.clearcoat.value=E.clearcoat,w.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(w.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,w.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(w.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===as&&w.clearcoatNormalScale.value.negate())),E.dispersion>0&&(w.dispersion.value=E.dispersion),E.iridescence>0&&(w.iridescence.value=E.iridescence,w.iridescenceIOR.value=E.iridescenceIOR,w.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(w.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,w.iridescenceMapTransform)),E.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),E.transmission>0&&(w.transmission.value=E.transmission,w.transmissionSamplerMap.value=N.texture,w.transmissionSamplerSize.value.set(N.width,N.height),E.transmissionMap&&(w.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,w.transmissionMapTransform)),w.thickness.value=E.thickness,E.thicknessMap&&(w.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=E.attenuationDistance,w.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(w.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(w.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=E.specularIntensity,w.specularColor.value.copy(E.specularColor),E.specularColorMap&&(w.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,w.specularColorMapTransform)),E.specularIntensityMap&&(w.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,w.specularIntensityMapTransform))}function A(w,E){E.matcap&&(w.matcap.value=E.matcap)}function R(w,E){const N=e.get(E).light;w.referencePosition.value.setFromMatrixPosition(N.matrixWorld),w.nearDistance.value=N.shadow.camera.near,w.farDistance.value=N.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function OP(r,e,t,n){let s={},u={},f=[];const h=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function m(N,D){const U=D.program;n.uniformBlockBinding(N,U)}function g(N,D){let U=s[N.id];U===void 0&&(A(N),U=_(N),s[N.id]=U,N.addEventListener("dispose",w));const B=D.program;n.updateUBOMapping(N,B);const z=e.render.frame;u[N.id]!==z&&(b(N),u[N.id]=z)}function _(N){const D=x();N.__bindingPointIndex=D;const U=r.createBuffer(),B=N.__size,z=N.usage;return r.bindBuffer(r.UNIFORM_BUFFER,U),r.bufferData(r.UNIFORM_BUFFER,B,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,D,U),U}function x(){for(let N=0;N<h;N++)if(f.indexOf(N)===-1)return f.push(N),N;return Rt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function b(N){const D=s[N.id],U=N.uniforms,B=N.__cache;r.bindBuffer(r.UNIFORM_BUFFER,D);for(let z=0,H=U.length;z<H;z++){const W=Array.isArray(U[z])?U[z]:[U[z]];for(let I=0,P=W.length;I<P;I++){const Z=W[I];if(M(Z,z,I,B)===!0){const se=Z.__offset,te=Array.isArray(Z.value)?Z.value:[Z.value];let fe=0;for(let pe=0;pe<te.length;pe++){const Y=te[pe],q=R(Y);typeof Y=="number"||typeof Y=="boolean"?(Z.__data[0]=Y,r.bufferSubData(r.UNIFORM_BUFFER,se+fe,Z.__data)):Y.isMatrix3?(Z.__data[0]=Y.elements[0],Z.__data[1]=Y.elements[1],Z.__data[2]=Y.elements[2],Z.__data[3]=0,Z.__data[4]=Y.elements[3],Z.__data[5]=Y.elements[4],Z.__data[6]=Y.elements[5],Z.__data[7]=0,Z.__data[8]=Y.elements[6],Z.__data[9]=Y.elements[7],Z.__data[10]=Y.elements[8],Z.__data[11]=0):(Y.toArray(Z.__data,fe),fe+=q.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,se,Z.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(N,D,U,B){const z=N.value,H=D+"_"+U;if(B[H]===void 0)return typeof z=="number"||typeof z=="boolean"?B[H]=z:B[H]=z.clone(),!0;{const W=B[H];if(typeof z=="number"||typeof z=="boolean"){if(W!==z)return B[H]=z,!0}else if(W.equals(z)===!1)return W.copy(z),!0}return!1}function A(N){const D=N.uniforms;let U=0;const B=16;for(let H=0,W=D.length;H<W;H++){const I=Array.isArray(D[H])?D[H]:[D[H]];for(let P=0,Z=I.length;P<Z;P++){const se=I[P],te=Array.isArray(se.value)?se.value:[se.value];for(let fe=0,pe=te.length;fe<pe;fe++){const Y=te[fe],q=R(Y),ne=U%B,be=ne%q.boundary,Ne=ne+be;U+=be,Ne!==0&&B-Ne<q.storage&&(U+=B-Ne),se.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),se.__offset=U,U+=q.storage}}}const z=U%B;return z>0&&(U+=B-z),N.__size=U,N.__cache={},this}function R(N){const D={boundary:0,storage:0};return typeof N=="number"||typeof N=="boolean"?(D.boundary=4,D.storage=4):N.isVector2?(D.boundary=8,D.storage=8):N.isVector3||N.isColor?(D.boundary=16,D.storage=12):N.isVector4?(D.boundary=16,D.storage=16):N.isMatrix3?(D.boundary=48,D.storage=48):N.isMatrix4?(D.boundary=64,D.storage=64):N.isTexture?ft("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ft("WebGLRenderer: Unsupported uniform value type.",N),D}function w(N){const D=N.target;D.removeEventListener("dispose",w);const U=f.indexOf(D.__bindingPointIndex);f.splice(U,1),r.deleteBuffer(s[D.id]),delete s[D.id],delete u[D.id]}function E(){for(const N in s)r.deleteBuffer(s[N]);f=[],s={},u={}}return{bind:m,update:g,dispose:E}}const PP=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Lo=null;function zP(){return Lo===null&&(Lo=new Yr(PP,16,16,tf,Bo),Lo.name="DFG_LUT",Lo.minFilter=oi,Lo.magFilter=oi,Lo.wrapS=Rs,Lo.wrapT=Rs,Lo.generateMipmaps=!1,Lo.needsUpdate=!0),Lo}class jT{constructor(e={}){const{canvas:t=kE(),context:n=null,depth:s=!0,stencil:u=!1,alpha:f=!1,antialias:h=!1,premultipliedAlpha:m=!0,preserveDrawingBuffer:g=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:x=!1,reversedDepthBuffer:b=!1,outputBufferType:M=ts}=e;this.isWebGLRenderer=!0;let A;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=f;const R=M,w=new Set([My,Sy,wm]),E=new Set([ts,vr,qh,jh,_y,xy]),N=new Uint32Array(4),D=new Int32Array(4);let U=null,B=null;const z=[],H=[];let W=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=gr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let P=!1;this._outputColorSpace=Ia;let Z=0,se=0,te=null,fe=-1,pe=null;const Y=new jn,q=new jn;let ne=null;const be=new yt(0);let Ne=0,X=t.width,oe=t.height,Ae=1,Fe=null,lt=null;const de=new jn(0,0,X,oe),Re=new jn(0,0,X,oe);let tt=!1;const st=new ad;let ht=!1,jt=!1;const tn=new Xt,Nt=new j,Le=new jn,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Oe=!1;function nt(){return te===null?Ae:1}let Q=n;function Et(k,re){return t.getContext(k,re)}try{const k={alpha:!0,depth:s,stencil:u,antialias:h,premultipliedAlpha:m,preserveDrawingBuffer:g,powerPreference:_,failIfMajorPerformanceCaveat:x};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${my}`),t.addEventListener("webglcontextlost",Ct,!1),t.addEventListener("webglcontextrestored",Jt,!1),t.addEventListener("webglcontextcreationerror",nn,!1),Q===null){const re="webgl2";if(Q=Et(re,k),Q===null)throw Et(re)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(k){throw Rt("WebGLRenderer: "+k.message),k}let ot,Tt,Qe,G,O,ae,Te,Ie,Ee,dt,Ke,vt,Dt,Ve,Ze,ct,K,me,et,J,je,Ge,at,Xe;function Ue(){ot=new BI(Q),ot.init(),Ge=new qT(Q,ot),Tt=new RI(Q,ot,e,Ge),Qe=new wP(Q,ot),Tt.reversedDepthBuffer&&b&&Qe.buffers.depth.setReversed(!0),G=new VI(Q),O=new hP,ae=new CP(Q,ot,Qe,O,Tt,Ge,G),Te=new DI(I),Ie=new zI(I),Ee=new WD(Q),at=new wI(Q,Ee),dt=new FI(Q,Ee,G,at),Ke=new GI(Q,dt,Ee,G),et=new HI(Q,Tt,ae),ct=new NI(O),vt=new fP(I,Te,Ie,ot,Tt,at,ct),Dt=new IP(I,O),Ve=new pP,Ze=new xP(ot),me=new AI(I,Te,Ie,Qe,Ke,A,m),K=new TP(I,Ke,Tt),Xe=new OP(Q,G,Tt,Qe),J=new CI(Q,ot,G),je=new kI(Q,ot,G),G.programs=vt.programs,I.capabilities=Tt,I.extensions=ot,I.properties=O,I.renderLists=Ve,I.shadowMap=K,I.state=Qe,I.info=G}Ue(),R!==ts&&(W=new WI(R,t.width,t.height,s,u));const Ye=new LP(I,Q);this.xr=Ye,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const k=ot.get("WEBGL_lose_context");k&&k.loseContext()},this.forceContextRestore=function(){const k=ot.get("WEBGL_lose_context");k&&k.restoreContext()},this.getPixelRatio=function(){return Ae},this.setPixelRatio=function(k){k!==void 0&&(Ae=k,this.setSize(X,oe,!1))},this.getSize=function(k){return k.set(X,oe)},this.setSize=function(k,re,Se=!0){if(Ye.isPresenting){ft("WebGLRenderer: Can't change size while VR device is presenting.");return}X=k,oe=re,t.width=Math.floor(k*Ae),t.height=Math.floor(re*Ae),Se===!0&&(t.style.width=k+"px",t.style.height=re+"px"),W!==null&&W.setSize(t.width,t.height),this.setViewport(0,0,k,re)},this.getDrawingBufferSize=function(k){return k.set(X*Ae,oe*Ae).floor()},this.setDrawingBufferSize=function(k,re,Se){X=k,oe=re,Ae=Se,t.width=Math.floor(k*Se),t.height=Math.floor(re*Se),this.setViewport(0,0,k,re)},this.setEffects=function(k){if(R===ts){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(k){for(let re=0;re<k.length;re++)if(k[re].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}W.setEffects(k||[])},this.getCurrentViewport=function(k){return k.copy(Y)},this.getViewport=function(k){return k.copy(de)},this.setViewport=function(k,re,Se,ye){k.isVector4?de.set(k.x,k.y,k.z,k.w):de.set(k,re,Se,ye),Qe.viewport(Y.copy(de).multiplyScalar(Ae).round())},this.getScissor=function(k){return k.copy(Re)},this.setScissor=function(k,re,Se,ye){k.isVector4?Re.set(k.x,k.y,k.z,k.w):Re.set(k,re,Se,ye),Qe.scissor(q.copy(Re).multiplyScalar(Ae).round())},this.getScissorTest=function(){return tt},this.setScissorTest=function(k){Qe.setScissorTest(tt=k)},this.setOpaqueSort=function(k){Fe=k},this.setTransparentSort=function(k){lt=k},this.getClearColor=function(k){return k.copy(me.getClearColor())},this.setClearColor=function(){me.setClearColor(...arguments)},this.getClearAlpha=function(){return me.getClearAlpha()},this.setClearAlpha=function(){me.setClearAlpha(...arguments)},this.clear=function(k=!0,re=!0,Se=!0){let ye=0;if(k){let ue=!1;if(te!==null){const Je=te.texture.format;ue=w.has(Je)}if(ue){const Je=te.texture.type,mt=E.has(Je),qe=me.getClearColor(),_t=me.getClearAlpha(),xt=qe.r,Lt=qe.g,St=qe.b;mt?(N[0]=xt,N[1]=Lt,N[2]=St,N[3]=_t,Q.clearBufferuiv(Q.COLOR,0,N)):(D[0]=xt,D[1]=Lt,D[2]=St,D[3]=_t,Q.clearBufferiv(Q.COLOR,0,D))}else ye|=Q.COLOR_BUFFER_BIT}re&&(ye|=Q.DEPTH_BUFFER_BIT),Se&&(ye|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.clear(ye)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ct,!1),t.removeEventListener("webglcontextrestored",Jt,!1),t.removeEventListener("webglcontextcreationerror",nn,!1),me.dispose(),Ve.dispose(),Ze.dispose(),O.dispose(),Te.dispose(),Ie.dispose(),Ke.dispose(),at.dispose(),Xe.dispose(),vt.dispose(),Ye.dispose(),Ye.removeEventListener("sessionstart",xr),Ye.removeEventListener("sessionend",Go),na.stop()};function Ct(k){k.preventDefault(),gm("WebGLRenderer: Context Lost."),P=!0}function Jt(){gm("WebGLRenderer: Context Restored."),P=!1;const k=G.autoReset,re=K.enabled,Se=K.autoUpdate,ye=K.needsUpdate,ue=K.type;Ue(),G.autoReset=k,K.enabled=re,K.autoUpdate=Se,K.needsUpdate=ye,K.type=ue}function nn(k){Rt("WebGLRenderer: A WebGL context could not be created. Reason: ",k.statusMessage)}function Jn(k){const re=k.target;re.removeEventListener("dispose",Jn),Ci(re)}function Ci(k){Qr(k),O.remove(k)}function Qr(k){const re=O.get(k).programs;re!==void 0&&(re.forEach(function(Se){vt.releaseProgram(Se)}),k.isShaderMaterial&&vt.releaseShaderCache(k))}this.renderBufferDirect=function(k,re,Se,ye,ue,Je){re===null&&(re=He);const mt=ue.isMesh&&ue.matrixWorld.determinant()<0,qe=Ds(k,re,Se,ye,ue);Qe.setMaterial(ye,mt);let _t=Se.index,xt=1;if(ye.wireframe===!0){if(_t=dt.getWireframeAttribute(Se),_t===void 0)return;xt=2}const Lt=Se.drawRange,St=Se.attributes.position;let Pt=Lt.start*xt,Mn=(Lt.start+Lt.count)*xt;Je!==null&&(Pt=Math.max(Pt,Je.start*xt),Mn=Math.min(Mn,(Je.start+Je.count)*xt)),_t!==null?(Pt=Math.max(Pt,0),Mn=Math.min(Mn,_t.count)):St!=null&&(Pt=Math.max(Pt,0),Mn=Math.min(Mn,St.count));const Bn=Mn-Pt;if(Bn<0||Bn===1/0)return;at.setup(ue,ye,qe,Se,_t);let In,Wt=J;if(_t!==null&&(In=Ee.get(_t),Wt=je,Wt.setIndex(In)),ue.isMesh)ye.wireframe===!0?(Qe.setLineWidth(ye.wireframeLinewidth*nt()),Wt.setMode(Q.LINES)):Wt.setMode(Q.TRIANGLES);else if(ue.isLine){let ut=ye.linewidth;ut===void 0&&(ut=1),Qe.setLineWidth(ut*nt()),ue.isLineSegments?Wt.setMode(Q.LINES):ue.isLineLoop?Wt.setMode(Q.LINE_LOOP):Wt.setMode(Q.LINE_STRIP)}else ue.isPoints?Wt.setMode(Q.POINTS):ue.isSprite&&Wt.setMode(Q.TRIANGLES);if(ue.isBatchedMesh)if(ue._multiDrawInstances!==null)Zh("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Wt.renderMultiDrawInstances(ue._multiDrawStarts,ue._multiDrawCounts,ue._multiDrawCount,ue._multiDrawInstances);else if(ot.get("WEBGL_multi_draw"))Wt.renderMultiDraw(ue._multiDrawStarts,ue._multiDrawCounts,ue._multiDrawCount);else{const ut=ue._multiDrawStarts,_n=ue._multiDrawCounts,Ft=ue._multiDrawCount,xi=_t?Ee.get(_t).bytesPerElement:1,Ls=O.get(ye).currentProgram.getUniforms();for(let Wn=0;Wn<Ft;Wn++)Ls.setValue(Q,"_gl_DrawID",Wn),Wt.render(ut[Wn]/xi,_n[Wn])}else if(ue.isInstancedMesh)Wt.renderInstances(Pt,Bn,ue.count);else if(Se.isInstancedBufferGeometry){const ut=Se._maxInstanceCount!==void 0?Se._maxInstanceCount:1/0,_n=Math.min(Se.instanceCount,ut);Wt.renderInstances(Pt,Bn,_n)}else Wt.render(Pt,Bn)};function Kr(k,re,Se){k.transparent===!0&&k.side===Uo&&k.forceSinglePass===!1?(k.side=as,k.needsUpdate=!0,Ha(k,re,Se),k.side=Ll,k.needsUpdate=!0,Ha(k,re,Se),k.side=Uo):Ha(k,re,Se)}this.compile=function(k,re,Se=null){Se===null&&(Se=k),B=Ze.get(Se),B.init(re),H.push(B),Se.traverseVisible(function(ue){ue.isLight&&ue.layers.test(re.layers)&&(B.pushLight(ue),ue.castShadow&&B.pushShadow(ue))}),k!==Se&&k.traverseVisible(function(ue){ue.isLight&&ue.layers.test(re.layers)&&(B.pushLight(ue),ue.castShadow&&B.pushShadow(ue))}),B.setupLights();const ye=new Set;return k.traverse(function(ue){if(!(ue.isMesh||ue.isPoints||ue.isLine||ue.isSprite))return;const Je=ue.material;if(Je)if(Array.isArray(Je))for(let mt=0;mt<Je.length;mt++){const qe=Je[mt];Kr(qe,Se,ue),ye.add(qe)}else Kr(Je,Se,ue),ye.add(Je)}),B=H.pop(),ye},this.compileAsync=function(k,re,Se=null){const ye=this.compile(k,re,Se);return new Promise(ue=>{function Je(){if(ye.forEach(function(mt){O.get(mt).currentProgram.isReady()&&ye.delete(mt)}),ye.size===0){ue(k);return}setTimeout(Je,10)}ot.get("KHR_parallel_shader_compile")!==null?Je():setTimeout(Je,10)})};let Ho=null;function Jr(k){Ho&&Ho(k)}function xr(){na.stop()}function Go(){na.start()}const na=new VT;na.setAnimationLoop(Jr),typeof self<"u"&&na.setContext(self),this.setAnimationLoop=function(k){Ho=k,Ye.setAnimationLoop(k),k===null?na.stop():na.start()},Ye.addEventListener("sessionstart",xr),Ye.addEventListener("sessionend",Go),this.render=function(k,re){if(re!==void 0&&re.isCamera!==!0){Rt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;const Se=Ye.enabled===!0&&Ye.isPresenting===!0,ye=W!==null&&(te===null||Se)&&W.begin(I,te);if(k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),re.parent===null&&re.matrixWorldAutoUpdate===!0&&re.updateMatrixWorld(),Ye.enabled===!0&&Ye.isPresenting===!0&&(W===null||W.isCompositing()===!1)&&(Ye.cameraAutoUpdate===!0&&Ye.updateCamera(re),re=Ye.getCamera()),k.isScene===!0&&k.onBeforeRender(I,k,re,te),B=Ze.get(k,H.length),B.init(re),H.push(B),tn.multiplyMatrices(re.projectionMatrix,re.matrixWorldInverse),st.setFromProjectionMatrix(tn,ks,re.reversedDepth),jt=this.localClippingEnabled,ht=ct.init(this.clippingPlanes,jt),U=Ve.get(k,z.length),U.init(),z.push(U),Ye.enabled===!0&&Ye.isPresenting===!0){const mt=I.xr.getDepthSensingMesh();mt!==null&&Fa(mt,re,-1/0,I.sortObjects)}Fa(k,re,0,I.sortObjects),U.finish(),I.sortObjects===!0&&U.sort(Fe,lt),Oe=Ye.enabled===!1||Ye.isPresenting===!1||Ye.hasDepthSensing()===!1,Oe&&me.addToRenderList(U,k),this.info.render.frame++,ht===!0&&ct.beginShadows();const ue=B.state.shadowsArray;if(K.render(ue,k,re),ht===!0&&ct.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ye&&W.hasRenderPass())===!1){const mt=U.opaque,qe=U.transmissive;if(B.setupLights(),re.isArrayCamera){const _t=re.cameras;if(qe.length>0)for(let xt=0,Lt=_t.length;xt<Lt;xt++){const St=_t[xt];Ri(mt,qe,k,St)}Oe&&me.render(k);for(let xt=0,Lt=_t.length;xt<Lt;xt++){const St=_t[xt];$n(U,k,St,St.viewport)}}else qe.length>0&&Ri(mt,qe,k,re),Oe&&me.render(k),$n(U,k,re)}te!==null&&se===0&&(ae.updateMultisampleRenderTarget(te),ae.updateRenderTargetMipmap(te)),ye&&W.end(I),k.isScene===!0&&k.onAfterRender(I,k,re),at.resetDefaultState(),fe=-1,pe=null,H.pop(),H.length>0?(B=H[H.length-1],ht===!0&&ct.setGlobalState(I.clippingPlanes,B.state.camera)):B=null,z.pop(),z.length>0?U=z[z.length-1]:U=null};function Fa(k,re,Se,ye){if(k.visible===!1)return;if(k.layers.test(re.layers)){if(k.isGroup)Se=k.renderOrder;else if(k.isLOD)k.autoUpdate===!0&&k.update(re);else if(k.isLight)B.pushLight(k),k.castShadow&&B.pushShadow(k);else if(k.isSprite){if(!k.frustumCulled||st.intersectsSprite(k)){ye&&Le.setFromMatrixPosition(k.matrixWorld).applyMatrix4(tn);const mt=Ke.update(k),qe=k.material;qe.visible&&U.push(k,mt,qe,Se,Le.z,null)}}else if((k.isMesh||k.isLine||k.isPoints)&&(!k.frustumCulled||st.intersectsObject(k))){const mt=Ke.update(k),qe=k.material;if(ye&&(k.boundingSphere!==void 0?(k.boundingSphere===null&&k.computeBoundingSphere(),Le.copy(k.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),Le.copy(mt.boundingSphere.center)),Le.applyMatrix4(k.matrixWorld).applyMatrix4(tn)),Array.isArray(qe)){const _t=mt.groups;for(let xt=0,Lt=_t.length;xt<Lt;xt++){const St=_t[xt],Pt=qe[St.materialIndex];Pt&&Pt.visible&&U.push(k,mt,Pt,Se,Le.z,St)}}else qe.visible&&U.push(k,mt,qe,Se,Le.z,null)}}const Je=k.children;for(let mt=0,qe=Je.length;mt<qe;mt++)Fa(Je[mt],re,Se,ye)}function $n(k,re,Se,ye){const{opaque:ue,transmissive:Je,transparent:mt}=k;B.setupLightsView(Se),ht===!0&&ct.setGlobalState(I.clippingPlanes,Se),ye&&Qe.viewport(Y.copy(ye)),ue.length>0&&ka(ue,re,Se),Je.length>0&&ka(Je,re,Se),mt.length>0&&ka(mt,re,Se),Qe.buffers.depth.setTest(!0),Qe.buffers.depth.setMask(!0),Qe.buffers.color.setMask(!0),Qe.setPolygonOffset(!1)}function Ri(k,re,Se,ye){if((Se.isScene===!0?Se.overrideMaterial:null)!==null)return;if(B.state.transmissionRenderTarget[ye.id]===void 0){const Pt=ot.has("EXT_color_buffer_half_float")||ot.has("EXT_color_buffer_float");B.state.transmissionRenderTarget[ye.id]=new Hs(1,1,{generateMipmaps:!0,type:Pt?Bo:ts,minFilter:Io,samples:Tt.samples,stencilBuffer:u,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Sn.workingColorSpace})}const Je=B.state.transmissionRenderTarget[ye.id],mt=ye.viewport||Y;Je.setSize(mt.z*I.transmissionResolutionScale,mt.w*I.transmissionResolutionScale);const qe=I.getRenderTarget(),_t=I.getActiveCubeFace(),xt=I.getActiveMipmapLevel();I.setRenderTarget(Je),I.getClearColor(be),Ne=I.getClearAlpha(),Ne<1&&I.setClearColor(16777215,.5),I.clear(),Oe&&me.render(Se);const Lt=I.toneMapping;I.toneMapping=gr;const St=ye.viewport;if(ye.viewport!==void 0&&(ye.viewport=void 0),B.setupLightsView(ye),ht===!0&&ct.setGlobalState(I.clippingPlanes,ye),ka(k,Se,ye),ae.updateMultisampleRenderTarget(Je),ae.updateRenderTargetMipmap(Je),ot.has("WEBGL_multisampled_render_to_texture")===!1){let Pt=!1;for(let Mn=0,Bn=re.length;Mn<Bn;Mn++){const In=re[Mn],{object:Wt,geometry:ut,material:_n,group:Ft}=In;if(_n.side===Uo&&Wt.layers.test(ye.layers)){const xi=_n.side;_n.side=as,_n.needsUpdate=!0,Va(Wt,Se,ye,ut,_n,Ft),_n.side=xi,_n.needsUpdate=!0,Pt=!0}}Pt===!0&&(ae.updateMultisampleRenderTarget(Je),ae.updateRenderTargetMipmap(Je))}I.setRenderTarget(qe,_t,xt),I.setClearColor(be,Ne),St!==void 0&&(ye.viewport=St),I.toneMapping=Lt}function ka(k,re,Se){const ye=re.isScene===!0?re.overrideMaterial:null;for(let ue=0,Je=k.length;ue<Je;ue++){const mt=k[ue],{object:qe,geometry:_t,group:xt}=mt;let Lt=mt.material;Lt.allowOverride===!0&&ye!==null&&(Lt=ye),qe.layers.test(Se.layers)&&Va(qe,re,Se,_t,Lt,xt)}}function Va(k,re,Se,ye,ue,Je){k.onBeforeRender(I,re,Se,ye,ue,Je),k.modelViewMatrix.multiplyMatrices(Se.matrixWorldInverse,k.matrixWorld),k.normalMatrix.getNormalMatrix(k.modelViewMatrix),ue.onBeforeRender(I,re,Se,ye,k,Je),ue.transparent===!0&&ue.side===Uo&&ue.forceSinglePass===!1?(ue.side=as,ue.needsUpdate=!0,I.renderBufferDirect(Se,re,ye,ue,k,Je),ue.side=Ll,ue.needsUpdate=!0,I.renderBufferDirect(Se,re,ye,ue,k,Je),ue.side=Uo):I.renderBufferDirect(Se,re,ye,ue,k,Je),k.onAfterRender(I,re,Se,ye,ue,Je)}function Ha(k,re,Se){re.isScene!==!0&&(re=He);const ye=O.get(k),ue=B.state.lights,Je=B.state.shadowsArray,mt=ue.state.version,qe=vt.getParameters(k,ue.state,Je,re,Se),_t=vt.getProgramCacheKey(qe);let xt=ye.programs;ye.environment=k.isMeshStandardMaterial?re.environment:null,ye.fog=re.fog,ye.envMap=(k.isMeshStandardMaterial?Ie:Te).get(k.envMap||ye.environment),ye.envMapRotation=ye.environment!==null&&k.envMap===null?re.environmentRotation:k.envMapRotation,xt===void 0&&(k.addEventListener("dispose",Jn),xt=new Map,ye.programs=xt);let Lt=xt.get(_t);if(Lt!==void 0){if(ye.currentProgram===Lt&&ye.lightsStateVersion===mt)return Xo(k,qe),Lt}else qe.uniforms=vt.getUniforms(k),k.onBeforeCompile(qe,I),Lt=vt.acquireProgram(qe,_t),xt.set(_t,Lt),ye.uniforms=qe.uniforms;const St=ye.uniforms;return(!k.isShaderMaterial&&!k.isRawShaderMaterial||k.clipping===!0)&&(St.clippingPlanes=ct.uniform),Xo(k,qe),ye.needsLights=Sr(k),ye.lightsStateVersion=mt,ye.needsLights&&(St.ambientLightColor.value=ue.state.ambient,St.lightProbe.value=ue.state.probe,St.directionalLights.value=ue.state.directional,St.directionalLightShadows.value=ue.state.directionalShadow,St.spotLights.value=ue.state.spot,St.spotLightShadows.value=ue.state.spotShadow,St.rectAreaLights.value=ue.state.rectArea,St.ltc_1.value=ue.state.rectAreaLTC1,St.ltc_2.value=ue.state.rectAreaLTC2,St.pointLights.value=ue.state.point,St.pointLightShadows.value=ue.state.pointShadow,St.hemisphereLights.value=ue.state.hemi,St.directionalShadowMap.value=ue.state.directionalShadowMap,St.directionalShadowMatrix.value=ue.state.directionalShadowMatrix,St.spotShadowMap.value=ue.state.spotShadowMap,St.spotLightMatrix.value=ue.state.spotLightMatrix,St.spotLightMap.value=ue.state.spotLightMap,St.pointShadowMap.value=ue.state.pointShadowMap,St.pointShadowMatrix.value=ue.state.pointShadowMatrix),ye.currentProgram=Lt,ye.uniformsList=null,Lt}function $r(k){if(k.uniformsList===null){const re=k.currentProgram.getUniforms();k.uniformsList=mv.seqWithValue(re.seq,k.uniforms)}return k.uniformsList}function Xo(k,re){const Se=O.get(k);Se.outputColorSpace=re.outputColorSpace,Se.batching=re.batching,Se.batchingColor=re.batchingColor,Se.instancing=re.instancing,Se.instancingColor=re.instancingColor,Se.instancingMorph=re.instancingMorph,Se.skinning=re.skinning,Se.morphTargets=re.morphTargets,Se.morphNormals=re.morphNormals,Se.morphColors=re.morphColors,Se.morphTargetsCount=re.morphTargetsCount,Se.numClippingPlanes=re.numClippingPlanes,Se.numIntersection=re.numClipIntersection,Se.vertexAlphas=re.vertexAlphas,Se.vertexTangents=re.vertexTangents,Se.toneMapping=re.toneMapping}function Ds(k,re,Se,ye,ue){re.isScene!==!0&&(re=He),ae.resetTextureUnits();const Je=re.fog,mt=ye.isMeshStandardMaterial?re.environment:null,qe=te===null?I.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:zu,_t=(ye.isMeshStandardMaterial?Ie:Te).get(ye.envMap||mt),xt=ye.vertexColors===!0&&!!Se.attributes.color&&Se.attributes.color.itemSize===4,Lt=!!Se.attributes.tangent&&(!!ye.normalMap||ye.anisotropy>0),St=!!Se.morphAttributes.position,Pt=!!Se.morphAttributes.normal,Mn=!!Se.morphAttributes.color;let Bn=gr;ye.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Bn=I.toneMapping);const In=Se.morphAttributes.position||Se.morphAttributes.normal||Se.morphAttributes.color,Wt=In!==void 0?In.length:0,ut=O.get(ye),_n=B.state.lights;if(ht===!0&&(jt===!0||k!==pe)){const Fi=k===pe&&ye.id===fe;ct.setState(ye,k,Fi)}let Ft=!1;ye.version===ut.__version?(ut.needsLights&&ut.lightsStateVersion!==_n.state.version||ut.outputColorSpace!==qe||ue.isBatchedMesh&&ut.batching===!1||!ue.isBatchedMesh&&ut.batching===!0||ue.isBatchedMesh&&ut.batchingColor===!0&&ue.colorTexture===null||ue.isBatchedMesh&&ut.batchingColor===!1&&ue.colorTexture!==null||ue.isInstancedMesh&&ut.instancing===!1||!ue.isInstancedMesh&&ut.instancing===!0||ue.isSkinnedMesh&&ut.skinning===!1||!ue.isSkinnedMesh&&ut.skinning===!0||ue.isInstancedMesh&&ut.instancingColor===!0&&ue.instanceColor===null||ue.isInstancedMesh&&ut.instancingColor===!1&&ue.instanceColor!==null||ue.isInstancedMesh&&ut.instancingMorph===!0&&ue.morphTexture===null||ue.isInstancedMesh&&ut.instancingMorph===!1&&ue.morphTexture!==null||ut.envMap!==_t||ye.fog===!0&&ut.fog!==Je||ut.numClippingPlanes!==void 0&&(ut.numClippingPlanes!==ct.numPlanes||ut.numIntersection!==ct.numIntersection)||ut.vertexAlphas!==xt||ut.vertexTangents!==Lt||ut.morphTargets!==St||ut.morphNormals!==Pt||ut.morphColors!==Mn||ut.toneMapping!==Bn||ut.morphTargetsCount!==Wt)&&(Ft=!0):(Ft=!0,ut.__version=ye.version);let xi=ut.currentProgram;Ft===!0&&(xi=Ha(ye,re,ue));let Ls=!1,Wn=!1,la=!1;const An=xi.getUniforms(),Ni=ut.uniforms;if(Qe.useProgram(xi.program)&&(Ls=!0,Wn=!0,la=!0),ye.id!==fe&&(fe=ye.id,Wn=!0),Ls||pe!==k){Qe.buffers.depth.getReversed()&&k.reversedDepth!==!0&&(k._reversedDepth=!0,k.updateProjectionMatrix()),An.setValue(Q,"projectionMatrix",k.projectionMatrix),An.setValue(Q,"viewMatrix",k.matrixWorldInverse);const ki=An.map.cameraPosition;ki!==void 0&&ki.setValue(Q,Nt.setFromMatrixPosition(k.matrixWorld)),Tt.logarithmicDepthBuffer&&An.setValue(Q,"logDepthBufFC",2/(Math.log(k.far+1)/Math.LN2)),(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial)&&An.setValue(Q,"isOrthographic",k.isOrthographicCamera===!0),pe!==k&&(pe=k,Wn=!0,la=!0)}if(ut.needsLights&&(_n.state.directionalShadowMap.length>0&&An.setValue(Q,"directionalShadowMap",_n.state.directionalShadowMap,ae),_n.state.spotShadowMap.length>0&&An.setValue(Q,"spotShadowMap",_n.state.spotShadowMap,ae),_n.state.pointShadowMap.length>0&&An.setValue(Q,"pointShadowMap",_n.state.pointShadowMap,ae)),ue.isSkinnedMesh){An.setOptional(Q,ue,"bindMatrix"),An.setOptional(Q,ue,"bindMatrixInverse");const Fi=ue.skeleton;Fi&&(Fi.boneTexture===null&&Fi.computeBoneTexture(),An.setValue(Q,"boneTexture",Fi.boneTexture,ae))}ue.isBatchedMesh&&(An.setOptional(Q,ue,"batchingTexture"),An.setValue(Q,"batchingTexture",ue._matricesTexture,ae),An.setOptional(Q,ue,"batchingIdTexture"),An.setValue(Q,"batchingIdTexture",ue._indirectTexture,ae),An.setOptional(Q,ue,"batchingColorTexture"),ue._colorsTexture!==null&&An.setValue(Q,"batchingColorTexture",ue._colorsTexture,ae));const bi=Se.morphAttributes;if((bi.position!==void 0||bi.normal!==void 0||bi.color!==void 0)&&et.update(ue,Se,xi),(Wn||ut.receiveShadow!==ue.receiveShadow)&&(ut.receiveShadow=ue.receiveShadow,An.setValue(Q,"receiveShadow",ue.receiveShadow)),ye.isMeshGouraudMaterial&&ye.envMap!==null&&(Ni.envMap.value=_t,Ni.flipEnvMap.value=_t.isCubeTexture&&_t.isRenderTargetTexture===!1?-1:1),ye.isMeshStandardMaterial&&ye.envMap===null&&re.environment!==null&&(Ni.envMapIntensity.value=re.environmentIntensity),Ni.dfgLUT!==void 0&&(Ni.dfgLUT.value=zP()),Wn&&(An.setValue(Q,"toneMappingExposure",I.toneMappingExposure),ut.needsLights&&br(Ni,la),Je&&ye.fog===!0&&Dt.refreshFogUniforms(Ni,Je),Dt.refreshMaterialUniforms(Ni,ye,Ae,oe,B.state.transmissionRenderTarget[k.id]),mv.upload(Q,$r(ut),Ni,ae)),ye.isShaderMaterial&&ye.uniformsNeedUpdate===!0&&(mv.upload(Q,$r(ut),Ni,ae),ye.uniformsNeedUpdate=!1),ye.isSpriteMaterial&&An.setValue(Q,"center",ue.center),An.setValue(Q,"modelViewMatrix",ue.modelViewMatrix),An.setValue(Q,"normalMatrix",ue.normalMatrix),An.setValue(Q,"modelMatrix",ue.matrixWorld),ye.isShaderMaterial||ye.isRawShaderMaterial){const Fi=ye.uniformsGroups;for(let ki=0,Wo=Fi.length;ki<Wo;ki++){const rs=Fi[ki];Xe.update(rs,xi),Xe.bind(rs,xi)}}return xi}function br(k,re){k.ambientLightColor.needsUpdate=re,k.lightProbe.needsUpdate=re,k.directionalLights.needsUpdate=re,k.directionalLightShadows.needsUpdate=re,k.pointLights.needsUpdate=re,k.pointLightShadows.needsUpdate=re,k.spotLights.needsUpdate=re,k.spotLightShadows.needsUpdate=re,k.rectAreaLights.needsUpdate=re,k.hemisphereLights.needsUpdate=re}function Sr(k){return k.isMeshLambertMaterial||k.isMeshToonMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isShadowMaterial||k.isShaderMaterial&&k.lights===!0}this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return se},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(k,re,Se){const ye=O.get(k);ye.__autoAllocateDepthBuffer=k.resolveDepthBuffer===!1,ye.__autoAllocateDepthBuffer===!1&&(ye.__useRenderToTexture=!1),O.get(k.texture).__webglTexture=re,O.get(k.depthTexture).__webglTexture=ye.__autoAllocateDepthBuffer?void 0:Se,ye.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(k,re){const Se=O.get(k);Se.__webglFramebuffer=re,Se.__useDefaultFramebuffer=re===void 0};const Mr=Q.createFramebuffer();this.setRenderTarget=function(k,re=0,Se=0){te=k,Z=re,se=Se;let ye=null,ue=!1,Je=!1;if(k){const qe=O.get(k);if(qe.__useDefaultFramebuffer!==void 0){Qe.bindFramebuffer(Q.FRAMEBUFFER,qe.__webglFramebuffer),Y.copy(k.viewport),q.copy(k.scissor),ne=k.scissorTest,Qe.viewport(Y),Qe.scissor(q),Qe.setScissorTest(ne),fe=-1;return}else if(qe.__webglFramebuffer===void 0)ae.setupRenderTarget(k);else if(qe.__hasExternalTextures)ae.rebindTextures(k,O.get(k.texture).__webglTexture,O.get(k.depthTexture).__webglTexture);else if(k.depthBuffer){const Lt=k.depthTexture;if(qe.__boundDepthTexture!==Lt){if(Lt!==null&&O.has(Lt)&&(k.width!==Lt.image.width||k.height!==Lt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ae.setupDepthRenderbuffer(k)}}const _t=k.texture;(_t.isData3DTexture||_t.isDataArrayTexture||_t.isCompressedArrayTexture)&&(Je=!0);const xt=O.get(k).__webglFramebuffer;k.isWebGLCubeRenderTarget?(Array.isArray(xt[re])?ye=xt[re][Se]:ye=xt[re],ue=!0):k.samples>0&&ae.useMultisampledRTT(k)===!1?ye=O.get(k).__webglMultisampledFramebuffer:Array.isArray(xt)?ye=xt[Se]:ye=xt,Y.copy(k.viewport),q.copy(k.scissor),ne=k.scissorTest}else Y.copy(de).multiplyScalar(Ae).floor(),q.copy(Re).multiplyScalar(Ae).floor(),ne=tt;if(Se!==0&&(ye=Mr),Qe.bindFramebuffer(Q.FRAMEBUFFER,ye)&&Qe.drawBuffers(k,ye),Qe.viewport(Y),Qe.scissor(q),Qe.setScissorTest(ne),ue){const qe=O.get(k.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+re,qe.__webglTexture,Se)}else if(Je){const qe=re;for(let _t=0;_t<k.textures.length;_t++){const xt=O.get(k.textures[_t]);Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0+_t,xt.__webglTexture,Se,qe)}}else if(k!==null&&Se!==0){const qe=O.get(k.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,qe.__webglTexture,Se)}fe=-1},this.readRenderTargetPixels=function(k,re,Se,ye,ue,Je,mt,qe=0){if(!(k&&k.isWebGLRenderTarget)){Rt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _t=O.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&mt!==void 0&&(_t=_t[mt]),_t){Qe.bindFramebuffer(Q.FRAMEBUFFER,_t);try{const xt=k.textures[qe],Lt=xt.format,St=xt.type;if(!Tt.textureFormatReadable(Lt)){Rt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Tt.textureTypeReadable(St)){Rt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}re>=0&&re<=k.width-ye&&Se>=0&&Se<=k.height-ue&&(k.textures.length>1&&Q.readBuffer(Q.COLOR_ATTACHMENT0+qe),Q.readPixels(re,Se,ye,ue,Ge.convert(Lt),Ge.convert(St),Je))}finally{const xt=te!==null?O.get(te).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,xt)}}},this.readRenderTargetPixelsAsync=async function(k,re,Se,ye,ue,Je,mt,qe=0){if(!(k&&k.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _t=O.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&mt!==void 0&&(_t=_t[mt]),_t)if(re>=0&&re<=k.width-ye&&Se>=0&&Se<=k.height-ue){Qe.bindFramebuffer(Q.FRAMEBUFFER,_t);const xt=k.textures[qe],Lt=xt.format,St=xt.type;if(!Tt.textureFormatReadable(Lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Tt.textureTypeReadable(St))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Pt=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.bufferData(Q.PIXEL_PACK_BUFFER,Je.byteLength,Q.STREAM_READ),k.textures.length>1&&Q.readBuffer(Q.COLOR_ATTACHMENT0+qe),Q.readPixels(re,Se,ye,ue,Ge.convert(Lt),Ge.convert(St),0);const Mn=te!==null?O.get(te).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Mn);const Bn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await q3(Q,Bn,4),Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.getBufferSubData(Q.PIXEL_PACK_BUFFER,0,Je),Q.deleteBuffer(Pt),Q.deleteSync(Bn),Je}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(k,re=null,Se=0){const ye=Math.pow(2,-Se),ue=Math.floor(k.image.width*ye),Je=Math.floor(k.image.height*ye),mt=re!==null?re.x:0,qe=re!==null?re.y:0;ae.setTexture2D(k,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Se,0,0,mt,qe,ue,Je),Qe.unbindTexture()};const eo=Q.createFramebuffer(),Xs=Q.createFramebuffer();this.copyTextureToTexture=function(k,re,Se=null,ye=null,ue=0,Je=null){Je===null&&(ue!==0?(Zh("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Je=ue,ue=0):Je=0);let mt,qe,_t,xt,Lt,St,Pt,Mn,Bn;const In=k.isCompressedTexture?k.mipmaps[Je]:k.image;if(Se!==null)mt=Se.max.x-Se.min.x,qe=Se.max.y-Se.min.y,_t=Se.isBox3?Se.max.z-Se.min.z:1,xt=Se.min.x,Lt=Se.min.y,St=Se.isBox3?Se.min.z:0;else{const bi=Math.pow(2,-ue);mt=Math.floor(In.width*bi),qe=Math.floor(In.height*bi),k.isDataArrayTexture?_t=In.depth:k.isData3DTexture?_t=Math.floor(In.depth*bi):_t=1,xt=0,Lt=0,St=0}ye!==null?(Pt=ye.x,Mn=ye.y,Bn=ye.z):(Pt=0,Mn=0,Bn=0);const Wt=Ge.convert(re.format),ut=Ge.convert(re.type);let _n;re.isData3DTexture?(ae.setTexture3D(re,0),_n=Q.TEXTURE_3D):re.isDataArrayTexture||re.isCompressedArrayTexture?(ae.setTexture2DArray(re,0),_n=Q.TEXTURE_2D_ARRAY):(ae.setTexture2D(re,0),_n=Q.TEXTURE_2D),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,re.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,re.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,re.unpackAlignment);const Ft=Q.getParameter(Q.UNPACK_ROW_LENGTH),xi=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Ls=Q.getParameter(Q.UNPACK_SKIP_PIXELS),Wn=Q.getParameter(Q.UNPACK_SKIP_ROWS),la=Q.getParameter(Q.UNPACK_SKIP_IMAGES);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,In.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,In.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,xt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Lt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,St);const An=k.isDataArrayTexture||k.isData3DTexture,Ni=re.isDataArrayTexture||re.isData3DTexture;if(k.isDepthTexture){const bi=O.get(k),Fi=O.get(re),ki=O.get(bi.__renderTarget),Wo=O.get(Fi.__renderTarget);Qe.bindFramebuffer(Q.READ_FRAMEBUFFER,ki.__webglFramebuffer),Qe.bindFramebuffer(Q.DRAW_FRAMEBUFFER,Wo.__webglFramebuffer);for(let rs=0;rs<_t;rs++)An&&(Q.framebufferTextureLayer(Q.READ_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,O.get(k).__webglTexture,ue,St+rs),Q.framebufferTextureLayer(Q.DRAW_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,O.get(re).__webglTexture,Je,Bn+rs)),Q.blitFramebuffer(xt,Lt,mt,qe,Pt,Mn,mt,qe,Q.DEPTH_BUFFER_BIT,Q.NEAREST);Qe.bindFramebuffer(Q.READ_FRAMEBUFFER,null),Qe.bindFramebuffer(Q.DRAW_FRAMEBUFFER,null)}else if(ue!==0||k.isRenderTargetTexture||O.has(k)){const bi=O.get(k),Fi=O.get(re);Qe.bindFramebuffer(Q.READ_FRAMEBUFFER,eo),Qe.bindFramebuffer(Q.DRAW_FRAMEBUFFER,Xs);for(let ki=0;ki<_t;ki++)An?Q.framebufferTextureLayer(Q.READ_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,bi.__webglTexture,ue,St+ki):Q.framebufferTexture2D(Q.READ_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,bi.__webglTexture,ue),Ni?Q.framebufferTextureLayer(Q.DRAW_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Fi.__webglTexture,Je,Bn+ki):Q.framebufferTexture2D(Q.DRAW_FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,Fi.__webglTexture,Je),ue!==0?Q.blitFramebuffer(xt,Lt,mt,qe,Pt,Mn,mt,qe,Q.COLOR_BUFFER_BIT,Q.NEAREST):Ni?Q.copyTexSubImage3D(_n,Je,Pt,Mn,Bn+ki,xt,Lt,mt,qe):Q.copyTexSubImage2D(_n,Je,Pt,Mn,xt,Lt,mt,qe);Qe.bindFramebuffer(Q.READ_FRAMEBUFFER,null),Qe.bindFramebuffer(Q.DRAW_FRAMEBUFFER,null)}else Ni?k.isDataTexture||k.isData3DTexture?Q.texSubImage3D(_n,Je,Pt,Mn,Bn,mt,qe,_t,Wt,ut,In.data):re.isCompressedArrayTexture?Q.compressedTexSubImage3D(_n,Je,Pt,Mn,Bn,mt,qe,_t,Wt,In.data):Q.texSubImage3D(_n,Je,Pt,Mn,Bn,mt,qe,_t,Wt,ut,In):k.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,Je,Pt,Mn,mt,qe,Wt,ut,In.data):k.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,Je,Pt,Mn,In.width,In.height,Wt,In.data):Q.texSubImage2D(Q.TEXTURE_2D,Je,Pt,Mn,mt,qe,Wt,ut,In);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Ft),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,xi),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Ls),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Wn),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,la),Je===0&&re.generateMipmaps&&Q.generateMipmap(_n),Qe.unbindTexture()},this.initRenderTarget=function(k){O.get(k).__webglFramebuffer===void 0&&ae.setupRenderTarget(k)},this.initTexture=function(k){k.isCubeTexture?ae.setTextureCube(k,0):k.isData3DTexture?ae.setTexture3D(k,0):k.isDataArrayTexture||k.isCompressedArrayTexture?ae.setTexture2DArray(k,0):ae.setTexture2D(k,0),Qe.unbindTexture()},this.resetState=function(){Z=0,se=0,te=null,Qe.reset(),at.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ks}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Sn._getDrawingBufferColorSpace(e),t.unpackColorSpace=Sn._getUnpackColorSpace()}}const BP=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:gy,AddEquation:Du,AddOperation:TE,AdditiveAnimationBlendMode:Ab,AdditiveBlending:Hx,AgXToneMapping:vb,AlphaFormat:Eb,AlwaysCompare:zE,AlwaysDepth:xv,AlwaysStencilFunc:qx,AmbientLight:NT,AnimationAction:BT,AnimationClip:Sm,AnimationLoader:PN,AnimationMixer:fD,AnimationObjectGroup:uD,AnimationUtils:LN,ArcCurve:iT,ArrayCamera:OT,ArrowHelper:PD,AttachedBindMode:Wx,Audio:PT,AudioAnalyser:$N,AudioContext:$b,AudioListener:QN,AudioLoader:jN,AxesHelper:zD,BackSide:as,BasicDepthPacking:NE,BasicShadowMap:sE,BatchedMesh:KE,Bone:Ib,BooleanKeyframeTrack:uf,Box2:xD,Box3:za,Box3Helper:ID,BoxGeometry:lf,BoxHelper:UD,BufferAttribute:Xn,BufferGeometry:Kt,BufferGeometryLoader:IT,ByteType:xb,Cache:Oo,Camera:Ry,CameraHelper:LD,CanvasTexture:tN,CapsuleGeometry:Py,CatmullRomCurve3:aT,CineonToneMapping:mb,CircleGeometry:zy,ClampToEdgeWrapping:Rs,Clock:eS,Color:yt,ColorKeyframeTrack:Zb,ColorManagement:Sn,CompressedArrayTexture:$R,CompressedCubeTexture:eN,CompressedTexture:Oy,CompressedTextureLoader:zN,ConeGeometry:Nm,ConstantAlphaFactor:SE,ConstantColorFactor:xE,Controls:FD,CubeCamera:WE,CubeDepthTexture:tT,CubeReflectionMapping:zo,CubeRefractionMapping:Pu,CubeTexture:Cm,CubeTextureLoader:BN,CubeUVReflectionMapping:id,CubicBezierCurve:Bb,CubicBezierCurve3:sT,CubicInterpolant:ST,CullFaceBack:Vx,CullFaceFront:aE,CullFaceFrontBack:n3,CullFaceNone:iE,Curve:Zr,CurvePath:oT,CustomBlending:rE,CustomToneMapping:gb,CylinderGeometry:Rm,Cylindrical:_D,Data3DTexture:Cy,DataArrayTexture:wy,DataTexture:Yr,DataTextureLoader:FN,DataUtils:ER,DecrementStencilOp:x3,DecrementWrapStencilOp:S3,DefaultLoadingManager:TT,DepthFormat:Fo,DepthStencilFormat:Uu,DepthTexture:ed,DetachedBindMode:AE,DirectionalLight:RT,DirectionalLightHelper:DD,DiscreteInterpolant:MT,DodecahedronGeometry:By,DoubleSide:Uo,DstAlphaFactor:mE,DstColorFactor:vE,DynamicCopyUsage:z3,DynamicDrawUsage:D3,DynamicReadUsage:I3,EdgesGeometry:nT,EllipseCurve:Fy,EqualCompare:IE,EqualDepth:Sv,EqualStencilFunc:A3,EquirectangularReflectionMapping:om,EquirectangularRefractionMapping:lm,Euler:Gs,EventDispatcher:ko,ExternalTexture:Pb,ExtrudeGeometry:ky,FileLoader:Ul,Float16BufferAttribute:DR,Float32BufferAttribute:bt,FloatType:is,Fog:Dy,FogExp2:Ny,FramebufferTexture:JR,FrontSide:Ll,Frustum:ad,FrustumArray:Iy,GLBufferAttribute:gD,GLSL1:F3,GLSL3:jx,GreaterCompare:OE,GreaterDepth:Ev,GreaterEqualCompare:Ay,GreaterEqualDepth:Mv,GreaterEqualStencilFunc:N3,GreaterStencilFunc:C3,GridHelper:RD,Group:Gh,HalfFloatType:Bo,HemisphereLight:AT,HemisphereLightHelper:CD,IcosahedronGeometry:Vy,ImageBitmapLoader:qN,ImageLoader:Mm,ImageUtils:VE,IncrementStencilOp:_3,IncrementWrapStencilOp:b3,InstancedBufferAttribute:$h,InstancedBufferGeometry:UT,InstancedInterleavedBuffer:mD,InstancedMesh:QE,Int16BufferAttribute:RR,Int32BufferAttribute:NR,Int8BufferAttribute:AR,IntType:yy,InterleavedBuffer:Ly,InterleavedBufferAttribute:nf,Interpolant:Um,InterpolateDiscrete:fm,InterpolateLinear:ay,InterpolateSmooth:dv,InterpolationSamplingMode:H3,InterpolationSamplingType:V3,InvertStencilOp:M3,KeepStencilOp:Wc,KeyframeTrack:_r,LOD:YE,LatheGeometry:Hy,Layers:Kh,LessCompare:UE,LessDepth:bv,LessEqualCompare:Ty,LessEqualDepth:ef,LessEqualStencilFunc:w3,LessStencilFunc:T3,Light:Gu,LightProbe:LT,Line:Fu,Line3:MD,LineBasicMaterial:ss,LineCurve:Fb,LineCurve3:rT,LineDashedMaterial:xT,LineLoop:JE,LineSegments:Vo,LinearFilter:oi,LinearInterpolant:Yb,LinearMipMapLinearFilter:r3,LinearMipMapNearestFilter:s3,LinearMipmapLinearFilter:Io,LinearMipmapNearestFilter:Jp,LinearSRGBColorSpace:zu,LinearToneMapping:db,LinearTransfer:dm,Loader:Ns,LoaderUtils:Jx,LoadingManager:Qb,LoopOnce:wE,LoopPingPong:RE,LoopRepeat:CE,MOUSE:Gc,Material:Ba,MaterialLoader:Zy,MathUtils:uR,Matrix2:aS,Matrix3:en,Matrix4:Xt,MaxEquation:cE,Mesh:Yi,MeshBasicMaterial:Vu,MeshDepthMaterial:Wb,MeshDistanceMaterial:qb,MeshLambertMaterial:yT,MeshMatcapMaterial:_T,MeshNormalMaterial:vT,MeshPhongMaterial:mT,MeshPhysicalMaterial:pT,MeshStandardMaterial:Xb,MeshToonMaterial:gT,MinEquation:uE,MirroredRepeatWrapping:cm,MixOperation:EE,MultiplyBlending:Xx,MultiplyOperation:Am,NearestFilter:Bi,NearestMipMapLinearFilter:a3,NearestMipMapNearestFilter:i3,NearestMipmapLinearFilter:Vh,NearestMipmapNearestFilter:_b,NeutralToneMapping:yb,NeverCompare:LE,NeverDepth:_v,NeverStencilFunc:E3,NoBlending:Po,NoColorSpace:Cl,NoNormalPacking:p3,NoToneMapping:gr,NormalAnimationBlendMode:Ey,NormalBlending:Kc,NormalGAPacking:g3,NormalRGPacking:m3,NotEqualCompare:PE,NotEqualDepth:Tv,NotEqualStencilFunc:R3,NumberKeyframeTrack:xm,Object3D:Cn,ObjectLoader:XN,ObjectSpaceNormalMap:DE,OctahedronGeometry:Dm,OneFactor:hE,OneMinusConstantAlphaFactor:ME,OneMinusConstantColorFactor:bE,OneMinusDstAlphaFactor:gE,OneMinusDstColorFactor:yE,OneMinusSrcAlphaFactor:yv,OneMinusSrcColorFactor:pE,OrthographicCamera:Dl,PCFShadowMap:Xh,PCFSoftShadowMap:Kp,PMREMGenerator:nb,Path:ly,PerspectiveCamera:zi,Plane:wl,PlaneGeometry:sd,PlaneHelper:OD,PointLight:CT,PointLightHelper:AD,Points:$E,PointsMaterial:Ob,PolarGridHelper:ND,PolyhedronGeometry:Hu,PositionalAudio:JN,PropertyBinding:wn,PropertyMixer:zT,QuadraticBezierCurve:kb,QuadraticBezierCurve3:Vb,Quaternion:Pa,QuaternionKeyframeTrack:Im,QuaternionLinearInterpolant:ET,R11_EAC_Format:Uv,RED_GREEN_RGTC2_Format:ny,RED_RGTC1_Format:ey,REVISION:my,RG11_EAC_Format:Ov,RGBADepthPacking:f3,RGBAFormat:Oa,RGBAIntegerFormat:My,RGBA_ASTC_10x10_Format:Yv,RGBA_ASTC_10x5_Format:Wv,RGBA_ASTC_10x6_Format:qv,RGBA_ASTC_10x8_Format:jv,RGBA_ASTC_12x10_Format:Zv,RGBA_ASTC_12x12_Format:Qv,RGBA_ASTC_4x4_Format:zv,RGBA_ASTC_5x4_Format:Bv,RGBA_ASTC_5x5_Format:Fv,RGBA_ASTC_6x5_Format:kv,RGBA_ASTC_6x6_Format:Vv,RGBA_ASTC_8x5_Format:Hv,RGBA_ASTC_8x6_Format:Gv,RGBA_ASTC_8x8_Format:Xv,RGBA_BPTC_Format:Kv,RGBA_ETC2_EAC_Format:Lv,RGBA_PVRTC_2BPPV1_Format:Rv,RGBA_PVRTC_4BPPV1_Format:Cv,RGBA_S3TC_DXT1_Format:em,RGBA_S3TC_DXT3_Format:tm,RGBA_S3TC_DXT5_Format:nm,RGBDepthPacking:h3,RGBFormat:Tb,RGBIntegerFormat:o3,RGB_BPTC_SIGNED_Format:Jv,RGB_BPTC_UNSIGNED_Format:$v,RGB_ETC1_Format:Nv,RGB_ETC2_Format:Dv,RGB_PVRTC_2BPPV1_Format:wv,RGB_PVRTC_4BPPV1_Format:Av,RGB_S3TC_DXT1_Format:$p,RGDepthPacking:d3,RGFormat:tf,RGIntegerFormat:Sy,RawShaderMaterial:Gb,Ray:of,Raycaster:FT,RectAreaLight:DT,RedFormat:by,RedIntegerFormat:wm,ReinhardToneMapping:pb,RenderTarget:Cb,RenderTarget3D:hD,RepeatWrapping:um,ReplaceStencilOp:y3,ReverseSubtractEquation:lE,RingGeometry:Gy,SIGNED_R11_EAC_Format:Iv,SIGNED_RED_GREEN_RGTC2_Format:iy,SIGNED_RED_RGTC1_Format:ty,SIGNED_RG11_EAC_Format:Pv,SRGBColorSpace:Ia,SRGBTransfer:zn,Scene:Lb,ShaderChunk:un,ShaderLib:qr,ShaderMaterial:yr,ShadowMaterial:dT,Shape:$c,ShapeGeometry:Xy,ShapePath:BD,ShapeUtils:jr,ShortType:bb,Skeleton:Uy,SkeletonHelper:TD,SkinnedMesh:ZE,Source:Iu,Sphere:_a,SphereGeometry:Lm,Spherical:eb,SphericalHarmonics3:Jb,SplineCurve:Hb,SpotLight:wT,SpotLightHelper:ED,Sprite:jE,SpriteMaterial:Ub,SrcAlphaFactor:vv,SrcAlphaSaturateFactor:_E,SrcColorFactor:dE,StaticCopyUsage:P3,StaticDrawUsage:pm,StaticReadUsage:U3,StereoCamera:YN,StreamCopyUsage:B3,StreamDrawUsage:L3,StreamReadUsage:O3,StringKeyframeTrack:cf,SubtractEquation:oE,SubtractiveBlending:Gx,TOUCH:Xc,TangentSpaceNormalMap:ku,TetrahedronGeometry:Wy,Texture:wi,TextureLoader:kN,TextureUtils:XD,Timer:vD,TimestampQuery:k3,TorusGeometry:qy,TorusKnotGeometry:jy,Triangle:Cs,TriangleFanDrawMode:c3,TriangleStripDrawMode:u3,TrianglesDrawMode:l3,TubeGeometry:Yy,UVMapping:vy,Uint16BufferAttribute:Rb,Uint32BufferAttribute:Nb,Uint8BufferAttribute:wR,Uint8ClampedBufferAttribute:CR,Uniform:iS,UniformsGroup:pD,UniformsLib:pt,UniformsUtils:XE,UnsignedByteType:ts,UnsignedInt101111Type:Mb,UnsignedInt248Type:jh,UnsignedInt5999Type:Sb,UnsignedIntType:vr,UnsignedShort4444Type:_y,UnsignedShort5551Type:xy,UnsignedShortType:qh,VSMShadowMap:jc,Vector2:ze,Vector3:j,Vector4:jn,VectorKeyframeTrack:bm,VideoFrameTexture:KR,VideoTexture:eT,WebGL3DRenderTarget:pR,WebGLArrayRenderTarget:dR,WebGLCoordinateSystem:ks,WebGLCubeRenderTarget:Db,WebGLRenderTarget:Hs,WebGLRenderer:jT,WebGLUtils:qT,WebGPUCoordinateSystem:Yh,WebXRController:pv,WireframeGeometry:hT,WrapAroundEnding:hm,ZeroCurvatureEnding:Yc,ZeroFactor:fE,ZeroSlopeEnding:Zc,ZeroStencilOp:v3,createCanvasElement:kE,error:Rt,getConsoleFunction:W3,log:gm,setConsoleFunction:X3,warn:ft,warnOnce:Zh},Symbol.toStringTag,{value:"Module"}));var Rx={exports:{}},Nx={},Dx={exports:{}},Lx={};var L1;function FP(){if(L1)return Lx;L1=1;var r=Tm();function e(x,b){return x===b&&(x!==0||1/x===1/b)||x!==x&&b!==b}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,s=r.useEffect,u=r.useLayoutEffect,f=r.useDebugValue;function h(x,b){var M=b(),A=n({inst:{value:M,getSnapshot:b}}),R=A[0].inst,w=A[1];return u(function(){R.value=M,R.getSnapshot=b,m(R)&&w({inst:R})},[x,M,b]),s(function(){return m(R)&&w({inst:R}),x(function(){m(R)&&w({inst:R})})},[x]),f(M),M}function m(x){var b=x.getSnapshot;x=x.value;try{var M=b();return!t(x,M)}catch{return!0}}function g(x,b){return b()}var _=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:h;return Lx.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:_,Lx}var U1;function kP(){return U1||(U1=1,Dx.exports=FP()),Dx.exports}var I1;function VP(){if(I1)return Nx;I1=1;var r=Tm(),e=kP();function t(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}var n=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,u=r.useRef,f=r.useEffect,h=r.useMemo,m=r.useDebugValue;return Nx.useSyncExternalStoreWithSelector=function(g,_,x,b,M){var A=u(null);if(A.current===null){var R={hasValue:!1,value:null};A.current=R}else R=A.current;A=h(function(){function E(z){if(!N){if(N=!0,D=z,z=b(z),M!==void 0&&R.hasValue){var H=R.value;if(M(H,z))return U=H}return U=z}if(H=U,n(D,z))return H;var W=b(z);return M!==void 0&&M(H,W)?(D=z,H):(D=z,U=W)}var N=!1,D,U,B=x===void 0?null:x;return[function(){return E(_())},B===null?void 0:function(){return E(B())}]},[_,x,b,M]);var w=s(g,A[0],A[1]);return f(function(){R.hasValue=!0,R.value=w},[w]),m(w),w},Nx}var O1;function HP(){return O1||(O1=1,Rx.exports=VP()),Rx.exports}var GP=HP();const XP=py(GP),P1=r=>{let e;const t=new Set,n=(g,_)=>{const x=typeof g=="function"?g(e):g;if(!Object.is(x,e)){const b=e;e=_??(typeof x!="object"||x===null)?x:Object.assign({},e,x),t.forEach(M=>M(e,b))}},s=()=>e,h={setState:n,getState:s,getInitialState:()=>m,subscribe:g=>(t.add(g),()=>t.delete(g))},m=e=r(n,s,h);return h},WP=(r=>r?P1(r):P1),{useSyncExternalStoreWithSelector:qP}=XP,jP=r=>r;function YP(r,e=jP,t){const n=qP(r.subscribe,r.getState,r.getInitialState,e,t);return hb.useDebugValue(n),n}const z1=(r,e)=>{const t=WP(r),n=(s,u=e)=>YP(t,s,u);return Object.assign(n,t),n},ZP=((r,e)=>r?z1(r,e):z1);var sb=nE();const QP=py(sb);function sS(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=e?r.return:r.child;for(;n;){const s=sS(n,e,t);if(s)return s;n=e?null:n.sibling}}function YT(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const rS=YT(rt.createContext(null));class ZT extends rt.Component{render(){return rt.createElement(rS.Provider,{value:this._reactInternals},this.props.children)}}function QT(){const r=rt.useContext(rS);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=rt.useId();return rt.useMemo(()=>{for(const t of[r,r?.alternate]){if(!t)continue;const n=sS(t,!1,s=>{let u=s.memoizedState;for(;u;){if(u.memoizedState===e)return!0;u=u.next}});if(n)return n}},[r,e])}const KP=Symbol.for("react.context"),JP=r=>r!==null&&typeof r=="object"&&"$$typeof"in r&&r.$$typeof===KP;function $P(){const r=QT(),[e]=rt.useState(()=>new Map);e.clear();let t=r;for(;t;){const n=t.type;JP(n)&&n!==rS&&!e.has(n)&&e.set(n,rt.use(YT(n))),t=t.return}return e}function ez(){const r=$P();return rt.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>rt.createElement(e,null,rt.createElement(t.Provider,{...n,value:r.get(t)})),e=>rt.createElement(ZT,{...e})),[r])}function KT(r){let e=r.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const JT=r=>r&&r.isOrthographicCamera,tz=r=>r&&r.hasOwnProperty("current"),nz=r=>r!=null&&(typeof r=="string"||typeof r=="number"||r.isColor),Om=((r,e)=>typeof window<"u"&&(((r=window.document)==null?void 0:r.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?rt.useLayoutEffect:rt.useEffect;function $T(r){const e=rt.useRef(r);return Om(()=>{e.current=r},[r]),e}function iz(){const r=QT(),e=ez();return rt.useMemo(()=>({children:t})=>{const s=!!sS(r,!0,u=>u.type===rt.StrictMode)?rt.StrictMode:rt.Fragment;return he.jsx(s,{children:he.jsx(e,{children:t})})},[r,e])}function az({set:r}){return Om(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}const sz=(r=>(r=class extends rt.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},r.getDerivedStateFromError=()=>({error:!0}),r))();function eA(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}function Bh(r){var e;return(e=r.__r3f)==null?void 0:e.root.getState()}const yi={obj:r=>r===Object(r)&&!yi.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,nul:r=>r===null,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:s=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(yi.str(r)||yi.num(r)||yi.boo(r))return r===e;const u=yi.obj(r);if(u&&n==="reference")return r===e;const f=yi.arr(r);if(f&&t==="reference")return r===e;if((f||u)&&r===e)return!0;let h;for(h in r)if(!(h in e))return!1;if(u&&t==="shallow"&&n==="shallow"){for(h in s?e:r)if(!yi.equ(r[h],e[h],{strict:s,objects:"reference"}))return!1}else for(h in s?e:r)if(r[h]!==e[h])return!1;if(yi.und(h)){if(f&&r.length===0&&e.length===0||u&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function rz(r){r.type!=="Scene"&&(r.dispose==null||r.dispose());for(const e in r){const t=r[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const tA=["children","key","ref"];function oz(r){const e={};for(const t in r)tA.includes(t)||(e[t]=r[t]);return e}function uy(r,e,t,n){const s=r;let u=s?.__r3f;return u||(u={root:e,type:t,parent:null,children:[],props:oz(n),object:s,eventCount:0,handlers:{},isHidden:!1},s&&(s.__r3f=u)),u}function Em(r,e){if(!e.includes("-"))return{root:r,key:e,target:r[e]};if(e in r)return{root:r,key:e,target:r[e]};let t=r;const n=e.split("-");for(const s of n){if(typeof t!="object"||t===null){if(t!==void 0){const u=n.slice(n.indexOf(s)).join("-");return{root:t,key:u,target:void 0}}return{root:r,key:e,target:void 0}}e=s,r=t,t=t[e]}return{root:r,key:e,target:t}}const B1=/-\d+$/;function cy(r,e){if(yi.str(e.props.attach)){if(B1.test(e.props.attach)){const s=e.props.attach.replace(B1,""),{root:u,key:f}=Em(r.object,s);Array.isArray(u[f])||(u[f]=[])}const{root:t,key:n}=Em(r.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else yi.fun(e.props.attach)&&(e.previousAttach=e.props.attach(r.object,e.object))}function fy(r,e){if(yi.str(e.props.attach)){const{root:t,key:n}=Em(r.object,e.props.attach),s=e.previousAttach;s===void 0?delete t[n]:t[n]=s}else e.previousAttach==null||e.previousAttach(r.object,e.object);delete e.previousAttach}const rb=[...tA,"args","dispose","attach","object","onUpdate","dispose"],F1=new Map;function lz(r){let e=F1.get(r.constructor);try{e||(e=new r.constructor,F1.set(r.constructor,e))}catch{}return e}function uz(r,e){const t={};for(const n in e)if(!rb.includes(n)&&!yi.equ(e[n],r.props[n])){t[n]=e[n];for(const s in e)s.startsWith(`${n}-`)&&(t[s]=e[s])}for(const n in r.props){if(rb.includes(n)||e.hasOwnProperty(n))continue;const{root:s,key:u}=Em(r.object,n);if(s.constructor&&s.constructor.length===0){const f=lz(s);yi.und(f)||(t[u]=f[u])}else t[u]=0}return t}const cz=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],fz=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Lu(r,e){var t;const n=r.__r3f,s=n&&KT(n).getState(),u=n?.eventCount;for(const h in e){let m=e[h];if(rb.includes(h))continue;if(n&&fz.test(h)){typeof m=="function"?n.handlers[h]=m:delete n.handlers[h],n.eventCount=Object.keys(n.handlers).length;continue}if(m===void 0)continue;let{root:g,key:_,target:x}=Em(r,h);if(x===void 0&&(typeof g!="object"||g===null))throw Error(`R3F: Cannot set "${h}". Ensure it is an object before setting "${_}".`);if(x instanceof Kh&&m instanceof Kh)x.mask=m.mask;else if(x instanceof yt&&nz(m))x.set(m);else if(x!==null&&typeof x=="object"&&typeof x.set=="function"&&typeof x.copy=="function"&&m!=null&&m.constructor&&x.constructor===m.constructor)x.copy(m);else if(x!==null&&typeof x=="object"&&typeof x.set=="function"&&Array.isArray(m))typeof x.fromArray=="function"?x.fromArray(m):x.set(...m);else if(x!==null&&typeof x=="object"&&typeof x.set=="function"&&typeof m=="number")typeof x.setScalar=="function"?x.setScalar(m):x.set(m);else{var f;g[_]=m,s&&!s.linear&&cz.includes(_)&&(f=g[_])!=null&&f.isTexture&&g[_].format===Oa&&g[_].type===ts&&(g[_].colorSpace=Ia)}}if(n!=null&&n.parent&&s!=null&&s.internal&&(t=n.object)!=null&&t.isObject3D&&u!==n.eventCount){const h=n.object,m=s.internal.interaction.indexOf(h);m>-1&&s.internal.interaction.splice(m,1),n.eventCount&&h.raycast!==null&&s.internal.interaction.push(h)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&od(n),r}function od(r){var e;if(!r.parent)return;r.props.onUpdate==null||r.props.onUpdate(r.object);const t=(e=r.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function hz(r,e){r.manual||(JT(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix())}const ws=r=>r?.isObject3D;function uv(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function nA(r,e,t,n){const s=t.get(e);s&&(t.delete(e),t.size===0&&(r.delete(n),s.target.releasePointerCapture(n)))}function dz(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,s)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(s)}),t.capturedMap.forEach((n,s)=>{nA(t.capturedMap,e,n,s)})}function pz(r){function e(m){const{internal:g}=r.getState(),_=m.offsetX-g.initialClick[0],x=m.offsetY-g.initialClick[1];return Math.round(Math.sqrt(_*_+x*x))}function t(m){return m.filter(g=>["Move","Over","Enter","Out","Leave"].some(_=>{var x;return(x=g.__r3f)==null?void 0:x.handlers["onPointer"+_]}))}function n(m,g){const _=r.getState(),x=new Set,b=[],M=g?g(_.internal.interaction):_.internal.interaction;for(let E=0;E<M.length;E++){const N=Bh(M[E]);N&&(N.raycaster.camera=void 0)}_.previousRoot||_.events.compute==null||_.events.compute(m,_);function A(E){const N=Bh(E);if(!N||!N.events.enabled||N.raycaster.camera===null)return[];if(N.raycaster.camera===void 0){var D;N.events.compute==null||N.events.compute(m,N,(D=N.previousRoot)==null?void 0:D.getState()),N.raycaster.camera===void 0&&(N.raycaster.camera=null)}return N.raycaster.camera?N.raycaster.intersectObject(E,!0):[]}let R=M.flatMap(A).sort((E,N)=>{const D=Bh(E.object),U=Bh(N.object);return!D||!U?E.distance-N.distance:U.events.priority-D.events.priority||E.distance-N.distance}).filter(E=>{const N=uv(E);return x.has(N)?!1:(x.add(N),!0)});_.events.filter&&(R=_.events.filter(R,_));for(const E of R){let N=E.object;for(;N;){var w;(w=N.__r3f)!=null&&w.eventCount&&b.push({...E,eventObject:N}),N=N.parent}}if("pointerId"in m&&_.internal.capturedMap.has(m.pointerId))for(let E of _.internal.capturedMap.get(m.pointerId).values())x.has(uv(E.intersection))||b.push(E.intersection);return b}function s(m,g,_,x){if(m.length){const b={stopped:!1};for(const M of m){let A=Bh(M.object);if(A||M.object.traverseAncestors(R=>{const w=Bh(R);if(w)return A=w,!1}),A){const{raycaster:R,pointer:w,camera:E,internal:N}=A,D=new j(w.x,w.y,0).unproject(E),U=I=>{var P,Z;return(P=(Z=N.capturedMap.get(I))==null?void 0:Z.has(M.eventObject))!=null?P:!1},B=I=>{const P={intersection:M,target:g.target};N.capturedMap.has(I)?N.capturedMap.get(I).set(M.eventObject,P):N.capturedMap.set(I,new Map([[M.eventObject,P]])),g.target.setPointerCapture(I)},z=I=>{const P=N.capturedMap.get(I);P&&nA(N.capturedMap,M.eventObject,P,I)};let H={};for(let I in g){let P=g[I];typeof P!="function"&&(H[I]=P)}let W={...M,...H,pointer:w,intersections:m,stopped:b.stopped,delta:_,unprojectedPoint:D,ray:R.ray,camera:E,stopPropagation(){const I="pointerId"in g&&N.capturedMap.get(g.pointerId);if((!I||I.has(M.eventObject))&&(W.stopped=b.stopped=!0,N.hovered.size&&Array.from(N.hovered.values()).find(P=>P.eventObject===M.eventObject))){const P=m.slice(0,m.indexOf(M));u([...P,M])}},target:{hasPointerCapture:U,setPointerCapture:B,releasePointerCapture:z},currentTarget:{hasPointerCapture:U,setPointerCapture:B,releasePointerCapture:z},nativeEvent:g};if(x(W),b.stopped===!0)break}}}return m}function u(m){const{internal:g}=r.getState();for(const _ of g.hovered.values())if(!m.length||!m.find(x=>x.object===_.object&&x.index===_.index&&x.instanceId===_.instanceId)){const b=_.eventObject.__r3f;if(g.hovered.delete(uv(_)),b!=null&&b.eventCount){const M=b.handlers,A={..._,intersections:m};M.onPointerOut==null||M.onPointerOut(A),M.onPointerLeave==null||M.onPointerLeave(A)}}}function f(m,g){for(let _=0;_<g.length;_++){const x=g[_].__r3f;x==null||x.handlers.onPointerMissed==null||x.handlers.onPointerMissed(m)}}function h(m){switch(m){case"onPointerLeave":case"onPointerCancel":return()=>u([]);case"onLostPointerCapture":return g=>{const{internal:_}=r.getState();"pointerId"in g&&_.capturedMap.has(g.pointerId)&&requestAnimationFrame(()=>{_.capturedMap.has(g.pointerId)&&(_.capturedMap.delete(g.pointerId),u([]))})}}return function(_){const{onPointerMissed:x,internal:b}=r.getState();b.lastEvent.current=_;const M=m==="onPointerMove",A=m==="onClick"||m==="onContextMenu"||m==="onDoubleClick",w=n(_,M?t:void 0),E=A?e(_):0;m==="onPointerDown"&&(b.initialClick=[_.offsetX,_.offsetY],b.initialHits=w.map(D=>D.eventObject)),A&&!w.length&&E<=2&&(f(_,b.interaction),x&&x(_)),M&&u(w);function N(D){const U=D.eventObject,B=U.__r3f;if(!(B!=null&&B.eventCount))return;const z=B.handlers;if(M){if(z.onPointerOver||z.onPointerEnter||z.onPointerOut||z.onPointerLeave){const H=uv(D),W=b.hovered.get(H);W?W.stopped&&D.stopPropagation():(b.hovered.set(H,D),z.onPointerOver==null||z.onPointerOver(D),z.onPointerEnter==null||z.onPointerEnter(D))}z.onPointerMove==null||z.onPointerMove(D)}else{const H=z[m];H?(!A||b.initialHits.includes(U))&&(f(_,b.interaction.filter(W=>!b.initialHits.includes(W))),H(D)):A&&b.initialHits.includes(U)&&f(_,b.interaction.filter(W=>!b.initialHits.includes(W)))}}s(w,_,E,N)}}return{handlePointer:h}}const k1=r=>!!(r!=null&&r.render),iA=rt.createContext(null),mz=(r,e)=>{const t=ZP((h,m)=>{const g=new j,_=new j,x=new j;function b(E=m().camera,N=_,D=m().size){const{width:U,height:B,top:z,left:H}=D,W=U/B;N.isVector3?x.copy(N):x.set(...N);const I=E.getWorldPosition(g).distanceTo(x);if(JT(E))return{width:U/E.zoom,height:B/E.zoom,top:z,left:H,factor:1,distance:I,aspect:W};{const P=E.fov*Math.PI/180,Z=2*Math.tan(P/2)*I,se=Z*(U/B);return{width:se,height:Z,top:z,left:H,factor:U/se,distance:I,aspect:W}}}let M;const A=E=>h(N=>({performance:{...N.performance,current:E}})),R=new ze;return{set:h,get:m,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(E=1)=>r(m(),E),advance:(E,N)=>e(E,N,m()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new eS,pointer:R,mouse:R,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const E=m();M&&clearTimeout(M),E.performance.current!==E.performance.min&&A(E.performance.min),M=setTimeout(()=>A(m().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:b},setEvents:E=>h(N=>({...N,events:{...N.events,...E}})),setSize:(E,N,D=0,U=0)=>{const B=m().camera,z={width:E,height:N,top:D,left:U};h(H=>({size:z,viewport:{...H.viewport,...b(B,_,z)}}))},setDpr:E=>h(N=>{const D=eA(E);return{viewport:{...N.viewport,dpr:D,initialDpr:N.viewport.initialDpr||D}}}),setFrameloop:(E="always")=>{const N=m().clock;N.stop(),N.elapsedTime=0,E!=="never"&&(N.start(),N.elapsedTime=0),h(()=>({frameloop:E}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:rt.createRef(),active:!1,frames:0,priority:0,subscribe:(E,N,D)=>{const U=m().internal;return U.priority=U.priority+(N>0?1:0),U.subscribers.push({ref:E,priority:N,store:D}),U.subscribers=U.subscribers.sort((B,z)=>B.priority-z.priority),()=>{const B=m().internal;B!=null&&B.subscribers&&(B.priority=B.priority-(N>0?1:0),B.subscribers=B.subscribers.filter(z=>z.ref!==E))}}}}}),n=t.getState();let s=n.size,u=n.viewport.dpr,f=n.camera;return t.subscribe(()=>{const{camera:h,size:m,viewport:g,gl:_,set:x}=t.getState();if(m.width!==s.width||m.height!==s.height||g.dpr!==u){s=m,u=g.dpr,hz(h,m),g.dpr>0&&_.setPixelRatio(g.dpr);const b=typeof HTMLCanvasElement<"u"&&_.domElement instanceof HTMLCanvasElement;_.setSize(m.width,m.height,b)}h!==f&&(f=h,x(b=>({viewport:{...b.viewport,...b.viewport.getCurrentViewport(h)}})))}),t.subscribe(h=>r(h)),t};function aA(){const r=rt.useContext(iA);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Nu(r=t=>t,e){return aA()(r,e)}function gz(r,e=0){const t=aA(),n=t.getState().internal.subscribe,s=$T(r);return Om(()=>n(s,e,t),[e,n,t]),null}const vz=1,yz=8,_z=32,xz=2;var bz={version:"9.5.0"};function Sz(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var V1={exports:{}},H1={exports:{}},G1;function Mz(){return G1||(G1=1,(function(r){r.exports=function(e){function t(o,l,p,v){return new Ld(o,l,p,v)}function n(){}function s(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(o){var l=o,p=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(p=l.return),o=l.return;while(o)}return l.tag===3?p:null}function f(o){if(u(o)!==o)throw Error(s(188))}function h(o){var l=o.alternate;if(!l){if(l=u(o),l===null)throw Error(s(188));return l!==o?null:o}for(var p=o,v=l;;){var T=p.return;if(T===null)break;var C=T.alternate;if(C===null){if(v=T.return,v!==null){p=v;continue}break}if(T.child===C.child){for(C=T.child;C;){if(C===p)return f(T),o;if(C===v)return f(T),l;C=C.sibling}throw Error(s(188))}if(p.return!==v.return)p=T,v=C;else{for(var F=!1,ee=T.child;ee;){if(ee===p){F=!0,p=T,v=C;break}if(ee===v){F=!0,v=T,p=C;break}ee=ee.sibling}if(!F){for(ee=C.child;ee;){if(ee===p){F=!0,p=C,v=T;break}if(ee===v){F=!0,v=C,p=T;break}ee=ee.sibling}if(!F)throw Error(s(189))}}if(p.alternate!==v)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?o:l}function m(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=m(o),l!==null)return l;o=o.sibling}return null}function g(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(o.tag!==4&&(l=g(o),l!==null))return l;o=o.sibling}return null}function _(o){return o===null||typeof o!="object"?null:(o=Lr&&o[Lr]||o["@@iterator"],typeof o=="function"?o:null)}function x(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===po?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case il:return"Fragment";case sl:return"Profiler";case al:return"StrictMode";case Ff:return"Suspense";case Dr:return"SuspenseList";case cc:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case nl:return"Portal";case ds:return o.displayName||"Context";case uc:return(o._context.displayName||"Context")+".Consumer";case eu:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case kf:return l=o.displayName||null,l!==null?l:x(o.type)||"Memo";case ha:l=o._payload,o=o._init;try{return x(o(l))}catch{}}return null}function b(o){return{current:o}}function M(o){0>cl||(o.current=$f[cl],$f[cl]=null,cl--)}function A(o,l){cl++,$f[cl]=o.current,o.current=l}function R(o){return o>>>=0,o===0?32:31-(eh(o)/Jg|0)|0}function w(o){var l=o&42;if(l!==0)return l;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function E(o,l,p){var v=o.pendingLanes;if(v===0)return 0;var T=0,C=o.suspendedLanes,F=o.pingedLanes;o=o.warmLanes;var ee=v&134217727;return ee!==0?(v=ee&~C,v!==0?T=w(v):(F&=ee,F!==0?T=w(F):p||(p=ee&~o,p!==0&&(T=w(p))))):(ee=v&~C,ee!==0?T=w(ee):F!==0?T=w(F):p||(p=v&~o,p!==0&&(T=w(p)))),T===0?0:l!==0&&l!==T&&(l&C)===0&&(C=T&-T,p=l&-l,C>=p||C===32&&(p&4194048)!==0)?l:T}function N(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function D(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function U(){var o=ou;return ou<<=1,(ou&62914560)===0&&(ou=4194304),o}function B(o){for(var l=[],p=0;31>p;p++)l.push(o);return l}function z(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function H(o,l,p,v,T,C){var F=o.pendingLanes;o.pendingLanes=p,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=p,o.entangledLanes&=p,o.errorRecoveryDisabledLanes&=p,o.shellSuspendCounter=0;var ee=o.entanglements,we=o.expirationTimes,ke=o.hiddenUpdates;for(p=F&~p;0<p;){var it=31-Ta(p),We=1<<it;ee[it]=0,we[it]=-1;var gt=ke[it];if(gt!==null)for(ke[it]=null,it=0;it<gt.length;it++){var qt=gt[it];qt!==null&&(qt.lane&=-536870913)}p&=~We}v!==0&&W(o,v,0),C!==0&&T===0&&o.tag!==0&&(o.suspendedLanes|=C&~(F&~l))}function W(o,l,p){o.pendingLanes|=l,o.suspendedLanes&=~l;var v=31-Ta(l);o.entangledLanes|=l,o.entanglements[v]=o.entanglements[v]|1073741824|p&261930}function I(o,l){var p=o.entangledLanes|=l;for(o=o.entanglements;p;){var v=31-Ta(p),T=1<<v;T&l|o[v]&l&&(o[v]|=l),p&=~T}}function P(o,l){var p=l&-l;return p=(p&42)!==0?1:Z(p),(p&(o.suspendedLanes|l))!==0?0:p}function Z(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function se(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function te(o){if(typeof vp=="function"&&t0(o),Aa&&typeof Aa.setStrictMode=="function")try{Aa.setStrictMode(hl,o)}catch{}}function fe(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}function pe(o){if(rh===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);rh=l&&l[1]||"",sr=-1<p.stack.indexOf(`
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+rh+o+sr}function Y(o,l){if(!o||_c)return"";_c=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var We=function(){throw Error()};if(Object.defineProperty(We.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(We,[])}catch(qt){var gt=qt}Reflect.construct(o,[],We)}else{try{We.call()}catch(qt){gt=qt}o.call(We.prototype)}}else{try{throw Error()}catch(qt){gt=qt}(We=o())&&typeof We.catch=="function"&&We.catch(function(){})}}catch(qt){if(qt&&gt&&typeof qt.stack=="string")return[qt.stack,gt.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var T=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");T&&T.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=v.DetermineComponentFrameRoot(),F=C[0],ee=C[1];if(F&&ee){var we=F.split(`
`),ke=ee.split(`
`);for(T=v=0;v<we.length&&!we[v].includes("DetermineComponentFrameRoot");)v++;for(;T<ke.length&&!ke[T].includes("DetermineComponentFrameRoot");)T++;if(v===we.length||T===ke.length)for(v=we.length-1,T=ke.length-1;1<=v&&0<=T&&we[v]!==ke[T];)T--;for(;1<=v&&0<=T;v--,T--)if(we[v]!==ke[T]){if(v!==1||T!==1)do if(v--,T--,0>T||we[v]!==ke[T]){var it=`
`+we[v].replace(" at new "," at ");return o.displayName&&it.includes("<anonymous>")&&(it=it.replace("<anonymous>",o.displayName)),it}while(1<=v&&0<=T);break}}}finally{_c=!1,Error.prepareStackTrace=p}return(p=o?o.displayName||o.name:"")?pe(p):""}function q(o,l){switch(o.tag){case 26:case 27:case 5:return pe(o.type);case 16:return pe("Lazy");case 13:return o.child!==l&&l!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("SuspenseList");case 0:case 15:return Y(o.type,!1);case 11:return Y(o.type.render,!1);case 1:return Y(o.type,!0);case 31:return pe("Activity");default:return""}}function ne(o){try{var l="",p=null;do l+=q(o,p),p=o,o=o.return;while(o);return l}catch(v){return`
Error generating stack: `+v.message+`
`+v.stack}}function be(o,l){if(typeof o=="object"&&o!==null){var p=yp.get(o);return p!==void 0?p:(l={value:o,source:l,stack:ne(l)},yp.set(o,l),l)}return{value:o,source:l,stack:ne(l)}}function Ne(o,l){Or[rr++]=xc,Or[rr++]=Pn,Pn=o,xc=l}function X(o,l,p){gs[Ya++]=Qi,gs[Ya++]=Is,gs[Ya++]=vs,vs=o;var v=Qi;o=Is;var T=32-Ta(v)-1;v&=~(1<<T),p+=1;var C=32-Ta(l)+T;if(30<C){var F=T-T%5;C=(v&(1<<F)-1).toString(32),v>>=F,T-=F,Qi=1<<32-Ta(l)+T|p<<T|v,Is=C+o}else Qi=1<<C|p<<T|v,Is=o}function oe(o){o.return!==null&&(Ne(o,1),X(o,1,0))}function Ae(o){for(;o===Pn;)Pn=Or[--rr],Or[rr]=null,xc=Or[--rr],Or[rr]=null;for(;o===vs;)vs=gs[--Ya],gs[Ya]=null,Is=gs[--Ya],gs[Ya]=null,Qi=gs[--Ya],gs[Ya]=null}function Fe(o,l){gs[Ya++]=Qi,gs[Ya++]=Is,gs[Ya++]=vs,Qi=l.id,Is=l.overflow,vs=o}function lt(o,l){A(Ki,l),A(Pr,o),A(Xi,null),o=pg(l),M(Xi),A(Xi,o)}function de(){M(Xi),M(Pr),M(Ki)}function Re(o){o.memoizedState!==null&&A(bc,o);var l=Xi.current,p=iu(l,o.type);l!==p&&(A(Pr,o),A(Xi,p))}function tt(o){Pr.current===o&&(M(Xi),M(Pr)),bc.current===o&&(M(bc),hi?ll._currentValue=ol:ll._currentValue2=ol)}function st(o){var l=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw He(be(l,o)),oh}function ht(o,l){if(!Zn)throw Error(s(175));kg(o.stateNode,o.type,o.memoizedProps,l,o)||st(o,!0)}function jt(o){for(Ui=o.return;Ui;)switch(Ui.tag){case 5:case 31:case 13:pa=!1;return;case 27:case 3:pa=!0;return;default:Ui=Ui.return}}function tn(o){if(!Zn||o!==Ui)return!1;if(!dn)return jt(o),dn=!0,!1;var l=o.tag;if(Li?l!==3&&l!==27&&(l!==5||ru(o.type)&&!da(o.type,o.memoizedProps))&&Qn&&st(o):l!==3&&(l!==5||ru(o.type)&&!da(o.type,o.memoizedProps))&&Qn&&st(o),jt(o),l===13){if(!Zn)throw Error(s(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));Qn=rp(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));Qn=Hg(o)}else Qn=Li&&l===27?Lg(o.type,Qn):Ui?Dg(o.stateNode):null;return!0}function Nt(){Zn&&(Qn=Ui=null,dn=!1)}function Le(){var o=or;return o!==null&&(Ra===null?Ra=o:Ra.push.apply(Ra,o),or=null),o}function He(o){or===null?or=[o]:or.push(o)}function Oe(o,l,p){hi?(A(ys,l._currentValue),l._currentValue=p):(A(ys,l._currentValue2),l._currentValue2=p)}function nt(o){var l=ys.current;hi?o._currentValue=l:o._currentValue2=l,M(ys)}function Q(o,l,p){for(;o!==null;){var v=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),o===p)break;o=o.return}}function Et(o,l,p,v){var T=o.child;for(T!==null&&(T.return=o);T!==null;){var C=T.dependencies;if(C!==null){var F=T.child;C=C.firstContext;e:for(;C!==null;){var ee=C;C=T;for(var we=0;we<l.length;we++)if(ee.context===l[we]){C.lanes|=p,ee=C.alternate,ee!==null&&(ee.lanes|=p),Q(C.return,p,o),v||(F=null);break e}C=ee.next}}else if(T.tag===18){if(F=T.return,F===null)throw Error(s(341));F.lanes|=p,C=F.alternate,C!==null&&(C.lanes|=p),Q(F,p,o),F=null}else F=T.child;if(F!==null)F.return=T;else for(F=T;F!==null;){if(F===o){F=null;break}if(T=F.sibling,T!==null){T.return=F.return,F=T;break}F=F.return}T=F}}function ot(o,l,p,v){o=null;for(var T=l,C=!1;T!==null;){if(!C){if((T.flags&524288)!==0)C=!0;else if((T.flags&262144)!==0)break}if(T.tag===10){var F=T.alternate;if(F===null)throw Error(s(387));if(F=F.memoizedProps,F!==null){var ee=T.type;pi(T.pendingProps.value,F.value)||(o!==null?o.push(ee):o=[ee])}}else if(T===bc.current){if(F=T.alternate,F===null)throw Error(s(387));F.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(o!==null?o.push(ll):o=[ll])}T=T.return}o!==null&&Et(l,o,p,v),l.flags|=262144}function Tt(o){for(o=o.firstContext;o!==null;){var l=o.context;if(!pi(hi?l._currentValue:l._currentValue2,o.memoizedValue))return!0;o=o.next}return!1}function Qe(o){Vn=o,Os=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function G(o){return ae(Vn,o)}function O(o,l){return Vn===null&&Qe(o),ae(o,l)}function ae(o,l){var p=hi?l._currentValue:l._currentValue2;if(l={context:l,memoizedValue:p,next:null},Os===null){if(o===null)throw Error(s(308));Os=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else Os=Os.next=l;return p}function Te(){return{controller:new n0,data:new Map,refCount:0}}function Ie(o){o.refCount--,o.refCount===0&&Wi(f_,function(){o.controller.abort()})}function Ee(){}function dt(o){o!==Dn&&o.next===null&&(Dn===null?Sc=Dn=o:Dn=Dn.next=o),_s=!0,sa||(sa=!0,K())}function Ke(o,l){if(!lh&&_s){lh=!0;do for(var p=!1,v=Sc;v!==null;){if(o!==0){var T=v.pendingLanes;if(T===0)var C=0;else{var F=v.suspendedLanes,ee=v.pingedLanes;C=(1<<31-Ta(42|o)+1)-1,C&=T&~(F&~ee),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(p=!0,ct(v,C))}else C=pn,C=E(v,v===rn?C:0,v.cancelPendingCommit!==null||v.timeoutHandle!==Ea),(C&3)===0||N(v,C)||(p=!0,ct(v,C));v=v.next}while(p);lh=!1}}function vt(){Dt()}function Dt(){_s=sa=!1;var o=0;_o!==0&&rl()&&(o=_o);for(var l=aa(),p=null,v=Sc;v!==null;){var T=v.next,C=Ve(v,l);C===0?(v.next=null,p===null?Sc=T:p.next=T,T===null&&(Dn=p)):(p=v,(o!==0||(C&3)!==0)&&(_s=!0)),v=T}Ti!==0&&Ti!==5||Ke(o),_o!==0&&(_o=0)}function Ve(o,l){for(var p=o.suspendedLanes,v=o.pingedLanes,T=o.expirationTimes,C=o.pendingLanes&-62914561;0<C;){var F=31-Ta(C),ee=1<<F,we=T[F];we===-1?((ee&p)===0||(ee&v)!==0)&&(T[F]=D(ee,l)):we<=l&&(o.expiredLanes|=ee),C&=~ee}if(l=rn,p=pn,p=E(o,o===l?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==Ea),v=o.callbackNode,p===0||o===l&&(Un===2||Un===9)||o.cancelPendingCommit!==null)return v!==null&&v!==null&&nh(v),o.callbackNode=null,o.callbackPriority=0;if((p&3)===0||N(o,p)){if(l=p&-p,l===o.callbackPriority)return l;switch(v!==null&&nh(v),se(p)){case 2:case 8:p=e0;break;case 32:p=yc;break;case 268435456:p=ah;break;default:p=yc}return v=Ze.bind(null,o),p=vc(p,v),o.callbackPriority=l,o.callbackNode=p,l}return v!==null&&v!==null&&nh(v),o.callbackPriority=2,o.callbackNode=null,2}function Ze(o,l){if(Ti!==0&&Ti!==5)return o.callbackNode=null,o.callbackPriority=0,null;var p=o.callbackNode;if(nr()&&o.callbackNode!==p)return null;var v=pn;return v=E(o,o===rn?v:0,o.cancelPendingCommit!==null||o.timeoutHandle!==Ea),v===0?null:(Us(o,v,l),Ve(o,aa()),o.callbackNode!=null&&o.callbackNode===p?Ze.bind(null,o):null)}function ct(o,l){if(nr())return null;Us(o,l,!0)}function K(){Xd?Wd(function(){(cn&6)!==0?vc(ih,vt):Dt()}):vc(ih,vt)}function me(){if(_o===0){var o=zr;o===0&&(o=th,th<<=1,(th&261888)===0&&(th=256)),_o=o}return _o}function et(o,l){if(lu===null){var p=lu=[];_p=0,zr=me(),Ii={status:"pending",value:void 0,then:function(v){p.push(v)}}}return _p++,l.then(J,J),l}function J(){if(--_p===0&&lu!==null){Ii!==null&&(Ii.status="fulfilled");var o=lu;lu=null,zr=0,Ii=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function je(o,l){var p=[],v={status:"pending",value:null,reason:null,then:function(T){p.push(T)}};return o.then(function(){v.status="fulfilled",v.value=l;for(var T=0;T<p.length;T++)(0,p[T])(l)},function(T){for(v.status="rejected",v.reason=T,T=0;T<p.length;T++)(0,p[T])(void 0)}),v}function Ge(){var o=xo.current;return o!==null?o:rn.pooledCache}function at(o,l){l===null?A(xo,xo.current):A(xo,l.pool)}function Xe(){var o=Ge();return o===null?null:{parent:hi?Kn._currentValue:Kn._currentValue2,pool:o}}function Ue(o,l){if(pi(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var p=Object.keys(o),v=Object.keys(l);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var T=p[v];if(!c_.call(l,T)||!pi(o[T],l[T]))return!1}return!0}function Ye(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Ct(o,l,p){switch(p=o[p],p===void 0?o.push(l):p!==l&&(l.then(Ee,Ee),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Jn(o),o;default:if(typeof l.status=="string")l.then(Ee,Ee);else{if(o=rn,o!==null&&100<o.shellSuspendCounter)throw Error(s(482));o=l,o.status="pending",o.then(function(v){if(l.status==="pending"){var T=l;T.status="fulfilled",T.value=v}},function(v){if(l.status==="pending"){var T=l;T.status="rejected",T.reason=v}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Jn(o),o}throw ma=l,Oi}}function Jt(o){try{var l=o._init;return l(o._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(ma=p,Oi):p}}function nn(){if(ma===null)throw Error(s(459));var o=ma;return ma=null,o}function Jn(o){if(o===Oi||o===bs)throw Error(s(483))}function Ci(o){var l=dl;return dl+=1,bo===null&&(bo=[]),Ct(bo,o,l)}function Qr(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function Kr(o,l){throw l.$$typeof===tl?Error(s(525)):(o=Object.prototype.toString.call(l),Error(s(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function Ho(o){function l(_e,ce){if(o){var Me=_e.deletions;Me===null?(_e.deletions=[ce],_e.flags|=16):Me.push(ce)}}function p(_e,ce){if(!o)return null;for(;ce!==null;)l(_e,ce),ce=ce.sibling;return null}function v(_e){for(var ce=new Map;_e!==null;)_e.key!==null?ce.set(_e.key,_e):ce.set(_e.index,_e),_e=_e.sibling;return ce}function T(_e,ce){return _e=qa(_e,ce),_e.index=0,_e.sibling=null,_e}function C(_e,ce,Me){return _e.index=Me,o?(Me=_e.alternate,Me!==null?(Me=Me.index,Me<ce?(_e.flags|=67108866,ce):Me):(_e.flags|=67108866,ce)):(_e.flags|=1048576,ce)}function F(_e){return o&&_e.alternate===null&&(_e.flags|=67108866),_e}function ee(_e,ce,Me,$e){return ce===null||ce.tag!==6?(ce=Ud(Me,_e.mode,$e),ce.return=_e,ce):(ce=T(ce,Me),ce.return=_e,ce)}function we(_e,ce,Me,$e){var Ot=Me.type;return Ot===il?it(_e,ce,Me.props.children,$e,Me.key):ce!==null&&(ce.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===ha&&Jt(Ot)===ce.type)?(ce=T(ce,Me.props),Qr(ce,Me),ce.return=_e,ce):(ce=Nr(Me.type,Me.key,Me.props,null,_e.mode,$e),Qr(ce,Me),ce.return=_e,ce)}function ke(_e,ce,Me,$e){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==Me.containerInfo||ce.stateNode.implementation!==Me.implementation?(ce=Od(Me,_e.mode,$e),ce.return=_e,ce):(ce=T(ce,Me.children||[]),ce.return=_e,ce)}function it(_e,ce,Me,$e,Ot){return ce===null||ce.tag!==7?(ce=hs(Me,_e.mode,$e,Ot),ce.return=_e,ce):(ce=T(ce,Me),ce.return=_e,ce)}function We(_e,ce,Me){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=Ud(""+ce,_e.mode,Me),ce.return=_e,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case ir:return Me=Nr(ce.type,ce.key,ce.props,null,_e.mode,Me),Qr(Me,ce),Me.return=_e,Me;case nl:return ce=Od(ce,_e.mode,Me),ce.return=_e,ce;case ha:return ce=Jt(ce),We(_e,ce,Me)}if(mo(ce)||_(ce))return ce=hs(ce,_e.mode,Me,null),ce.return=_e,ce;if(typeof ce.then=="function")return We(_e,Ci(ce),Me);if(ce.$$typeof===ds)return We(_e,O(_e,ce),Me);Kr(_e,ce)}return null}function gt(_e,ce,Me,$e){var Ot=ce!==null?ce.key:null;if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return Ot!==null?null:ee(_e,ce,""+Me,$e);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case ir:return Me.key===Ot?we(_e,ce,Me,$e):null;case nl:return Me.key===Ot?ke(_e,ce,Me,$e):null;case ha:return Me=Jt(Me),gt(_e,ce,Me,$e)}if(mo(Me)||_(Me))return Ot!==null?null:it(_e,ce,Me,$e,null);if(typeof Me.then=="function")return gt(_e,ce,Ci(Me),$e);if(Me.$$typeof===ds)return gt(_e,ce,O(_e,Me),$e);Kr(_e,Me)}return null}function qt(_e,ce,Me,$e,Ot){if(typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint")return _e=_e.get(Me)||null,ee(ce,_e,""+$e,Ot);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case ir:return _e=_e.get($e.key===null?Me:$e.key)||null,we(ce,_e,$e,Ot);case nl:return _e=_e.get($e.key===null?Me:$e.key)||null,ke(ce,_e,$e,Ot);case ha:return $e=Jt($e),qt(_e,ce,Me,$e,Ot)}if(mo($e)||_($e))return _e=_e.get(Me)||null,it(ce,_e,$e,Ot,null);if(typeof $e.then=="function")return qt(_e,ce,Me,Ci($e),Ot);if($e.$$typeof===ds)return qt(_e,ce,Me,O(ce,$e),Ot);Kr(ce,$e)}return null}function vi(_e,ce,Me,$e){for(var Ot=null,ri=null,zt=ce,xn=ce=0,qi=null;zt!==null&&xn<Me.length;xn++){zt.index>xn?(qi=zt,zt=null):qi=zt.sibling;var Tn=gt(_e,zt,Me[xn],$e);if(Tn===null){zt===null&&(zt=qi);break}o&&zt&&Tn.alternate===null&&l(_e,zt),ce=C(Tn,ce,xn),ri===null?Ot=Tn:ri.sibling=Tn,ri=Tn,zt=qi}if(xn===Me.length)return p(_e,zt),dn&&Ne(_e,xn),Ot;if(zt===null){for(;xn<Me.length;xn++)zt=We(_e,Me[xn],$e),zt!==null&&(ce=C(zt,ce,xn),ri===null?Ot=zt:ri.sibling=zt,ri=zt);return dn&&Ne(_e,xn),Ot}for(zt=v(zt);xn<Me.length;xn++)qi=qt(zt,_e,xn,Me[xn],$e),qi!==null&&(o&&qi.alternate!==null&&zt.delete(qi.key===null?xn:qi.key),ce=C(qi,ce,xn),ri===null?Ot=qi:ri.sibling=qi,ri=qi);return o&&zt.forEach(function(Es){return l(_e,Es)}),dn&&Ne(_e,xn),Ot}function gu(_e,ce,Me,$e){if(Me==null)throw Error(s(151));for(var Ot=null,ri=null,zt=ce,xn=ce=0,qi=null,Tn=Me.next();zt!==null&&!Tn.done;xn++,Tn=Me.next()){zt.index>xn?(qi=zt,zt=null):qi=zt.sibling;var Es=gt(_e,zt,Tn.value,$e);if(Es===null){zt===null&&(zt=qi);break}o&&zt&&Es.alternate===null&&l(_e,zt),ce=C(Es,ce,xn),ri===null?Ot=Es:ri.sibling=Es,ri=Es,zt=qi}if(Tn.done)return p(_e,zt),dn&&Ne(_e,xn),Ot;if(zt===null){for(;!Tn.done;xn++,Tn=Me.next())Tn=We(_e,Tn.value,$e),Tn!==null&&(ce=C(Tn,ce,xn),ri===null?Ot=Tn:ri.sibling=Tn,ri=Tn);return dn&&Ne(_e,xn),Ot}for(zt=v(zt);!Tn.done;xn++,Tn=Me.next())Tn=qt(zt,_e,xn,Tn.value,$e),Tn!==null&&(o&&Tn.alternate!==null&&zt.delete(Tn.key===null?xn:Tn.key),ce=C(Tn,ce,xn),ri===null?Ot=Tn:ri.sibling=Tn,ri=Tn);return o&&zt.forEach(function(h_){return l(_e,h_)}),dn&&Ne(_e,xn),Ot}function Ro(_e,ce,Me,$e){if(typeof Me=="object"&&Me!==null&&Me.type===il&&Me.key===null&&(Me=Me.props.children),typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case ir:e:{for(var Ot=Me.key;ce!==null;){if(ce.key===Ot){if(Ot=Me.type,Ot===il){if(ce.tag===7){p(_e,ce.sibling),$e=T(ce,Me.props.children),$e.return=_e,_e=$e;break e}}else if(ce.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===ha&&Jt(Ot)===ce.type){p(_e,ce.sibling),$e=T(ce,Me.props),Qr($e,Me),$e.return=_e,_e=$e;break e}p(_e,ce);break}else l(_e,ce);ce=ce.sibling}Me.type===il?($e=hs(Me.props.children,_e.mode,$e,Me.key),$e.return=_e,_e=$e):($e=Nr(Me.type,Me.key,Me.props,null,_e.mode,$e),Qr($e,Me),$e.return=_e,_e=$e)}return F(_e);case nl:e:{for(Ot=Me.key;ce!==null;){if(ce.key===Ot)if(ce.tag===4&&ce.stateNode.containerInfo===Me.containerInfo&&ce.stateNode.implementation===Me.implementation){p(_e,ce.sibling),$e=T(ce,Me.children||[]),$e.return=_e,_e=$e;break e}else{p(_e,ce);break}else l(_e,ce);ce=ce.sibling}$e=Od(Me,_e.mode,$e),$e.return=_e,_e=$e}return F(_e);case ha:return Me=Jt(Me),Ro(_e,ce,Me,$e)}if(mo(Me))return vi(_e,ce,Me,$e);if(_(Me)){if(Ot=_(Me),typeof Ot!="function")throw Error(s(150));return Me=Ot.call(Me),gu(_e,ce,Me,$e)}if(typeof Me.then=="function")return Ro(_e,ce,Ci(Me),$e);if(Me.$$typeof===ds)return Ro(_e,ce,O(_e,Me),$e);Kr(_e,Me)}return typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint"?(Me=""+Me,ce!==null&&ce.tag===6?(p(_e,ce.sibling),$e=T(ce,Me),$e.return=_e,_e=$e):(p(_e,ce),$e=Ud(Me,_e.mode,$e),$e.return=_e,_e=$e),F(_e)):p(_e,ce)}return function(_e,ce,Me,$e){try{dl=0;var Ot=Ro(_e,ce,Me,$e);return bo=null,Ot}catch(zt){if(zt===Oi||zt===bs)throw zt;var ri=t(29,zt,null,_e.mode);return ri.lanes=$e,ri.return=_e,ri}}}function Jr(){for(var o=ur,l=pl=ur=0;l<o;){var p=$i[l];$i[l++]=null;var v=$i[l];$i[l++]=null;var T=$i[l];$i[l++]=null;var C=$i[l];if($i[l++]=null,v!==null&&T!==null){var F=v.pending;F===null?T.next=T:(T.next=F.next,F.next=T),v.pending=T}C!==0&&Fa(p,T,C)}}function xr(o,l,p,v){$i[ur++]=o,$i[ur++]=l,$i[ur++]=p,$i[ur++]=v,pl|=v,o.lanes|=v,o=o.alternate,o!==null&&(o.lanes|=v)}function Go(o,l,p,v){return xr(o,l,p,v),$n(o)}function na(o,l){return xr(o,null,null,l),$n(o)}function Fa(o,l,p){o.lanes|=p;var v=o.alternate;v!==null&&(v.lanes|=p);for(var T=!1,C=o.return;C!==null;)C.childLanes|=p,v=C.alternate,v!==null&&(v.childLanes|=p),C.tag===22&&(o=C.stateNode,o===null||o._visibility&1||(T=!0)),o=C,C=C.return;return o.tag===3?(C=o.stateNode,T&&l!==null&&(T=31-Ta(p),o=C.hiddenUpdates,v=o[T],v===null?o[T]=[l]:v.push(l),l.lane=p|536870912),C):null}function $n(o){if(50<En)throw En=0,Cc=null,Error(s(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}function Ri(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ka(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Va(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ha(o,l,p){var v=o.updateQueue;if(v===null)return null;if(v=v.shared,(cn&2)!==0){var T=v.pending;return T===null?l.next=l:(l.next=T.next,T.next=l),v.pending=l,l=$n(o),Fa(o,null,p),l}return xr(o,v,l,p),$n(o)}function $r(o,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,I(o,p)}}function Xo(o,l){var p=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var T=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var F={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};C===null?T=C=F:C=C.next=F,p=p.next}while(p!==null);C===null?T=C=l:C=C.next=l}else T=C=l;p={baseState:v.baseState,firstBaseUpdate:T,lastBaseUpdate:C,shared:v.shared,callbacks:v.callbacks},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=l:o.next=l,p.lastBaseUpdate=l}function Ds(){if(ch){var o=Ii;if(o!==null)throw o}}function br(o,l,p,v){ch=!1;var T=o.updateQueue;Za=!1;var C=T.firstBaseUpdate,F=T.lastBaseUpdate,ee=T.shared.pending;if(ee!==null){T.shared.pending=null;var we=ee,ke=we.next;we.next=null,F===null?C=ke:F.next=ke,F=we;var it=o.alternate;it!==null&&(it=it.updateQueue,ee=it.lastBaseUpdate,ee!==F&&(ee===null?it.firstBaseUpdate=ke:ee.next=ke,it.lastBaseUpdate=we))}if(C!==null){var We=T.baseState;F=0,it=ke=we=null,ee=C;do{var gt=ee.lane&-536870913,qt=gt!==ee.lane;if(qt?(pn&gt)===gt:(v&gt)===gt){gt!==0&&gt===zr&&(ch=!0),it!==null&&(it=it.next={lane:0,tag:ee.tag,payload:ee.payload,callback:null,next:null});e:{var vi=o,gu=ee;gt=l;var Ro=p;switch(gu.tag){case 1:if(vi=gu.payload,typeof vi=="function"){We=vi.call(Ro,We,gt);break e}We=vi;break e;case 3:vi.flags=vi.flags&-65537|128;case 0:if(vi=gu.payload,gt=typeof vi=="function"?vi.call(Ro,We,gt):vi,gt==null)break e;We=Bf({},We,gt);break e;case 2:Za=!0}}gt=ee.callback,gt!==null&&(o.flags|=64,qt&&(o.flags|=8192),qt=T.callbacks,qt===null?T.callbacks=[gt]:qt.push(gt))}else qt={lane:gt,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},it===null?(ke=it=qt,we=We):it=it.next=qt,F|=gt;if(ee=ee.next,ee===null){if(ee=T.shared.pending,ee===null)break;qt=ee,ee=qt.next,qt.next=null,T.lastBaseUpdate=qt,T.shared.pending=null}}while(!0);it===null&&(we=We),T.baseState=we,T.firstBaseUpdate=ke,T.lastBaseUpdate=it,C===null&&(T.shared.lanes=0),Fr|=F,o.lanes=F,o.memoizedState=We}}function Sr(o,l){if(typeof o!="function")throw Error(s(191,o));o.call(l)}function Mr(o,l){var p=o.callbacks;if(p!==null)for(o.callbacks=null,o=0;o<p.length;o++)Sr(p[o],l)}function eo(o,l){o=fr,A(So,o),A(ml,l),fr=o|l.baseLanes}function Xs(){A(So,fr),A(ml,ml.current)}function k(){fr=So.current,M(ml),M(So)}function re(o){var l=o.alternate;A(ui,ui.current&1),A(wa,o),Ca===null&&(l===null||ml.current!==null||l.memoizedState!==null)&&(Ca=o)}function Se(o){A(ui,ui.current),A(wa,o),Ca===null&&(Ca=o)}function ye(o){o.tag===22?(A(ui,ui.current),A(wa,o),Ca===null&&(Ca=o)):ue()}function ue(){A(ui,ui.current),A(wa,wa.current)}function Je(o){M(wa),Ca===o&&(Ca=null),M(ui)}function mt(o){for(var l=o;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||vo(p)||qf(p)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function qe(){throw Error(s(321))}function _t(o,l){if(l===null)return!1;for(var p=0;p<l.length&&p<o.length;p++)if(!pi(o[p],l[p]))return!1;return!0}function xt(o,l,p,v,T,C){return Br=C,Zt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ut.H=o===null||o.memoizedState===null?ii:cr,vn=!1,C=p(v,T),vn=!1,$t&&(C=St(l,p,v,T)),Lt(o),C}function Lt(o){Ut.H=Qa;var l=wt!==null&&wt.next!==null;if(Br=0,Gt=wt=Zt=null,sn=!1,Ss=0,Ps=null,l)throw Error(s(300));o===null||qn||(o=o.dependencies,o!==null&&Tt(o)&&(qn=!0))}function St(o,l,p,v){Zt=o;var T=0;do{if($t&&(Ps=null),Ss=0,$t=!1,25<=T)throw Error(s(301));if(T+=1,Gt=wt=null,o.updateQueue!=null){var C=o.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}Ut.H=Mo,C=l(p,v)}while($t);return C}function Pt(){var o=Ut.H,l=o.useState()[0];return l=typeof l.then=="function"?Ft(l):l,o=o.useState()[0],(wt!==null?wt.memoizedState:null)!==o&&(Zt.flags|=1024),l}function Mn(){var o=ra!==0;return ra=0,o}function Bn(o,l,p){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~p}function In(o){if(sn){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}sn=!1}Br=0,Gt=wt=Zt=null,$t=!1,Ss=ra=0,Ps=null}function Wt(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Zt.memoizedState=Gt=o:Gt=Gt.next=o,Gt}function ut(){if(wt===null){var o=Zt.alternate;o=o!==null?o.memoizedState:null}else o=wt.next;var l=Gt===null?Zt.memoizedState:Gt.next;if(l!==null)Gt=l,wt=o;else{if(o===null)throw Zt.alternate===null?Error(s(467)):Error(s(310));wt=o,o={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Gt===null?Zt.memoizedState=Gt=o:Gt=Gt.next=o}return Gt}function _n(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ft(o){var l=Ss;return Ss+=1,Ps===null&&(Ps=[]),o=Ct(Ps,o,l),l=Zt,(Gt===null?l.memoizedState:Gt.next)===null&&(l=l.alternate,Ut.H=l===null||l.memoizedState===null?ii:cr),o}function xi(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ft(o);if(o.$$typeof===ds)return G(o)}throw Error(s(438,String(o)))}function Ls(o){var l=null,p=Zt.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var v=Zt.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(l={data:v.data.map(function(T){return T.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),p===null&&(p=_n(),Zt.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(o),v=0;v<o;v++)p[v]=zd;return l.index++,p}function Wn(o,l){return typeof l=="function"?l(o):l}function la(o){var l=ut();return An(l,wt,o)}function An(o,l,p){var v=o.queue;if(v===null)throw Error(s(311));v.lastRenderedReducer=p;var T=o.baseQueue,C=v.pending;if(C!==null){if(T!==null){var F=T.next;T.next=C.next,C.next=F}l.baseQueue=T=C,v.pending=null}if(C=o.baseState,T===null)o.memoizedState=C;else{l=T.next;var ee=F=null,we=null,ke=l,it=!1;do{var We=ke.lane&-536870913;if(We!==ke.lane?(pn&We)===We:(Br&We)===We){var gt=ke.revertLane;if(gt===0)we!==null&&(we=we.next={lane:0,revertLane:0,gesture:null,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null}),We===zr&&(it=!0);else if((Br&gt)===gt){ke=ke.next,gt===zr&&(it=!0);continue}else We={lane:0,revertLane:ke.revertLane,gesture:null,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null},we===null?(ee=we=We,F=C):we=we.next=We,Zt.lanes|=gt,Fr|=gt;We=ke.action,vn&&p(C,We),C=ke.hasEagerState?ke.eagerState:p(C,We)}else gt={lane:We,revertLane:ke.revertLane,gesture:ke.gesture,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null},we===null?(ee=we=gt,F=C):we=we.next=gt,Zt.lanes|=We,Fr|=We;ke=ke.next}while(ke!==null&&ke!==l);if(we===null?F=C:we.next=ee,!pi(C,o.memoizedState)&&(qn=!0,it&&(p=Ii,p!==null)))throw p;o.memoizedState=C,o.baseState=F,o.baseQueue=we,v.lastRenderedState=C}return T===null&&(v.lanes=0),[o.memoizedState,v.dispatch]}function Ni(o){var l=ut(),p=l.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=o;var v=p.dispatch,T=p.pending,C=l.memoizedState;if(T!==null){p.pending=null;var F=T=T.next;do C=o(C,F.action),F=F.next;while(F!==T);pi(C,l.memoizedState)||(qn=!0),l.memoizedState=C,l.baseQueue===null&&(l.baseState=C),p.lastRenderedState=C}return[C,v]}function bi(o,l,p){var v=Zt,T=ut(),C=dn;if(C){if(p===void 0)throw Error(s(407));p=p()}else p=l();var F=!pi((wt||T).memoizedState,p);if(F&&(T.memoizedState=p,qn=!0),T=T.queue,Pl(Wo.bind(null,v,T,o),[o]),T.getSnapshot!==l||F||Gt!==null&&Gt.memoizedState.tag&1){if(v.flags|=2048,Ga(9,{destroy:void 0},ki.bind(null,v,T,p,l),null),rn===null)throw Error(s(349));C||(Br&127)!==0||Fi(v,l,p)}return p}function Fi(o,l,p){o.flags|=16384,o={getSnapshot:l,value:p},l=Zt.updateQueue,l===null?(l=_n(),Zt.updateQueue=l,l.stores=[o]):(p=l.stores,p===null?l.stores=[o]:p.push(o))}function ki(o,l,p,v){l.value=p,l.getSnapshot=v,rs(l)&&Pm(o)}function Wo(o,l,p){return p(function(){rs(l)&&Pm(o)})}function rs(o){var l=o.getSnapshot;o=o.value;try{var p=l();return!pi(o,p)}catch{return!0}}function Pm(o){var l=na(o,2);l!==null&&ti(l,o,2)}function ld(o){var l=Wt();if(typeof o=="function"){var p=o;if(o=p(),vn){te(!0);try{p()}finally{te(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:o},l}function Xu(o,l,p,v){return o.baseState=p,An(o,wt,typeof v=="function"?v:Wn)}function Er(o,l,p,v,T){if(yf(o))throw Error(s(485));if(o=l.action,o!==null){var C={payload:T,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(F){C.listeners.push(F)}};Ut.T!==null?p(!0):C.isTransition=!1,v(C),p=l.pending,p===null?(C.next=l.pending=C,ff(l,C)):(C.next=p.next,l.pending=p.next=C)}}function ff(o,l){var p=l.action,v=l.payload,T=o.state;if(l.isTransition){var C=Ut.T,F={};Ut.T=F;try{var ee=p(T,v),we=Ut.S;we!==null&&we(F,ee),hf(o,l,ee)}catch(ke){to(o,l,ke)}finally{C!==null&&F.types!==null&&(C.types=F.types),Ut.T=C}}else try{C=p(T,v),hf(o,l,C)}catch(ke){to(o,l,ke)}}function hf(o,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(v){qo(o,l,v)},function(v){return to(o,l,v)}):qo(o,l,p)}function qo(o,l,p){l.status="fulfilled",l.value=p,ud(l),o.state=p,l=o.pending,l!==null&&(p=l.next,p===l?o.pending=null:(p=p.next,l.next=p,ff(o,p)))}function to(o,l,p){var v=o.pending;if(o.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=p,ud(l),l=l.next;while(l!==v)}o.action=null}function ud(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function df(o,l){return l}function cd(o,l){if(dn){var p=rn.formState;if(p!==null){e:{var v=Zt;if(dn){if(Qn){var T=Ng(Qn,pa);if(T){Qn=Dg(T),v=np(T);break e}}st(v)}v=!1}v&&(l=p[0])}}p=Wt(),p.memoizedState=p.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:df,lastRenderedState:l},p.queue=v,p=Hm.bind(null,Zt,v),v.dispatch=p,v=ld(!1);var C=vf.bind(null,Zt,!1,v.queue);return v=Wt(),T={state:l,dispatch:null,action:o,pending:null},v.queue=T,p=Er.bind(null,Zt,T,C,p),T.dispatch=p,v.memoizedState=o,[l,p,!1]}function Il(o){var l=ut();return Ws(l,wt,o)}function Ws(o,l,p){if(l=An(o,l,df)[0],o=la(Wn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=Ft(l)}catch(F){throw F===Oi?bs:F}else v=l;l=ut();var T=l.queue,C=T.dispatch;return p!==l.memoizedState&&(Zt.flags|=2048,Ga(9,{destroy:void 0},fd.bind(null,T,p),null)),[v,C,o]}function fd(o,l){o.action=l}function Ol(o){var l=ut(),p=wt;if(p!==null)return Ws(l,p,o);ut(),l=l.memoizedState,p=ut();var v=p.queue.dispatch;return p.memoizedState=o,[l,v,!1]}function Ga(o,l,p,v){return o={tag:o,create:p,deps:v,inst:l,next:null},l=Zt.updateQueue,l===null&&(l=_n(),Zt.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=o.next=o:(v=p.next,p.next=o,o.next=v,l.lastEffect=o),o}function pf(){return ut().memoizedState}function jo(o,l,p,v){var T=Wt();Zt.flags|=o,T.memoizedState=Ga(1|l,{destroy:void 0},p,v===void 0?null:v)}function Wu(o,l,p,v){var T=ut();v=v===void 0?null:v;var C=T.memoizedState.inst;wt!==null&&v!==null&&_t(v,wt.memoizedState.deps)?T.memoizedState=Ga(l,C,p,v):(Zt.flags|=o,T.memoizedState=Ga(1|l,C,p,v))}function qu(o,l){jo(8390656,8,o,l)}function Pl(o,l){Wu(2048,8,o,l)}function zm(o){Zt.flags|=4;var l=Zt.updateQueue;if(l===null)l=_n(),Zt.updateQueue=l,l.events=[o];else{var p=l.events;p===null?l.events=[o]:p.push(o)}}function ua(o){var l=ut().memoizedState;return zm({ref:l,nextImpl:o}),function(){if((cn&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}function no(o,l){return Wu(4,2,o,l)}function ju(o,l){return Wu(4,4,o,l)}function zl(o,l){if(typeof l=="function"){o=o();var p=l(o);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Bm(o,l,p){p=p!=null?p.concat([o]):null,Wu(4,4,zl.bind(null,l,o),p)}function Yu(){}function mf(o,l){var p=ut();l=l===void 0?null:l;var v=p.memoizedState;return l!==null&&_t(l,v[1])?v[0]:(p.memoizedState=[o,l],o)}function Bl(o,l){var p=ut();l=l===void 0?null:l;var v=p.memoizedState;if(l!==null&&_t(l,v[1]))return v[0];if(v=o(),vn){te(!0);try{o()}finally{te(!1)}}return p.memoizedState=[v,l],v}function Fl(o,l,p){return p===void 0||(Br&1073741824)!==0&&(pn&261930)===0?o.memoizedState=l:(o.memoizedState=p,o=wr(),Zt.lanes|=o,Fr|=o,p)}function hd(o,l,p,v){return pi(p,l)?p:ml.current!==null?(o=Fl(o,p,v),pi(o,l)||(qn=!0),o):(Br&42)===0||(Br&1073741824)!==0&&(pn&261930)===0?(qn=!0,o.memoizedState=p):(o=wr(),Zt.lanes|=o,Fr|=o,l)}function Fm(o,l,p,v,T){var C=ps();hn(C!==0&&8>C?C:8);var F=Ut.T,ee={};Ut.T=ee,vf(o,!1,l,p);try{var we=T(),ke=Ut.S;if(ke!==null&&ke(ee,we),we!==null&&typeof we=="object"&&typeof we.then=="function"){var it=je(we,v);Zu(o,l,it,Yn(o))}else Zu(o,l,v,Yn(o))}catch(We){Zu(o,l,{then:function(){},status:"rejected",reason:We},Yn())}finally{hn(C),F!==null&&ee.types!==null&&(F.types=ee.types),Ut.T=F}}function km(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:ol,baseState:ol,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:ol},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:p},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function dd(){return G(ll)}function gf(){return ut().memoizedState}function Vm(){return ut().memoizedState}function e_(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var p=Yn();o=Va(p);var v=Ha(l,o,p);v!==null&&(ti(v,l,p),$r(v,l,p)),l={cache:Te()},o.payload=l;return}l=l.return}}function t_(o,l,p){var v=Yn();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},yf(o)?Gm(l,p):(p=Go(o,l,p,v),p!==null&&(ti(p,o,v),Xm(p,l,v)))}function Hm(o,l,p){var v=Yn();Zu(o,l,p,v)}function Zu(o,l,p,v){var T={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(yf(o))Gm(l,T);else{var C=o.alternate;if(o.lanes===0&&(C===null||C.lanes===0)&&(C=l.lastRenderedReducer,C!==null))try{var F=l.lastRenderedState,ee=C(F,p);if(T.hasEagerState=!0,T.eagerState=ee,pi(ee,F))return xr(o,l,T,0),rn===null&&Jr(),!1}catch{}if(p=Go(o,l,T,v),p!==null)return ti(p,o,v),Xm(p,l,v),!0}return!1}function vf(o,l,p,v){if(v={lane:2,revertLane:me(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},yf(o)){if(l)throw Error(s(479))}else l=Go(o,p,v,2),l!==null&&ti(l,o,2)}function yf(o){var l=o.alternate;return o===Zt||l!==null&&l===Zt}function Gm(o,l){$t=sn=!0;var p=o.pending;p===null?l.next=l:(l.next=p.next,p.next=l),o.pending=l}function Xm(o,l,p){if((p&4194048)!==0){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,I(o,p)}}function pd(o,l,p,v){l=o.memoizedState,p=p(v,l),p=p==null?l:Bf({},l,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}function _f(o,l,p,v,T,C,F){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(v,C,F):l.prototype&&l.prototype.isPureReactComponent?!Ue(p,v)||!Ue(T,C):!0}function Wm(o,l,p,v){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,v),l.state!==o&&Mc.enqueueReplaceState(l,l.state,null)}function Yo(o,l){var p=l;if("ref"in l){p={};for(var v in l)v!=="ref"&&(p[v]=l[v])}if(o=o.defaultProps){p===l&&(p=Bf({},p));for(var T in o)p[T]===void 0&&(p[T]=o[T])}return p}function xf(o,l){try{var p=o.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function md(o,l,p){try{var v=o.onCaughtError;v(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function gd(o,l,p){return p=Va(p),p.tag=3,p.payload={element:null},p.callback=function(){xf(o,l)},p}function qm(o){return o=Va(o),o.tag=3,o}function jm(o,l,p,v){var T=p.type.getDerivedStateFromError;if(typeof T=="function"){var C=v.value;o.payload=function(){return T(C)},o.callback=function(){md(l,p,v)}}var F=p.stateNode;F!==null&&typeof F.componentDidCatch=="function"&&(o.callback=function(){md(l,p,v),typeof T!="function"&&(kr===null?kr=new Set([this]):kr.add(this));var ee=v.stack;this.componentDidCatch(v.value,{componentStack:ee!==null?ee:""})})}function n_(o,l,p,v,T){if(p.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=p.alternate,l!==null&&ot(l,p,T,!0),p=wa.current,p!==null){switch(p.tag){case 31:case 13:return Ca===null?Ql():p.alternate===null&&si===0&&(si=3),p.flags&=-257,p.flags|=65536,p.lanes=T,v===lr?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([v]):l.add(v),$l(o,v,T)),!1;case 22:return p.flags|=65536,v===lr?p.flags|=16384:(l=p.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([v])},p.updateQueue=l):(p=l.retryQueue,p===null?l.retryQueue=new Set([v]):p.add(v)),$l(o,v,T)),!1}throw Error(s(435,p.tag))}return $l(o,v,T),Ql(),!1}if(dn)return l=wa.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=T,v!==oh&&(o=Error(s(422),{cause:v}),He(be(o,p)))):(v!==oh&&(l=Error(s(423),{cause:v}),He(be(l,p))),o=o.current.alternate,o.flags|=65536,T&=-T,o.lanes|=T,v=be(v,p),T=gd(o.stateNode,v,T),Xo(o,T),si!==4&&(si=2)),!1;var C=Error(s(520),{cause:v});if(C=be(C,p),Tc===null?Tc=[C]:Tc.push(C),si!==4&&(si=2),l===null)return!0;v=be(v,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,o=T&-T,p.lanes|=o,o=gd(p.stateNode,v,o),Xo(p,o),!1;case 1:if(l=p.type,C=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(kr===null||!kr.has(C))))return p.flags|=65536,T&=-T,p.lanes|=T,T=qm(T),jm(T,o,p,v),Xo(p,T),!1}p=p.return}while(p!==null);return!1}function Zi(o,l,p,v){l.child=o===null?xp(l,null,p,v):Ji(l,o.child,p,v)}function Ym(o,l,p,v,T){p=p.render;var C=l.ref;if("ref"in v){var F={};for(var ee in v)ee!=="ref"&&(F[ee]=v[ee])}else F=v;return Qe(l),v=xt(o,l,p,F,C,T),ee=Mn(),o!==null&&!qn?(Bn(o,l,T),qs(o,l,T)):(dn&&ee&&oe(l),l.flags|=1,Zi(o,l,v,T),l.child)}function Zm(o,l,p,v,T){if(o===null){var C=p.type;return typeof C=="function"&&!$o(C)&&C.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=C,Qm(o,l,C,v,T)):(o=Nr(p.type,null,v,l,l.mode,T),o.ref=l.ref,o.return=l,l.child=o)}if(C=o.child,!Ku(o,T)){var F=C.memoizedProps;if(p=p.compare,p=p!==null?p:Ue,p(F,v)&&o.ref===l.ref)return qs(o,l,T)}return l.flags|=1,o=qa(C,v),o.ref=l.ref,o.return=l,l.child=o}function Qm(o,l,p,v,T){if(o!==null){var C=o.memoizedProps;if(Ue(C,v)&&o.ref===l.ref)if(qn=!1,l.pendingProps=v=C,Ku(o,T))(o.flags&131072)!==0&&(qn=!0);else return l.lanes=o.lanes,qs(o,l,T)}return Sf(o,l,p,v,T)}function Km(o,l,p,v){var T=v.children,C=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((l.flags&128)!==0){if(C=C!==null?C.baseLanes|p:p,o!==null){for(v=l.child=o.child,T=0;v!==null;)T=T|v.lanes|v.childLanes,v=v.sibling;v=T&~C}else v=0,l.child=null;return kl(o,l,C,p,v)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&at(l,C!==null?C.cachePool:null),C!==null?eo(l,C):Xs(),ye(l);else return v=l.lanes=536870912,kl(o,l,C!==null?C.baseLanes|p:p,p,v)}else C!==null?(at(l,C.cachePool),eo(l,C),ue(),l.memoizedState=null):(o!==null&&at(l,null),Xs(),ue());return Zi(o,l,T,p),l.child}function Zo(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function kl(o,l,p,v,T){var C=Ge();return C=C===null?null:{parent:hi?Kn._currentValue:Kn._currentValue2,pool:C},l.memoizedState={baseLanes:p,cachePool:C},o!==null&&at(l,null),Xs(),ye(l),o!==null&&ot(o,l,v,!0),l.childLanes=T,null}function bf(o,l){return l=io({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function vd(o,l,p){return Ji(l,o.child,null,p),o=bf(l,l.pendingProps),o.flags|=2,Je(l),l.memoizedState=null,o}function Jm(o,l,p){var v=l.pendingProps,T=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(dn){if(v.mode==="hidden")return o=bf(l,v),l.lanes=536870912,Zo(null,o);if(Se(l),(o=Qn)?(o=ap(o,pa),o!==null&&(l.memoizedState={dehydrated:o,treeContext:vs!==null?{id:Qi,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},p=Id(o),p.return=l,l.child=p,Ui=l,Qn=null)):o=null,o===null)throw st(l);return l.lanes=536870912,null}return bf(l,v)}var C=o.memoizedState;if(C!==null){var F=C.dehydrated;if(Se(l),T)if(l.flags&256)l.flags&=-257,l=vd(o,l,p);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(s(558));else if(qn||ot(o,l,p,!1),T=(p&o.childLanes)!==0,qn||T){if(v=rn,v!==null&&(F=P(v,p),F!==0&&F!==C.retryLane))throw C.retryLane=F,na(o,F),ti(v,o,F),ga;Ql(),l=vd(o,l,p)}else o=C.treeContext,Zn&&(Qn=Og(F),Ui=l,dn=!0,or=null,pa=!1,o!==null&&Fe(l,o)),l=bf(l,v),l.flags|=4096;return l}return o=qa(o.child,{mode:v.mode,children:v.children}),o.ref=l.ref,l.child=o,o.return=l,o}function Qu(o,l){var p=l.ref;if(p===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(s(284));(o===null||o.ref!==p)&&(l.flags|=4194816)}}function Sf(o,l,p,v,T){return Qe(l),p=xt(o,l,p,v,void 0,T),v=Mn(),o!==null&&!qn?(Bn(o,l,T),qs(o,l,T)):(dn&&v&&oe(l),l.flags|=1,Zi(o,l,p,T),l.child)}function yd(o,l,p,v,T,C){return Qe(l),l.updateQueue=null,p=St(l,v,p,T),Lt(o),v=Mn(),o!==null&&!qn?(Bn(o,l,C),qs(o,l,C)):(dn&&v&&oe(l),l.flags|=1,Zi(o,l,p,C),l.child)}function Qo(o,l,p,v,T){if(Qe(l),l.stateNode===null){var C=ar,F=p.contextType;typeof F=="object"&&F!==null&&(C=G(F)),C=new p(v,C),l.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=Mc,l.stateNode=C,C._reactInternals=l,C=l.stateNode,C.props=v,C.state=l.memoizedState,C.refs={},Ri(l),F=p.contextType,C.context=typeof F=="object"&&F!==null?G(F):ar,C.state=l.memoizedState,F=p.getDerivedStateFromProps,typeof F=="function"&&(pd(l,p,F,v),C.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(F=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),F!==C.state&&Mc.enqueueReplaceState(C,C.state,null),br(l,v,C,T),Ds(),C.state=l.memoizedState),typeof C.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(o===null){C=l.stateNode;var ee=l.memoizedProps,we=Yo(p,ee);C.props=we;var ke=C.context,it=p.contextType;F=ar,typeof it=="object"&&it!==null&&(F=G(it));var We=p.getDerivedStateFromProps;it=typeof We=="function"||typeof C.getSnapshotBeforeUpdate=="function",ee=l.pendingProps!==ee,it||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(ee||ke!==F)&&Wm(l,C,v,F),Za=!1;var gt=l.memoizedState;C.state=gt,br(l,v,C,T),Ds(),ke=l.memoizedState,ee||gt!==ke||Za?(typeof We=="function"&&(pd(l,p,We,v),ke=l.memoizedState),(we=Za||_f(l,p,we,v,gt,ke,F))?(it||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(l.flags|=4194308)):(typeof C.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=ke),C.props=v,C.state=ke,C.context=F,v=we):(typeof C.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{C=l.stateNode,ka(o,l),F=l.memoizedProps,it=Yo(p,F),C.props=it,We=l.pendingProps,gt=C.context,ke=p.contextType,we=ar,typeof ke=="object"&&ke!==null&&(we=G(ke)),ee=p.getDerivedStateFromProps,(ke=typeof ee=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(F!==We||gt!==we)&&Wm(l,C,v,we),Za=!1,gt=l.memoizedState,C.state=gt,br(l,v,C,T),Ds();var qt=l.memoizedState;F!==We||gt!==qt||Za||o!==null&&o.dependencies!==null&&Tt(o.dependencies)?(typeof ee=="function"&&(pd(l,p,ee,v),qt=l.memoizedState),(it=Za||_f(l,p,it,v,gt,qt,we)||o!==null&&o.dependencies!==null&&Tt(o.dependencies))?(ke||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(v,qt,we),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(v,qt,we)),typeof C.componentDidUpdate=="function"&&(l.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof C.componentDidUpdate!="function"||F===o.memoizedProps&&gt===o.memoizedState||(l.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||F===o.memoizedProps&&gt===o.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=qt),C.props=v,C.state=qt,C.context=we,v=it):(typeof C.componentDidUpdate!="function"||F===o.memoizedProps&&gt===o.memoizedState||(l.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||F===o.memoizedProps&&gt===o.memoizedState||(l.flags|=1024),v=!1)}return C=v,Qu(o,l),v=(l.flags&128)!==0,C||v?(C=l.stateNode,p=v&&typeof p.getDerivedStateFromError!="function"?null:C.render(),l.flags|=1,o!==null&&v?(l.child=Ji(l,o.child,null,T),l.child=Ji(l,null,p,T)):Zi(o,l,p,T),l.memoizedState=C.state,o=l.child):o=qs(o,l,T),o}function $m(o,l,p,v){return Nt(),l.flags|=256,Zi(o,l,p,v),l.child}function _d(o){return{baseLanes:o,cachePool:Xe()}}function xd(o,l,p){return o=o!==null?o.childLanes&~p:0,l&&(o|=va),o}function bd(o,l,p){var v=l.pendingProps,T=!1,C=(l.flags&128)!==0,F;if((F=C)||(F=o!==null&&o.memoizedState===null?!1:(ui.current&2)!==0),F&&(T=!0,l.flags&=-129),F=(l.flags&32)!==0,l.flags&=-33,o===null){if(dn){if(T?re(l):ue(),(o=Qn)?(o=Fg(o,pa),o!==null&&(l.memoizedState={dehydrated:o,treeContext:vs!==null?{id:Qi,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},p=Id(o),p.return=l,l.child=p,Ui=l,Qn=null)):o=null,o===null)throw st(l);return qf(o)?l.lanes=32:l.lanes=536870912,null}var ee=v.children;return v=v.fallback,T?(ue(),T=l.mode,ee=io({mode:"hidden",children:ee},T),v=hs(v,T,p,null),ee.return=l,v.return=l,ee.sibling=v,l.child=ee,v=l.child,v.memoizedState=_d(p),v.childLanes=xd(o,F,p),l.memoizedState=gl,Zo(null,v)):(re(l),Mf(l,ee))}var we=o.memoizedState;if(we!==null&&(ee=we.dehydrated,ee!==null)){if(C)l.flags&256?(re(l),l.flags&=-257,l=Ko(o,l,p)):l.memoizedState!==null?(ue(),l.child=o.child,l.flags|=128,l=null):(ue(),ee=v.fallback,T=l.mode,v=io({mode:"visible",children:v.children},T),ee=hs(ee,T,p,null),ee.flags|=2,v.return=l,ee.return=l,v.sibling=ee,l.child=v,Ji(l,o.child,null,p),v=l.child,v.memoizedState=_d(p),v.childLanes=xd(o,F,p),l.memoizedState=gl,l=Zo(null,v));else if(re(l),qf(ee))F=jf(ee).digest,v=Error(s(419)),v.stack="",v.digest=F,He({value:v,source:null,stack:null}),l=Ko(o,l,p);else if(qn||ot(o,l,p,!1),F=(p&o.childLanes)!==0,qn||F){if(F=rn,F!==null&&(v=P(F,p),v!==0&&v!==we.retryLane))throw we.retryLane=v,na(o,v),ti(F,o,v),ga;vo(ee)||Ql(),l=Ko(o,l,p)}else vo(ee)?(l.flags|=192,l.child=o.child,l=null):(o=we.treeContext,Zn&&(Qn=Pg(ee),Ui=l,dn=!0,or=null,pa=!1,o!==null&&Fe(l,o)),l=Mf(l,v.children),l.flags|=4096);return l}return T?(ue(),ee=v.fallback,T=l.mode,we=o.child,C=we.sibling,v=qa(we,{mode:"hidden",children:v.children}),v.subtreeFlags=we.subtreeFlags&65011712,C!==null?ee=qa(C,ee):(ee=hs(ee,T,p,null),ee.flags|=2),ee.return=l,v.return=l,v.sibling=ee,l.child=v,Zo(null,v),v=l.child,ee=o.child.memoizedState,ee===null?ee=_d(p):(T=ee.cachePool,T!==null?(we=hi?Kn._currentValue:Kn._currentValue2,T=T.parent!==we?{parent:we,pool:we}:T):T=Xe(),ee={baseLanes:ee.baseLanes|p,cachePool:T}),v.memoizedState=ee,v.childLanes=xd(o,F,p),l.memoizedState=gl,Zo(o.child,v)):(re(l),p=o.child,o=p.sibling,p=qa(p,{mode:"visible",children:v.children}),p.return=l,p.sibling=null,o!==null&&(F=l.deletions,F===null?(l.deletions=[o],l.flags|=16):F.push(o)),l.child=p,l.memoizedState=null,p)}function Mf(o,l){return l=io({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function io(o,l){return o=t(22,o,null,l),o.lanes=0,o}function Ko(o,l,p){return Ji(l,o.child,null,p),o=Mf(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function eg(o,l,p){o.lanes|=l;var v=o.alternate;v!==null&&(v.lanes|=l),Q(o.return,l,p)}function Vl(o,l,p,v,T,C){var F=o.memoizedState;F===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:T,treeForkCount:C}:(F.isBackwards=l,F.rendering=null,F.renderingStartTime=0,F.last=v,F.tail=p,F.tailMode=T,F.treeForkCount=C)}function Sd(o,l,p){var v=l.pendingProps,T=v.revealOrder,C=v.tail;v=v.children;var F=ui.current,ee=(F&2)!==0;if(ee?(F=F&1|2,l.flags|=128):F&=1,A(ui,F),Zi(o,l,v,p),v=dn?xc:0,!ee&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&eg(o,p,l);else if(o.tag===19)eg(o,p,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(T){case"forwards":for(p=l.child,T=null;p!==null;)o=p.alternate,o!==null&&mt(o)===null&&(T=p),p=p.sibling;p=T,p===null?(T=l.child,l.child=null):(T=p.sibling,p.sibling=null),Vl(l,!1,T,p,C,v);break;case"backwards":case"unstable_legacy-backwards":for(p=null,T=l.child,l.child=null;T!==null;){if(o=T.alternate,o!==null&&mt(o)===null){l.child=T;break}o=T.sibling,T.sibling=p,p=T,T=o}Vl(l,!0,p,null,C,v);break;case"together":Vl(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function qs(o,l,p){if(o!==null&&(l.dependencies=o.dependencies),Fr|=l.lanes,(p&l.childLanes)===0)if(o!==null){if(ot(o,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(s(153));if(l.child!==null){for(o=l.child,p=qa(o,o.pendingProps),l.child=p,p.return=l;o.sibling!==null;)o=o.sibling,p=p.sibling=qa(o,o.pendingProps),p.return=l;p.sibling=null}return l.child}function Ku(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&Tt(o)))}function Md(o,l,p){switch(l.tag){case 3:lt(l,l.stateNode.containerInfo),Oe(l,Kn,o.memoizedState.cache),Nt();break;case 27:case 5:Re(l);break;case 4:lt(l,l.stateNode.containerInfo);break;case 10:Oe(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Se(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(re(l),l.flags|=128,null):(p&l.child.childLanes)!==0?bd(o,l,p):(re(l),o=qs(o,l,p),o!==null?o.sibling:null);re(l);break;case 19:var T=(o.flags&128)!==0;if(v=(p&l.childLanes)!==0,v||(ot(o,l,p,!1),v=(p&l.childLanes)!==0),T){if(v)return Sd(o,l,p);l.flags|=128}if(T=l.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),A(ui,ui.current),v)break;return null;case 22:return l.lanes=0,Km(o,l,p,l.pendingProps);case 24:Oe(l,Kn,o.memoizedState.cache)}return qs(o,l,p)}function Ed(o,l,p){if(o!==null)if(o.memoizedProps!==l.pendingProps)qn=!0;else{if(!Ku(o,p)&&(l.flags&128)===0)return qn=!1,Md(o,l,p);qn=(o.flags&131072)!==0}else qn=!1,dn&&(l.flags&1048576)!==0&&X(l,xc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(o=Jt(l.elementType),l.type=o,typeof o=="function")$o(o)?(v=Yo(o,v),l.tag=1,l=Qo(null,l,o,v,p)):(l.tag=0,l=Sf(null,l,o,v,p));else{if(o!=null){var T=o.$$typeof;if(T===eu){l.tag=11,l=Ym(null,l,o,v,p);break e}else if(T===kf){l.tag=14,l=Zm(null,l,o,v,p);break e}}throw l=x(o)||o,Error(s(306,l,""))}}return l;case 0:return Sf(o,l,l.type,l.pendingProps,p);case 1:return v=l.type,T=Yo(v,l.pendingProps),Qo(o,l,v,T,p);case 3:e:{if(lt(l,l.stateNode.containerInfo),o===null)throw Error(s(387));var C=l.pendingProps;T=l.memoizedState,v=T.element,ka(o,l),br(l,C,null,p);var F=l.memoizedState;if(C=F.cache,Oe(l,Kn,C),C!==T.cache&&Et(l,[Kn],p,!0),Ds(),C=F.element,Zn&&T.isDehydrated)if(T={element:C,isDehydrated:!1,cache:F.cache},l.updateQueue.baseState=T,l.memoizedState=T,l.flags&256){l=$m(o,l,C,p);break e}else if(C!==v){v=be(Error(s(424)),l),He(v),l=$m(o,l,C,p);break e}else for(Zn&&(Qn=Ig(l.stateNode.containerInfo),Ui=l,dn=!0,or=null,pa=!0),p=xp(l,null,C,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Nt(),C===v){l=qs(o,l,p);break e}Zi(o,l,C,p)}l=l.child}return l;case 26:if(ms)return Qu(o,l),o===null?(p=up(l.type,null,l.pendingProps,null))?l.memoizedState=p:dn||(l.stateNode=Kf(l.type,l.pendingProps,Ki.current,l)):l.memoizedState=up(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:if(Li)return Re(l),o===null&&Li&&dn&&(v=l.stateNode=Jf(l.type,l.pendingProps,Ki.current,Xi.current,!1),Ui=l,pa=!0,Qn=ip(l.type,v,Qn)),Zi(o,l,l.pendingProps.children,p),Qu(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&dn&&(Yg(l.type,l.pendingProps,Xi.current),(T=v=Qn)&&(v=zg(v,l.type,l.pendingProps,pa),v!==null?(l.stateNode=v,Ui=l,Qn=Ug(v),pa=!1,T=!0):T=!1),T||st(l)),Re(l),T=l.type,C=l.pendingProps,F=o!==null?o.memoizedProps:null,v=C.children,da(T,C)?v=null:F!==null&&da(T,F)&&(l.flags|=32),l.memoizedState!==null&&(T=xt(o,l,Pt,null,null,p),hi?ll._currentValue=T:ll._currentValue2=T),Qu(o,l),Zi(o,l,v,p),l.child;case 6:return o===null&&dn&&(lp(l.pendingProps,Xi.current),(o=p=Qn)&&(p=Bg(p,l.pendingProps,pa),p!==null?(l.stateNode=p,Ui=l,Qn=null,o=!0):o=!1),o||st(l)),null;case 13:return bd(o,l,p);case 4:return lt(l,l.stateNode.containerInfo),v=l.pendingProps,o===null?l.child=Ji(l,null,v,p):Zi(o,l,v,p),l.child;case 11:return Ym(o,l,l.type,l.pendingProps,p);case 7:return Zi(o,l,l.pendingProps,p),l.child;case 8:return Zi(o,l,l.pendingProps.children,p),l.child;case 12:return Zi(o,l,l.pendingProps.children,p),l.child;case 10:return v=l.pendingProps,Oe(l,l.type,v.value),Zi(o,l,v.children,p),l.child;case 9:return T=l.type._context,v=l.pendingProps.children,Qe(l),T=G(T),v=v(T),l.flags|=1,Zi(o,l,v,p),l.child;case 14:return Zm(o,l,l.type,l.pendingProps,p);case 15:return Qm(o,l,l.type,l.pendingProps,p);case 19:return Sd(o,l,p);case 31:return Jm(o,l,p);case 22:return Km(o,l,p,l.pendingProps);case 24:return Qe(l),v=G(Kn),o===null?(T=Ge(),T===null&&(T=rn,C=Te(),T.pooledCache=C,C.refCount++,C!==null&&(T.pooledCacheLanes|=p),T=C),l.memoizedState={parent:v,cache:T},Ri(l),Oe(l,Kn,T)):((o.lanes&p)!==0&&(ka(o,l),br(l,null,null,p),Ds()),T=o.memoizedState,C=l.memoizedState,T.parent!==v?(T={parent:v,cache:v},l.memoizedState=T,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=T),Oe(l,Kn,v)):(v=C.cache,Oe(l,Kn,v),v!==T.cache&&Et(l,[Kn],p,!0))),Zi(o,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(s(156,l.tag))}function os(o){o.flags|=4}function Ju(o){ja&&(o.flags|=8)}function tg(o,l){if(o!==null&&o.child===l.child)return!1;if((l.flags&16)!==0)return!0;for(o=l.child;o!==null;){if((o.flags&8218)!==0||(o.subtreeFlags&8218)!==0)return!0;o=o.sibling}return!1}function Td(o,l,p,v){if(gn)for(p=l.child;p!==null;){if(p.tag===5||p.tag===6)hc(o,p.stateNode);else if(!(p.tag===4||Li&&p.tag===27)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}else if(ja)for(var T=l.child;T!==null;){if(T.tag===5){var C=T.stateNode;p&&v&&(C=Rg(C,T.type,T.memoizedProps)),hc(o,C)}else if(T.tag===6)C=T.stateNode,p&&v&&(C=tp(C,T.memoizedProps)),hc(o,C);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)C=T.child,C!==null&&(C.return=T),Td(o,T,!0,!0);else if(T.child!==null){T.child.return=T,T=T.child;continue}}if(T===l)break;for(;T.sibling===null;){if(T.return===null||T.return===l)return;T=T.return}T.sibling.return=T.return,T=T.sibling}}function ng(o,l,p,v){var T=!1;if(ja)for(var C=l.child;C!==null;){if(C.tag===5){var F=C.stateNode;p&&v&&(F=Rg(F,C.type,C.memoizedProps)),$d(o,F)}else if(C.tag===6)F=C.stateNode,p&&v&&(F=tp(F,C.memoizedProps)),$d(o,F);else if(C.tag!==4){if(C.tag===22&&C.memoizedState!==null)T=C.child,T!==null&&(T.return=C),ng(o,C,!0,!0),T=!0;else if(C.child!==null){C.child.return=C,C=C.child;continue}}if(C===l)break;for(;C.sibling===null;){if(C.return===null||C.return===l)return T;C=C.return}C.sibling.return=C.return,C=C.sibling}return T}function ig(o,l){if(ja&&tg(o,l)){o=l.stateNode;var p=o.containerInfo,v=Jd();ng(v,l,!1,!1),o.pendingChildren=v,os(l),Cg(p,v)}}function Ad(o,l,p,v){if(gn)o.memoizedProps!==v&&os(l);else if(ja){var T=o.stateNode,C=o.memoizedProps;if((o=tg(o,l))||C!==v){var F=Xi.current;C=wg(T,p,C,v,!o,null),C===T?l.stateNode=T:(Ju(l),Ma(C,p,v,F)&&os(l),l.stateNode=C,o&&Td(C,l,!1,!1))}else l.stateNode=T}}function ca(o,l,p,v,T){if((o.mode&32)!==0&&(p===null?dc(l,v):su(l,p,v))){if(o.flags|=16777216,(T&335544128)===T||Vd(l,v))if(ni(o.stateNode,l,v))o.flags|=8192;else if(mn())o.flags|=8192;else throw ma=lr,uh}else o.flags&=-16777217}function Hl(o,l){if(dp(l)){if(o.flags|=16777216,!pp(l))if(mn())o.flags|=8192;else throw ma=lr,uh}else o.flags&=-16777217}function $u(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?U():536870912,o.lanes|=l,pu|=l)}function Gl(o,l){if(!dn)switch(o.tailMode){case"hidden":l=o.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:v.sibling=null}}function Fn(o){var l=o.alternate!==null&&o.alternate.child===o.child,p=0,v=0;if(l)for(var T=o.child;T!==null;)p|=T.lanes|T.childLanes,v|=T.subtreeFlags&65011712,v|=T.flags&65011712,T.return=o,T=T.sibling;else for(T=o.child;T!==null;)p|=T.lanes|T.childLanes,v|=T.subtreeFlags,v|=T.flags,T.return=o,T=T.sibling;return o.subtreeFlags|=v,o.childLanes=p,l}function ag(o,l,p){var v=l.pendingProps;switch(Ae(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fn(l),null;case 1:return Fn(l),null;case 3:return p=l.stateNode,v=null,o!==null&&(v=o.memoizedState.cache),l.memoizedState.cache!==v&&(l.flags|=2048),nt(Kn),de(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(o===null||o.child===null)&&(tn(l)?os(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Le())),ig(o,l),Fn(l),null;case 26:if(ms){var T=l.type,C=l.memoizedState;return o===null?(os(l),C!==null?(Fn(l),Hl(l,C)):(Fn(l),ca(l,T,null,v,p))):C?C!==o.memoizedState?(os(l),Fn(l),Hl(l,C)):(Fn(l),l.flags&=-16777217):(C=o.memoizedProps,gn?C!==v&&os(l):Ad(o,l,T,v),Fn(l),ca(l,T,C,v,p)),null}case 27:if(Li){if(tt(l),p=Ki.current,T=l.type,o!==null&&l.stateNode!=null)gn?o.memoizedProps!==v&&os(l):Ad(o,l,T,v);else{if(!v){if(l.stateNode===null)throw Error(s(166));return Fn(l),null}o=Xi.current,tn(l)?ht(l,o):(o=Jf(T,v,p,o,!0),l.stateNode=o,os(l))}return Fn(l),null}case 5:if(tt(l),T=l.type,o!==null&&l.stateNode!=null)Ad(o,l,T,v);else{if(!v){if(l.stateNode===null)throw Error(s(166));return Fn(l),null}if(C=Xi.current,tn(l))ht(l,C),Wg(l.stateNode,T,v,C)&&(l.flags|=64);else{var F=Fd(T,v,Ki.current,C,l);Ju(l),Td(F,l,!1,!1),l.stateNode=F,Ma(F,T,v,C)&&os(l)}}return Fn(l),ca(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,p),null;case 6:if(o&&l.stateNode!=null)p=o.memoizedProps,gn?p!==v&&os(l):ja&&(p!==v?(o=Ki.current,p=Xi.current,Ju(l),l.stateNode=Ur(v,o,p,l)):l.stateNode=o.stateNode);else{if(typeof v!="string"&&l.stateNode===null)throw Error(s(166));if(o=Ki.current,p=Xi.current,tn(l)){if(!Zn)throw Error(s(176));if(o=l.stateNode,p=l.memoizedProps,v=null,T=Ui,T!==null)switch(T.tag){case 27:case 5:v=T.memoizedProps}o_(o,p,l,v)||st(l,!0)}else Ju(l),l.stateNode=Ur(v,o,p,l)}return Fn(l),null;case 31:if(p=l.memoizedState,o===null||o.memoizedState!==null){if(v=tn(l),p!==null){if(o===null){if(!v)throw Error(s(318));if(!Zn)throw Error(s(556));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(557));sp(o,l)}else Nt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Fn(l),o=!1}else p=Le(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=p),o=!0;if(!o)return l.flags&256?(Je(l),l):(Je(l),null);if((l.flags&128)!==0)throw Error(s(558))}return Fn(l),null;case 13:if(v=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(T=tn(l),v!==null&&v.dehydrated!==null){if(o===null){if(!T)throw Error(s(318));if(!Zn)throw Error(s(344));if(T=l.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(s(317));Vg(T,l)}else Nt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Fn(l),T=!1}else T=Le(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=T),T=!0;if(!T)return l.flags&256?(Je(l),l):(Je(l),null)}return Je(l),(l.flags&128)!==0?(l.lanes=p,l):(p=v!==null,o=o!==null&&o.memoizedState!==null,p&&(v=l.child,T=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(T=v.alternate.memoizedState.cachePool.pool),C=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(C=v.memoizedState.cachePool.pool),C!==T&&(v.flags|=2048)),p!==o&&p&&(l.child.flags|=8192),$u(l,l.updateQueue),Fn(l),null);case 4:return de(),ig(o,l),o===null&&On(l.stateNode.containerInfo),Fn(l),null;case 10:return nt(l.type),Fn(l),null;case 19:if(M(ui),v=l.memoizedState,v===null)return Fn(l),null;if(T=(l.flags&128)!==0,C=v.rendering,C===null)if(T)Gl(v,!1);else{if(si!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(C=mt(o),C!==null){for(l.flags|=128,Gl(v,!1),o=C.updateQueue,l.updateQueue=o,$u(l,o),l.subtreeFlags=0,o=p,p=l.child;p!==null;)Of(p,o),p=p.sibling;return A(ui,ui.current&1|2),dn&&Ne(l,v.treeForkCount),l.child}o=o.sibling}v.tail!==null&&aa()>Co&&(l.flags|=128,T=!0,Gl(v,!1),l.lanes=4194304)}else{if(!T)if(o=mt(C),o!==null){if(l.flags|=128,T=!0,o=o.updateQueue,l.updateQueue=o,$u(l,o),Gl(v,!0),v.tail===null&&v.tailMode==="hidden"&&!C.alternate&&!dn)return Fn(l),null}else 2*aa()-v.renderingStartTime>Co&&p!==536870912&&(l.flags|=128,T=!0,Gl(v,!1),l.lanes=4194304);v.isBackwards?(C.sibling=l.child,l.child=C):(o=v.last,o!==null?o.sibling=C:l.child=C,v.last=C)}return v.tail!==null?(o=v.tail,v.rendering=o,v.tail=o.sibling,v.renderingStartTime=aa(),o.sibling=null,p=ui.current,A(ui,T?p&1|2:p&1),dn&&Ne(l,v.treeForkCount),o):(Fn(l),null);case 22:case 23:return Je(l),k(),v=l.memoizedState!==null,o!==null?o.memoizedState!==null!==v&&(l.flags|=8192):v&&(l.flags|=8192),v?(p&536870912)!==0&&(l.flags&128)===0&&(Fn(l),l.subtreeFlags&6&&(l.flags|=8192)):Fn(l),p=l.updateQueue,p!==null&&$u(l,p.retryQueue),p=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),v=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),v!==p&&(l.flags|=2048),o!==null&&M(xo),null;case 24:return p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),nt(Kn),Fn(l),null;case 25:return null;case 30:return null}throw Error(s(156,l.tag))}function wd(o,l){switch(Ae(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return nt(Kn),de(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return tt(l),null;case 31:if(l.memoizedState!==null){if(Je(l),l.alternate===null)throw Error(s(340));Nt()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Je(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(s(340));Nt()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return M(ui),null;case 4:return de(),null;case 10:return nt(l.type),null;case 22:case 23:return Je(l),k(),o!==null&&M(xo),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return nt(Kn),null;case 25:return null;default:return null}}function sg(o,l){switch(Ae(l),l.tag){case 3:nt(Kn),de();break;case 26:case 27:case 5:tt(l);break;case 4:de();break;case 31:l.memoizedState!==null&&Je(l);break;case 13:Je(l);break;case 19:M(ui);break;case 10:nt(l.type);break;case 22:case 23:Je(l),k(),o!==null&&M(xo);break;case 24:nt(Kn)}}function js(o,l){try{var p=l.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var T=v.next;p=T;do{if((p.tag&o)===o){v=void 0;var C=p.create,F=p.inst;v=C(),F.destroy=v}p=p.next}while(p!==T)}}catch(ee){Vt(l,l.return,ee)}}function Ys(o,l,p){try{var v=l.updateQueue,T=v!==null?v.lastEffect:null;if(T!==null){var C=T.next;v=C;do{if((v.tag&o)===o){var F=v.inst,ee=F.destroy;if(ee!==void 0){F.destroy=void 0,T=l;var we=p,ke=ee;try{ke()}catch(it){Vt(T,we,it)}}}v=v.next}while(v!==C)}}catch(it){Vt(l,l.return,it)}}function Xl(o){var l=o.updateQueue;if(l!==null){var p=o.stateNode;try{Mr(l,p)}catch(v){Vt(o,o.return,v)}}}function Ef(o,l,p){p.props=Yo(o.type,o.memoizedProps),p.state=o.memoizedState;try{p.componentWillUnmount()}catch(v){Vt(o,l,v)}}function Wl(o,l){try{var p=o.ref;if(p!==null){switch(o.tag){case 26:case 27:case 5:var v=nu(o.stateNode);break;case 30:v=o.stateNode;break;default:v=o.stateNode}typeof p=="function"?o.refCleanup=p(v):p.current=v}}catch(T){Vt(o,l,T)}}function ia(o,l){var p=o.ref,v=o.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(T){Vt(o,l,T)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(T){Vt(o,l,T)}else p.current=null}function Jo(o){var l=o.type,p=o.memoizedProps,v=o.stateNode;try{_g(v,l,p,o)}catch(T){Vt(o,o.return,T)}}function ec(o,l,p){try{xg(o.stateNode,o.type,p,l,o)}catch(v){Vt(o,o.return,v)}}function Cd(o){return o.tag===5||o.tag===3||(ms?o.tag===26:!1)||(Li?o.tag===27&&ul(o.type):!1)||o.tag===4}function Tr(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Cd(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(Li&&o.tag===27&&ul(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tf(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?Sg(p,o,l):Yd(p,o);else if(v!==4&&(Li&&v===27&&ul(o.type)&&(p=o.stateNode,l=null),o=o.child,o!==null))for(Tf(o,l,p),o=o.sibling;o!==null;)Tf(o,l,p),o=o.sibling}function tc(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?bg(p,o,l):jd(p,o);else if(v!==4&&(Li&&v===27&&ul(o.type)&&(p=o.stateNode),o=o.child,o!==null))for(tc(o,l,p),o=o.sibling;o!==null;)tc(o,l,p),o=o.sibling}function Rd(o,l,p){o=o.containerInfo;try{ep(o,p)}catch(v){Vt(l,l.return,v)}}function rg(o){var l=o.stateNode,p=o.memoizedProps;try{Mi(o.type,p,l,o)}catch(v){Vt(o,o.return,v)}}function i_(o,l){for(Vf(o.containerInfo),mi=l;mi!==null;)if(o=mi,l=o.child,(o.subtreeFlags&1028)!==0&&l!==null)l.return=o,mi=l;else for(;mi!==null;){o=mi;var p=o.alternate;switch(l=o.flags,o.tag){case 0:if((l&4)!==0&&(l=o.updateQueue,l=l!==null?l.events:null,l!==null))for(var v=0;v<l.length;v++){var T=l[v];T.ref.impl=T.nextImpl}break;case 11:case 15:break;case 1:if((l&1024)!==0&&p!==null){l=void 0,v=o,T=p.memoizedProps,p=p.memoizedState;var C=v.stateNode;try{var F=Yo(v.type,T);l=C.getSnapshotBeforeUpdate(F,p),C.__reactInternalSnapshotBeforeUpdate=l}catch(ee){Vt(v,v.return,ee)}}break;case 3:(l&1024)!==0&&gn&&Kd(o.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(s(163))}if(l=o.sibling,l!==null){l.return=o.return,mi=l;break}mi=o.return}}function og(o,l,p){var v=p.flags;switch(p.tag){case 0:case 11:case 15:fa(o,p),v&4&&js(5,p);break;case 1:if(fa(o,p),v&4)if(o=p.stateNode,l===null)try{o.componentDidMount()}catch(F){Vt(p,p.return,F)}else{var T=Yo(p.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(T,l,o.__reactInternalSnapshotBeforeUpdate)}catch(F){Vt(p,p.return,F)}}v&64&&Xl(p),v&512&&Wl(p,p.return);break;case 3:if(fa(o,p),v&64&&(v=p.updateQueue,v!==null)){if(o=null,p.child!==null)switch(p.child.tag){case 27:case 5:o=nu(p.child.stateNode);break;case 1:o=p.child.stateNode}try{Mr(v,o)}catch(F){Vt(p,p.return,F)}}break;case 27:Li&&l===null&&v&4&&rg(p);case 26:case 5:if(fa(o,p),l===null){if(v&4)Jo(p);else if(v&64){o=p.type,l=p.memoizedProps,T=p.stateNode;try{Gg(T,o,l,p)}catch(F){Vt(p,p.return,F)}}}v&512&&Wl(p,p.return);break;case 12:fa(o,p);break;case 31:fa(o,p),v&4&&us(o,p);break;case 13:fa(o,p),v&4&&ic(o,p),v&64&&(v=p.memoizedState,v!==null&&(v=v.dehydrated,v!==null&&(p=a_.bind(null,p),Yf(v,p))));break;case 22:if(v=p.memoizedState!==null||ci,!v){l=l!==null&&l.memoizedState!==null||fi,T=ci;var C=fi;ci=v,(fi=l)&&!C?fs(o,p,(p.subtreeFlags&8772)!==0):fa(o,p),ci=T,fi=C}break;case 30:break;default:fa(o,p)}}function Nd(o){var l=o.alternate;l!==null&&(o.alternate=null,Nd(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Hf(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function ls(o,l,p){for(p=p.child;p!==null;)nc(o,l,p),p=p.sibling}function nc(o,l,p){if(Aa&&typeof Aa.onCommitFiberUnmount=="function")try{Aa.onCommitFiberUnmount(hl,p)}catch{}switch(p.tag){case 26:if(ms){fi||ia(p,l),ls(o,l,p),p.memoizedState?yo(p.memoizedState):p.stateNode&&hp(p.stateNode);break}case 27:if(Li){fi||ia(p,l);var v=ai,T=gi;ul(p.type)&&(ai=p.stateNode,gi=!1),ls(o,l,p),Gi(p.stateNode),ai=v,gi=T;break}case 5:fi||ia(p,l);case 6:if(gn){if(v=ai,T=gi,ai=null,ls(o,l,p),ai=v,gi=T,ai!==null)if(gi)try{Zd(ai,p.stateNode)}catch(C){Vt(p,l,C)}else try{Mg(ai,p.stateNode)}catch(C){Vt(p,l,C)}}else ls(o,l,p);break;case 18:gn&&ai!==null&&(gi?Zf(ai,p.stateNode):op(ai,p.stateNode));break;case 4:gn?(v=ai,T=gi,ai=p.stateNode.containerInfo,gi=!0,ls(o,l,p),ai=v,gi=T):(ja&&Rd(p.stateNode,p,Jd()),ls(o,l,p));break;case 0:case 11:case 14:case 15:Ys(2,p,l),fi||Ys(4,p,l),ls(o,l,p);break;case 1:fi||(ia(p,l),v=p.stateNode,typeof v.componentWillUnmount=="function"&&Ef(p,l,v)),ls(o,l,p);break;case 21:ls(o,l,p);break;case 22:fi=(v=fi)||p.memoizedState!==null,ls(o,l,p),fi=v;break;default:ls(o,l,p)}}function us(o,l){if(Zn&&l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{l_(o)}catch(p){Vt(l,l.return,p)}}}function ic(o,l){if(Zn&&l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{u_(o)}catch(p){Vt(l,l.return,p)}}function cs(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new Sp),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new Sp),l;default:throw Error(s(435,o.tag))}}function Ar(o,l){var p=cs(o);l.forEach(function(v){if(!p.has(v)){p.add(v);var T=s_.bind(null,o,v);v.then(T,T)}})}function Vi(o,l){var p=l.deletions;if(p!==null)for(var v=0;v<p.length;v++){var T=p[v],C=o,F=l;if(gn){var ee=F;e:for(;ee!==null;){switch(ee.tag){case 27:if(Li){if(ul(ee.type)){ai=ee.stateNode,gi=!1;break e}break}case 5:ai=ee.stateNode,gi=!1;break e;case 3:case 4:ai=ee.stateNode.containerInfo,gi=!0;break e}ee=ee.return}if(ai===null)throw Error(s(160));nc(C,F,T),ai=null,gi=!1}else nc(C,F,T);C=T.alternate,C!==null&&(C.return=null),T.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)ac(l,o),l=l.sibling}function ac(o,l){var p=o.alternate,v=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Vi(l,o),Hi(o),v&4&&(Ys(3,o,o.return),js(3,o),Ys(5,o,o.return));break;case 1:Vi(l,o),Hi(o),v&512&&(fi||p===null||ia(p,p.return)),v&64&&ci&&(o=o.updateQueue,o!==null&&(v=o.callbacks,v!==null&&(p=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=p===null?v:p.concat(v))));break;case 26:if(ms){var T=Ln;if(Vi(l,o),Hi(o),v&512&&(fi||p===null||ia(p,p.return)),v&4){v=p!==null?p.memoizedState:null;var C=o.memoizedState;p===null?C===null?o.stateNode===null?o.stateNode=Zg(T,o.type,o.memoizedProps,o):fp(T,o.type,o.stateNode):o.stateNode=cp(T,C,o.memoizedProps):v!==C?(v===null?p.stateNode!==null&&hp(p.stateNode):yo(v),C===null?fp(T,o.type,o.stateNode):cp(T,C,o.memoizedProps)):C===null&&o.stateNode!==null&&ec(o,o.memoizedProps,p.memoizedProps)}break}case 27:if(Li){Vi(l,o),Hi(o),v&512&&(fi||p===null||ia(p,p.return)),p!==null&&v&4&&ec(o,o.memoizedProps,p.memoizedProps);break}case 5:if(Vi(l,o),Hi(o),v&512&&(fi||p===null||ia(p,p.return)),gn){if(o.flags&32){T=o.stateNode;try{Qd(T)}catch(We){Vt(o,o.return,We)}}v&4&&o.stateNode!=null&&(T=o.memoizedProps,ec(o,T,p!==null?p.memoizedProps:T)),v&1024&&(uu=!0)}else ja&&o.alternate!==null&&(o.alternate.stateNode=o.stateNode);break;case 6:if(Vi(l,o),Hi(o),v&4&&gn){if(o.stateNode===null)throw Error(s(162));v=o.memoizedProps,p=p!==null?p.memoizedProps:v,T=o.stateNode;try{yg(T,p,v)}catch(We){Vt(o,o.return,We)}}break;case 3:if(ms?(Qg(),T=Ln,Ln=gc(l.containerInfo),Vi(l,o),Ln=T):Vi(l,o),Hi(o),v&4){if(gn&&Zn&&p!==null&&p.memoizedState.isDehydrated)try{Xg(l.containerInfo)}catch(We){Vt(o,o.return,We)}if(ja){v=l.containerInfo,p=l.pendingChildren;try{ep(v,p)}catch(We){Vt(o,o.return,We)}}}uu&&(uu=!1,Af(o));break;case 4:ms?(p=Ln,Ln=gc(o.stateNode.containerInfo),Vi(l,o),Hi(o),Ln=p):(Vi(l,o),Hi(o)),v&4&&ja&&Rd(o.stateNode,o,o.stateNode.pendingChildren);break;case 12:Vi(l,o),Hi(o);break;case 31:Vi(l,o),Hi(o),v&4&&(v=o.updateQueue,v!==null&&(o.updateQueue=null,Ar(o,v)));break;case 13:Vi(l,o),Hi(o),o.child.flags&8192&&o.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ac=aa()),v&4&&(v=o.updateQueue,v!==null&&(o.updateQueue=null,Ar(o,v)));break;case 22:T=o.memoizedState!==null;var F=p!==null&&p.memoizedState!==null,ee=ci,we=fi;if(ci=ee||T,fi=we||F,Vi(l,o),fi=we,ci=ee,Hi(o),v&8192&&(l=o.stateNode,l._visibility=T?l._visibility&-2:l._visibility|1,T&&(p===null||F||ci||fi||ao(o)),gn)){e:if(p=null,gn)for(l=o;;){if(l.tag===5||ms&&l.tag===26){if(p===null){F=p=l;try{C=F.stateNode,T?r_(C):Tg(F.stateNode,F.memoizedProps)}catch(We){Vt(F,F.return,We)}}}else if(l.tag===6){if(p===null){F=l;try{var ke=F.stateNode;T?Eg(ke):Ag(ke,F.memoizedProps)}catch(We){Vt(F,F.return,We)}}}else if(l.tag===18){if(p===null){F=l;try{var it=F.stateNode;T?qg(it):jg(F.stateNode)}catch(We){Vt(F,F.return,We)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}}v&4&&(v=o.updateQueue,v!==null&&(p=v.retryQueue,p!==null&&(v.retryQueue=null,Ar(o,p))));break;case 19:Vi(l,o),Hi(o),v&4&&(v=o.updateQueue,v!==null&&(o.updateQueue=null,Ar(o,v)));break;case 30:break;case 21:break;default:Vi(l,o),Hi(o)}}function Hi(o){var l=o.flags;if(l&2){try{for(var p,v=o.return;v!==null;){if(Cd(v)){p=v;break}v=v.return}if(gn){if(p==null)throw Error(s(160));switch(p.tag){case 27:if(Li){var T=p.stateNode,C=Tr(o);tc(o,C,T);break}case 5:var F=p.stateNode;p.flags&32&&(Qd(F),p.flags&=-33);var ee=Tr(o);tc(o,ee,F);break;case 3:case 4:var we=p.stateNode.containerInfo,ke=Tr(o);Tf(o,ke,we);break;default:throw Error(s(161))}}}catch(it){Vt(o,o.return,it)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function Af(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;Af(l),l.tag===5&&l.flags&1024&&Gd(l.stateNode),o=o.sibling}}function fa(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)og(o,l.alternate,l),l=l.sibling}function ao(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:Ys(4,l,l.return),ao(l);break;case 1:ia(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&Ef(l,l.return,p),ao(l);break;case 27:Li&&Gi(l.stateNode);case 26:case 5:ia(l,l.return),ao(l);break;case 22:l.memoizedState===null&&ao(l);break;case 30:ao(l);break;default:ao(l)}o=o.sibling}}function fs(o,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,T=o,C=l,F=C.flags;switch(C.tag){case 0:case 11:case 15:fs(T,C,p),js(4,C);break;case 1:if(fs(T,C,p),v=C,T=v.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(ke){Vt(v,v.return,ke)}if(v=C,T=v.updateQueue,T!==null){var ee=v.stateNode;try{var we=T.shared.hiddenCallbacks;if(we!==null)for(T.shared.hiddenCallbacks=null,T=0;T<we.length;T++)Sr(we[T],ee)}catch(ke){Vt(v,v.return,ke)}}p&&F&64&&Xl(C),Wl(C,C.return);break;case 27:Li&&rg(C);case 26:case 5:fs(T,C,p),p&&v===null&&F&4&&Jo(C),Wl(C,C.return);break;case 12:fs(T,C,p);break;case 31:fs(T,C,p),p&&F&4&&us(T,C);break;case 13:fs(T,C,p),p&&F&4&&ic(T,C);break;case 22:C.memoizedState===null&&fs(T,C,p),Wl(C,C.return);break;case 30:break;default:fs(T,C,p)}l=l.sibling}}function so(o,l){var p=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==p&&(o!=null&&o.refCount++,p!=null&&Ie(p))}function Dd(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Ie(o))}function ei(o,l,p,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)wf(o,l,p,v),l=l.sibling}function wf(o,l,p,v){var T=l.flags;switch(l.tag){case 0:case 11:case 15:ei(o,l,p,v),T&2048&&js(9,l);break;case 1:ei(o,l,p,v);break;case 3:ei(o,l,p,v),T&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Ie(o)));break;case 12:if(T&2048){ei(o,l,p,v),o=l.stateNode;try{var C=l.memoizedProps,F=C.id,ee=C.onPostCommit;typeof ee=="function"&&ee(F,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(we){Vt(l,l.return,we)}}else ei(o,l,p,v);break;case 31:ei(o,l,p,v);break;case 13:ei(o,l,p,v);break;case 23:break;case 22:C=l.stateNode,F=l.alternate,l.memoizedState!==null?C._visibility&2?ei(o,l,p,v):ql(o,l):C._visibility&2?ei(o,l,p,v):(C._visibility|=2,xa(o,l,p,v,(l.subtreeFlags&10256)!==0||!1)),T&2048&&so(F,l);break;case 24:ei(o,l,p,v),T&2048&&Dd(l.alternate,l);break;default:ei(o,l,p,v)}}function xa(o,l,p,v,T){for(T=T&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var C=o,F=l,ee=p,we=v,ke=F.flags;switch(F.tag){case 0:case 11:case 15:xa(C,F,ee,we,T),js(8,F);break;case 23:break;case 22:var it=F.stateNode;F.memoizedState!==null?it._visibility&2?xa(C,F,ee,we,T):ql(C,F):(it._visibility|=2,xa(C,F,ee,we,T)),T&&ke&2048&&so(F.alternate,F);break;case 24:xa(C,F,ee,we,T),T&&ke&2048&&Dd(F.alternate,F);break;default:xa(C,F,ee,we,T)}l=l.sibling}}function ql(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=o,v=l,T=v.flags;switch(v.tag){case 22:ql(p,v),T&2048&&so(v.alternate,v);break;case 24:ql(p,v),T&2048&&Dd(v.alternate,v);break;default:ql(p,v)}l=l.sibling}}function Zs(o,l,p){if(o.subtreeFlags&Ka)for(o=o.child;o!==null;)ro(o,l,p),o=o.sibling}function ro(o,l,p){switch(o.tag){case 26:if(Zs(o,l,p),o.flags&Ka)if(o.memoizedState!==null)Kg(p,Ln,o.memoizedState,o.memoizedProps);else{var v=o.stateNode,T=o.type;o=o.memoizedProps,((l&335544128)===l||Vd(T,o))&&Gf(p,v,T,o)}break;case 5:Zs(o,l,p),o.flags&Ka&&(v=o.stateNode,T=o.type,o=o.memoizedProps,((l&335544128)===l||Vd(T,o))&&Gf(p,v,T,o));break;case 3:case 4:ms?(v=Ln,Ln=gc(o.stateNode.containerInfo),Zs(o,l,p),Ln=v):Zs(o,l,p);break;case 22:o.memoizedState===null&&(v=o.alternate,v!==null&&v.memoizedState!==null?(v=Ka,Ka=16777216,Zs(o,l,p),Ka=v):Zs(o,l,p));break;default:Zs(o,l,p)}}function Cf(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function jl(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var v=l[p];mi=v,Xa(v,o)}Cf(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Rf(o),o=o.sibling}function Rf(o){switch(o.tag){case 0:case 11:case 15:jl(o),o.flags&2048&&Ys(9,o,o.return);break;case 3:jl(o);break;case 12:jl(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,sc(o)):jl(o);break;default:jl(o)}}function sc(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var v=l[p];mi=v,Xa(v,o)}Cf(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:Ys(8,l,l.return),sc(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,sc(l));break;default:sc(l)}o=o.sibling}}function Xa(o,l){for(;mi!==null;){var p=mi;switch(p.tag){case 0:case 11:case 15:Ys(8,p,l);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var v=p.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:Ie(p.memoizedState.cache)}if(v=p.child,v!==null)v.return=p,mi=v;else e:for(p=o;mi!==null;){v=mi;var T=v.sibling,C=v.return;if(Nd(v),v===p){mi=null;break e}if(T!==null){T.return=C,mi=T;break e}mi=C}}}function oo(o){var l=Yt(o);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(s(364));return l}if(o=di(o),o===null)throw Error(s(362));return o.stateNode.current}function lo(o,l){var p=o.tag;switch(l.$$typeof){case Ms:if(o.type===l.value)return!0;break;case fu:e:{for(l=l.value,o=[o,0],p=0;p<o.length;){var v=o[p++],T=v.tag,C=o[p++],F=l[C];if(T!==5&&T!==26&&T!==27||!go(v)){for(;F!=null&&lo(v,F);)C++,F=l[C];if(C===l.length){l=!0;break e}else for(v=v.child;v!==null;)o.push(v,C),v=v.sibling}}l=!1}return l;case hu:if((p===5||p===26||p===27)&&qd(o.stateNode,l.value))return!0;break;case Eo:if((p===5||p===6||p===26||p===27)&&(o=pc(o),o!==null&&0<=o.indexOf(l.value)))return!0;break;case Ec:if((p===5||p===26||p===27)&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(s(365))}return!1}function Yl(o){switch(o.$$typeof){case Ms:return"<"+(x(o.value)||"Unknown")+">";case fu:return":has("+(Yl(o)||"")+")";case hu:return'[role="'+o.value+'"]';case Eo:return'"'+o.value+'"';case Ec:return'[data-testname="'+o.value+'"]';default:throw Error(s(365))}}function Zl(o,l){var p=[];o=[o,0];for(var v=0;v<o.length;){var T=o[v++],C=T.tag,F=o[v++],ee=l[F];if(C!==5&&C!==26&&C!==27||!go(T)){for(;ee!=null&&lo(T,ee);)F++,ee=l[F];if(F===l.length)p.push(T);else for(T=T.child;T!==null;)o.push(T,F),T=T.sibling}}return p}function ba(o,l){if(!Di)throw Error(s(363));o=oo(o),o=Zl(o,l),l=[],o=Array.from(o);for(var p=0;p<o.length;){var v=o[p++],T=v.tag;if(T===5||T===26||T===27)go(v)||l.push(v.stateNode);else for(v=v.child;v!==null;)o.push(v),v=v.sibling}return l}function Yn(){return(cn&2)!==0&&pn!==0?pn&-pn:Ut.T!==null?me():au()}function wr(){if(va===0)if((pn&536870912)===0||dn){var o=fl;fl<<=1,(fl&3932160)===0&&(fl=262144),va=o}else va=536870912;return o=wa.current,o!==null&&(o.flags|=32),va}function ti(o,l,p){(o===rn&&(Un===2||Un===9)||o.cancelPendingCommit!==null)&&(li(o,0),Ks(o,pn,va,!1)),z(o,p),((cn&2)===0||o!==rn)&&(o===rn&&((cn&2)===0&&(wo|=p),si===4&&Ks(o,pn,va,!1)),dt(o))}function Us(o,l,p){if((cn&6)!==0)throw Error(s(327));var v=!p&&(l&127)===0&&(l&o.expiredLanes)===0||N(o,l),T=v?cg(o,l):Js(o,l,!0),C=v;do{if(T===0){To&&!v&&Ks(o,l,0,!1);break}else{if(p=o.current.alternate,C&&!lg(p)){T=Js(o,l,!1),C=!1;continue}if(T===2){if(C=l,o.errorRecoveryDisabledLanes&C)var F=0;else F=o.pendingLanes&-536870913,F=F!==0?F:F&536870912?536870912:0;if(F!==0){l=F;e:{var ee=o;T=Tc;var we=Zn&&ee.current.memoizedState.isDehydrated;if(we&&(li(ee,F).flags|=256),F=Js(ee,F,!1),F!==2){if(Ao&&!we){ee.errorRecoveryDisabledLanes|=C,wo|=C,T=4;break e}C=Ra,Ra=T,C!==null&&(Ra===null?Ra=C:Ra.push.apply(Ra,C))}T=F}if(C=!1,T!==2)continue}}if(T===1){li(o,0),Ks(o,l,0,!0);break}e:{switch(v=o,C=T,C){case 0:case 1:throw Error(s(345));case 4:if((l&4194048)!==l)break;case 6:Ks(v,l,va,!zs);break e;case 2:Ra=null;break;case 3:case 5:break;default:throw Error(s(329))}if((l&62914560)===l&&(T=Ac+300-aa(),10<T)){if(Ks(v,l,va,!zs),E(v,0,!0)!==0)break e;hr=l,v.timeoutHandle=kd(Qs.bind(null,v,p,Ra,wc,fh,l,va,wo,pu,zs,C,"Throttled",-0,0),T);break e}Qs(v,p,Ra,wc,fh,l,va,wo,pu,zs,C,null,-0,0)}}break}while(!0);dt(o)}function Qs(o,l,p,v,T,C,F,ee,we,ke,it,We,gt,qt){if(o.timeoutHandle=Ea,We=l.subtreeFlags,We&8192||(We&16785408)===16785408){We=Hd(),ro(l,C,We);var vi=(C&62914560)===C?Ac-aa():(C&4194048)===C?yl-aa():0;if(vi=vg(We,vi),vi!==null){hr=C,o.cancelPendingCommit=vi(er.bind(null,o,l,C,p,v,T,F,ee,we,it,We,null,gt,qt)),Ks(o,C,F,!ke);return}}er(o,l,C,p,v,T,F,ee,we)}function lg(o){for(var l=o;;){var p=l.tag;if((p===0||p===11||p===15)&&l.flags&16384&&(p=l.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var v=0;v<p.length;v++){var T=p[v],C=T.getSnapshot;T=T.value;try{if(!pi(C(),T))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ks(o,l,p,v){l&=~du,l&=~wo,o.suspendedLanes|=l,o.pingedLanes&=~l,v&&(o.warmLanes|=l),v=o.expirationTimes;for(var T=l;0<T;){var C=31-Ta(T),F=1<<C;v[C]=-1,T&=~F}p!==0&&W(o,p,l)}function Nf(){return(cn&6)===0?(Ke(0),!1):!0}function Df(){if(fn!==null){if(Un===0)var o=fn.return;else o=fn,Os=Vn=null,In(o),bo=null,dl=0,o=fn;for(;o!==null;)sg(o.alternate,o),o=o.return;fn=null}}function li(o,l){var p=o.timeoutHandle;p!==Ea&&(o.timeoutHandle=Ea,gg(p)),p=o.cancelPendingCommit,p!==null&&(o.cancelPendingCommit=null,p()),hr=0,Df(),rn=o,fn=p=qa(o.current,null),pn=l,Un=0,Ei=null,zs=!1,To=N(o,l),Ao=!1,pu=va=du=wo=Fr=si=0,Ra=Tc=null,fh=!1,(l&8)!==0&&(l|=l&32);var v=o.entangledLanes;if(v!==0)for(o=o.entanglements,v&=l;0<v;){var T=31-Ta(v),C=1<<T;l|=o[T],v&=~C}return fr=l,Jr(),p}function kn(o,l){Zt=null,Ut.H=Qa,l===Oi||l===bs?(l=nn(),Un=3):l===uh?(l=nn(),Un=4):Un=l===ga?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Ei=l,fn===null&&(si=1,xf(o,be(l,o.current)))}function mn(){var o=wa.current;return o===null?!0:(pn&4194048)===pn?Ca===null:(pn&62914560)===pn||(pn&536870912)!==0?o===Ca:!1}function Cr(){var o=Ut.H;return Ut.H=Qa,o===null?Qa:o}function Wa(){var o=Ut.A;return Ut.A=cu,o}function Ql(){si=4,zs||(pn&4194048)!==pn&&wa.current!==null||(To=!0),(Fr&134217727)===0&&(wo&134217727)===0||rn===null||Ks(rn,pn,va,!1)}function Js(o,l,p){var v=cn;cn|=2;var T=Cr(),C=Wa();(rn!==o||pn!==l)&&(wc=null,li(o,l)),l=!1;var F=si;e:do try{if(Un!==0&&fn!==null){var ee=fn,we=Ei;switch(Un){case 8:Df(),F=6;break e;case 3:case 2:case 9:case 6:wa.current===null&&(l=!0);var ke=Un;if(Un=0,Ei=null,$s(o,ee,we,ke),p&&To){F=0;break e}break;default:ke=Un,Un=0,Ei=null,$s(o,ee,we,ke)}}ug(),F=si;break}catch(it){kn(o,it)}while(!0);return l&&o.shellSuspendCounter++,Os=Vn=null,cn=v,Ut.H=T,Ut.A=C,fn===null&&(rn=null,pn=0,Jr()),F}function ug(){for(;fn!==null;)uo(fn)}function cg(o,l){var p=cn;cn|=2;var v=Cr(),T=Wa();rn!==o||pn!==l?(wc=null,Co=aa()+500,li(o,l)):To=N(o,l);e:do try{if(Un!==0&&fn!==null){l=fn;var C=Ei;t:switch(Un){case 1:Un=0,Ei=null,$s(o,l,C,1);break;case 2:case 9:if(Ye(C)){Un=0,Ei=null,Lf(l);break}l=function(){Un!==2&&Un!==9||rn!==o||(Un=7),dt(o)},C.then(l,l);break e;case 3:Un=7;break e;case 4:Un=5;break e;case 7:Ye(C)?(Un=0,Ei=null,Lf(l)):(Un=0,Ei=null,$s(o,l,C,7));break;case 5:var F=null;switch(fn.tag){case 26:F=fn.memoizedState;case 5:case 27:var ee=fn,we=ee.type,ke=ee.pendingProps;if(F?pp(F):ni(ee.stateNode,we,ke)){Un=0,Ei=null;var it=ee.sibling;if(it!==null)fn=it;else{var We=ee.return;We!==null?(fn=We,Jl(We)):fn=null}break t}}Un=0,Ei=null,$s(o,l,C,5);break;case 6:Un=0,Ei=null,$s(o,l,C,6);break;case 8:Df(),si=6;break e;default:throw Error(s(462))}}Kl();break}catch(gt){kn(o,gt)}while(!0);return Os=Vn=null,Ut.H=v,Ut.A=T,cn=p,fn!==null?0:(rn=null,pn=0,Jr(),si)}function Kl(){for(;fn!==null&&!$g();)uo(fn)}function uo(o){var l=Ed(o.alternate,o,fr);o.memoizedProps=o.pendingProps,l===null?Jl(o):fn=l}function Lf(o){var l=o,p=l.alternate;switch(l.tag){case 15:case 0:l=yd(p,l,l.pendingProps,l.type,void 0,pn);break;case 11:l=yd(p,l,l.pendingProps,l.type.render,l.ref,pn);break;case 5:In(l);default:sg(p,l),l=fn=Of(l,fr),l=Ed(p,l,fr)}o.memoizedProps=o.pendingProps,l===null?Jl(o):fn=l}function $s(o,l,p,v){Os=Vn=null,In(l),bo=null,dl=0;var T=l.return;try{if(n_(o,T,l,p,pn)){si=1,xf(o,be(p,o.current)),fn=null;return}}catch(C){if(T!==null)throw fn=T,C;si=1,xf(o,be(p,o.current)),fn=null;return}l.flags&32768?(dn||v===1?o=!0:To||(pn&536870912)!==0?o=!1:(zs=o=!0,(v===2||v===9||v===3||v===6)&&(v=wa.current,v!==null&&v.tag===13&&(v.flags|=16384))),co(l,o)):Jl(l)}function Jl(o){var l=o;do{if((l.flags&32768)!==0){co(l,zs);return}o=l.return;var p=ag(l.alternate,l,fr);if(p!==null){fn=p;return}if(l=l.sibling,l!==null){fn=l;return}fn=l=o}while(l!==null);si===0&&(si=5)}function co(o,l){do{var p=wd(o.alternate,o);if(p!==null){p.flags&=32767,fn=p;return}if(p=o.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(o=o.sibling,o!==null)){fn=o;return}fn=o=p}while(o!==null);si=6,fn=null}function er(o,l,p,v,T,C,F,ee,we){o.cancelPendingCommit=null;do nr();while(Ti!==0);if((cn&6)!==0)throw Error(s(327));if(l!==null){if(l===o.current)throw Error(s(177));if(C=l.lanes|l.childLanes,C|=pl,H(o,p,C,F,ee,we),o===rn&&(fn=rn=null,pn=0),_l=l,Vr=o,hr=p,mu=C,hh=T,Mp=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,Si(yc,function(){return rc(),null})):(o.callbackNode=null,o.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=Ut.T,Ut.T=null,T=ps(),hn(2),F=cn,cn|=4;try{i_(o,l,p)}finally{cn=F,hn(T),Ut.T=v}}Ti=1,Rr(),tr(),Uf()}}function Rr(){if(Ti===1){Ti=0;var o=Vr,l=_l,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=Ut.T,Ut.T=null;var v=ps();hn(2);var T=cn;cn|=4;try{ac(l,o),mg(o.containerInfo)}finally{cn=T,hn(v),Ut.T=p}}o.current=l,Ti=2}}function tr(){if(Ti===2){Ti=0;var o=Vr,l=_l,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=Ut.T,Ut.T=null;var v=ps();hn(2);var T=cn;cn|=4;try{og(o,l.alternate,l)}finally{cn=T,hn(v),Ut.T=p}}Ti=3}}function Uf(){if(Ti===4||Ti===3){Ti=0,gp();var o=Vr,l=_l,p=hr,v=Mp;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Ti=5:(Ti=0,_l=Vr=null,If(o,o.pendingLanes));var T=o.pendingLanes;if(T===0&&(kr=null),se(p),l=l.stateNode,Aa&&typeof Aa.onCommitFiberRoot=="function")try{Aa.onCommitFiberRoot(hl,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=Ut.T,T=ps(),hn(2),Ut.T=null;try{for(var C=o.onRecoverableError,F=0;F<v.length;F++){var ee=v[F];C(ee.value,{componentStack:ee.stack})}}finally{Ut.T=l,hn(T)}}(hr&3)!==0&&nr(),dt(o),T=o.pendingLanes,(p&261930)!==0&&(T&42)!==0?o===Cc?En++:(En=0,Cc=o):En=0,Zn&&mc(),Ke(0)}}function If(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Ie(l)))}function nr(){return Rr(),tr(),Uf(),rc()}function rc(){if(Ti!==5)return!1;var o=Vr,l=mu;mu=0;var p=se(hr),v=32>p?32:p;p=Ut.T;var T=ps();try{hn(v),Ut.T=null,v=hh,hh=null;var C=Vr,F=hr;if(Ti=0,_l=Vr=null,hr=0,(cn&6)!==0)throw Error(s(331));var ee=cn;if(cn|=4,Rf(C.current),wf(C,C.current,F,v),cn=ee,Ke(0,!1),Aa&&typeof Aa.onPostCommitFiberRoot=="function")try{Aa.onPostCommitFiberRoot(hl,C)}catch{}return!0}finally{hn(T),Ut.T=p,If(o,l)}}function fo(o,l,p){l=be(p,l),l=gd(o.stateNode,l,2),o=Ha(o,l,2),o!==null&&(z(o,2),dt(o))}function Vt(o,l,p){if(o.tag===3)fo(o,o,p);else for(;l!==null;){if(l.tag===3){fo(l,o,p);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(kr===null||!kr.has(v))){o=be(p,o),p=qm(2),v=Ha(l,p,2),v!==null&&(jm(p,v,l,o),z(v,2),dt(v));break}}l=l.return}}function $l(o,l,p){var v=o.pingCache;if(v===null){v=o.pingCache=new Ja;var T=new Set;v.set(l,T)}else T=v.get(l),T===void 0&&(T=new Set,v.set(l,T));T.has(p)||(Ao=!0,T.add(p),o=fg.bind(null,o,l,p),l.then(o,o))}function fg(o,l,p){var v=o.pingCache;v!==null&&v.delete(l),o.pingedLanes|=o.suspendedLanes&p,o.warmLanes&=~p,rn===o&&(pn&p)===p&&(si===4||si===3&&(pn&62914560)===pn&&300>aa()-Ac?(cn&2)===0&&li(o,0):du|=p,pu===pn&&(pu=0)),dt(o)}function hg(o,l){l===0&&(l=U()),o=na(o,l),o!==null&&(z(o,l),dt(o))}function a_(o){var l=o.memoizedState,p=0;l!==null&&(p=l.retryLane),hg(o,p)}function s_(o,l){var p=0;switch(o.tag){case 31:case 13:var v=o.stateNode,T=o.memoizedState;T!==null&&(p=T.retryLane);break;case 19:v=o.stateNode;break;case 22:v=o.stateNode._retryCache;break;default:throw Error(s(314))}v!==null&&v.delete(l),hg(o,p)}function Si(o,l){return vc(o,l)}function Ld(o,l,p,v){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $o(o){return o=o.prototype,!(!o||!o.isReactComponent)}function qa(o,l){var p=o.alternate;return p===null?(p=t(o.tag,l,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=l,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&65011712,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,l=o.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p.refCleanup=o.refCleanup,p}function Of(o,l){o.flags&=65011714;var p=o.alternate;return p===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=p.childLanes,o.lanes=p.lanes,o.child=p.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=p.memoizedProps,o.memoizedState=p.memoizedState,o.updateQueue=p.updateQueue,o.type=p.type,l=p.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function Nr(o,l,p,v,T,C){var F=0;if(v=o,typeof o=="function")$o(o)&&(F=1);else if(typeof o=="string")F=ms&&Li?Qf(o,p,Xi.current)?26:mp(o)?27:5:ms?Qf(o,p,Xi.current)?26:5:Li&&mp(o)?27:5;else e:switch(o){case cc:return o=t(31,p,l,T),o.elementType=cc,o.lanes=C,o;case il:return hs(p.children,T,C,l);case al:F=8,T|=24;break;case sl:return o=t(12,p,l,T|2),o.elementType=sl,o.lanes=C,o;case Ff:return o=t(13,p,l,T),o.elementType=Ff,o.lanes=C,o;case Dr:return o=t(19,p,l,T),o.elementType=Dr,o.lanes=C,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case ds:F=10;break e;case uc:F=9;break e;case eu:F=11;break e;case kf:F=14;break e;case ha:F=16,v=null;break e}F=29,p=Error(s(130,o===null?"null":typeof o,"")),v=null}return l=t(F,p,l,T),l.elementType=o,l.type=v,l.lanes=C,l}function hs(o,l,p,v){return o=t(7,o,v,l),o.lanes=p,o}function Ud(o,l,p){return o=t(6,o,null,l),o.lanes=p,o}function Id(o){var l=t(18,null,null,0);return l.stateNode=o,l}function Od(o,l,p){return l=t(4,o.children!==null?o.children:[],o.key,l),l.lanes=p,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function dg(o,l,p,v,T,C,F,ee,we){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ea,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=v,this.onUncaughtError=T,this.onCaughtError=C,this.onRecoverableError=F,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=we,this.incompleteTransitions=new Map}function ho(o,l,p,v,T,C,F,ee,we,ke,it,We){return o=new dg(o,l,p,F,we,ke,it,We,ee),l=1,C===!0&&(l|=24),C=t(3,null,null,l),o.current=C,C.stateNode=o,l=Te(),l.refCount++,o.pooledCache=l,l.refCount++,C.memoizedState={element:v,isDehydrated:p,cache:l},Ri(C),o}function Pf(o){return o?(o=ar,o):ar}function oc(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(s(188)):(o=Object.keys(o).join(","),Error(s(268,o)));return o=h(l),o=o!==null?m(o):null,o===null?null:nu(o.stateNode)}function Pd(o,l,p,v,T,C){T=Pf(T),v.context===null?v.context=T:v.pendingContext=T,v=Va(l),v.payload={element:p},C=C===void 0?null:C,C!==null&&(v.callback=C),p=Ha(o,v,l),p!==null&&(ti(p,o,l),$r(p,o,l))}function el(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<l?p:l}}function lc(o,l){el(o,l),(o=o.alternate)&&el(o,l)}var an={},zf=hb,Sa=QP,Bf=Object.assign,tl=Symbol.for("react.element"),ir=Symbol.for("react.transitional.element"),nl=Symbol.for("react.portal"),il=Symbol.for("react.fragment"),al=Symbol.for("react.strict_mode"),sl=Symbol.for("react.profiler"),uc=Symbol.for("react.consumer"),ds=Symbol.for("react.context"),eu=Symbol.for("react.forward_ref"),Ff=Symbol.for("react.suspense"),Dr=Symbol.for("react.suspense_list"),kf=Symbol.for("react.memo"),ha=Symbol.for("react.lazy"),cc=Symbol.for("react.activity"),zd=Symbol.for("react.memo_cache_sentinel"),Lr=Symbol.iterator,po=Symbol.for("react.client.reference"),mo=Array.isArray,Ut=zf.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Bd=e.rendererVersion,fc=e.rendererPackageName,tu=e.extraDevToolsConfig,nu=e.getPublicInstance,pg=e.getRootHostContext,iu=e.getChildHostContext,Vf=e.prepareForCommit,mg=e.resetAfterCommit,Fd=e.createInstance;e.cloneMutableInstance;var hc=e.appendInitialChild,Ma=e.finalizeInitialChildren,da=e.shouldSetTextContent,Ur=e.createTextInstance;e.cloneMutableTextInstance;var kd=e.scheduleTimeout,gg=e.cancelTimeout,Ea=e.noTimeout,hi=e.isPrimaryRenderer;e.warnsIfNotActing;var gn=e.supportsMutation,ja=e.supportsPersistence,Zn=e.supportsHydration,Yt=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var On=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var hn=e.setCurrentUpdatePriority,ps=e.getCurrentUpdatePriority,au=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var rl=e.shouldAttemptEagerTransition,Hf=e.detachDeletedInstance;e.requestPostPaintCallback;var dc=e.maySuspendCommit,su=e.maySuspendCommitOnUpdate,Vd=e.maySuspendCommitInSyncRender,ni=e.preloadInstance,Hd=e.startSuspendingCommit,Gf=e.suspendInstance;e.suspendOnActiveViewTransition;var vg=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var ol=e.NotPendingTransition,ll=e.HostTransitionContext,Gd=e.resetFormInstance;e.bindToConsole;var Xd=e.supportsMicrotasks,Wd=e.scheduleMicrotask,Di=e.supportsTestSelectors,di=e.findFiberRoot,Xf=e.getBoundingRect,pc=e.getTextContent,go=e.isHiddenSubtree,qd=e.matchAccessibilityRole,Ir=e.setFocusIfFocusable,Wf=e.setupIntersectionObserver,jd=e.appendChild,Yd=e.appendChildToContainer,yg=e.commitTextUpdate,_g=e.commitMount,xg=e.commitUpdate,bg=e.insertBefore,Sg=e.insertInContainerBefore,Mg=e.removeChild,Zd=e.removeChildFromContainer,Qd=e.resetTextContent,r_=e.hideInstance,Eg=e.hideTextInstance,Tg=e.unhideInstance,Ag=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var Kd=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var wg=e.cloneInstance,Jd=e.createContainerChildSet,$d=e.appendChildToContainerChildSet,Cg=e.finalizeContainerChildren,ep=e.replaceContainerChildren,Rg=e.cloneHiddenInstance,tp=e.cloneHiddenTextInstance,vo=e.isSuspenseInstancePending,qf=e.isSuspenseInstanceFallback,jf=e.getSuspenseInstanceFallbackErrorDetails,Yf=e.registerSuspenseInstanceRetry,Ng=e.canHydrateFormStateMarker,np=e.isFormStateMarkerMatching,Dg=e.getNextHydratableSibling,Lg=e.getNextHydratableSiblingAfterSingleton,Ug=e.getFirstHydratableChild,Ig=e.getFirstHydratableChildWithinContainer,Og=e.getFirstHydratableChildWithinActivityInstance,Pg=e.getFirstHydratableChildWithinSuspenseInstance,ip=e.getFirstHydratableChildWithinSingleton,zg=e.canHydrateInstance,Bg=e.canHydrateTextInstance,ap=e.canHydrateActivityInstance,Fg=e.canHydrateSuspenseInstance,kg=e.hydrateInstance,o_=e.hydrateTextInstance,sp=e.hydrateActivityInstance,Vg=e.hydrateSuspenseInstance,Hg=e.getNextHydratableInstanceAfterActivityInstance,rp=e.getNextHydratableInstanceAfterSuspenseInstance,Gg=e.commitHydratedInstance,Xg=e.commitHydratedContainer,l_=e.commitHydratedActivityInstance,u_=e.commitHydratedSuspenseInstance,Wg=e.finalizeHydratedChildren,mc=e.flushHydrationEvents;e.clearActivityBoundary;var op=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Zf=e.clearSuspenseBoundaryFromContainer,qg=e.hideDehydratedBoundary,jg=e.unhideDehydratedBoundary,ru=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var Yg=e.validateHydratableInstance,lp=e.validateHydratableTextInstance,ms=e.supportsResources,Qf=e.isHostHoistableType,gc=e.getHoistableRoot,up=e.getResource,cp=e.acquireResource,yo=e.releaseResource,Zg=e.hydrateHoistable,fp=e.mountHoistable,hp=e.unmountHoistable,Kf=e.createHoistableInstance,Qg=e.prepareToCommitHoistables,dp=e.mayResourceSuspendCommit,pp=e.preloadResource,Kg=e.suspendResource,Li=e.supportsSingletons,Jf=e.resolveSingletonInstance,Mi=e.acquireSingletonInstance,Gi=e.releaseSingletonInstance,mp=e.isHostSingletonType,ul=e.isSingletonScope,$f=[],cl=-1,ar={},Ta=Math.clz32?Math.clz32:R,eh=Math.log,Jg=Math.LN2,th=256,fl=262144,ou=4194304,vc=Sa.unstable_scheduleCallback,nh=Sa.unstable_cancelCallback,$g=Sa.unstable_shouldYield,gp=Sa.unstable_requestPaint,aa=Sa.unstable_now,ih=Sa.unstable_ImmediatePriority,e0=Sa.unstable_UserBlockingPriority,yc=Sa.unstable_NormalPriority,ah=Sa.unstable_IdlePriority,vp=Sa.log,t0=Sa.unstable_setDisableYieldValue,hl=null,Aa=null,pi=typeof Object.is=="function"?Object.is:fe,sh=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},c_=Object.prototype.hasOwnProperty,rh,sr,_c=!1,yp=new WeakMap,Or=[],rr=0,Pn=null,xc=0,gs=[],Ya=0,vs=null,Qi=1,Is="",Xi=b(null),Pr=b(null),Ki=b(null),bc=b(null),Ui=null,Qn=null,dn=!1,or=null,pa=!1,oh=Error(s(519)),ys=b(null),Vn=null,Os=null,n0=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(p,v){o.push(v)}};this.abort=function(){l.aborted=!0,o.forEach(function(p){return p()})}},Wi=Sa.unstable_scheduleCallback,f_=Sa.unstable_NormalPriority,Kn={$$typeof:ds,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Sc=null,Dn=null,sa=!1,_s=!1,lh=!1,_o=0,lu=null,_p=0,zr=0,Ii=null,xs=Ut.S;Ut.S=function(o,l){yl=aa(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&et(o,l),xs!==null&&xs(o,l)};var xo=b(null),Oi=Error(s(460)),uh=Error(s(474)),bs=Error(s(542)),lr={then:function(){}},ma=null,bo=null,dl=0,Ji=Ho(!0),xp=Ho(!1),$i=[],ur=0,pl=0,Za=!1,ch=!1,ml=b(null),So=b(0),wa=b(null),Ca=null,ui=b(0),Br=0,Zt=null,wt=null,Gt=null,sn=!1,$t=!1,vn=!1,ra=0,Ss=0,Ps=null,bp=0,Qa={readContext:G,use:xi,useCallback:qe,useContext:qe,useEffect:qe,useImperativeHandle:qe,useLayoutEffect:qe,useInsertionEffect:qe,useMemo:qe,useReducer:qe,useRef:qe,useState:qe,useDebugValue:qe,useDeferredValue:qe,useTransition:qe,useSyncExternalStore:qe,useId:qe,useHostTransitionStatus:qe,useFormState:qe,useActionState:qe,useOptimistic:qe,useMemoCache:qe,useCacheRefresh:qe};Qa.useEffectEvent=qe;var ii={readContext:G,use:xi,useCallback:function(o,l){return Wt().memoizedState=[o,l===void 0?null:l],o},useContext:G,useEffect:qu,useImperativeHandle:function(o,l,p){p=p!=null?p.concat([o]):null,jo(4194308,4,zl.bind(null,l,o),p)},useLayoutEffect:function(o,l){return jo(4194308,4,o,l)},useInsertionEffect:function(o,l){jo(4,2,o,l)},useMemo:function(o,l){var p=Wt();l=l===void 0?null:l;var v=o();if(vn){te(!0);try{o()}finally{te(!1)}}return p.memoizedState=[v,l],v},useReducer:function(o,l,p){var v=Wt();if(p!==void 0){var T=p(l);if(vn){te(!0);try{p(l)}finally{te(!1)}}}else T=l;return v.memoizedState=v.baseState=T,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:T},v.queue=o,o=o.dispatch=t_.bind(null,Zt,o),[v.memoizedState,o]},useRef:function(o){var l=Wt();return o={current:o},l.memoizedState=o},useState:function(o){o=ld(o);var l=o.queue,p=Hm.bind(null,Zt,l);return l.dispatch=p,[o.memoizedState,p]},useDebugValue:Yu,useDeferredValue:function(o,l){var p=Wt();return Fl(p,o,l)},useTransition:function(){var o=ld(!1);return o=Fm.bind(null,Zt,o.queue,!0,!1),Wt().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,p){var v=Zt,T=Wt();if(dn){if(p===void 0)throw Error(s(407));p=p()}else{if(p=l(),rn===null)throw Error(s(349));(pn&127)!==0||Fi(v,l,p)}T.memoizedState=p;var C={value:p,getSnapshot:l};return T.queue=C,qu(Wo.bind(null,v,C,o),[o]),v.flags|=2048,Ga(9,{destroy:void 0},ki.bind(null,v,C,p,l),null),p},useId:function(){var o=Wt(),l=rn.identifierPrefix;if(dn){var p=Is,v=Qi;p=(v&~(1<<32-Ta(v)-1)).toString(32)+p,l="_"+l+"R_"+p,p=ra++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=bp++,l="_"+l+"r_"+p.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:dd,useFormState:cd,useActionState:cd,useOptimistic:function(o){var l=Wt();l.memoizedState=l.baseState=o;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=vf.bind(null,Zt,!0,p),p.dispatch=l,[o,l]},useMemoCache:Ls,useCacheRefresh:function(){return Wt().memoizedState=e_.bind(null,Zt)},useEffectEvent:function(o){var l=Wt(),p={impl:o};return l.memoizedState=p,function(){if((cn&2)!==0)throw Error(s(440));return p.impl.apply(void 0,arguments)}}},cr={readContext:G,use:xi,useCallback:mf,useContext:G,useEffect:Pl,useImperativeHandle:Bm,useInsertionEffect:no,useLayoutEffect:ju,useMemo:Bl,useReducer:la,useRef:pf,useState:function(){return la(Wn)},useDebugValue:Yu,useDeferredValue:function(o,l){var p=ut();return hd(p,wt.memoizedState,o,l)},useTransition:function(){var o=la(Wn)[0],l=ut().memoizedState;return[typeof o=="boolean"?o:Ft(o),l]},useSyncExternalStore:bi,useId:gf,useHostTransitionStatus:dd,useFormState:Il,useActionState:Il,useOptimistic:function(o,l){var p=ut();return Xu(p,wt,o,l)},useMemoCache:Ls,useCacheRefresh:Vm};cr.useEffectEvent=ua;var Mo={readContext:G,use:xi,useCallback:mf,useContext:G,useEffect:Pl,useImperativeHandle:Bm,useInsertionEffect:no,useLayoutEffect:ju,useMemo:Bl,useReducer:Ni,useRef:pf,useState:function(){return Ni(Wn)},useDebugValue:Yu,useDeferredValue:function(o,l){var p=ut();return wt===null?Fl(p,o,l):hd(p,wt.memoizedState,o,l)},useTransition:function(){var o=Ni(Wn)[0],l=ut().memoizedState;return[typeof o=="boolean"?o:Ft(o),l]},useSyncExternalStore:bi,useId:gf,useHostTransitionStatus:dd,useFormState:Ol,useActionState:Ol,useOptimistic:function(o,l){var p=ut();return wt!==null?Xu(p,wt,o,l):(p.baseState=o,[o,p.queue.dispatch])},useMemoCache:Ls,useCacheRefresh:Vm};Mo.useEffectEvent=ua;var Mc={enqueueSetState:function(o,l,p){o=o._reactInternals;var v=Yn(),T=Va(v);T.payload=l,p!=null&&(T.callback=p),l=Ha(o,T,v),l!==null&&(ti(l,o,v),$r(l,o,v))},enqueueReplaceState:function(o,l,p){o=o._reactInternals;var v=Yn(),T=Va(v);T.tag=1,T.payload=l,p!=null&&(T.callback=p),l=Ha(o,T,v),l!==null&&(ti(l,o,v),$r(l,o,v))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var p=Yn(),v=Va(p);v.tag=2,l!=null&&(v.callback=l),l=Ha(o,v,p),l!==null&&(ti(l,o,p),$r(l,o,p))}},ga=Error(s(461)),qn=!1,gl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},ci=!1,fi=!1,uu=!1,Sp=typeof WeakSet=="function"?WeakSet:Set,mi=null,ai=null,gi=!1,Ln=null,Ka=8192,cu={getCacheForType:function(o){var l=G(Kn),p=l.data.get(o);return p===void 0&&(p=o(),l.data.set(o,p)),p},cacheSignal:function(){return G(Kn).controller.signal}},Ms=0,fu=1,hu=2,Ec=3,Eo=4;if(typeof Symbol=="function"&&Symbol.for){var vl=Symbol.for;Ms=vl("selector.component"),fu=vl("selector.has_pseudo_class"),hu=vl("selector.role"),Ec=vl("selector.test_id"),Eo=vl("selector.text")}var Ja=typeof WeakMap=="function"?WeakMap:Map,cn=0,rn=null,fn=null,pn=0,Un=0,Ei=null,zs=!1,To=!1,Ao=!1,fr=0,si=0,Fr=0,wo=0,du=0,va=0,pu=0,Tc=null,Ra=null,fh=!1,Ac=0,yl=0,Co=1/0,wc=null,kr=null,Ti=0,Vr=null,_l=null,hr=0,mu=0,hh=null,Mp=null,En=0,Cc=null;return an.attemptContinuousHydration=function(o){if(o.tag===13||o.tag===31){var l=na(o,67108864);l!==null&&ti(l,o,67108864),lc(o,67108864)}},an.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13||o.tag===31){var l=Yn();l=Z(l);var p=na(o,l);p!==null&&ti(p,o,l),lc(o,l)}},an.attemptSynchronousHydration=function(o){switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var l=w(o.pendingLanes);if(l!==0){for(o.pendingLanes|=2,o.entangledLanes|=2;l;){var p=1<<31-Ta(l);o.entanglements[1]|=p,l&=~p}dt(o),(cn&6)===0&&(Co=aa()+500,Ke(0))}}break;case 31:case 13:l=na(o,2),l!==null&&ti(l,o,2),Nf(),lc(o,2)}},an.batchedUpdates=function(o,l){return o(l)},an.createComponentSelector=function(o){return{$$typeof:Ms,value:o}},an.createContainer=function(o,l,p,v,T,C,F,ee,we,ke){return ho(o,l,!1,null,p,v,C,null,F,ee,we,ke)},an.createHasPseudoClassSelector=function(o){return{$$typeof:fu,value:o}},an.createHydrationContainer=function(o,l,p,v,T,C,F,ee,we,ke,it,We,gt,qt){var vi;return o=ho(p,v,!0,o,T,C,ee,qt,we,ke,it,We),o.context=Pf(null),p=o.current,v=Yn(),v=Z(v),T=Va(v),T.callback=(vi=l)!=null?vi:null,Ha(p,T,v),l=v,o.current.lanes=l,z(o,l),dt(o),o},an.createPortal=function(o,l,p){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:nl,key:v==null?null:""+v,children:o,containerInfo:l,implementation:p}},an.createRoleSelector=function(o){return{$$typeof:hu,value:o}},an.createTestNameSelector=function(o){return{$$typeof:Ec,value:o}},an.createTextSelector=function(o){return{$$typeof:Eo,value:o}},an.defaultOnCaughtError=function(o){console.error(o)},an.defaultOnRecoverableError=function(o){sh(o)},an.defaultOnUncaughtError=function(o){sh(o)},an.deferredUpdates=function(o){var l=Ut.T,p=ps();try{return hn(32),Ut.T=null,o()}finally{hn(p),Ut.T=l}},an.discreteUpdates=function(o,l,p,v,T){var C=Ut.T,F=ps();try{return hn(2),Ut.T=null,o(l,p,v,T)}finally{hn(F),Ut.T=C,cn===0&&(Co=aa()+500)}},an.findAllNodes=ba,an.findBoundingRects=function(o,l){if(!Di)throw Error(s(363));l=ba(o,l),o=[];for(var p=0;p<l.length;p++)o.push(Xf(l[p]));for(l=o.length-1;0<l;l--){p=o[l];for(var v=p.x,T=v+p.width,C=p.y,F=C+p.height,ee=l-1;0<=ee;ee--)if(l!==ee){var we=o[ee],ke=we.x,it=ke+we.width,We=we.y,gt=We+we.height;if(v>=ke&&C>=We&&T<=it&&F<=gt){o.splice(l,1);break}else if(v!==ke||p.width!==we.width||gt<C||We>F){if(!(C!==We||p.height!==we.height||it<v||ke>T)){ke>v&&(we.width+=ke-v,we.x=v),it<T&&(we.width=T-ke),o.splice(l,1);break}}else{We>C&&(we.height+=We-C,we.y=C),gt<F&&(we.height=F-We),o.splice(l,1);break}}}return o},an.findHostInstance=oc,an.findHostInstanceWithNoPortals=function(o){return o=h(o),o=o!==null?g(o):null,o===null?null:nu(o.stateNode)},an.findHostInstanceWithWarning=function(o){return oc(o)},an.flushPassiveEffects=nr,an.flushSyncFromReconciler=function(o){var l=cn;cn|=1;var p=Ut.T,v=ps();try{if(hn(2),Ut.T=null,o)return o()}finally{hn(v),Ut.T=p,cn=l,(cn&6)===0&&Ke(0)}},an.flushSyncWork=Nf,an.focusWithin=function(o,l){if(!Di)throw Error(s(363));for(o=oo(o),l=Zl(o,l),l=Array.from(l),o=0;o<l.length;){var p=l[o++],v=p.tag;if(!go(p)){if((v===5||v===26||v===27)&&Ir(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},an.getFindAllNodesFailureDescription=function(o,l){if(!Di)throw Error(s(363));var p=0,v=[];o=[oo(o),0];for(var T=0;T<o.length;){var C=o[T++],F=C.tag,ee=o[T++],we=l[ee];if((F!==5&&F!==26&&F!==27||!go(C))&&(lo(C,we)&&(v.push(Yl(we)),ee++,ee>p&&(p=ee)),ee<l.length))for(C=C.child;C!==null;)o.push(C,ee),C=C.sibling}if(p<l.length){for(o=[];p<l.length;p++)o.push(Yl(l[p]));return`findAllNodes was able to match part of the selector:
`+(v.join(" > ")+`
No matching component was found for:
`)+o.join(" > ")}return null},an.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 27:case 5:return nu(o.child.stateNode);default:return o.child.stateNode}},an.injectIntoDevTools=function(){var o={bundleType:0,version:Bd,rendererPackageName:fc,currentDispatcherRef:Ut,reconcilerVersion:"19.2.0"};if(tu!==null&&(o.rendererConfig=tu),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)o=!0;else{try{hl=l.inject(o),Aa=l}catch{}o=!!l.checkDCE}}return o},an.isAlreadyRendering=function(){return(cn&6)!==0},an.observeVisibleRects=function(o,l,p,v){if(!Di)throw Error(s(363));o=ba(o,l);var T=Wf(o,p,v).disconnect;return{disconnect:function(){T()}}},an.shouldError=function(){return null},an.shouldSuspend=function(){return!1},an.startHostTransition=function(o,l,p,v){if(o.tag!==5)throw Error(s(476));var T=km(o).queue;Fm(o,T,l,ol,p===null?n:function(){var C=km(o);return C.next===null&&(C=o.alternate.memoizedState),Zu(o,C.next.queue,{},Yn()),p(v)})},an.updateContainer=function(o,l,p,v){var T=l.current,C=Yn();return Pd(T,C,o,l,p,v),C},an.updateContainerSync=function(o,l,p,v){return Pd(l.current,2,o,l,p,v),2},an},r.exports.default=r.exports,Object.defineProperty(r.exports,"__esModule",{value:!0})})(H1)),H1.exports}var X1;function Ez(){return X1||(X1=1,V1.exports=Mz()),V1.exports}var Tz=Ez();const Az=Sz(Tz);function wz(r){const e=Az(r);return e.injectIntoDevTools(),e}const sA=0,nd={},Cz=/^three(?=[A-Z])/,Jy=r=>`${r[0].toUpperCase()}${r.slice(1)}`;let Rz=0;const Nz=r=>typeof r=="function";function Dz(r){if(Nz(r)){const e=`${Rz++}`;return nd[e]=r,e}else Object.assign(nd,r)}function rA(r,e){const t=Jy(r),n=nd[t];if(r!=="primitive"&&!n)throw new Error(`R3F: ${t} 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(r==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function Lz(r,e,t){var n;return r=Jy(r)in nd?r:r.replace(Cz,""),rA(r,e),r==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,uy(e.object,t,r,e)}function Uz(r){if(!r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?fy(r.parent,r):ws(r.object)&&(r.object.visible=!1),r.isHidden=!0,od(r)}}function oA(r){if(r.isHidden){var e;r.props.attach&&(e=r.parent)!=null&&e.object?cy(r.parent,r):ws(r.object)&&r.props.visible!==!1&&(r.object.visible=!0),r.isHidden=!1,od(r)}}function oS(r,e,t){const n=e.root.getState();if(!(!r.parent&&r.object!==n.scene)){if(!e.object){var s,u;const f=nd[Jy(e.type)];e.object=(s=e.props.object)!=null?s:new f(...(u=e.props.args)!=null?u:[]),e.object.__r3f=e}if(Lu(e.object,e.props),e.props.attach)cy(r,e);else if(ws(e.object)&&ws(r.object)){const f=r.object.children.indexOf(t?.object);if(t&&f!==-1){const h=r.object.children.indexOf(e.object);if(h!==-1){r.object.children.splice(h,1);const m=h<f?f-1:f;r.object.children.splice(m,0,e.object)}else e.object.parent=r.object,r.object.children.splice(f,0,e.object),e.object.dispatchEvent({type:"added"}),r.object.dispatchEvent({type:"childadded",child:e.object})}else r.object.add(e.object)}for(const f of e.children)oS(e,f);od(e)}}function Ux(r,e){e&&(e.parent=r,r.children.push(e),oS(r,e))}function W1(r,e,t){if(!e||!t)return;e.parent=r;const n=r.children.indexOf(t);n!==-1?r.children.splice(n,0,e):r.children.push(e),oS(r,e,t)}function lA(r){if(typeof r.dispose=="function"){const e=()=>{try{r.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():sb.unstable_scheduleCallback(sb.unstable_IdlePriority,e)}}function ob(r,e,t){if(!e)return;e.parent=null;const n=r.children.indexOf(e);n!==-1&&r.children.splice(n,1),e.props.attach?fy(r,e):ws(e.object)&&ws(r.object)&&(r.object.remove(e.object),dz(KT(e),e.object));const s=e.props.dispose!==null&&t!==!1;for(let u=e.children.length-1;u>=0;u--){const f=e.children[u];ob(e,f,s)}e.children.length=0,delete e.object.__r3f,s&&e.type!=="primitive"&&e.object.type!=="Scene"&&lA(e.object),t===void 0&&od(e)}function Iz(r,e){for(const t of[r,r.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const gv=[];function Oz(){for(const[t]of gv){const n=t.parent;if(n){t.props.attach?fy(n,t):ws(t.object)&&ws(n.object)&&n.object.remove(t.object);for(const s of t.children)s.props.attach?fy(t,s):ws(s.object)&&ws(t.object)&&t.object.remove(s.object)}t.isHidden&&oA(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&lA(t.object)}for(const[t,n,s]of gv){t.props=n;const u=t.parent;if(u){var r,e;const f=nd[Jy(t.type)];t.object=(r=t.props.object)!=null?r:new f(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,Iz(s,t.object),Lu(t.object,t.props),t.props.attach?cy(u,t):ws(t.object)&&ws(u.object)&&u.object.add(t.object);for(const h of t.children)h.props.attach?cy(t,h):ws(h.object)&&ws(t.object)&&t.object.add(h.object);od(t)}}gv.length=0}const Ix=()=>{},q1={};let cv=sA;const Pz=0,zz=4,lb=wz({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:Lz,removeChild:ob,appendChild:Ux,appendInitialChild:Ux,insertBefore:W1,appendChildToContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||Ux(t,e)},removeChildFromContainer(r,e){const t=r.getState().scene.__r3f;!e||!t||ob(t,e)},insertInContainerBefore(r,e,t){const n=r.getState().scene.__r3f;!e||!t||!n||W1(n,e,t)},getRootHostContext:()=>q1,getChildHostContext:()=>q1,commitUpdate(r,e,t,n,s){var u,f,h;rA(e,n);let m=!1;if((r.type==="primitive"&&t.object!==n.object||((u=n.args)==null?void 0:u.length)!==((f=t.args)==null?void 0:f.length)||(h=n.args)!=null&&h.some((_,x)=>{var b;return _!==((b=t.args)==null?void 0:b[x])}))&&(m=!0),m)gv.push([r,{...n},s]);else{const _=uz(r,n);Object.keys(_).length&&(Object.assign(r.props,_),Lu(r.object,_))}(s.sibling===null||(s.flags&zz)===Pz)&&Oz()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:r=>r?.object,prepareForCommit:()=>null,preparePortalMount:r=>uy(r.getState().scene,r,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:Uz,unhideInstance:oA,createTextInstance:Ix,hideTextInstance:Ix,unhideTextInstance:Ix,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?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:rt.createContext(null),setCurrentUpdatePriority(r){cv=r},getCurrentUpdatePriority(){return cv},resolveUpdatePriority(){var r;if(cv!==sA)return cv;switch(typeof window<"u"&&((r=window.event)==null?void 0:r.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return xz;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return yz;default:return _z}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:bz.version,applyViewTransitionName(r,e,t){},restoreViewTransitionName(r,e){},cancelViewTransitionName(r,e,t){},cancelRootViewTransitionName(r){},restoreRootViewTransitionName(r){},InstanceMeasurement:null,measureInstance:r=>null,wasInstanceInViewport:r=>!0,hasInstanceChanged:(r,e)=>!1,hasInstanceAffectedParent:(r,e)=>!1,suspendOnActiveViewTransition(r,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(r){},createViewTransitionInstance:r=>null,getCurrentGestureOffset(r){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(r,e){return r},cloneMutableTextInstance(r){return r},cloneRootViewTransitionContainer(r){throw new Error("Not implemented.")},removeRootViewTransitionClone(r,e){throw new Error("Not implemented.")},createFragmentInstance:r=>null,updateFragmentInstanceFiber(r,e){},commitNewChildToFragmentInstance(r,e){},deleteChildFromFragmentInstance(r,e){},measureClonedInstance:r=>null,maySuspendCommitOnUpdate:(r,e,t)=>!1,maySuspendCommitInSyncRender:(r,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(r,e)=>null}),sf=new Map,Fh={objects:"shallow",strict:!1};function Bz(r,e){if(!e&&typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:s,left:u}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:s,left:u}}else if(!e&&typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function Fz(r){const e=sf.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const s=typeof reportError=="function"?reportError:console.error,u=n||mz(fb,Y1),f=t||lb.createContainer(u,vz,null,!1,null,"",s,s,s,null);e||sf.set(r,{fiber:f,store:u});let h,m,g=!1,_=null;return{async configure(x={}){let b;_=new Promise(X=>b=X);let{gl:M,size:A,scene:R,events:w,onCreated:E,shadows:N=!1,linear:D=!1,flat:U=!1,legacy:B=!1,orthographic:z=!1,frameloop:H="always",dpr:W=[1,2],performance:I,raycaster:P,camera:Z,onPointerMissed:se}=x,te=u.getState(),fe=te.gl;if(!te.gl){const X={canvas:r,powerPreference:"high-performance",antialias:!0,alpha:!0},oe=typeof M=="function"?await M(X):M;k1(oe)?fe=oe:fe=new jT({...X,...M}),te.set({gl:fe})}let pe=te.raycaster;pe||te.set({raycaster:pe=new FT});const{params:Y,...q}=P||{};if(yi.equ(q,pe,Fh)||Lu(pe,{...q}),yi.equ(Y,pe.params,Fh)||Lu(pe,{params:{...pe.params,...Y}}),!te.camera||te.camera===m&&!yi.equ(m,Z,Fh)){m=Z;const X=Z?.isCamera,oe=X?Z:z?new Dl(0,0,0,0,.1,1e3):new zi(75,0,.1,1e3);X||(oe.position.z=5,Z&&(Lu(oe,Z),oe.manual||("aspect"in Z||"left"in Z||"right"in Z||"bottom"in Z||"top"in Z)&&(oe.manual=!0,oe.updateProjectionMatrix())),!te.camera&&!(Z!=null&&Z.rotation)&&oe.lookAt(0,0,0)),te.set({camera:oe}),pe.camera=oe}if(!te.scene){let X;R!=null&&R.isScene?(X=R,uy(X,u,"",{})):(X=new Lb,uy(X,u,"",{}),R&&Lu(X,R)),te.set({scene:X})}w&&!te.events.handlers&&te.set({events:w(u)});const ne=Bz(r,A);if(yi.equ(ne,te.size,Fh)||te.setSize(ne.width,ne.height,ne.top,ne.left),W&&te.viewport.dpr!==eA(W)&&te.setDpr(W),te.frameloop!==H&&te.setFrameloop(H),te.onPointerMissed||te.set({onPointerMissed:se}),I&&!yi.equ(I,te.performance,Fh)&&te.set(X=>({performance:{...X.performance,...I}})),!te.xr){var be;const X=(Fe,lt)=>{const de=u.getState();de.frameloop!=="never"&&Y1(Fe,!0,de,lt)},oe=()=>{const Fe=u.getState();Fe.gl.xr.enabled=Fe.gl.xr.isPresenting,Fe.gl.xr.setAnimationLoop(Fe.gl.xr.isPresenting?X:null),Fe.gl.xr.isPresenting||fb(Fe)},Ae={connect(){const Fe=u.getState().gl;Fe.xr.addEventListener("sessionstart",oe),Fe.xr.addEventListener("sessionend",oe)},disconnect(){const Fe=u.getState().gl;Fe.xr.removeEventListener("sessionstart",oe),Fe.xr.removeEventListener("sessionend",oe)}};typeof((be=fe.xr)==null?void 0:be.addEventListener)=="function"&&Ae.connect(),te.set({xr:Ae})}if(fe.shadowMap){const X=fe.shadowMap.enabled,oe=fe.shadowMap.type;if(fe.shadowMap.enabled=!!N,yi.boo(N))fe.shadowMap.type=Kp;else if(yi.str(N)){var Ne;const Ae={basic:sE,percentage:Xh,soft:Kp,variance:jc};fe.shadowMap.type=(Ne=Ae[N])!=null?Ne:Kp}else yi.obj(N)&&Object.assign(fe.shadowMap,N);(X!==fe.shadowMap.enabled||oe!==fe.shadowMap.type)&&(fe.shadowMap.needsUpdate=!0)}return Sn.enabled=!B,g||(fe.outputColorSpace=D?zu:Ia,fe.toneMapping=U?gr:gy),te.legacy!==B&&te.set(()=>({legacy:B})),te.linear!==D&&te.set(()=>({linear:D})),te.flat!==U&&te.set(()=>({flat:U})),M&&!yi.fun(M)&&!k1(M)&&!yi.equ(M,fe,Fh)&&Lu(fe,M),h=E,g=!0,b(),this},render(x){return!g&&!_&&this.configure(),_.then(()=>{lb.updateContainer(he.jsx(kz,{store:u,children:x,onCreated:h,rootElement:r}),f,null,()=>{})}),u},unmount(){uA(r)}}}function kz({store:r,children:e,onCreated:t,rootElement:n}){return Om(()=>{const s=r.getState();s.set(u=>({internal:{...u.internal,active:!0}})),t&&t(s),r.getState().events.connected||s.events.connect==null||s.events.connect(n)},[]),he.jsx(iA.Provider,{value:r,children:e})}function uA(r,e){const t=sf.get(r),n=t?.fiber;if(n){const s=t?.store.getState();s&&(s.internal.active=!1),lb.updateContainer(null,n,null,()=>{s&&setTimeout(()=>{try{var u,f,h,m;s.events.disconnect==null||s.events.disconnect(),(u=s.gl)==null||(f=u.renderLists)==null||f.dispose==null||f.dispose(),(h=s.gl)==null||h.forceContextLoss==null||h.forceContextLoss(),(m=s.gl)!=null&&m.xr&&s.xr.disconnect(),rz(s.scene),sf.delete(r)}catch{}},500)})}}const Vz=new Set,Hz=new Set,Gz=new Set;function Ox(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function rm(r,e){switch(r){case"before":return Ox(Vz,e);case"after":return Ox(Hz,e);case"tail":return Ox(Gz,e)}}let Px,zx;function ub(r,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),Px=e.internal.subscribers;for(let s=0;s<Px.length;s++)zx=Px[s],zx.ref.current(zx.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let hy=!1,cb=!1,Bx,j1,kh;function cA(r){j1=requestAnimationFrame(cA),hy=!0,Bx=0,rm("before",r),cb=!0;for(const t of sf.values()){var e;kh=t.store.getState(),kh.internal.active&&(kh.frameloop==="always"||kh.internal.frames>0)&&!((e=kh.gl.xr)!=null&&e.isPresenting)&&(Bx+=ub(r,kh))}if(cb=!1,rm("after",r),Bx===0)return rm("tail",r),hy=!1,cancelAnimationFrame(j1)}function fb(r,e=1){var t;if(!r)return sf.forEach(n=>fb(n.store.getState(),e));(t=r.gl.xr)!=null&&t.isPresenting||!r.internal.active||r.frameloop==="never"||(e>1?r.internal.frames=Math.min(60,r.internal.frames+e):cb?r.internal.frames=2:r.internal.frames=1,hy||(hy=!0,requestAnimationFrame(cA)))}function Y1(r,e=!0,t,n){if(e&&rm("before",r),t)ub(r,t,n);else for(const s of sf.values())ub(r,s.store.getState());e&&rm("after",r)}const Fx={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 Xz(r){const{handlePointer:e}=pz(r);return{priority:1,enabled:!0,compute(t,n,s){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Fx).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:s}=r.getState();(t=s.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(s.lastEvent.current)},connect:t=>{const{set:n,events:s}=r.getState();if(s.disconnect==null||s.disconnect(),n(u=>({events:{...u.events,connected:t}})),s.handlers)for(const u in s.handlers){const f=s.handlers[u],[h,m]=Fx[u];t.addEventListener(h,f,{passive:m})}},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){if(n.handlers)for(const s in n.handlers){const u=n.handlers[s],[f]=Fx[s];n.connected.removeEventListener(f,u)}t(s=>({events:{...s.events,connected:void 0}}))}}}}function Z1(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function Wz({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const s=t||(typeof window>"u"?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[u,f]=rt.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=rt.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u,orientationHandler:null}),m=r?typeof r=="number"?r:r.scroll:null,g=r?typeof r=="number"?r:r.resize:null,_=rt.useRef(!1);rt.useEffect(()=>(_.current=!0,()=>{_.current=!1}));const[x,b,M]=rt.useMemo(()=>{const E=()=>{if(!h.current.element)return;const{left:N,top:D,width:U,height:B,bottom:z,right:H,x:W,y:I}=h.current.element.getBoundingClientRect(),P={left:N,top:D,width:U,height:B,bottom:z,right:H,x:W,y:I};h.current.element instanceof HTMLElement&&n&&(P.height=h.current.element.offsetHeight,P.width=h.current.element.offsetWidth),Object.freeze(P),_.current&&!Zz(h.current.lastBounds,P)&&f(h.current.lastBounds=P)};return[E,g?Z1(E,g):E,m?Z1(E,m):E]},[f,n,m,g]);function A(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(E=>E.removeEventListener("scroll",M,!0)),h.current.scrollContainers=null),h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null),h.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",h.current.orientationHandler))}function R(){h.current.element&&(h.current.resizeObserver=new s(M),h.current.resizeObserver.observe(h.current.element),e&&h.current.scrollContainers&&h.current.scrollContainers.forEach(E=>E.addEventListener("scroll",M,{capture:!0,passive:!0})),h.current.orientationHandler=()=>{M()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",h.current.orientationHandler))}const w=E=>{!E||E===h.current.element||(A(),h.current.element=E,h.current.scrollContainers=fA(E),R())};return jz(M,!!e),qz(b),rt.useEffect(()=>{A(),R()},[e,M,b]),rt.useEffect(()=>A,[]),[w,u,x]}function qz(r){rt.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function jz(r,e){rt.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function fA(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:s}=window.getComputedStyle(r);return[t,n,s].some(u=>u==="auto"||u==="scroll")&&e.push(r),[...e,...fA(r.parentElement)]}const Yz=["x","y","top","bottom","left","right","width","height"],Zz=(r,e)=>Yz.every(t=>r[t]===e[t]);function Qz({ref:r,children:e,fallback:t,resize:n,style:s,gl:u,events:f=Xz,eventSource:h,eventPrefix:m,shadows:g,linear:_,flat:x,legacy:b,orthographic:M,frameloop:A,dpr:R,performance:w,raycaster:E,camera:N,scene:D,onPointerMissed:U,onCreated:B,...z}){rt.useMemo(()=>Dz(BP),[]);const H=iz(),[W,I]=Wz({scroll:!0,debounce:{scroll:50,resize:0},...n}),P=rt.useRef(null),Z=rt.useRef(null);rt.useImperativeHandle(r,()=>P.current);const se=$T(U),[te,fe]=rt.useState(!1),[pe,Y]=rt.useState(!1);if(te)throw te;if(pe)throw pe;const q=rt.useRef(null);Om(()=>{const be=P.current;if(I.width>0&&I.height>0&&be){q.current||(q.current=Fz(be));async function Ne(){await q.current.configure({gl:u,scene:D,events:f,shadows:g,linear:_,flat:x,legacy:b,orthographic:M,frameloop:A,dpr:R,performance:w,raycaster:E,camera:N,size:I,onPointerMissed:(...X)=>se.current==null?void 0:se.current(...X),onCreated:X=>{X.events.connect==null||X.events.connect(h?tz(h)?h.current:h:Z.current),m&&X.setEvents({compute:(oe,Ae)=>{const Fe=oe[m+"X"],lt=oe[m+"Y"];Ae.pointer.set(Fe/Ae.size.width*2-1,-(lt/Ae.size.height)*2+1),Ae.raycaster.setFromCamera(Ae.pointer,Ae.camera)}}),B?.(X)}}),q.current.render(he.jsx(H,{children:he.jsx(sz,{set:Y,children:he.jsx(rt.Suspense,{fallback:he.jsx(az,{set:fe}),children:e??null})})}))}Ne()}}),rt.useEffect(()=>{const be=P.current;if(be)return()=>uA(be)},[]);const ne=h?"none":"auto";return he.jsx("div",{ref:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ne,...s},...z,children:he.jsx("div",{ref:W,style:{width:"100%",height:"100%"},children:he.jsx("canvas",{ref:P,style:{display:"block"},children:t})})})}function Kz(r){return he.jsx(ZT,{children:he.jsx(Qz,{...r})})}var Jz=Object.defineProperty,$z=(r,e,t)=>e in r?Jz(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,e4=(r,e,t)=>($z(r,e+"",t),t);class t4{constructor(){e4(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const u=s.indexOf(t);u!==-1&&s.splice(u,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let u=0,f=s.length;u<f;u++)s[u].call(this,e);e.target=null}}}var n4=Object.defineProperty,i4=(r,e,t)=>e in r?n4(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bt=(r,e,t)=>(i4(r,typeof e!="symbol"?e+"":e,t),t);const fv=new of,Q1=new wl,a4=Math.cos(70*(Math.PI/180)),K1=(r,e)=>(r%e+e)%e;let s4=class extends t4{constructor(e,t){super(),Bt(this,"object"),Bt(this,"domElement"),Bt(this,"enabled",!0),Bt(this,"target",new j),Bt(this,"minDistance",0),Bt(this,"maxDistance",1/0),Bt(this,"minZoom",0),Bt(this,"maxZoom",1/0),Bt(this,"minPolarAngle",0),Bt(this,"maxPolarAngle",Math.PI),Bt(this,"minAzimuthAngle",-1/0),Bt(this,"maxAzimuthAngle",1/0),Bt(this,"enableDamping",!1),Bt(this,"dampingFactor",.05),Bt(this,"enableZoom",!0),Bt(this,"zoomSpeed",1),Bt(this,"enableRotate",!0),Bt(this,"rotateSpeed",1),Bt(this,"enablePan",!0),Bt(this,"panSpeed",1),Bt(this,"screenSpacePanning",!0),Bt(this,"keyPanSpeed",7),Bt(this,"zoomToCursor",!1),Bt(this,"autoRotate",!1),Bt(this,"autoRotateSpeed",2),Bt(this,"reverseOrbit",!1),Bt(this,"reverseHorizontalOrbit",!1),Bt(this,"reverseVerticalOrbit",!1),Bt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Bt(this,"mouseButtons",{LEFT:Gc.ROTATE,MIDDLE:Gc.DOLLY,RIGHT:Gc.PAN}),Bt(this,"touches",{ONE:Xc.ROTATE,TWO:Xc.DOLLY_PAN}),Bt(this,"target0"),Bt(this,"position0"),Bt(this,"zoom0"),Bt(this,"_domElementKeyEvents",null),Bt(this,"getPolarAngle"),Bt(this,"getAzimuthalAngle"),Bt(this,"setPolarAngle"),Bt(this,"setAzimuthalAngle"),Bt(this,"getDistance"),Bt(this,"getZoomScale"),Bt(this,"listenToKeyEvents"),Bt(this,"stopListenToKeyEvents"),Bt(this,"saveState"),Bt(this,"reset"),Bt(this,"update"),Bt(this,"connect"),Bt(this,"dispose"),Bt(this,"dollyIn"),Bt(this,"dollyOut"),Bt(this,"getScale"),Bt(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>_.phi,this.getAzimuthalAngle=()=>_.theta,this.setPolarAngle=K=>{let me=K1(K,2*Math.PI),et=_.phi;et<0&&(et+=2*Math.PI),me<0&&(me+=2*Math.PI);let J=Math.abs(me-et);2*Math.PI-J<J&&(me<et?me+=2*Math.PI:et+=2*Math.PI),x.phi=me-et,n.update()},this.setAzimuthalAngle=K=>{let me=K1(K,2*Math.PI),et=_.theta;et<0&&(et+=2*Math.PI),me<0&&(me+=2*Math.PI);let J=Math.abs(me-et);2*Math.PI-J<J&&(me<et?me+=2*Math.PI:et+=2*Math.PI),x.theta=me-et,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=K=>{K.addEventListener("keydown",Ee),this._domElementKeyEvents=K},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ee),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(s),n.update(),m=h.NONE},this.update=(()=>{const K=new j,me=new j(0,1,0),et=new Pa().setFromUnitVectors(e.up,me),J=et.clone().invert(),je=new j,Ge=new Pa,at=2*Math.PI;return function(){const Ue=n.object.position;et.setFromUnitVectors(e.up,me),J.copy(et).invert(),K.copy(Ue).sub(n.target),K.applyQuaternion(et),_.setFromVector3(K),n.autoRotate&&m===h.NONE&&fe(se()),n.enableDamping?(_.theta+=x.theta*n.dampingFactor,_.phi+=x.phi*n.dampingFactor):(_.theta+=x.theta,_.phi+=x.phi);let Ye=n.minAzimuthAngle,Ct=n.maxAzimuthAngle;isFinite(Ye)&&isFinite(Ct)&&(Ye<-Math.PI?Ye+=at:Ye>Math.PI&&(Ye-=at),Ct<-Math.PI?Ct+=at:Ct>Math.PI&&(Ct-=at),Ye<=Ct?_.theta=Math.max(Ye,Math.min(Ct,_.theta)):_.theta=_.theta>(Ye+Ct)/2?Math.max(Ye,_.theta):Math.min(Ct,_.theta)),_.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,_.phi)),_.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(M,n.dampingFactor):n.target.add(M),n.zoomToCursor&&I||n.object.isOrthographicCamera?_.radius=Ae(_.radius):_.radius=Ae(_.radius*b),K.setFromSpherical(_),K.applyQuaternion(J),Ue.copy(n.target).add(K),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(x.theta*=1-n.dampingFactor,x.phi*=1-n.dampingFactor,M.multiplyScalar(1-n.dampingFactor)):(x.set(0,0,0),M.set(0,0,0));let Jt=!1;if(n.zoomToCursor&&I){let nn=null;if(n.object instanceof zi&&n.object.isPerspectiveCamera){const Jn=K.length();nn=Ae(Jn*b);const Ci=Jn-nn;n.object.position.addScaledVector(H,Ci),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Jn=new j(W.x,W.y,0);Jn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/b)),n.object.updateProjectionMatrix(),Jt=!0;const Ci=new j(W.x,W.y,0);Ci.unproject(n.object),n.object.position.sub(Ci).add(Jn),n.object.updateMatrixWorld(),nn=K.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;nn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(nn).add(n.object.position):(fv.origin.copy(n.object.position),fv.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(fv.direction))<a4?e.lookAt(n.target):(Q1.setFromNormalAndCoplanarPoint(n.object.up,n.target),fv.intersectPlane(Q1,n.target))))}else n.object instanceof Dl&&n.object.isOrthographicCamera&&(Jt=b!==1,Jt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/b)),n.object.updateProjectionMatrix()));return b=1,I=!1,Jt||je.distanceToSquared(n.object.position)>g||8*(1-Ge.dot(n.object.quaternion))>g?(n.dispatchEvent(s),je.copy(n.object.position),Ge.copy(n.object.quaternion),Jt=!1,!0):!1}})(),this.connect=K=>{n.domElement=K,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",vt),n.domElement.addEventListener("pointerdown",Qe),n.domElement.addEventListener("pointercancel",O),n.domElement.addEventListener("wheel",Ie)},this.dispose=()=>{var K,me,et,J,je,Ge;n.domElement&&(n.domElement.style.touchAction="auto"),(K=n.domElement)==null||K.removeEventListener("contextmenu",vt),(me=n.domElement)==null||me.removeEventListener("pointerdown",Qe),(et=n.domElement)==null||et.removeEventListener("pointercancel",O),(J=n.domElement)==null||J.removeEventListener("wheel",Ie),(je=n.domElement)==null||je.ownerDocument.removeEventListener("pointermove",G),(Ge=n.domElement)==null||Ge.ownerDocument.removeEventListener("pointerup",O),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Ee)};const n=this,s={type:"change"},u={type:"start"},f={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let m=h.NONE;const g=1e-6,_=new eb,x=new eb;let b=1;const M=new j,A=new ze,R=new ze,w=new ze,E=new ze,N=new ze,D=new ze,U=new ze,B=new ze,z=new ze,H=new j,W=new ze;let I=!1;const P=[],Z={};function se(){return 2*Math.PI/60/60*n.autoRotateSpeed}function te(){return Math.pow(.95,n.zoomSpeed)}function fe(K){n.reverseOrbit||n.reverseHorizontalOrbit?x.theta+=K:x.theta-=K}function pe(K){n.reverseOrbit||n.reverseVerticalOrbit?x.phi+=K:x.phi-=K}const Y=(()=>{const K=new j;return function(et,J){K.setFromMatrixColumn(J,0),K.multiplyScalar(-et),M.add(K)}})(),q=(()=>{const K=new j;return function(et,J){n.screenSpacePanning===!0?K.setFromMatrixColumn(J,1):(K.setFromMatrixColumn(J,0),K.crossVectors(n.object.up,K)),K.multiplyScalar(et),M.add(K)}})(),ne=(()=>{const K=new j;return function(et,J){const je=n.domElement;if(je&&n.object instanceof zi&&n.object.isPerspectiveCamera){const Ge=n.object.position;K.copy(Ge).sub(n.target);let at=K.length();at*=Math.tan(n.object.fov/2*Math.PI/180),Y(2*et*at/je.clientHeight,n.object.matrix),q(2*J*at/je.clientHeight,n.object.matrix)}else je&&n.object instanceof Dl&&n.object.isOrthographicCamera?(Y(et*(n.object.right-n.object.left)/n.object.zoom/je.clientWidth,n.object.matrix),q(J*(n.object.top-n.object.bottom)/n.object.zoom/je.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function be(K){n.object instanceof zi&&n.object.isPerspectiveCamera||n.object instanceof Dl&&n.object.isOrthographicCamera?b=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Ne(K){be(b/K)}function X(K){be(b*K)}function oe(K){if(!n.zoomToCursor||!n.domElement)return;I=!0;const me=n.domElement.getBoundingClientRect(),et=K.clientX-me.left,J=K.clientY-me.top,je=me.width,Ge=me.height;W.x=et/je*2-1,W.y=-(J/Ge)*2+1,H.set(W.x,W.y,1).unproject(n.object).sub(n.object.position).normalize()}function Ae(K){return Math.max(n.minDistance,Math.min(n.maxDistance,K))}function Fe(K){A.set(K.clientX,K.clientY)}function lt(K){oe(K),U.set(K.clientX,K.clientY)}function de(K){E.set(K.clientX,K.clientY)}function Re(K){R.set(K.clientX,K.clientY),w.subVectors(R,A).multiplyScalar(n.rotateSpeed);const me=n.domElement;me&&(fe(2*Math.PI*w.x/me.clientHeight),pe(2*Math.PI*w.y/me.clientHeight)),A.copy(R),n.update()}function tt(K){B.set(K.clientX,K.clientY),z.subVectors(B,U),z.y>0?Ne(te()):z.y<0&&X(te()),U.copy(B),n.update()}function st(K){N.set(K.clientX,K.clientY),D.subVectors(N,E).multiplyScalar(n.panSpeed),ne(D.x,D.y),E.copy(N),n.update()}function ht(K){oe(K),K.deltaY<0?X(te()):K.deltaY>0&&Ne(te()),n.update()}function jt(K){let me=!1;switch(K.code){case n.keys.UP:ne(0,n.keyPanSpeed),me=!0;break;case n.keys.BOTTOM:ne(0,-n.keyPanSpeed),me=!0;break;case n.keys.LEFT:ne(n.keyPanSpeed,0),me=!0;break;case n.keys.RIGHT:ne(-n.keyPanSpeed,0),me=!0;break}me&&(K.preventDefault(),n.update())}function tn(){if(P.length==1)A.set(P[0].pageX,P[0].pageY);else{const K=.5*(P[0].pageX+P[1].pageX),me=.5*(P[0].pageY+P[1].pageY);A.set(K,me)}}function Nt(){if(P.length==1)E.set(P[0].pageX,P[0].pageY);else{const K=.5*(P[0].pageX+P[1].pageX),me=.5*(P[0].pageY+P[1].pageY);E.set(K,me)}}function Le(){const K=P[0].pageX-P[1].pageX,me=P[0].pageY-P[1].pageY,et=Math.sqrt(K*K+me*me);U.set(0,et)}function He(){n.enableZoom&&Le(),n.enablePan&&Nt()}function Oe(){n.enableZoom&&Le(),n.enableRotate&&tn()}function nt(K){if(P.length==1)R.set(K.pageX,K.pageY);else{const et=ct(K),J=.5*(K.pageX+et.x),je=.5*(K.pageY+et.y);R.set(J,je)}w.subVectors(R,A).multiplyScalar(n.rotateSpeed);const me=n.domElement;me&&(fe(2*Math.PI*w.x/me.clientHeight),pe(2*Math.PI*w.y/me.clientHeight)),A.copy(R)}function Q(K){if(P.length==1)N.set(K.pageX,K.pageY);else{const me=ct(K),et=.5*(K.pageX+me.x),J=.5*(K.pageY+me.y);N.set(et,J)}D.subVectors(N,E).multiplyScalar(n.panSpeed),ne(D.x,D.y),E.copy(N)}function Et(K){const me=ct(K),et=K.pageX-me.x,J=K.pageY-me.y,je=Math.sqrt(et*et+J*J);B.set(0,je),z.set(0,Math.pow(B.y/U.y,n.zoomSpeed)),Ne(z.y),U.copy(B)}function ot(K){n.enableZoom&&Et(K),n.enablePan&&Q(K)}function Tt(K){n.enableZoom&&Et(K),n.enableRotate&&nt(K)}function Qe(K){var me,et;n.enabled!==!1&&(P.length===0&&((me=n.domElement)==null||me.ownerDocument.addEventListener("pointermove",G),(et=n.domElement)==null||et.ownerDocument.addEventListener("pointerup",O)),Dt(K),K.pointerType==="touch"?dt(K):ae(K))}function G(K){n.enabled!==!1&&(K.pointerType==="touch"?Ke(K):Te(K))}function O(K){var me,et,J;Ve(K),P.length===0&&((me=n.domElement)==null||me.releasePointerCapture(K.pointerId),(et=n.domElement)==null||et.ownerDocument.removeEventListener("pointermove",G),(J=n.domElement)==null||J.ownerDocument.removeEventListener("pointerup",O)),n.dispatchEvent(f),m=h.NONE}function ae(K){let me;switch(K.button){case 0:me=n.mouseButtons.LEFT;break;case 1:me=n.mouseButtons.MIDDLE;break;case 2:me=n.mouseButtons.RIGHT;break;default:me=-1}switch(me){case Gc.DOLLY:if(n.enableZoom===!1)return;lt(K),m=h.DOLLY;break;case Gc.ROTATE:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enablePan===!1)return;de(K),m=h.PAN}else{if(n.enableRotate===!1)return;Fe(K),m=h.ROTATE}break;case Gc.PAN:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enableRotate===!1)return;Fe(K),m=h.ROTATE}else{if(n.enablePan===!1)return;de(K),m=h.PAN}break;default:m=h.NONE}m!==h.NONE&&n.dispatchEvent(u)}function Te(K){if(n.enabled!==!1)switch(m){case h.ROTATE:if(n.enableRotate===!1)return;Re(K);break;case h.DOLLY:if(n.enableZoom===!1)return;tt(K);break;case h.PAN:if(n.enablePan===!1)return;st(K);break}}function Ie(K){n.enabled===!1||n.enableZoom===!1||m!==h.NONE&&m!==h.ROTATE||(K.preventDefault(),n.dispatchEvent(u),ht(K),n.dispatchEvent(f))}function Ee(K){n.enabled===!1||n.enablePan===!1||jt(K)}function dt(K){switch(Ze(K),P.length){case 1:switch(n.touches.ONE){case Xc.ROTATE:if(n.enableRotate===!1)return;tn(),m=h.TOUCH_ROTATE;break;case Xc.PAN:if(n.enablePan===!1)return;Nt(),m=h.TOUCH_PAN;break;default:m=h.NONE}break;case 2:switch(n.touches.TWO){case Xc.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;He(),m=h.TOUCH_DOLLY_PAN;break;case Xc.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Oe(),m=h.TOUCH_DOLLY_ROTATE;break;default:m=h.NONE}break;default:m=h.NONE}m!==h.NONE&&n.dispatchEvent(u)}function Ke(K){switch(Ze(K),m){case h.TOUCH_ROTATE:if(n.enableRotate===!1)return;nt(K),n.update();break;case h.TOUCH_PAN:if(n.enablePan===!1)return;Q(K),n.update();break;case h.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ot(K),n.update();break;case h.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Tt(K),n.update();break;default:m=h.NONE}}function vt(K){n.enabled!==!1&&K.preventDefault()}function Dt(K){P.push(K)}function Ve(K){delete Z[K.pointerId];for(let me=0;me<P.length;me++)if(P[me].pointerId==K.pointerId){P.splice(me,1);return}}function Ze(K){let me=Z[K.pointerId];me===void 0&&(me=new ze,Z[K.pointerId]=me),me.set(K.pageX,K.pageY)}function ct(K){const me=K.pointerId===P[0].pointerId?P[1]:P[0];return Z[me.pointerId]}this.dollyIn=(K=te())=>{X(K),n.update()},this.dollyOut=(K=te())=>{Ne(K),n.update()},this.getScale=()=>b,this.setScale=K=>{be(K),n.update()},this.getZoomScale=()=>te(),t!==void 0&&this.connect(t),this.update()}};const r4=rt.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:s=!0,keyEvents:u=!1,onChange:f,onStart:h,onEnd:m,...g},_)=>{const x=Nu(z=>z.invalidate),b=Nu(z=>z.camera),M=Nu(z=>z.gl),A=Nu(z=>z.events),R=Nu(z=>z.setEvents),w=Nu(z=>z.set),E=Nu(z=>z.get),N=Nu(z=>z.performance),D=e||b,U=n||A.connected||M.domElement,B=rt.useMemo(()=>new s4(D),[D]);return gz(()=>{B.enabled&&B.update()},-1),rt.useEffect(()=>(u&&B.connect(u===!0?U:u),B.connect(U),()=>{B.dispose()}),[u,U,t,B,x]),rt.useEffect(()=>{const z=I=>{x(),t&&N.regress(),f&&f(I)},H=I=>{h&&h(I)},W=I=>{m&&m(I)};return B.addEventListener("change",z),B.addEventListener("start",H),B.addEventListener("end",W),()=>{B.removeEventListener("start",H),B.removeEventListener("end",W),B.removeEventListener("change",z)}},[f,h,m,B,x,R]),rt.useEffect(()=>{if(r){const z=E().controls;return w({controls:B}),()=>w({controls:z})}},[r,B]),rt.createElement("primitive",kx({ref:_,object:B,enableDamping:s},g))}),o4=Object.assign({"../../glitch_assumption_toggle/src/index.tsx":()=>Hr(()=>import("./index-B1PtMIUq.js"),__vite__mapDeps([0,1])),"../../glitch_ccd/src/index.tsx":()=>Hr(()=>import("./index-CMvlyyxu.js"),__vite__mapDeps([2,3])),"../../glitch_chess_analogy/src/index.tsx":()=>Hr(()=>import("./index-CwQ-ysLn.js"),__vite__mapDeps([4,5])),"./index.tsx":()=>Hr(()=>import("./index-CDPygLjY.js"),[]),"../../glitch_level_questions/src/index.tsx":()=>Hr(()=>import("./index-CRhmqMwz.js"),__vite__mapDeps([6,7])),"../../glitch_lightlane/src/index.tsx":()=>Hr(()=>import("./index-C370CA0j.js"),[]),"../../glitch_migration_paradox/src/index.tsx":()=>Hr(()=>import("./index-BOUPxVBe.js"),__vite__mapDeps([8,9])),"../../glitch_onboarding/src/index.tsx":()=>Hr(()=>import("./index-DOdpM0HQ.js"),__vite__mapDeps([10,11])),"../../glitch_onboarding2/src/index.tsx":()=>Hr(()=>import("./index-MgCr_Urj.js"),__vite__mapDeps([12,13])),"../../glitch_sphere_paradox/src/index.tsx":()=>Hr(()=>import("./index-Be41ZfS7.js"),__vite__mapDeps([14,15])),"../../glitch_voxel_universe/src/index.tsx":()=>Hr(()=>import("./index-DnqmHVBx.js"),__vite__mapDeps([16,17]))}),l4=Object.assign({"../../glitch_assumption_toggle/glitch.manifest.json":_w,"../../glitch_ccd/glitch.manifest.json":Cw,"../../glitch_chess_analogy/glitch.manifest.json":zw,"../glitch.manifest.json":qw,"../../glitch_level_questions/glitch.manifest.json":tC,"../../glitch_lightlane/glitch.manifest.json":cC,"../../glitch_migration_paradox/glitch.manifest.json":_C,"../../glitch_onboarding/glitch.manifest.json":CC,"../../glitch_onboarding2/glitch.manifest.json":zC,"../../glitch_sphere_paradox/glitch.manifest.json":qC,"../../glitch_voxel_universe/glitch.manifest.json":t3}),$y=new Set(["glitch_gallery"]),lS=Object.fromEntries(Object.entries(o4).map(([r,e])=>[gA(r),e]).filter(([r])=>!$y.has(r))),u4=Object.fromEntries(Object.entries(l4).map(([r,e])=>[gA(r),e]).filter(([r])=>!$y.has(r))),uS=Object.keys(lS).sort((r,e)=>r.localeCompare(e)),c4=[{folder:"glitch_epicycles",note:"No exported GlitchComponent entry point yet."},{folder:"glitch_threshold_theory",note:"Standalone HTML experiment, not a React GlitchComponent."}],hA=new Set(["glitch_lightlane"]),dA=[{id:"fluid",label:"Fluid",width:null,height:null,note:"Host size"},{id:"desktop",label:"Desktop",width:1440,height:900,note:"1440×900"},{id:"tablet",label:"Tablet",width:834,height:1112,note:"834×1112"},{id:"mobile",label:"Mobile",width:390,height:844,note:"390×844"},{id:"narrow",label:"Narrow",width:320,height:640,note:"320×640"}],f4={primary:"#7dff9b",accent:"#ffb84d",bg:"#050505",bgSecondary:"#101613",text:"#f3ffee",textMuted:"#8cc99a",border:"rgba(125, 255, 155, 0.22)"},h4=new URL("/assets/blblblbl-D60GLrQ8.mp3",import.meta.url).href,d4=new URL("/assets/blblblbl-BrzQxThI.m4a",import.meta.url).href,p4={glitch_assumption_toggle:{"machine.compute_step":[h4,d4]}},J1={"ui.button_click":[{frequency:640,durationMs:55,gain:.025,type:"square"},{frequency:880,durationMs:40,gain:.018,type:"triangle",delayMs:36}],"ui.button_hover":[{frequency:540,durationMs:40,gain:.012,type:"sine"}],"machine.compute_start":[{frequency:240,durationMs:90,gain:.02,type:"sawtooth"},{frequency:320,durationMs:90,gain:.018,type:"sawtooth",delayMs:82},{frequency:430,durationMs:90,gain:.016,type:"triangle",delayMs:164}],"machine.compute_step":[{frequency:780,durationMs:26,gain:.009,type:"square"}],"machine.compute_done":[{frequency:520,durationMs:80,gain:.018,type:"triangle"},{frequency:780,durationMs:110,gain:.018,type:"triangle",delayMs:70}],"machine.verdict_stable":[{frequency:440,durationMs:90,gain:.016,type:"triangle"},{frequency:554,durationMs:90,gain:.016,type:"triangle",delayMs:65},{frequency:659,durationMs:140,gain:.015,type:"triangle",delayMs:130}],"machine.verdict_alert":[{frequency:180,durationMs:120,gain:.022,type:"sawtooth"},{frequency:140,durationMs:140,gain:.02,type:"sawtooth",delayMs:100}]},pA=Object.fromEntries(dA.map(r=>[r.id,r])),dy=uS.map(r=>{const e=u4[r];return{folder:r,componentId:e?.componentId??rf(r).replace(/\s+/g,"-").toLowerCase(),displayName:e?.displayName??rf(r),version:e?.version??"0.0.0",packageName:e?.packageName??r,tags:e?.tags??[],description:e?.description,thumbnailLabel:e?.thumbnailLabel,kind:hA.has(r)?"canvas":"standard"}}).filter(r=>!($y.has(r.folder)||r.componentId==="gallery"||r.packageName==="@glitch-components/gallery")),m4=Object.fromEntries(dy.map(r=>[r.folder,r])),mA="preview";let jp=null;class g4 extends hb.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error&&this.setState({error:null})}render(){return this.state.error?he.jsxs("div",{className:"gallery-state gallery-state-error",children:[he.jsx("span",{className:"gallery-badge gallery-badge-danger",children:"Render Error"}),he.jsx("h3",{children:"Component crashed while rendering."}),he.jsx("pre",{className:"gallery-pre",children:this.state.error.stack??this.state.error.message})]}):this.props.children}}function gA(r){const e=r.split("/");return e[e.length-3]??r}function rf(r){return r.replace(/^glitch[_-]?/i,"").replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function v4(r,e){const t=e.metadata??{},n=rf(r).replace(/\s+/g,"-").toLowerCase();return{name:t.name??n,displayName:t.displayName??rf(r),version:t.version??"0.0.0",description:t.description,tags:t.tags??[],paramSchema:t.paramSchema??{},defaultParams:t.defaultParams??{}}}function vA(){if(typeof window>"u")return dy[0]?.folder??"";const r=new URLSearchParams(window.location.search).get("component");return r&&!$y.has(r)&&uS.includes(r)?r:dy[0]?.folder??""}function $1(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mode")===mA}function y4(){if(typeof window>"u")return"fluid";const r=new URLSearchParams(window.location.search).get("viewport");return r&&r in pA?r:"fluid"}async function yA(r){const e=lS[r];if(!e)throw new Error("Missing loader for this component folder.");const t=await e();return{Component:t.default,kind:hA.has(r)?"canvas":"standard",metadata:v4(r,t)}}function _4(r){return r.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function eE(r){if(r===void 0)return"undefined";try{return JSON.stringify(r,null,2)}catch(e){return`Could not serialize payload: ${String(e)}`}}function x4(r,e){return String(r.value)===e}function hv(r,e){if(r.type==="boolean")return!!e;if(r.type==="number"||r.type==="range"){const t=Number(e);return Number.isFinite(t)?t:r.default??0}return r.type==="select"&&typeof e=="string"&&r.options?r.options.find(n=>x4(n,e))?.value??e:e}function b4(r){let e=0;for(let n=0;n<r.length;n+=1)e=e*31+r.charCodeAt(n)|0;const t=Math.abs(e)%360;return{"--gallery-card-hue":String(t)}}function S4(r){return r.split(/[_-]+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function M4(){if(typeof window>"u")return null;const r=window.AudioContext||window.webkitAudioContext;return r?(jp||(jp=new r),jp.state==="suspended"&&jp.resume(),jp):null}function E4(r,e){const t=r.currentTime+(e.delayMs??0)/1e3,n=t+e.durationMs/1e3,s=r.createOscillator(),u=r.createGain();s.type=e.type??"triangle",s.frequency.setValueAtTime(e.frequency,t),u.gain.setValueAtTime(1e-4,t),u.gain.exponentialRampToValueAtTime(e.gain??.02,t+.008),u.gain.exponentialRampToValueAtTime(1e-4,n),s.connect(u),u.connect(r.destination),s.start(t),s.stop(n+.02)}function tE(r){const e=M4();if(!e)return;const t=J1[r]??J1["ui.button_click"];for(const n of t)E4(e,n)}function T4(r,e){return p4[r]?.[e]??[]}function A4({entry:r,hostBridge:e,params:t,previewKey:n,onComplete:s,onProgress:u}){const h={config:{id:`${r.metadata.name}-gallery`,name:r.metadata.name,version:r.metadata.version,params:t},theme:f4,host:e,onComplete:s,onProgress:u},m=r.Component;return r.kind==="canvas"?he.jsx("div",{className:"gallery-canvas-shell",children:he.jsxs(Kz,{camera:{position:[8,8,8],fov:45},children:[he.jsx(m,{...h}),he.jsx(r4,{makeDefault:!0})]})},n):he.jsx("div",{className:"gallery-standard-shell",children:he.jsx(m,{...h})},n)}function w4({paramKey:r,schema:e,value:t,onChange:n}){const s=e.label??rf(r),u=`gallery-param-${r}`;if(e.type==="boolean")return he.jsxs("label",{className:"gallery-control gallery-checkbox",htmlFor:u,children:[he.jsxs("span",{className:"gallery-control-copy",children:[he.jsx("span",{className:"gallery-control-label",children:s}),e.description?he.jsx("span",{className:"gallery-control-help",children:e.description}):null]}),he.jsx("input",{checked:!!t,id:u,type:"checkbox",onChange:f=>n(r,f.currentTarget.checked)})]});if(e.type==="select")return he.jsxs("label",{className:"gallery-control",htmlFor:u,children:[he.jsx("span",{className:"gallery-control-label",children:s}),e.description?he.jsx("span",{className:"gallery-control-help",children:e.description}):null,he.jsx("select",{className:"gallery-input",id:u,value:String(t??""),onChange:f=>n(r,hv(e,f.currentTarget.value)),children:(e.options??[]).map(f=>he.jsx("option",{value:String(f.value),children:f.label},`${r}-${f.label}-${f.value}`))})]});if(e.type==="range"){const f=typeof t=="number"?t:Number(e.default??0);return he.jsxs("div",{className:"gallery-control",children:[he.jsx("label",{className:"gallery-control-label",htmlFor:u,children:s}),e.description?he.jsx("span",{className:"gallery-control-help",children:e.description}):null,he.jsxs("div",{className:"gallery-range-row",children:[he.jsx("input",{className:"gallery-range",id:u,max:e.max,min:e.min,step:e.step,type:"range",value:f,onChange:h=>n(r,hv(e,h.currentTarget.value))}),he.jsx("input",{className:"gallery-number",max:e.max,min:e.min,step:e.step,type:"number",value:f,onChange:h=>n(r,hv(e,h.currentTarget.value))})]})]})}return e.type==="number"?he.jsxs("label",{className:"gallery-control",htmlFor:u,children:[he.jsx("span",{className:"gallery-control-label",children:s}),e.description?he.jsx("span",{className:"gallery-control-help",children:e.description}):null,he.jsx("input",{className:"gallery-input",id:u,max:e.max,min:e.min,step:e.step,type:"number",value:typeof t=="number"?t:Number(e.default??0),onChange:f=>n(r,hv(e,f.currentTarget.value))})]}):he.jsxs("label",{className:"gallery-control",htmlFor:u,children:[he.jsx("span",{className:"gallery-control-label",children:s}),e.description?he.jsx("span",{className:"gallery-control-help",children:e.description}):null,he.jsx("input",{className:"gallery-input",id:u,type:e.type==="color"?"color":"text",value:typeof t=="string"?t:String(t??""),onChange:f=>n(r,f.currentTarget.value)})]})}function C4(){return rt.useEffect(()=>{if(typeof document>"u")return;const r=$1()?"preview":"shell";return document.body.dataset.galleryMode=r,()=>{delete document.body.dataset.galleryMode}},[]),$1()?he.jsx(N4,{}):he.jsx(R4,{})}function R4(){const[r,e]=rt.useState(vA),[t,n]=rt.useState(y4),[s,u]=rt.useState({}),[f,h]=rt.useState({}),[m,g]=rt.useState({}),[_,x]=rt.useState(null),[b,M]=rt.useState(null),[A,R]=rt.useState([]),[w,E]=rt.useState(0),N=rt.useRef(null),[D,U]=rt.useState(!1),B=rt.useCallback((q,ne)=>{R(be=>[{id:Date.now()+be.length,kind:q,payload:ne,timestamp:_4(new Date)},...be].slice(0,32))},[]),z=rt.useCallback(async q=>{if(s[q])return s[q];if(!lS[q])return h(ne=>({...ne,[q]:{status:"error",error:"Missing loader for this component folder."}})),null;h(ne=>({...ne,[q]:{status:"loading"}}));try{const ne=await yA(q);return u(be=>({...be,[q]:ne})),g(be=>be[q]?be:{...be,[q]:{...ne.metadata.defaultParams}}),h(be=>({...be,[q]:{status:"idle"}})),ne}catch(ne){const be=ne instanceof Error?ne.message:String(ne);return h(Ne=>({...Ne,[q]:{status:"error",error:be}})),B("system",{component:q,error:be,type:"load-error"}),null}},[B,s]);rt.useEffect(()=>{if(!r)return;const q=window.setTimeout(()=>{z(r)},0);return()=>window.clearTimeout(q)},[z,r]),rt.useEffect(()=>{if(!r||typeof window>"u")return;const q=new URL(window.location.href);q.searchParams.set("component",r),q.searchParams.set("viewport",t),window.history.replaceState({},"",q)},[r,t]),rt.useEffect(()=>{const q=window.setTimeout(()=>{x(null),M(null),R([]),E(ne=>ne+1),U(!1)},0);return()=>window.clearTimeout(q)},[r]);const H=rt.useCallback(q=>{N.current?.contentWindow&&N.current.contentWindow.postMessage({source:"glitch-gallery-shell",type:"sync",payload:q},window.location.origin)},[]);rt.useEffect(()=>{const q=ne=>{if(!(ne.origin!==window.location.origin||!ne.data||ne.data.source!=="glitch-gallery-preview")){if(ne.data.type==="ready"){U(!0);return}if(ne.data.type==="progress"){x(ne.data.percent),B("progress",{percent:ne.data.percent});return}if(ne.data.type==="complete"){M(ne.data.payload),B("complete",ne.data.payload);return}ne.data.type==="log"&&B(ne.data.kind,ne.data.payload)}};return window.addEventListener("message",q),()=>window.removeEventListener("message",q)},[B]);const W=r?s[r]:void 0,I=r?m4[r]:void 0,P=r?f[r]:void 0,Z=pA[t],se=rt.useMemo(()=>r?m[r]??W?.metadata.defaultParams??{}:{},[m,W?.metadata.defaultParams,r]);rt.useEffect(()=>{!r||!D||H({component:r,params:se,revision:w})},[H,D,w,se,r]);const te=rt.useCallback((q,ne)=>{r&&g(be=>({...be,[r]:{...be[r]??{},[q]:ne}}))},[r]),fe=rt.useCallback(()=>{!r||!W||(g(q=>({...q,[r]:{...W.metadata.defaultParams}})),E(q=>q+1),B("system",{component:r,type:"params-reset"}))},[B,W,r]),pe=rt.useCallback(()=>{r&&(E(q=>q+1),B("system",{component:r,type:"preview-remount"}))},[B,r]),Y=rt.useMemo(()=>{if(typeof window>"u")return"";const q=new URL(window.location.href);return q.search="",q.searchParams.set("mode",mA),q.searchParams.set("component",r),q.toString()},[r]);return he.jsxs("div",{className:"gallery-shell","data-gallery-shell":"true",children:[he.jsxs("aside",{className:"gallery-sidebar",children:[he.jsxs("div",{className:"gallery-sidebar-header",children:[he.jsx("span",{className:"gallery-eyebrow",children:"Dev Host"}),he.jsx("h1",{children:"Glitch Gallery"}),he.jsx("div",{className:"gallery-viewport-switcher gallery-sidebar-viewport-switcher","data-gallery-viewport-switcher":"true",children:dA.map(q=>he.jsxs("button",{className:`gallery-viewport-button gallery-viewport-button-compact${t===q.id?" is-active":""}`,"data-gallery-viewport":q.id,type:"button",onClick:()=>n(q.id),children:[q.label," : ",q.width?`${q.width}px`:"Fluid"]},q.id))})]}),he.jsx("div",{className:"gallery-section",children:he.jsxs("div",{className:"gallery-selected-card",children:[he.jsx("span",{className:"gallery-eyebrow",children:"Selected"}),he.jsx("h2",{className:"gallery-selected-title",children:W?.metadata.displayName??I?.displayName??rf(r)}),he.jsx("p",{className:"gallery-selected-subtitle",children:W?.metadata.description??I?.description??"Gallery loads components lazily and hosts them with the same sound bridge/event logging model used for Glitch University testing."}),he.jsxs("div",{className:"gallery-toolbar-actions gallery-sidebar-actions",children:[he.jsx("button",{className:"gallery-button",type:"button",onClick:pe,children:"Remount Preview"}),he.jsx("button",{className:"gallery-button",type:"button",onClick:fe,disabled:!W,children:"Reset Params"})]})]})}),he.jsxs("div",{className:"gallery-section",children:[he.jsxs("div",{className:"gallery-section-header",children:[he.jsx("h2",{children:"GlitchComponents"}),he.jsx("span",{className:"gallery-badge",children:uS.length})]}),he.jsx("div",{className:"gallery-list","data-gallery-component-list":"true",children:dy.map(q=>{const ne=q.folder,be=s[ne],Ne=r===ne,X=f[ne]?.status??"idle";return he.jsxs("button",{className:`gallery-list-item${Ne?" is-active":""}`,"data-gallery-component":ne,type:"button",onClick:()=>e(ne),style:b4(ne),children:[he.jsx("span",{className:"gallery-list-thumb","aria-hidden":"true",children:he.jsxs("span",{className:"gallery-list-thumb-frame",children:[he.jsx("span",{className:"gallery-list-thumb-type",children:q.kind==="canvas"?"Canvas":"Standard"}),he.jsx("strong",{children:q.thumbnailLabel??S4(q.componentId)}),he.jsx("span",{className:"gallery-list-thumb-id",children:q.componentId})]})}),he.jsxs("span",{className:"gallery-list-copy",children:[he.jsx("span",{className:"gallery-list-title",children:be?.metadata.displayName??q.displayName}),he.jsx("span",{className:"gallery-list-subtitle",children:ne}),he.jsx("span",{className:"gallery-list-note",children:q.tags.slice(0,3).join(" · ")||"No tags exported"})]}),he.jsxs("span",{className:"gallery-list-status",children:[he.jsxs("span",{className:"gallery-badge gallery-badge-muted",children:["v",q.version]}),X==="loading"?he.jsx("span",{className:"gallery-badge",children:"Loading"}):null,X==="error"?he.jsx("span",{className:"gallery-badge gallery-badge-danger",children:"Error"}):null]})]},ne)})})]}),he.jsxs("div",{className:"gallery-section",children:[he.jsx("div",{className:"gallery-section-header",children:he.jsx("h2",{children:"Not Yet Exported"})}),he.jsx("div",{className:"gallery-list",children:c4.map(q=>he.jsxs("div",{className:"gallery-list-item is-disabled",children:[he.jsxs("span",{className:"gallery-list-copy",children:[he.jsx("span",{className:"gallery-list-title",children:rf(q.folder)}),he.jsx("span",{className:"gallery-list-subtitle",children:q.folder}),he.jsx("span",{className:"gallery-list-note",children:q.note})]}),he.jsx("span",{className:"gallery-badge gallery-badge-muted",children:"Raw"})]},q.folder))})]})]}),he.jsx("main",{className:"gallery-main",children:he.jsxs("div",{className:"gallery-grid",children:[he.jsxs("section",{className:"gallery-preview-panel",children:[he.jsxs("div",{className:"gallery-panel-header",children:[he.jsx("span",{className:"gallery-badge",children:r}),he.jsxs("div",{className:"gallery-stage-badges",children:[he.jsx("span",{className:"gallery-badge gallery-badge-muted",children:Z.width?`${Z.width}px`:"Fluid"}),_!==null?he.jsxs("span",{className:"gallery-badge gallery-badge-accent",children:[Math.round(_),"%"]}):null]})]}),he.jsx("div",{className:"gallery-stage","data-gallery-stage":r,children:he.jsx("div",{className:`gallery-stage-viewport${Z.width?"":" is-fluid"}`,"data-gallery-preview-viewport":t,style:Z.width?{"--gallery-preview-width":`${Z.width}px`,"--gallery-preview-height":`${Z.height}px`}:void 0,children:P?.status==="error"?he.jsxs("div",{className:"gallery-state gallery-state-error",children:[he.jsx("span",{className:"gallery-badge gallery-badge-danger",children:"Load Error"}),he.jsx("h3",{children:"Unable to import this component."}),he.jsx("pre",{className:"gallery-pre",children:P.error})]}):W?he.jsx("iframe",{ref:N,className:"gallery-preview-frame","data-gallery-preview-frame":r,src:Y,title:`${r} preview`},r):he.jsxs("div",{className:"gallery-state",children:[he.jsx("span",{className:"gallery-badge",children:"Loading"}),he.jsx("h3",{children:"Importing component metadata…"}),he.jsx("p",{children:"The gallery keeps the catalog light and only imports the selected component bundle."})]})})})]}),he.jsxs("aside",{className:"gallery-inspector",children:[he.jsxs("section",{className:"gallery-panel",children:[he.jsx("div",{className:"gallery-section-header",children:he.jsx("h3",{children:"Metadata"})}),W?he.jsxs("dl",{className:"gallery-metadata",children:[he.jsxs("div",{children:[he.jsx("dt",{children:"Name"}),he.jsx("dd",{children:W.metadata.name})]}),he.jsxs("div",{children:[he.jsx("dt",{children:"Version"}),he.jsx("dd",{children:W.metadata.version??I?.version})]}),he.jsxs("div",{children:[he.jsx("dt",{children:"Wrapper"}),he.jsx("dd",{children:W.kind==="canvas"?"Canvas host":"Standard host"})]}),he.jsxs("div",{children:[he.jsx("dt",{children:"Package"}),he.jsx("dd",{children:I?.packageName??"Unknown"})]}),he.jsxs("div",{children:[he.jsx("dt",{children:"Viewport"}),he.jsx("dd",{children:Z.width?`${Z.width}px fixed width`:"Fluid host width"})]}),he.jsxs("div",{children:[he.jsx("dt",{children:"Tags"}),he.jsx("dd",{children:W.metadata.tags?.length?W.metadata.tags.join(", "):I?.tags.length?I.tags.join(", "):"None exported"})]})]}):he.jsx("p",{className:"gallery-muted",children:"Metadata appears after the module loads."})]}),he.jsxs("section",{className:"gallery-panel gallery-panel-scroll",children:[he.jsxs("div",{className:"gallery-section-header",children:[he.jsx("h3",{children:"Params"}),W?he.jsx("span",{className:"gallery-badge",children:Object.keys(W.metadata.paramSchema).length}):null]}),W&&Object.keys(W.metadata.paramSchema).length>0?he.jsx("div",{className:"gallery-controls gallery-controls-scroll",children:Object.entries(W.metadata.paramSchema).map(([q,ne])=>he.jsx(w4,{onChange:te,paramKey:q,schema:ne,value:se[q]??ne.default},q))}):he.jsx("p",{className:"gallery-muted",children:"This component does not expose parameter controls."})]}),he.jsxs("section",{className:"gallery-panel",children:[he.jsx("div",{className:"gallery-section-header",children:he.jsx("h3",{children:"Latest Result"})}),b?he.jsx("pre",{className:"gallery-pre",children:eE(b)}):he.jsx("p",{className:"gallery-muted",children:"No completion payload yet."})]}),he.jsxs("section",{className:"gallery-panel",children:[he.jsxs("div",{className:"gallery-section-header",children:[he.jsx("h3",{children:"Event Log"}),he.jsx("button",{className:"gallery-button gallery-button-quiet",type:"button",onClick:()=>R([]),children:"Clear"})]}),A.length>0?he.jsx("div",{className:"gallery-log-list",children:A.map(q=>he.jsxs("article",{className:"gallery-log-item",children:[he.jsxs("div",{className:"gallery-log-header",children:[he.jsx("span",{className:`gallery-badge gallery-badge-${q.kind}`,children:q.kind}),he.jsx("span",{className:"gallery-log-time",children:q.timestamp})]}),he.jsx("pre",{className:"gallery-pre",children:eE(q.payload)})]},q.id))}):he.jsx("p",{className:"gallery-muted",children:"Progress, completion, host events, and sound calls appear here."})]})]})]})})]})}function N4(){const[r,e]=rt.useState(vA),[t,n]=rt.useState(null),[s,u]=rt.useState(null),[f,h]=rt.useState({}),[m,g]=rt.useState(0),_=rt.useRef({}),x=rt.useCallback(M=>{typeof window>"u"||window.parent===window||window.parent.postMessage(M,window.location.origin)},[]);rt.useEffect(()=>{x({source:"glitch-gallery-preview",type:"ready"})},[x]),rt.useEffect(()=>{const M=A=>{if(A.origin!==window.location.origin||!A.data||A.data.source!=="glitch-gallery-shell"||A.data.type!=="sync")return;const R=A.data.payload;e(R.component),h(R.params),g(R.revision)};return window.addEventListener("message",M),()=>window.removeEventListener("message",M)},[]),rt.useEffect(()=>{let M=!1;return yA(r).then(A=>{M||(n(A),u(null),h(R=>Object.keys(R).length>0?R:{...A.metadata.defaultParams}))}).catch(A=>{if(M)return;const R=A instanceof Error?A.message:String(A);n(null),u(R),x({source:"glitch-gallery-preview",type:"log",kind:"system",payload:{type:"load-error",component:r,error:R}})}),()=>{M=!0}},[x,r]);const b=rt.useMemo(()=>({playSound(M,A){const R=`${r}:${M}`,w=T4(r,M);let E=!1;if(w.length>0&&typeof window<"u"){E=!0;const[N]=w,D=_.current[R]??new Audio(N);_.current[R]=D,D.pause(),D.currentTime=0;const U=D.play();U&&U.catch(()=>{tE(M)})}E||tE(M),x({source:"glitch-gallery-preview",type:"log",kind:"sound",payload:{id:M,payload:A}})},stopSound(M,A){const R=`${r}:${M}`,w=_.current[R];w&&(w.pause(),w.currentTime=0),x({source:"glitch-gallery-preview",type:"log",kind:"sound",payload:{id:`stop:${M}`,payload:A}})},emit(M,A){x({source:"glitch-gallery-preview",type:"log",kind:"host",payload:{type:M,payload:A}})}}),[x]);return s?he.jsx("div",{className:"gallery-runtime-root",children:he.jsxs("div",{className:"gallery-state gallery-state-error",children:[he.jsx("span",{className:"gallery-badge gallery-badge-danger",children:"Load Error"}),he.jsx("h3",{children:"Unable to import this component."}),he.jsx("pre",{className:"gallery-pre",children:s})]})}):t?he.jsx("div",{className:"gallery-runtime-root","data-gallery-runtime":r,children:he.jsx(g4,{resetKey:`${r}:${m}`,children:he.jsx(A4,{entry:t,hostBridge:b,onComplete:M=>{x({source:"glitch-gallery-preview",type:"complete",payload:M})},onProgress:M=>{x({source:"glitch-gallery-preview",type:"progress",percent:M})},params:f,previewKey:`${r}:${m}`})})}):he.jsx("div",{className:"gallery-runtime-root",children:he.jsxs("div",{className:"gallery-state",children:[he.jsx("span",{className:"gallery-badge",children:"Loading"}),he.jsx("h3",{children:"Importing preview runtime…"})]})})}lw.createRoot(document.getElementById("root")).render(he.jsx(C4,{}));export{PD as A,as as B,yt as C,Uo as D,Ny as F,C4 as G,QE as I,uR as M,Dl as O,zi as P,Pa as Q,my as R,yr as S,Xc as T,iS as U,j as V,jT as W,kx as _,gz as a,ze as b,ow as c,XE as d,Dz as e,wl as f,Kz as g,r4 as h,Cn as i,he as j,FD as k,Gc as l,eb as m,of as n,Lb as o,Kp as p,qy as q,rt as r,Xb as s,Yi as t,Nu as u,lf as v,Vu as w,NT as x,RT as y,CT as z};