4042 lines
1.0 MiB
4042 lines
1.0 MiB
function $x(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var b_={exports:{}},Ap={};var Lb;function AA(){if(Lb)return Ap;Lb=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,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:o,type:i,key:f,ref:s!==void 0?s:null,props:u}}return Ap.Fragment=e,Ap.jsx=t,Ap.jsxs=t,Ap}var Ib;function wA(){return Ib||(Ib=1,b_.exports=AA()),b_.exports}var Bs=wA(),M_={exports:{}},qt={};var Ob;function CA(){if(Ob)return qt;Ob=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=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,C={};function E(X,se,Ee){this.props=X,this.context=se,this.refs=C,this.updater=Ee||A}E.prototype.isReactComponent={},E.prototype.setState=function(X,se){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,se,"setState")},E.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function D(){}D.prototype=E.prototype;function U(X,se,Ee){this.props=X,this.context=se,this.refs=C,this.updater=Ee||A}var L=U.prototype=new D;L.constructor=U,R(L,E.prototype),L.isPureReactComponent=!0;var B=Array.isArray;function P(){}var H={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function I(X,se,Ee){var Oe=Ee.ref;return{$$typeof:o,type:X,key:se,ref:Oe!==void 0?Oe:null,props:Ee}}function z(X,se){return I(X.type,se,X.props)}function j(X){return typeof X=="object"&&X!==null&&X.$$typeof===o}function ae(X){var se={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(Ee){return se[Ee]})}var $=/\/+/g;function ue(X,se){return typeof X=="object"&&X!==null&&X.key!=null?ae(""+X.key):se.toString(36)}function he(X){switch(X.status){case"fulfilled":return X.value;case"rejected":throw X.reason;default:switch(typeof X.status=="string"?X.then(P,P):(X.status="pending",X.then(function(se){X.status==="pending"&&(X.status="fulfilled",X.value=se)},function(se){X.status==="pending"&&(X.status="rejected",X.reason=se)})),X.status){case"fulfilled":return X.value;case"rejected":throw X.reason}}throw X}function q(X,se,Ee,Oe,nt){var fe=typeof X;(fe==="undefined"||fe==="boolean")&&(X=null);var Te=!1;if(X===null)Te=!0;else switch(fe){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(X.$$typeof){case o:case e:Te=!0;break;case _:return Te=X._init,q(Te(X._payload),se,Ee,Oe,nt)}}if(Te)return nt=nt(X),Te=Oe===""?"."+ue(X,0):Oe,B(nt)?(Ee="",Te!=null&&(Ee=Te.replace($,"$&/")+"/"),q(nt,se,Ee,"",function(ut){return ut})):nt!=null&&(j(nt)&&(nt=z(nt,Ee+(nt.key==null||X&&X.key===nt.key?"":(""+nt.key).replace($,"$&/")+"/")+Te)),se.push(nt)),1;Te=0;var Je=Oe===""?".":Oe+":";if(B(X))for(var et=0;et<X.length;et++)Oe=X[et],fe=Je+ue(Oe,et),Te+=q(Oe,se,Ee,fe,nt);else if(et=M(X),typeof et=="function")for(X=et.call(X),et=0;!(Oe=X.next()).done;)Oe=Oe.value,fe=Je+ue(Oe,et++),Te+=q(Oe,se,Ee,fe,nt);else if(fe==="object"){if(typeof X.then=="function")return q(he(X),se,Ee,Oe,nt);throw se=String(X),Error("Objects are not valid as a React child (found: "+(se==="[object Object]"?"object with keys {"+Object.keys(X).join(", ")+"}":se)+"). If you meant to render a collection of children, use an array instead.")}return Te}function K(X,se,Ee){if(X==null)return X;var Oe=[],nt=0;return q(X,Oe,"","",function(fe){return se.call(Ee,fe,nt++)}),Oe}function ce(X){if(X._status===-1){var se=X._result;se=se(),se.then(function(Ee){(X._status===0||X._status===-1)&&(X._status=1,X._result=Ee)},function(Ee){(X._status===0||X._status===-1)&&(X._status=2,X._result=Ee)}),X._status===-1&&(X._status=0,X._result=se)}if(X._status===1)return X._result.default;throw X._result}var Ae=typeof reportError=="function"?reportError:function(X){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var se=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(se))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",X);return}console.error(X)},Ce={map:K,forEach:function(X,se,Ee){K(X,function(){se.apply(this,arguments)},Ee)},count:function(X){var se=0;return K(X,function(){se++}),se},toArray:function(X){return K(X,function(se){return se})||[]},only:function(X){if(!j(X))throw Error("React.Children.only expected to receive a single React element child.");return X}};return qt.Activity=x,qt.Children=Ce,qt.Component=E,qt.Fragment=t,qt.Profiler=s,qt.PureComponent=U,qt.StrictMode=i,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,se,Ee){if(X==null)throw Error("The argument must be a React element, but you passed "+X+".");var Oe=R({},X.props),nt=X.key;if(se!=null)for(fe in se.key!==void 0&&(nt=""+se.key),se)!W.call(se,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&se.ref===void 0||(Oe[fe]=se[fe]);var fe=arguments.length-2;if(fe===1)Oe.children=Ee;else if(1<fe){for(var Te=Array(fe),Je=0;Je<fe;Je++)Te[Je]=arguments[Je+2];Oe.children=Te}return I(X.type,nt,Oe)},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,se,Ee){var Oe,nt={},fe=null;if(se!=null)for(Oe in se.key!==void 0&&(fe=""+se.key),se)W.call(se,Oe)&&Oe!=="key"&&Oe!=="__self"&&Oe!=="__source"&&(nt[Oe]=se[Oe]);var Te=arguments.length-2;if(Te===1)nt.children=Ee;else if(1<Te){for(var Je=Array(Te),et=0;et<Te;et++)Je[et]=arguments[et+2];nt.children=Je}if(X&&X.defaultProps)for(Oe in Te=X.defaultProps,Te)nt[Oe]===void 0&&(nt[Oe]=Te[Oe]);return I(X,fe,nt)},qt.createRef=function(){return{current:null}},qt.forwardRef=function(X){return{$$typeof:h,render:X}},qt.isValidElement=j,qt.lazy=function(X){return{$$typeof:_,_payload:{_status:-1,_result:X},_init:ce}},qt.memo=function(X,se){return{$$typeof:g,type:X,compare:se===void 0?null:se}},qt.startTransition=function(X){var se=H.T,Ee={};H.T=Ee;try{var Oe=X(),nt=H.S;nt!==null&&nt(Ee,Oe),typeof Oe=="object"&&Oe!==null&&typeof Oe.then=="function"&&Oe.then(P,Ae)}catch(fe){Ae(fe)}finally{se!==null&&Ee.types!==null&&(se.types=Ee.types),H.T=se}},qt.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},qt.use=function(X){return H.H.use(X)},qt.useActionState=function(X,se,Ee){return H.H.useActionState(X,se,Ee)},qt.useCallback=function(X,se){return H.H.useCallback(X,se)},qt.useContext=function(X){return H.H.useContext(X)},qt.useDebugValue=function(){},qt.useDeferredValue=function(X,se){return H.H.useDeferredValue(X,se)},qt.useEffect=function(X,se){return H.H.useEffect(X,se)},qt.useEffectEvent=function(X){return H.H.useEffectEvent(X)},qt.useId=function(){return H.H.useId()},qt.useImperativeHandle=function(X,se,Ee){return H.H.useImperativeHandle(X,se,Ee)},qt.useInsertionEffect=function(X,se){return H.H.useInsertionEffect(X,se)},qt.useLayoutEffect=function(X,se){return H.H.useLayoutEffect(X,se)},qt.useMemo=function(X,se){return H.H.useMemo(X,se)},qt.useOptimistic=function(X,se){return H.H.useOptimistic(X,se)},qt.useReducer=function(X,se,Ee){return H.H.useReducer(X,se,Ee)},qt.useRef=function(X){return H.H.useRef(X)},qt.useState=function(X){return H.H.useState(X)},qt.useSyncExternalStore=function(X,se,Ee){return H.H.useSyncExternalStore(X,se,Ee)},qt.useTransition=function(){return H.H.useTransition()},qt.version="19.2.3",qt}var zb;function ym(){return zb||(zb=1,M_.exports=CA()),M_.exports}var It=ym();const O1=$x(It);var E_={exports:{}},wp={},T_={exports:{}},A_={};var Pb;function RA(){return Pb||(Pb=1,(function(o){function e(q,K){var ce=q.length;q.push(K);e:for(;0<ce;){var Ae=ce-1>>>1,Ce=q[Ae];if(0<s(Ce,K))q[Ae]=K,q[ce]=Ce,ce=Ae;else break e}}function t(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var K=q[0],ce=q.pop();if(ce!==K){q[0]=ce;e:for(var Ae=0,Ce=q.length,X=Ce>>>1;Ae<X;){var se=2*(Ae+1)-1,Ee=q[se],Oe=se+1,nt=q[Oe];if(0>s(Ee,ce))Oe<Ce&&0>s(nt,Ee)?(q[Ae]=nt,q[Oe]=ce,Ae=Oe):(q[Ae]=Ee,q[se]=ce,Ae=se);else if(Oe<Ce&&0>s(nt,ce))q[Ae]=nt,q[Oe]=ce,Ae=Oe;else break e}}return K}function s(q,K){var ce=q.sortIndex-K.sortIndex;return ce!==0?ce:q.id-K.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;o.unstable_now=function(){return u.now()}}else{var f=Date,h=f.now();o.unstable_now=function(){return f.now()-h}}var m=[],g=[],_=1,x=null,b=3,M=!1,A=!1,R=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function L(q){for(var K=t(g);K!==null;){if(K.callback===null)i(g);else if(K.startTime<=q)i(g),K.sortIndex=K.expirationTime,e(m,K);else break;K=t(g)}}function B(q){if(R=!1,L(q),!A)if(t(m)!==null)A=!0,P||(P=!0,ae());else{var K=t(g);K!==null&&he(B,K.startTime-q)}}var P=!1,H=-1,W=5,I=-1;function z(){return C?!0:!(o.unstable_now()-I<W)}function j(){if(C=!1,P){var q=o.unstable_now();I=q;var K=!0;try{e:{A=!1,R&&(R=!1,D(H),H=-1),M=!0;var ce=b;try{t:{for(L(q),x=t(m);x!==null&&!(x.expirationTime>q&&z());){var Ae=x.callback;if(typeof Ae=="function"){x.callback=null,b=x.priorityLevel;var Ce=Ae(x.expirationTime<=q);if(q=o.unstable_now(),typeof Ce=="function"){x.callback=Ce,L(q),K=!0;break t}x===t(m)&&i(m),L(q)}else i(m);x=t(m)}if(x!==null)K=!0;else{var X=t(g);X!==null&&he(B,X.startTime-q),K=!1}}break e}finally{x=null,b=ce,M=!1}K=void 0}}finally{K?ae():P=!1}}}var ae;if(typeof U=="function")ae=function(){U(j)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,ue=$.port2;$.port1.onmessage=j,ae=function(){ue.postMessage(null)}}else ae=function(){E(j,0)};function he(q,K){H=E(function(){q(o.unstable_now())},K)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(q){q.callback=null},o.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<q?Math.floor(1e3/q):5},o.unstable_getCurrentPriorityLevel=function(){return b},o.unstable_next=function(q){switch(b){case 1:case 2:case 3:var K=3;break;default:K=b}var ce=b;b=K;try{return q()}finally{b=ce}},o.unstable_requestPaint=function(){C=!0},o.unstable_runWithPriority=function(q,K){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ce=b;b=q;try{return K()}finally{b=ce}},o.unstable_scheduleCallback=function(q,K,ce){var Ae=o.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?Ae+ce:Ae):ce=Ae,q){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=ce+Ce,q={id:_++,callback:K,priorityLevel:q,startTime:ce,expirationTime:Ce,sortIndex:-1},ce>Ae?(q.sortIndex=ce,e(g,q),t(m)===null&&q===t(g)&&(R?(D(H),H=-1):R=!0,he(B,ce-Ae))):(q.sortIndex=Ce,e(m,q),A||M||(A=!0,P||(P=!0,ae()))),q},o.unstable_shouldYield=z,o.unstable_wrapCallback=function(q){var K=b;return function(){var ce=b;b=K;try{return q.apply(this,arguments)}finally{b=ce}}}})(A_)),A_}var Bb;function z1(){return Bb||(Bb=1,T_.exports=RA()),T_.exports}var w_={exports:{}},Ca={};var Fb;function DA(){if(Fb)return Ca;Fb=1;var o=ym();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 i={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=o.__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 Ca.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ca.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,_)},Ca.flushSync=function(m){var g=f.T,_=i.p;try{if(f.T=null,i.p=2,m)return m()}finally{f.T=g,i.p=_,i.d.f()}},Ca.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,i.d.C(m,g))},Ca.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},Ca.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"?i.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:M}):_==="script"&&i.d.X(m,{crossOrigin:x,integrity:b,fetchPriority:M,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Ca.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);i.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&&i.d.M(m)},Ca.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var _=g.as,x=h(_,g.crossOrigin);i.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})}},Ca.preloadModule=function(m,g){if(typeof m=="string")if(g){var _=h(g.as,g.crossOrigin);i.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 i.d.m(m)},Ca.requestFormReset=function(m){i.d.r(m)},Ca.unstable_batchedUpdates=function(m,g){return m(g)},Ca.useFormState=function(m,g,_){return f.H.useFormState(m,g,_)},Ca.useFormStatus=function(){return f.H.useHostTransitionStatus()},Ca.version="19.2.3",Ca}var Vb;function NA(){if(Vb)return w_.exports;Vb=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),w_.exports=DA(),w_.exports}var kb;function UA(){if(kb)return wp;kb=1;var o=z1(),e=ym(),t=NA();function i(n){var a="https://react.dev/errors/"+n;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 #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function f(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function h(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(u(n)!==n)throw Error(i(188))}function g(n){var a=n.alternate;if(!a){if(a=u(n),a===null)throw Error(i(188));return a!==n?null:n}for(var c=n,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),n;if(S===d)return m(y),a;S=S.sibling}throw Error(i(188))}if(c.return!==d.return)c=y,d=S;else{for(var N=!1,k=y.child;k;){if(k===c){N=!0,c=y,d=S;break}if(k===d){N=!0,d=y,c=S;break}k=k.sibling}if(!N){for(k=S.child;k;){if(k===c){N=!0,c=S,d=y;break}if(k===d){N=!0,d=S,c=y;break}k=k.sibling}if(!N)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:a}function _(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=_(n),a!==null)return a;n=n.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"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),U=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),j=Symbol.iterator;function ae(n){return n===null||typeof n!="object"?null:(n=j&&n[j]||n["@@iterator"],typeof n=="function"?n:null)}var $=Symbol.for("react.client.reference");function ue(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===$?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case R:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case B:return"Suspense";case P:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case A:return"Portal";case U:return n.displayName||"Context";case D:return(n._context.displayName||"Context")+".Consumer";case L:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case H:return a=n.displayName||null,a!==null?a:ue(n.type)||"Memo";case W:a=n._payload,n=n._init;try{return ue(n(a))}catch{}}return null}var he=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},Ae=[],Ce=-1;function X(n){return{current:n}}function se(n){0>Ce||(n.current=Ae[Ce],Ae[Ce]=null,Ce--)}function Ee(n,a){Ce++,Ae[Ce]=n.current,n.current=a}var Oe=X(null),nt=X(null),fe=X(null),Te=X(null);function Je(n,a){switch(Ee(fe,a),Ee(nt,n),Ee(Oe,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?nb(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=nb(a),n=ib(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}se(Oe),Ee(Oe,n)}function et(){se(Oe),se(nt),se(fe)}function ut(n){n.memoizedState!==null&&Ee(Te,n);var a=Oe.current,c=ib(a,n.type);a!==c&&(Ee(nt,n),Ee(Oe,c))}function Jt(n){nt.current===n&&(se(Oe),se(nt)),Te.current===n&&(se(Te),bp._currentValue=ce)}var on,Dt;function Re(n){if(on===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);on=a&&a[1]||"",Dt=-1<c.stack.indexOf(`
|
|
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
`+on+n+Dt}var Ve=!1;function Ue(n,a){if(!n||Ve)return"";Ve=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(Me){var ve=Me}Reflect.construct(n,[],Ie)}else{try{Ie.call()}catch(Me){ve=Me}n.call(Ie.prototype)}}else{try{throw Error()}catch(Me){ve=Me}(Ie=n())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(Me){if(Me&&ve&&typeof Me.stack=="string")return[Me.stack,ve.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(),N=S[0],k=S[1];if(N&&k){var Q=N.split(`
|
|
`),pe=k.split(`
|
|
`);for(y=d=0;d<Q.length&&!Q[d].includes("DetermineComponentFrameRoot");)d++;for(;y<pe.length&&!pe[y].includes("DetermineComponentFrameRoot");)y++;if(d===Q.length||y===pe.length)for(d=Q.length-1,y=pe.length-1;1<=d&&0<=y&&Q[d]!==pe[y];)y--;for(;1<=d&&0<=y;d--,y--)if(Q[d]!==pe[y]){if(d!==1||y!==1)do if(d--,y--,0>y||Q[d]!==pe[y]){var we=`
|
|
`+Q[d].replace(" at new "," at ");return n.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",n.displayName)),we}while(1<=d&&0<=y);break}}}finally{Ve=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Re(c):""}function Ke(n,a){switch(n.tag){case 26:case 27:case 5:return Re(n.type);case 16:return Re("Lazy");case 13:return n.child!==a&&a!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ue(n.type,!1);case 11:return Ue(n.type.render,!1);case 1:return Ue(n.type,!0);case 31:return Re("Activity");default:return""}}function Z(n){try{var a="",c=null;do a+=Ke(n,c),c=n,n=n.return;while(n);return a}catch(d){return`
|
|
Error generating stack: `+d.message+`
|
|
`+d.stack}}var St=Object.prototype.hasOwnProperty,tt=o.unstable_scheduleCallback,Mt=o.unstable_cancelCallback,We=o.unstable_shouldYield,G=o.unstable_requestPaint,O=o.unstable_now,ne=o.unstable_getCurrentPriorityLevel,Se=o.unstable_ImmediatePriority,Le=o.unstable_UserBlockingPriority,be=o.unstable_NormalPriority,ct=o.unstable_LowPriority,Ze=o.unstable_IdlePriority,gt=o.log,wt=o.unstable_setDisableYieldValue,Be=null,Xe=null;function ft(n){if(typeof gt=="function"&&wt(n),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(Be,n)}catch{}}var lt=Math.clz32?Math.clz32:te,$e=Math.log,Zt=Math.LN2;function te(n){return n>>>=0,n===0?32:31-($e(n)/Zt|0)|0}var it=256,Ge=262144,st=4194304;function Fe(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ne(n,a,c){var d=n.pendingLanes;if(d===0)return 0;var y=0,S=n.suspendedLanes,N=n.pingedLanes;n=n.warmLanes;var k=d&134217727;return k!==0?(d=k&~S,d!==0?y=Fe(d):(N&=k,N!==0?y=Fe(N):c||(c=k&~n,c!==0&&(y=Fe(c))))):(k=d&~S,k!==0?y=Fe(k):N!==0?y=Fe(N):c||(c=d&~n,c!==0&&(y=Fe(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 je(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Bt(n,a){switch(n){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 dn(){var n=st;return st<<=1,(st&62914560)===0&&(st=4194304),n}function gn(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Xi(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function va(n,a,c,d,y,S){var N=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var k=n.entanglements,Q=n.expirationTimes,pe=n.hiddenUpdates;for(c=N&~c;0<c;){var we=31-lt(c),Ie=1<<we;k[we]=0,Q[we]=-1;var ve=pe[we];if(ve!==null)for(pe[we]=null,we=0;we<ve.length;we++){var Me=ve[we];Me!==null&&(Me.lane&=-536870913)}c&=~Ie}d!==0&&Zr(n,d,0),S!==0&&y===0&&n.tag!==0&&(n.suspendedLanes|=S&~(N&~a))}function Zr(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var d=31-lt(a);n.entangledLanes|=a,n.entanglements[d]=n.entanglements[d]|1073741824|c&261930}function jr(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var d=31-lt(c),y=1<<d;y&a|n[d]&a&&(n[d]|=a),c&=~y}}function Vo(n,a){var c=a&-a;return c=(c&42)!==0?1:Qr(c),(c&(n.suspendedLanes|a))!==0?0:c}function Qr(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function _r(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function ko(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:Ab(n.type))}function Ki(n,a){var c=K.p;try{return K.p=n,a()}finally{K.p=c}}var za=Math.random().toString(36).slice(2),Qn="__reactFiber$"+za,Ti="__reactProps$"+za,Pa="__reactContainer$"+za,Ba="__reactEvents$"+za,Fa="__reactListeners$"+za,Jr="__reactHandles$"+za,Ho="__reactResources$"+za,Rs="__reactMarker$"+za;function xr(n){delete n[Qn],delete n[Ti],delete n[Ba],delete n[Fa],delete n[Jr]}function Sr(n){var a=n[Qn];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Pa]||c[Qn]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=cb(n);n!==null;){if(c=n[Qn])return c;n=cb(n)}return a}n=c,c=n.parentNode}return null}function br(n){if(n=n[Qn]||n[Pa]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function Kr(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(i(33))}function Gs(n){var a=n[Ho];return a||(a=n[Ho]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function V(n){n[Rs]=!0}var ie=new Set,ye={};function me(n,a){oe(n,a),oe(n+"Capture",a)}function oe(n,a){for(ye[n]=a,n=0;n<a.length;n++)ie.add(a[n])}var qe=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]*$"),ht={},He={};function mt(n){return St.call(He,n)?!0:St.call(ht,n)?!1:qe.test(n)?He[n]=!0:(ht[n]=!0,!1)}function vt(n,a,c){if(mt(a))if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+c)}}function At(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function _t(n,a,c,d){if(d===null)n.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+d)}}function Ut(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Sn(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function zn(n,a,c){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,S=d.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return y.call(this)},set:function(N){c=""+N,S.call(this,N)}}),Object.defineProperty(n,a,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(N){c=""+N},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Un(n){if(!n._valueTracker){var a=Sn(n)?"checked":"value";n._valueTracker=zn(n,a,""+n[a])}}function Ht(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),d="";return n&&(d=Sn(n)?n.checked?"true":"false":n.value),n=d,n!==c?(a.setValue(n),!0):!1}function at(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var vn=/[\n"\\]/g;function Ot(n){return n.replace(vn,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function vi(n,a,c,d,y,S,N,k){n.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?n.type=N:n.removeAttribute("type"),a!=null?N==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Ut(a)):n.value!==""+Ut(a)&&(n.value=""+Ut(a)):N!=="submit"&&N!=="reset"||n.removeAttribute("value"),a!=null?Gn(n,N,Ut(a)):c!=null?Gn(n,N,Ut(c)):d!=null&&n.removeAttribute("value"),y==null&&S!=null&&(n.defaultChecked=!!S),y!=null&&(n.checked=y&&typeof y!="function"&&typeof y!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Ut(k):n.removeAttribute("name")}function Ds(n,a,c,d,y,S,N,k){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.type=S),a!=null||c!=null){if(!(S!=="submit"&&S!=="reset"||a!=null)){Un(n);return}c=c!=null?""+Ut(c):"",a=a!=null?""+Ut(a):c,k||a===n.value||(n.value=a),n.defaultValue=a}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=k?n.checked:!!d,n.defaultChecked=!!d,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(n.name=N),Un(n)}function Gn(n,a,c){a==="number"&&at(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function sa(n,a,c,d){if(n=n.options,a){a={};for(var y=0;y<c.length;y++)a["$"+c[y]]=!0;for(c=0;c<n.length;c++)y=a.hasOwnProperty("$"+n[c].value),n[c].selected!==y&&(n[c].selected=y),y&&d&&(n[c].defaultSelected=!0)}else{for(c=""+Ut(c),a=null,y=0;y<n.length;y++){if(n[y].value===c){n[y].selected=!0,d&&(n[y].defaultSelected=!0);return}a!==null||n[y].disabled||(a=n[y])}a!==null&&(a.selected=!0)}}function En(n,a,c){if(a!=null&&(a=""+Ut(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+Ut(c):""}function Ai(n,a,c,d){if(a==null){if(d!=null){if(c!=null)throw Error(i(92));if(he(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),a=c}c=Ut(a),n.defaultValue=c,d=n.textContent,d===c&&d!==""&&d!==null&&(n.value=d),Un(n)}function yi(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var Ii=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 Oi(n,a,c){var d=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":d?n.setProperty(a,c):typeof c!="number"||c===0||Ii.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function Go(n,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(n=n.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="");for(var y in a)d=a[y],a.hasOwnProperty(y)&&c[y]!==d&&Oi(n,y,d)}else for(var S in a)a.hasOwnProperty(S)&&Oi(n,S,a[S])}function is(n){if(n.indexOf("-")===-1)return!1;switch(n){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 Rm=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"]]),nd=/^[\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 Vu(n){return nd.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Mr(){}var nf=null;function af(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Xo=null,$r=null;function id(n){var a=br(n);if(a&&(n=a.stateNode)){var c=n[Ti]||null;e:switch(n=a.stateNode,a.type){case"input":if(vi(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Ot(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var d=c[a];if(d!==n&&d.form===n.form){var y=d[Ti]||null;if(!y)throw Error(i(90));vi(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===n.form&&Ht(d)}break e;case"textarea":En(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&sa(n,!!c.multiple,a,!1)}}}var sf=!1;function ad(n,a,c){if(sf)return n(a,c);sf=!0;try{var d=n(a);return d}finally{if(sf=!1,(Xo!==null||$r!==null)&&(Os(),Xo&&(a=Xo,n=$r,$r=Xo=null,id(a),n)))for(a=0;a<n.length;a++)id(n[a])}}function Dl(n,a){var c=n.stateNode;if(c===null)return null;var d=c[Ti]||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)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var Xs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sd=!1;if(Xs)try{var Nl={};Object.defineProperty(Nl,"passive",{get:function(){sd=!0}}),window.addEventListener("test",Nl,Nl),window.removeEventListener("test",Nl,Nl)}catch{sd=!1}var Va=null,rf=null,Wo=null;function ku(){if(Wo)return Wo;var n,a=rf,c=a.length,d,y="value"in Va?Va.value:Va.textContent,S=y.length;for(n=0;n<c&&a[n]===y[n];n++);var N=c-n;for(d=1;d<=N&&a[c-d]===y[S-d];d++);return Wo=y.slice(n,1<d?1-d:void 0)}function Hu(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Ul(){return!0}function Dm(){return!1}function ra(n){function a(c,d,y,S,N){this._reactName=c,this._targetInst=y,this.type=d,this.nativeEvent=S,this.target=N,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(c=n[k],this[k]=c?c(S):S[k]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Ul:Dm,this.isPropagationStopped=Dm,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=Ul)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ul)},persist:function(){},isPersistent:Ul}),a}var eo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gu=ra(eo),Ll=x({},eo,{view:0,detail:0}),Nm=ra(Ll),Xu,of,Il,Ol=x({},Ll,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ff,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Il&&(Il&&n.type==="mousemove"?(Xu=n.screenX-Il.screenX,of=n.screenY-Il.screenY):of=Xu=0,Il=n),Xu)},movementY:function(n){return"movementY"in n?n.movementY:of}}),rd=ra(Ol),Um=x({},Ol,{dataTransfer:0}),Lm=ra(Um),od=x({},Ll,{relatedTarget:0}),lf=ra(od),Im=x({},eo,{animationName:0,elapsedTime:0,pseudoElement:0}),Hy=ra(Im),Gy=x({},eo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Om=ra(Gy),Wu=x({},eo,{data:0}),uf=ra(Wu),cf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zm={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"},Pm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ld(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=Pm[n])?!!a[n]:!1}function ff(){return ld}var Bm=x({},Ll,{key:function(n){if(n.key){var a=cf[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Hu(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?zm[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ff,charCode:function(n){return n.type==="keypress"?Hu(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Hu(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),qo=ra(Bm),hf=x({},Ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ud=ra(hf),cd=x({},Ll,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ff}),Fm=ra(cd),Vm=x({},eo,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xy=ra(Vm),Wi=x({},Ol,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),km=ra(Wi),Hm=x({},eo,{newState:0,oldState:0}),Gm=ra(Hm),Xm=[9,13,27,32],Yo=Xs&&"CompositionEvent"in window,zl=null;Xs&&"documentMode"in document&&(zl=document.documentMode);var df=Xs&&"TextEvent"in window&&!zl,fd=Xs&&(!Yo||zl&&8<zl&&11>=zl),Wm=" ",qu=!1;function pf(n,a){switch(n){case"keyup":return Xm.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hd(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Zo=!1;function qm(n,a){switch(n){case"compositionend":return hd(a);case"keypress":return a.which!==32?null:(qu=!0,Wm);case"textInput":return n=a.data,n===Wm&&qu?null:n;default:return null}}function dd(n,a){if(Zo)return n==="compositionend"||!Yo&&pf(n,a)?(n=ku(),Wo=rf=Va=null,Zo=!1,n):null;switch(n){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 fd&&a.locale!=="ko"?null:a.data;default:return null}}var pd={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 md(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!pd[n.type]:a==="textarea"}function mf(n,a,c,d){Xo?$r?$r.push(d):$r=[d]:Xo=d,a=Jg(a,"onChange"),0<a.length&&(c=new Gu("onChange","change",null,c,d),n.push({event:c,listeners:a}))}var to=null,jo=null;function Ym(n){QS(n,0)}function Pl(n){var a=Kr(n);if(Ht(a))return n}function gd(n,a){if(n==="change")return a}var Ws=!1;if(Xs){var Yu;if(Xs){var vd="oninput"in document;if(!vd){var yd=document.createElement("div");yd.setAttribute("oninput","return;"),vd=typeof yd.oninput=="function"}Yu=vd}else Yu=!1;Ws=Yu&&(!document.documentMode||9<document.documentMode)}function as(){to&&(to.detachEvent("onpropertychange",Zu),jo=to=null)}function Zu(n){if(n.propertyName==="value"&&Pl(jo)){var a=[];mf(a,jo,n,af(n)),ad(Ym,a)}}function Zm(n,a,c){n==="focusin"?(as(),to=a,jo=c,to.attachEvent("onpropertychange",Zu)):n==="focusout"&&as()}function _d(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Pl(jo)}function jm(n,a){if(n==="click")return Pl(a)}function Qm(n,a){if(n==="input"||n==="change")return Pl(a)}function xd(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var oa=typeof Object.is=="function"?Object.is:xd;function Bl(n,a){if(oa(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),d=Object.keys(a);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var y=c[d];if(!St.call(a,y)||!oa(n[y],a[y]))return!1}return!0}function ju(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Fl(n,a){var c=ju(n);n=0;for(var d;c;){if(c.nodeType===3){if(d=n+c.textContent.length,n<=a&&d>=a)return{node:c,offset:a-n};n=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ju(c)}}function Pn(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Pn(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Jm(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=at(n.document);a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=at(n.document)}return a}function Sd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var Km=Xs&&"documentMode"in document&&11>=document.documentMode,qs=null,Ys=null,Vl=null,gf=!1;function kl(n,a,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;gf||qs==null||qs!==at(d)||(d=qs,"selectionStart"in d&&Sd(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}),Vl&&Bl(Vl,d)||(Vl=d,d=Jg(Ys,"onSelect"),0<d.length&&(a=new Gu("onSelect","select",null,a,c),n.push({event:a,listeners:d}),a.target=qs)))}function $i(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var Qo={animationend:$i("Animation","AnimationEnd"),animationiteration:$i("Animation","AnimationIteration"),animationstart:$i("Animation","AnimationStart"),transitionrun:$i("Transition","TransitionRun"),transitionstart:$i("Transition","TransitionStart"),transitioncancel:$i("Transition","TransitionCancel"),transitionend:$i("Transition","TransitionEnd")},Qu={},bd={};Xs&&(bd=document.createElement("div").style,"AnimationEvent"in window||(delete Qo.animationend.animation,delete Qo.animationiteration.animation,delete Qo.animationstart.animation),"TransitionEvent"in window||delete Qo.transitionend.transition);function Er(n){if(Qu[n])return Qu[n];if(!Qo[n])return n;var a=Qo[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in bd)return Qu[n]=a[c];return n}var vf=Er("animationend"),Ju=Er("animationiteration"),Md=Er("animationstart"),$m=Er("transitionrun"),Wy=Er("transitionstart"),eg=Er("transitioncancel"),Ed=Er("transitionend"),ss=new Map,Ku="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(" ");Ku.push("scrollEnd");function rs(n,a){ss.set(n,a),me(a,[n])}var $u=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},os=[],Tr=0,zi=0;function ec(){for(var n=Tr,a=zi=Tr=0;a<n;){var c=os[a];os[a++]=null;var d=os[a];os[a++]=null;var y=os[a];os[a++]=null;var S=os[a];if(os[a++]=null,d!==null&&y!==null){var N=d.pending;N===null?y.next=y:(y.next=N.next,N.next=y),d.pending=y}S!==0&&no(c,y,S)}}function Pi(n,a,c,d){os[Tr++]=n,os[Tr++]=a,os[Tr++]=c,os[Tr++]=d,zi|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function yf(n,a,c,d){return Pi(n,a,c,d),ls(n)}function la(n,a){return Pi(n,null,null,a),ls(n)}function no(n,a,c){n.lanes|=c;var d=n.alternate;d!==null&&(d.lanes|=c);for(var y=!1,S=n.return;S!==null;)S.childLanes|=c,d=S.alternate,d!==null&&(d.childLanes|=c),S.tag===22&&(n=S.stateNode,n===null||n._visibility&1||(y=!0)),n=S,S=S.return;return n.tag===3?(S=n.stateNode,y&&a!==null&&(y=31-lt(c),n=S.hiddenUpdates,d=n[y],d===null?n[y]=[a]:d.push(a),a.lane=c|536870912),S):null}function ls(n){if(50<bo)throw bo=0,ml=null,Error(i(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var io={};function Td(n,a,c,d){this.tag=n,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 Jn(n,a,c,d){return new Td(n,a,c,d)}function _f(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ya(n,a){var c=n.alternate;return c===null?(c=Jn(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function Hl(n,a){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,a=c.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function Zs(n,a,c,d,y,S){var N=0;if(d=n,typeof n=="function")_f(n)&&(N=1);else if(typeof n=="string")N=pA(n,c,Oe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=Jn(31,c,a,y),n.elementType=I,n.lanes=S,n;case R:return ao(c.children,y,S,a);case C:N=8,y|=24;break;case E:return n=Jn(12,c,a,y|2),n.elementType=E,n.lanes=S,n;case B:return n=Jn(13,c,a,y),n.elementType=B,n.lanes=S,n;case P:return n=Jn(19,c,a,y),n.elementType=P,n.lanes=S,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case U:N=10;break e;case D:N=9;break e;case L:N=11;break e;case H:N=14;break e;case W:N=16,d=null;break e}N=29,c=Error(i(130,n===null?"null":typeof n,"")),d=null}return a=Jn(N,c,a,y),a.elementType=n,a.type=d,a.lanes=S,a}function ao(n,a,c,d){return n=Jn(7,n,d,a),n.lanes=c,n}function xf(n,a,c){return n=Jn(6,n,null,a),n.lanes=c,n}function Gl(n){var a=Jn(18,null,null,0);return a.stateNode=n,a}function Sf(n,a,c){return a=Jn(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var tc=new WeakMap;function ka(n,a){if(typeof n=="object"&&n!==null){var c=tc.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Z(a)},tc.set(n,a),a)}return{value:n,source:a,stack:Z(a)}}var so=[],ro=0,Xl=null,Wl=0,_a=[],qn=0,Ar=null,Kn=1,Ns="";function js(n,a){so[ro++]=Wl,so[ro++]=Xl,Xl=n,Wl=a}function tg(n,a,c){_a[qn++]=Kn,_a[qn++]=Ns,_a[qn++]=Ar,Ar=n;var d=Kn;n=Ns;var y=32-lt(d)-1;d&=~(1<<y),c+=1;var S=32-lt(a)+y;if(30<S){var N=y-y%5;S=(d&(1<<N)-1).toString(32),d>>=N,y-=N,Kn=1<<32-lt(a)+y|c<<y|d,Ns=S+n}else Kn=1<<S|c<<y|d,Ns=n}function Qs(n){n.return!==null&&(js(n,1),tg(n,1,0))}function bf(n){for(;n===Xl;)Xl=so[--ro],so[ro]=null,Wl=so[--ro],so[ro]=null;for(;n===Ar;)Ar=_a[--qn],_a[qn]=null,Ns=_a[--qn],_a[qn]=null,Kn=_a[--qn],_a[qn]=null}function Mf(n,a){_a[qn++]=Kn,_a[qn++]=Ns,_a[qn++]=Ar,Kn=a.id,Ns=a.overflow,Ar=n}var si=null,Bn=null,fn=!1,wr=null,Ha=!1,ql=Error(i(519));function Js(n){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ks(ka(a,n)),ql}function ng(n){var a=n.stateNode,c=n.type,d=n.memoizedProps;switch(a[Qn]=n,a[Ti]=d,c){case"dialog":mn("cancel",a),mn("close",a);break;case"iframe":case"object":case"embed":mn("load",a);break;case"video":case"audio":for(c=0;c<Ss.length;c++)mn(Ss[c],a);break;case"source":mn("error",a);break;case"img":case"image":case"link":mn("error",a),mn("load",a);break;case"details":mn("toggle",a);break;case"input":mn("invalid",a),Ds(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":mn("invalid",a);break;case"textarea":mn("invalid",a),Ai(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||eb(a.textContent,c)?(d.popover!=null&&(mn("beforetoggle",a),mn("toggle",a)),d.onScroll!=null&&mn("scroll",a),d.onScrollEnd!=null&&mn("scrollend",a),d.onClick!=null&&(a.onclick=Mr),a=!0):a=!1,a||Js(n,!0)}function ig(n){for(si=n.return;si;)switch(si.tag){case 5:case 31:case 13:Ha=!1;return;case 27:case 3:Ha=!0;return;default:si=si.return}}function Yl(n){if(n!==si)return!1;if(!fn)return ig(n),fn=!0,!1;var a=n.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||o_(n.type,n.memoizedProps)),c=!c),c&&Bn&&Js(n),ig(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Bn=ub(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Bn=ub(n)}else a===27?(a=Bn,du(n.type)?(n=h_,h_=null,Bn=n):Bn=a):Bn=si?hr(n.stateNode.nextSibling):null;return!0}function oo(){Bn=si=null,fn=!1}function Ef(){var n=wr;return n!==null&&(oi===null?oi=n:oi.push.apply(oi,n),wr=null),n}function Ks(n){wr===null?wr=[n]:wr.push(n)}var Zl=X(null),lo=null,$s=null;function Cr(n,a,c){Ee(Zl,a._currentValue),a._currentValue=c}function er(n){n._currentValue=Zl.current,se(Zl)}function Tf(n,a,c){for(;n!==null;){var d=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),n===c)break;n=n.return}}function Af(n,a,c,d){var y=n.child;for(y!==null&&(y.return=n);y!==null;){var S=y.dependencies;if(S!==null){var N=y.child;S=S.firstContext;e:for(;S!==null;){var k=S;S=y;for(var Q=0;Q<a.length;Q++)if(k.context===a[Q]){S.lanes|=c,k=S.alternate,k!==null&&(k.lanes|=c),Tf(S.return,c,n),d||(N=null);break e}S=k.next}}else if(y.tag===18){if(N=y.return,N===null)throw Error(i(341));N.lanes|=c,S=N.alternate,S!==null&&(S.lanes|=c),Tf(N,c,n),N=null}else N=y.child;if(N!==null)N.return=y;else for(N=y;N!==null;){if(N===n){N=null;break}if(y=N.sibling,y!==null){y.return=N.return,N=y;break}N=N.return}y=N}}function tr(n,a,c,d){n=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 N=y.alternate;if(N===null)throw Error(i(387));if(N=N.memoizedProps,N!==null){var k=y.type;oa(y.pendingProps.value,N.value)||(n!==null?n.push(k):n=[k])}}else if(y===Te.current){if(N=y.alternate,N===null)throw Error(i(387));N.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(n!==null?n.push(bp):n=[bp])}y=y.return}n!==null&&Af(a,n,c,d),a.flags|=262144}function nc(n){for(n=n.firstContext;n!==null;){if(!oa(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function uo(n){lo=n,$s=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Pt(n){return ag(lo,n)}function jl(n,a){return lo===null&&uo(n),ag(n,a)}function ag(n,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},$s===null){if(n===null)throw Error(i(308));$s=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else $s=$s.next=a;return c}var sg=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(c,d){n.push(d)}};this.abort=function(){a.aborted=!0,n.forEach(function(c){return c()})}},qy=o.unstable_scheduleCallback,Yy=o.unstable_NormalPriority,_i={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ad(){return{controller:new sg,data:new Map,refCount:0}}function Jo(n){n.refCount--,n.refCount===0&&qy(Yy,function(){n.controller.abort()})}var Ga=null,wf=0,Rr=0,us=null;function wd(n,a){if(Ga===null){var c=Ga=[];wf=0,Rr=_e(),us={status:"pending",value:void 0,then:function(d){c.push(d)}}}return wf++,a.then(Cd,Cd),a}function Cd(){if(--wf===0&&Ga!==null){us!==null&&(us.status="fulfilled");var n=Ga;Ga=null,Rr=0,us=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function Rd(n,a){var c=[],d={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return n.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 rg=q.S;q.S=function(n,a){gp=O(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&wd(n,a),rg!==null&&rg(n,a)};var co=X(null);function Cf(){var n=co.current;return n!==null?n:Vt.pooledCache}function ic(n,a){a===null?Ee(co,co.current):Ee(co,a.pool)}function Dd(){var n=Cf();return n===null?null:{parent:_i._currentValue,pool:n}}var Ko=Error(i(460)),ac=Error(i(474)),Kt=Error(i(542)),Rf={then:function(){}};function xa(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Df(n,a,c){switch(c=n[c],c===void 0?n.push(a):c!==a&&(a.then(Mr,Mr),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,tl(n),n;default:if(typeof a.status=="string")a.then(Mr,Mr);else{if(n=Vt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=a,n.status="pending",n.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 n=a.reason,tl(n),n}throw nr=a,Ko}}function $o(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(nr=c,Ko):c}}var nr=null;function el(){if(nr===null)throw Error(i(459));var n=nr;return nr=null,n}function tl(n){if(n===Ko||n===Kt)throw Error(i(483))}var nl=null,il=0;function sc(n){var a=il;return il+=1,nl===null&&(nl=[]),Df(nl,n,a)}function cs(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Ql(n,a){throw a.$$typeof===b?Error(i(525)):(n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Nf(n){function a(re,ee){if(n){var de=re.deletions;de===null?(re.deletions=[ee],re.flags|=16):de.push(ee)}}function c(re,ee){if(!n)return null;for(;ee!==null;)a(re,ee),ee=ee.sibling;return null}function d(re){for(var ee=new Map;re!==null;)re.key!==null?ee.set(re.key,re):ee.set(re.index,re),re=re.sibling;return ee}function y(re,ee){return re=ya(re,ee),re.index=0,re.sibling=null,re}function S(re,ee,de){return re.index=de,n?(de=re.alternate,de!==null?(de=de.index,de<ee?(re.flags|=67108866,ee):de):(re.flags|=67108866,ee)):(re.flags|=1048576,ee)}function N(re){return n&&re.alternate===null&&(re.flags|=67108866),re}function k(re,ee,de,De){return ee===null||ee.tag!==6?(ee=xf(de,re.mode,De),ee.return=re,ee):(ee=y(ee,de),ee.return=re,ee)}function Q(re,ee,de,De){var Rt=de.type;return Rt===R?we(re,ee,de.props.children,De,de.key):ee!==null&&(ee.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===W&&$o(Rt)===ee.type)?(ee=y(ee,de.props),cs(ee,de),ee.return=re,ee):(ee=Zs(de.type,de.key,de.props,null,re.mode,De),cs(ee,de),ee.return=re,ee)}function pe(re,ee,de,De){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==de.containerInfo||ee.stateNode.implementation!==de.implementation?(ee=Sf(de,re.mode,De),ee.return=re,ee):(ee=y(ee,de.children||[]),ee.return=re,ee)}function we(re,ee,de,De,Rt){return ee===null||ee.tag!==7?(ee=ao(de,re.mode,De,Rt),ee.return=re,ee):(ee=y(ee,de),ee.return=re,ee)}function Ie(re,ee,de){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=xf(""+ee,re.mode,de),ee.return=re,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case M:return de=Zs(ee.type,ee.key,ee.props,null,re.mode,de),cs(de,ee),de.return=re,de;case A:return ee=Sf(ee,re.mode,de),ee.return=re,ee;case W:return ee=$o(ee),Ie(re,ee,de)}if(he(ee)||ae(ee))return ee=ao(ee,re.mode,de,null),ee.return=re,ee;if(typeof ee.then=="function")return Ie(re,sc(ee),de);if(ee.$$typeof===U)return Ie(re,jl(re,ee),de);Ql(re,ee)}return null}function ve(re,ee,de,De){var Rt=ee!==null?ee.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Rt!==null?null:k(re,ee,""+de,De);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case M:return de.key===Rt?Q(re,ee,de,De):null;case A:return de.key===Rt?pe(re,ee,de,De):null;case W:return de=$o(de),ve(re,ee,de,De)}if(he(de)||ae(de))return Rt!==null?null:we(re,ee,de,De,null);if(typeof de.then=="function")return ve(re,ee,sc(de),De);if(de.$$typeof===U)return ve(re,ee,jl(re,de),De);Ql(re,de)}return null}function Me(re,ee,de,De,Rt){if(typeof De=="string"&&De!==""||typeof De=="number"||typeof De=="bigint")return re=re.get(de)||null,k(ee,re,""+De,Rt);if(typeof De=="object"&&De!==null){switch(De.$$typeof){case M:return re=re.get(De.key===null?de:De.key)||null,Q(ee,re,De,Rt);case A:return re=re.get(De.key===null?de:De.key)||null,pe(ee,re,De,Rt);case W:return De=$o(De),Me(re,ee,de,De,Rt)}if(he(De)||ae(De))return re=re.get(de)||null,we(ee,re,De,Rt,null);if(typeof De.then=="function")return Me(re,ee,de,sc(De),Rt);if(De.$$typeof===U)return Me(re,ee,de,jl(ee,De),Rt);Ql(ee,De)}return null}function xt(re,ee,de,De){for(var Rt=null,wn=null,bt=ee,nn=ee=0,_n=null;bt!==null&&nn<de.length;nn++){bt.index>nn?(_n=bt,bt=null):_n=bt.sibling;var Cn=ve(re,bt,de[nn],De);if(Cn===null){bt===null&&(bt=_n);break}n&&bt&&Cn.alternate===null&&a(re,bt),ee=S(Cn,ee,nn),wn===null?Rt=Cn:wn.sibling=Cn,wn=Cn,bt=_n}if(nn===de.length)return c(re,bt),fn&&js(re,nn),Rt;if(bt===null){for(;nn<de.length;nn++)bt=Ie(re,de[nn],De),bt!==null&&(ee=S(bt,ee,nn),wn===null?Rt=bt:wn.sibling=bt,wn=bt);return fn&&js(re,nn),Rt}for(bt=d(bt);nn<de.length;nn++)_n=Me(bt,re,nn,de[nn],De),_n!==null&&(n&&_n.alternate!==null&&bt.delete(_n.key===null?nn:_n.key),ee=S(_n,ee,nn),wn===null?Rt=_n:wn.sibling=_n,wn=_n);return n&&bt.forEach(function(yu){return a(re,yu)}),fn&&js(re,nn),Rt}function zt(re,ee,de,De){if(de==null)throw Error(i(151));for(var Rt=null,wn=null,bt=ee,nn=ee=0,_n=null,Cn=de.next();bt!==null&&!Cn.done;nn++,Cn=de.next()){bt.index>nn?(_n=bt,bt=null):_n=bt.sibling;var yu=ve(re,bt,Cn.value,De);if(yu===null){bt===null&&(bt=_n);break}n&&bt&&yu.alternate===null&&a(re,bt),ee=S(yu,ee,nn),wn===null?Rt=yu:wn.sibling=yu,wn=yu,bt=_n}if(Cn.done)return c(re,bt),fn&&js(re,nn),Rt;if(bt===null){for(;!Cn.done;nn++,Cn=de.next())Cn=Ie(re,Cn.value,De),Cn!==null&&(ee=S(Cn,ee,nn),wn===null?Rt=Cn:wn.sibling=Cn,wn=Cn);return fn&&js(re,nn),Rt}for(bt=d(bt);!Cn.done;nn++,Cn=de.next())Cn=Me(bt,re,nn,Cn.value,De),Cn!==null&&(n&&Cn.alternate!==null&&bt.delete(Cn.key===null?nn:Cn.key),ee=S(Cn,ee,nn),wn===null?Rt=Cn:wn.sibling=Cn,wn=Cn);return n&&bt.forEach(function(TA){return a(re,TA)}),fn&&js(re,nn),Rt}function kn(re,ee,de,De){if(typeof de=="object"&&de!==null&&de.type===R&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case M:e:{for(var Rt=de.key;ee!==null;){if(ee.key===Rt){if(Rt=de.type,Rt===R){if(ee.tag===7){c(re,ee.sibling),De=y(ee,de.props.children),De.return=re,re=De;break e}}else if(ee.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===W&&$o(Rt)===ee.type){c(re,ee.sibling),De=y(ee,de.props),cs(De,de),De.return=re,re=De;break e}c(re,ee);break}else a(re,ee);ee=ee.sibling}de.type===R?(De=ao(de.props.children,re.mode,De,de.key),De.return=re,re=De):(De=Zs(de.type,de.key,de.props,null,re.mode,De),cs(De,de),De.return=re,re=De)}return N(re);case A:e:{for(Rt=de.key;ee!==null;){if(ee.key===Rt)if(ee.tag===4&&ee.stateNode.containerInfo===de.containerInfo&&ee.stateNode.implementation===de.implementation){c(re,ee.sibling),De=y(ee,de.children||[]),De.return=re,re=De;break e}else{c(re,ee);break}else a(re,ee);ee=ee.sibling}De=Sf(de,re.mode,De),De.return=re,re=De}return N(re);case W:return de=$o(de),kn(re,ee,de,De)}if(he(de))return xt(re,ee,de,De);if(ae(de)){if(Rt=ae(de),typeof Rt!="function")throw Error(i(150));return de=Rt.call(de),zt(re,ee,de,De)}if(typeof de.then=="function")return kn(re,ee,sc(de),De);if(de.$$typeof===U)return kn(re,ee,jl(re,de),De);Ql(re,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,ee!==null&&ee.tag===6?(c(re,ee.sibling),De=y(ee,de),De.return=re,re=De):(c(re,ee),De=xf(de,re.mode,De),De.return=re,re=De),N(re)):c(re,ee)}return function(re,ee,de,De){try{il=0;var Rt=kn(re,ee,de,De);return nl=null,Rt}catch(bt){if(bt===Ko||bt===Kt)throw bt;var wn=Jn(29,bt,null,re.mode);return wn.lanes=De,wn.return=re,wn}}}var Dr=Nf(!0),Uf=Nf(!1),ua=!1;function rc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nd(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Nr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function fo(n,a,c){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var y=d.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),d.pending=a,a=ls(n),no(n,null,c),a}return Pi(n,d,a,c),ls(n)}function ho(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var d=a.lanes;d&=n.pendingLanes,c|=d,a.lanes=c,jr(n,c)}}function Ct(n,a){var c=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var y=null,S=null;if(c=c.firstBaseUpdate,c!==null){do{var N={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};S===null?y=S=N:S=S.next=N,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},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}var Ud=!1;function oc(){if(Ud){var n=us;if(n!==null)throw n}}function Jl(n,a,c,d){Ud=!1;var y=n.updateQueue;ua=!1;var S=y.firstBaseUpdate,N=y.lastBaseUpdate,k=y.shared.pending;if(k!==null){y.shared.pending=null;var Q=k,pe=Q.next;Q.next=null,N===null?S=pe:N.next=pe,N=Q;var we=n.alternate;we!==null&&(we=we.updateQueue,k=we.lastBaseUpdate,k!==N&&(k===null?we.firstBaseUpdate=pe:k.next=pe,we.lastBaseUpdate=Q))}if(S!==null){var Ie=y.baseState;N=0,we=pe=Q=null,k=S;do{var ve=k.lane&-536870913,Me=ve!==k.lane;if(Me?(jt&ve)===ve:(d&ve)===ve){ve!==0&&ve===Rr&&(Ud=!0),we!==null&&(we=we.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var xt=n,zt=k;ve=a;var kn=c;switch(zt.tag){case 1:if(xt=zt.payload,typeof xt=="function"){Ie=xt.call(kn,Ie,ve);break e}Ie=xt;break e;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=zt.payload,ve=typeof xt=="function"?xt.call(kn,Ie,ve):xt,ve==null)break e;Ie=x({},Ie,ve);break e;case 2:ua=!0}}ve=k.callback,ve!==null&&(n.flags|=64,Me&&(n.flags|=8192),Me=y.callbacks,Me===null?y.callbacks=[ve]:Me.push(ve))}else Me={lane:ve,tag:k.tag,payload:k.payload,callback:k.callback,next:null},we===null?(pe=we=Me,Q=Ie):we=we.next=Me,N|=ve;if(k=k.next,k===null){if(k=y.shared.pending,k===null)break;Me=k,k=Me.next,Me.next=null,y.lastBaseUpdate=Me,y.shared.pending=null}}while(!0);we===null&&(Q=Ie),y.baseState=Q,y.firstBaseUpdate=pe,y.lastBaseUpdate=we,S===null&&(y.shared.lanes=0),ur|=N,n.lanes=N,n.memoizedState=Ie}}function Kl(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function og(n,a){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)Kl(c[n],a)}var $l=X(null),Lf=X(0);function lg(n,a){n=Ya,Ee(Lf,n),Ee($l,a),Ya=n|a.baseLanes}function Ld(){Ee(Lf,Ya),Ee($l,$l.current)}function lc(){Ya=Lf.current,se($l),se(Lf)}var Sa=X(null),ca=null;function Ur(n){var a=n.alternate;Ee(hn,hn.current&1),Ee(Sa,n),ca===null&&(a===null||$l.current!==null||a.memoizedState!==null)&&(ca=n)}function Id(n){Ee(hn,hn.current),Ee(Sa,n),ca===null&&(ca=n)}function ug(n){n.tag===22?(Ee(hn,hn.current),Ee(Sa,n),ca===null&&(ca=n)):ba()}function ba(){Ee(hn,hn.current),Ee(Sa,Sa.current)}function ui(n){se(Sa),ca===n&&(ca=null),se(hn)}var hn=X(0);function Xa(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c_(c)||f_(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===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Yn=0,Xt=null,Ln=null,ln=null,fs=!1,eu=!1,al=!1,If=0,uc=0,tu=null,Od=0;function $n(){throw Error(i(321))}function zd(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!oa(n[c],a[c]))return!1;return!0}function Of(n,a,c,d,y,S){return Yn=S,Xt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,q.H=n===null||n.memoizedState===null?kg:np,al=!1,S=c(d,y),al=!1,eu&&(S=sl(a,c,d,y)),cg(n),S}function cg(n){q.H=nu;var a=Ln!==null&&Ln.next!==null;if(Yn=0,ln=Ln=Xt=null,fs=!1,uc=0,tu=null,a)throw Error(i(300));n===null||xi||(n=n.dependencies,n!==null&&nc(n)&&(xi=!0))}function sl(n,a,c,d){Xt=n;var y=0;do{if(eu&&(tu=null),uc=0,eu=!1,25<=y)throw Error(i(301));if(y+=1,ln=Ln=null,n.updateQueue!=null){var S=n.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}q.H=hs,S=a(c,d)}while(eu);return S}function rl(){var n=q.H,a=n.useState()[0];return a=typeof a.then=="function"?cc(a):a,n=n.useState()[0],(Ln!==null?Ln.memoizedState:null)!==n&&(Xt.flags|=1024),a}function Pd(){var n=If!==0;return If=0,n}function Bd(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function Fd(n){if(fs){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}fs=!1}Yn=0,ln=Ln=Xt=null,eu=!1,uc=If=0,tu=null}function wi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Xt.memoizedState=ln=n:ln=ln.next=n,ln}function ci(){if(Ln===null){var n=Xt.alternate;n=n!==null?n.memoizedState:null}else n=Ln.next;var a=ln===null?Xt.memoizedState:ln.next;if(a!==null)ln=a,Ln=n;else{if(n===null)throw Xt.alternate===null?Error(i(467)):Error(i(310));Ln=n,n={memoizedState:Ln.memoizedState,baseState:Ln.baseState,baseQueue:Ln.baseQueue,queue:Ln.queue,next:null},ln===null?Xt.memoizedState=ln=n:ln=ln.next=n}return ln}function zf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cc(n){var a=uc;return uc+=1,tu===null&&(tu=[]),n=Df(tu,n,a),a=Xt,(ln===null?a.memoizedState:ln.next)===null&&(a=a.alternate,q.H=a===null||a.memoizedState===null?kg:np),n}function po(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return cc(n);if(n.$$typeof===U)return Pt(n)}throw Error(i(438,String(n)))}function Vd(n){var a=null,c=Xt.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var d=Xt.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=zf(),Xt.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(n),d=0;d<n;d++)c[d]=z;return a.index++,c}function Lr(n,a){return typeof a=="function"?a(n):a}function Pf(n){var a=ci();return kd(a,Ln,n)}function kd(n,a,c){var d=n.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var y=n.baseQueue,S=d.pending;if(S!==null){if(y!==null){var N=y.next;y.next=S.next,S.next=N}a.baseQueue=y=S,d.pending=null}if(S=n.baseState,y===null)n.memoizedState=S;else{a=y.next;var k=N=null,Q=null,pe=a,we=!1;do{var Ie=pe.lane&-536870913;if(Ie!==pe.lane?(jt&Ie)===Ie:(Yn&Ie)===Ie){var ve=pe.revertLane;if(ve===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),Ie===Rr&&(we=!0);else if((Yn&ve)===ve){pe=pe.next,ve===Rr&&(we=!0);continue}else Ie={lane:0,revertLane:pe.revertLane,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},Q===null?(k=Q=Ie,N=S):Q=Q.next=Ie,Xt.lanes|=ve,ur|=ve;Ie=pe.action,al&&c(S,Ie),S=pe.hasEagerState?pe.eagerState:c(S,Ie)}else ve={lane:Ie,revertLane:pe.revertLane,gesture:pe.gesture,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},Q===null?(k=Q=ve,N=S):Q=Q.next=ve,Xt.lanes|=Ie,ur|=Ie;pe=pe.next}while(pe!==null&&pe!==a);if(Q===null?N=S:Q.next=k,!oa(S,n.memoizedState)&&(xi=!0,we&&(c=us,c!==null)))throw c;n.memoizedState=S,n.baseState=N,n.baseQueue=Q,d.lastRenderedState=S}return y===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function Hd(n){var a=ci(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var d=c.dispatch,y=c.pending,S=a.memoizedState;if(y!==null){c.pending=null;var N=y=y.next;do S=n(S,N.action),N=N.next;while(N!==y);oa(S,a.memoizedState)||(xi=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),c.lastRenderedState=S}return[S,d]}function fg(n,a,c){var d=Xt,y=ci(),S=fn;if(S){if(c===void 0)throw Error(i(407));c=c()}else c=a();var N=!oa((Ln||y).memoizedState,c);if(N&&(y.memoizedState=c,xi=!0),y=y.queue,Qd(pg.bind(null,d,y,n),[n]),y.getSnapshot!==a||N||ln!==null&&ln.memoizedState.tag&1){if(d.flags|=2048,mo(9,{destroy:void 0},dg.bind(null,d,y,c,a),null),Vt===null)throw Error(i(349));S||(Yn&127)!==0||hg(d,a,c)}return c}function hg(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=Xt.updateQueue,a===null?(a=zf(),Xt.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function dg(n,a,c,d){a.value=c,a.getSnapshot=d,mg(a)&&gg(n)}function pg(n,a,c){return c(function(){mg(a)&&gg(n)})}function mg(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!oa(n,c)}catch{return!0}}function gg(n){var a=la(n,2);a!==null&&en(a,n,2)}function Gd(n){var a=wi();if(typeof n=="function"){var c=n;if(n=c(),al){ft(!0);try{c()}finally{ft(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:n},a}function Xd(n,a,c,d){return n.baseState=c,kd(n,Ln,typeof d=="function"?d:Lr)}function Zy(n,a,c,d,y){if(kf(n))throw Error(i(485));if(n=a.action,n!==null){var S={payload:y,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){S.listeners.push(N)}};q.T!==null?c(!0):S.isTransition=!1,d(S),c=a.pending,c===null?(S.next=a.pending=S,vg(a,S)):(S.next=c.next,a.pending=c.next=S)}}function vg(n,a){var c=a.action,d=a.payload,y=n.state;if(a.isTransition){var S=q.T,N={};q.T=N;try{var k=c(y,d),Q=q.S;Q!==null&&Q(N,k),yg(n,a,k)}catch(pe){Wd(n,a,pe)}finally{S!==null&&N.types!==null&&(S.types=N.types),q.T=S}}else try{S=c(y,d),yg(n,a,S)}catch(pe){Wd(n,a,pe)}}function yg(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){_g(n,a,d)},function(d){return Wd(n,a,d)}):_g(n,a,c)}function _g(n,a,c){a.status="fulfilled",a.value=c,xg(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,vg(n,c)))}function Wd(n,a,c){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=c,xg(a),a=a.next;while(a!==d)}n.action=null}function xg(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function qd(n,a){return a}function Yd(n,a){if(fn){var c=Vt.formState;if(c!==null){e:{var d=Xt;if(fn){if(Bn){t:{for(var y=Bn,S=Ha;y.nodeType!==8;){if(!S){y=null;break t}if(y=hr(y.nextSibling),y===null){y=null;break t}}S=y.data,y=S==="F!"||S==="F"?y:null}if(y){Bn=hr(y.nextSibling),d=y.data==="F!";break e}}Js(d)}d=!1}d&&(a=c[0])}}return c=wi(),c.memoizedState=c.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qd,lastRenderedState:a},c.queue=d,c=Bg.bind(null,Xt,d),d.dispatch=c,d=Gd(!1),S=tp.bind(null,Xt,!1,d.queue),d=wi(),y={state:a,dispatch:null,action:n,pending:null},d.queue=y,c=Zy.bind(null,Xt,y,S,c),y.dispatch=c,d.memoizedState=n,[a,c,!1]}function Sg(n){var a=ci();return Zd(a,Ln,n)}function Zd(n,a,c){if(a=kd(n,a,qd)[0],n=Pf(Lr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=cc(a)}catch(N){throw N===Ko?Kt:N}else d=a;a=ci();var y=a.queue,S=y.dispatch;return c!==a.memoizedState&&(Xt.flags|=2048,mo(9,{destroy:void 0},bg.bind(null,y,c),null)),[d,S,n]}function bg(n,a){n.action=a}function jd(n){var a=ci(),c=Ln;if(c!==null)return Zd(a,c,n);ci(),a=a.memoizedState,c=ci();var d=c.queue.dispatch;return c.memoizedState=n,[a,d,!1]}function mo(n,a,c,d){return n={tag:n,create:c,deps:d,inst:a,next:null},a=Xt.updateQueue,a===null&&(a=zf(),Xt.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=n.next=n:(d=c.next,c.next=n,n.next=d,a.lastEffect=n),n}function Bf(){return ci().memoizedState}function Ff(n,a,c,d){var y=wi();Xt.flags|=n,y.memoizedState=mo(1|a,{destroy:void 0},c,d===void 0?null:d)}function Vf(n,a,c,d){var y=ci();d=d===void 0?null:d;var S=y.memoizedState.inst;Ln!==null&&d!==null&&zd(d,Ln.memoizedState.deps)?y.memoizedState=mo(a,S,c,d):(Xt.flags|=n,y.memoizedState=mo(1|a,S,c,d))}function Mg(n,a){Ff(8390656,8,n,a)}function Qd(n,a){Vf(2048,8,n,a)}function Eg(n){Xt.flags|=4;var a=Xt.updateQueue;if(a===null)a=zf(),Xt.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function Tg(n){var a=ci().memoizedState;return Eg({ref:a,nextImpl:n}),function(){if((Et&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function Ag(n,a){return Vf(4,2,n,a)}function wg(n,a){return Vf(4,4,n,a)}function Cg(n,a){if(typeof a=="function"){n=n();var c=a(n);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Rg(n,a,c){c=c!=null?c.concat([n]):null,Vf(4,4,Cg.bind(null,a,n),c)}function Jd(){}function Dg(n,a){var c=ci();a=a===void 0?null:a;var d=c.memoizedState;return a!==null&&zd(a,d[1])?d[0]:(c.memoizedState=[n,a],n)}function Ng(n,a){var c=ci();a=a===void 0?null:a;var d=c.memoizedState;if(a!==null&&zd(a,d[1]))return d[0];if(d=n(),al){ft(!0);try{n()}finally{ft(!1)}}return c.memoizedState=[d,a],d}function Kd(n,a,c){return c===void 0||(Yn&1073741824)!==0&&(jt&261930)===0?n.memoizedState=a:(n.memoizedState=c,n=sn(),Xt.lanes|=n,ur|=n,c)}function Ug(n,a,c,d){return oa(c,a)?c:$l.current!==null?(n=Kd(n,c,d),oa(n,a)||(xi=!0),n):(Yn&42)===0||(Yn&1073741824)!==0&&(jt&261930)===0?(xi=!0,n.memoizedState=c):(n=sn(),Xt.lanes|=n,ur|=n,a)}function Lg(n,a,c,d,y){var S=K.p;K.p=S!==0&&8>S?S:8;var N=q.T,k={};q.T=k,tp(n,!1,a,c);try{var Q=y(),pe=q.S;if(pe!==null&&pe(k,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var we=Rd(Q,d);fc(n,a,we,ja(n))}else fc(n,a,d,ja(n))}catch(Ie){fc(n,a,{then:function(){},status:"rejected",reason:Ie},ja())}finally{K.p=S,N!==null&&k.types!==null&&(N.types=k.types),q.T=N}}function jy(){}function $d(n,a,c,d){if(n.tag!==5)throw Error(i(476));var y=Ig(n).queue;Lg(n,y,a,ce,c===null?jy:function(){return Og(n),c(d)})}function Ig(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:ce},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:c},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function Og(n){var a=Ig(n);a.next===null&&(a=n.alternate.memoizedState),fc(n,a.next.queue,{},ja())}function ep(){return Pt(bp)}function zg(){return ci().memoizedState}function Pg(){return ci().memoizedState}function Qy(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=ja();n=Nr(c);var d=fo(a,n,c);d!==null&&(en(d,a,c),ho(d,a,c)),a={cache:Ad()},n.payload=a;return}a=a.return}}function Jy(n,a,c){var d=ja();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},kf(n)?Fg(a,c):(c=yf(n,a,c,d),c!==null&&(en(c,n,d),Vg(c,a,d)))}function Bg(n,a,c){var d=ja();fc(n,a,c,d)}function fc(n,a,c,d){var y={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(kf(n))Fg(a,y);else{var S=n.alternate;if(n.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var N=a.lastRenderedState,k=S(N,c);if(y.hasEagerState=!0,y.eagerState=k,oa(k,N))return Pi(n,a,y,0),Vt===null&&ec(),!1}catch{}if(c=yf(n,a,y,d),c!==null)return en(c,n,d),Vg(c,a,d),!0}return!1}function tp(n,a,c,d){if(d={lane:2,revertLane:_e(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},kf(n)){if(a)throw Error(i(479))}else a=yf(n,c,d,2),a!==null&&en(a,n,2)}function kf(n){var a=n.alternate;return n===Xt||a!==null&&a===Xt}function Fg(n,a){eu=fs=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function Vg(n,a,c){if((c&4194048)!==0){var d=a.lanes;d&=n.pendingLanes,c|=d,a.lanes=c,jr(n,c)}}var nu={readContext:Pt,use:po,useCallback:$n,useContext:$n,useEffect:$n,useImperativeHandle:$n,useLayoutEffect:$n,useInsertionEffect:$n,useMemo:$n,useReducer:$n,useRef:$n,useState:$n,useDebugValue:$n,useDeferredValue:$n,useTransition:$n,useSyncExternalStore:$n,useId:$n,useHostTransitionStatus:$n,useFormState:$n,useActionState:$n,useOptimistic:$n,useMemoCache:$n,useCacheRefresh:$n};nu.useEffectEvent=$n;var kg={readContext:Pt,use:po,useCallback:function(n,a){return wi().memoizedState=[n,a===void 0?null:a],n},useContext:Pt,useEffect:Mg,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Ff(4194308,4,Cg.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Ff(4194308,4,n,a)},useInsertionEffect:function(n,a){Ff(4,2,n,a)},useMemo:function(n,a){var c=wi();a=a===void 0?null:a;var d=n();if(al){ft(!0);try{n()}finally{ft(!1)}}return c.memoizedState=[d,a],d},useReducer:function(n,a,c){var d=wi();if(c!==void 0){var y=c(a);if(al){ft(!0);try{c(a)}finally{ft(!1)}}}else y=a;return d.memoizedState=d.baseState=y,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:y},d.queue=n,n=n.dispatch=Jy.bind(null,Xt,n),[d.memoizedState,n]},useRef:function(n){var a=wi();return n={current:n},a.memoizedState=n},useState:function(n){n=Gd(n);var a=n.queue,c=Bg.bind(null,Xt,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:Jd,useDeferredValue:function(n,a){var c=wi();return Kd(c,n,a)},useTransition:function(){var n=Gd(!1);return n=Lg.bind(null,Xt,n.queue,!0,!1),wi().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var d=Xt,y=wi();if(fn){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),Vt===null)throw Error(i(349));(jt&127)!==0||hg(d,a,c)}y.memoizedState=c;var S={value:c,getSnapshot:a};return y.queue=S,Mg(pg.bind(null,d,S,n),[n]),d.flags|=2048,mo(9,{destroy:void 0},dg.bind(null,d,S,c,a),null),c},useId:function(){var n=wi(),a=Vt.identifierPrefix;if(fn){var c=Ns,d=Kn;c=(d&~(1<<32-lt(d)-1)).toString(32)+c,a="_"+a+"R_"+c,c=If++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=Od++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:ep,useFormState:Yd,useActionState:Yd,useOptimistic:function(n){var a=wi();a.memoizedState=a.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=tp.bind(null,Xt,!0,c),c.dispatch=a,[n,a]},useMemoCache:Vd,useCacheRefresh:function(){return wi().memoizedState=Qy.bind(null,Xt)},useEffectEvent:function(n){var a=wi(),c={impl:n};return a.memoizedState=c,function(){if((Et&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},np={readContext:Pt,use:po,useCallback:Dg,useContext:Pt,useEffect:Qd,useImperativeHandle:Rg,useInsertionEffect:Ag,useLayoutEffect:wg,useMemo:Ng,useReducer:Pf,useRef:Bf,useState:function(){return Pf(Lr)},useDebugValue:Jd,useDeferredValue:function(n,a){var c=ci();return Ug(c,Ln.memoizedState,n,a)},useTransition:function(){var n=Pf(Lr)[0],a=ci().memoizedState;return[typeof n=="boolean"?n:cc(n),a]},useSyncExternalStore:fg,useId:zg,useHostTransitionStatus:ep,useFormState:Sg,useActionState:Sg,useOptimistic:function(n,a){var c=ci();return Xd(c,Ln,n,a)},useMemoCache:Vd,useCacheRefresh:Pg};np.useEffectEvent=Tg;var hs={readContext:Pt,use:po,useCallback:Dg,useContext:Pt,useEffect:Qd,useImperativeHandle:Rg,useInsertionEffect:Ag,useLayoutEffect:wg,useMemo:Ng,useReducer:Hd,useRef:Bf,useState:function(){return Hd(Lr)},useDebugValue:Jd,useDeferredValue:function(n,a){var c=ci();return Ln===null?Kd(c,n,a):Ug(c,Ln.memoizedState,n,a)},useTransition:function(){var n=Hd(Lr)[0],a=ci().memoizedState;return[typeof n=="boolean"?n:cc(n),a]},useSyncExternalStore:fg,useId:zg,useHostTransitionStatus:ep,useFormState:jd,useActionState:jd,useOptimistic:function(n,a){var c=ci();return Ln!==null?Xd(c,Ln,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:Vd,useCacheRefresh:Pg};hs.useEffectEvent=Tg;function Hf(n,a,c,d){a=n.memoizedState,c=c(d,a),c=c==null?a:x({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var hc={enqueueSetState:function(n,a,c){n=n._reactInternals;var d=ja(),y=Nr(d);y.payload=a,c!=null&&(y.callback=c),a=fo(n,y,d),a!==null&&(en(a,n,d),ho(a,n,d))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var d=ja(),y=Nr(d);y.tag=1,y.payload=a,c!=null&&(y.callback=c),a=fo(n,y,d),a!==null&&(en(a,n,d),ho(a,n,d))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=ja(),d=Nr(c);d.tag=2,a!=null&&(d.callback=a),a=fo(n,d,c),a!==null&&(en(a,n,c),ho(a,n,c))}};function ip(n,a,c,d,y,S,N){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,S,N):a.prototype&&a.prototype.isPureReactComponent?!Bl(c,d)||!Bl(y,S):!0}function ap(n,a,c,d){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,d),a.state!==n&&hc.enqueueReplaceState(a,a.state,null)}function go(n,a){var c=a;if("ref"in a){c={};for(var d in a)d!=="ref"&&(c[d]=a[d])}if(n=n.defaultProps){c===a&&(c=x({},c));for(var y in n)c[y]===void 0&&(c[y]=n[y])}return c}function Hg(n){$u(n)}function sp(n){console.error(n)}function rp(n){$u(n)}function Gf(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function Gg(n,a,c){try{var d=n.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function op(n,a,c){return c=Nr(c),c.tag=3,c.payload={element:null},c.callback=function(){Gf(n,a)},c}function lp(n){return n=Nr(n),n.tag=3,n}function Xg(n,a,c,d){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var S=d.value;n.payload=function(){return y(S)},n.callback=function(){Gg(a,c,d)}}var N=c.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(n.callback=function(){Gg(a,c,d),typeof y!="function"&&(di===null?di=new Set([this]):di.add(this));var k=d.stack;this.componentDidCatch(d.value,{componentStack:k!==null?k:""})})}function Ci(n,a,c,d,y){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=c.alternate,a!==null&&tr(a,c,y,!0),c=Sa.current,c!==null){switch(c.tag){case 31:case 13:return ca===null?uu():c.alternate===null&&ei===0&&(ei=3),c.flags&=-257,c.flags|=65536,c.lanes=y,d===Rf?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([d]):a.add(d),Ec(n,d,y)),!1;case 22:return c.flags|=65536,d===Rf?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)),Ec(n,d,y)),!1}throw Error(i(435,c.tag))}return Ec(n,d,y),uu(),!1}if(fn)return a=Sa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,d!==ql&&(n=Error(i(422),{cause:d}),Ks(ka(n,c)))):(d!==ql&&(a=Error(i(423),{cause:d}),Ks(ka(a,c))),n=n.current.alternate,n.flags|=65536,y&=-y,n.lanes|=y,d=ka(d,c),y=op(n.stateNode,d,y),Ct(n,y),ei!==4&&(ei=2)),!1;var S=Error(i(520),{cause:d});if(S=ka(S,c),pl===null?pl=[S]:pl.push(S),ei!==4&&(ei=2),a===null)return!0;d=ka(d,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=y&-y,c.lanes|=n,n=op(c.stateNode,d,n),Ct(c,n),!1;case 1:if(a=c.type,S=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(di===null||!di.has(S))))return c.flags|=65536,y&=-y,c.lanes|=y,y=lp(y),Xg(y,n,c,d),Ct(c,y),!1}c=c.return}while(c!==null);return!1}var Xf=Error(i(461)),xi=!1;function Bi(n,a,c,d){a.child=n===null?Uf(a,null,c,d):Dr(a,n.child,c,d)}function up(n,a,c,d,y){c=c.render;var S=a.ref;if("ref"in d){var N={};for(var k in d)k!=="ref"&&(N[k]=d[k])}else N=d;return uo(a),d=Of(n,a,c,N,S,y),k=Pd(),n!==null&&!xi?(Bd(n,a,y),fi(n,a,y)):(fn&&k&&Qs(a),a.flags|=1,Bi(n,a,d,y),a.child)}function ol(n,a,c,d,y){if(n===null){var S=c.type;return typeof S=="function"&&!_f(S)&&S.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=S,Wf(n,a,S,d,y)):(n=Zs(c.type,null,d,a,a.mode,y),n.ref=a.ref,n.return=a,a.child=n)}if(S=n.child,!Jf(n,y)){var N=S.memoizedProps;if(c=c.compare,c=c!==null?c:Bl,c(N,d)&&n.ref===a.ref)return fi(n,a,y)}return a.flags|=1,n=ya(S,d),n.ref=a.ref,n.return=a,a.child=n}function Wf(n,a,c,d,y){if(n!==null){var S=n.memoizedProps;if(Bl(S,d)&&n.ref===a.ref)if(xi=!1,a.pendingProps=d=S,Jf(n,y))(n.flags&131072)!==0&&(xi=!0);else return a.lanes=n.lanes,fi(n,a,y)}return iu(n,a,c,d,y)}function ll(n,a,c,d){var y=d.children,S=n!==null?n.memoizedState:null;if(n===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,n!==null){for(d=a.child=n.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~S}else d=0,a.child=null;return Ma(n,a,S,c,d)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&ic(a,S!==null?S.cachePool:null),S!==null?lg(a,S):Ld(),ug(a);else return d=a.lanes=536870912,Ma(n,a,S!==null?S.baseLanes|c:c,c,d)}else S!==null?(ic(a,S.cachePool),lg(a,S),ba(),a.memoizedState=null):(n!==null&&ic(a,null),Ld(),ba());return Bi(n,a,y,c),a.child}function ir(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ma(n,a,c,d,y){var S=Cf();return S=S===null?null:{parent:_i._currentValue,pool:S},a.memoizedState={baseLanes:c,cachePool:S},n!==null&&ic(a,null),Ld(),ug(a),n!==null&&tr(n,a,d,!0),a.childLanes=y,null}function qf(n,a){return a=Qf({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Wg(n,a,c){return Dr(a,n.child,null,c),n=qf(a,a.pendingProps),n.flags|=2,ui(a),a.memoizedState=null,n}function Yf(n,a,c){var d=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(fn){if(d.mode==="hidden")return n=qf(a,d),a.lanes=536870912,ir(null,n);if(Id(a),(n=Bn)?(n=lb(n,Ha),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ar!==null?{id:Kn,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},c=Gl(n),c.return=a,a.child=c,si=a,Bn=null)):n=null,n===null)throw Js(a);return a.lanes=536870912,null}return qf(a,d)}var S=n.memoizedState;if(S!==null){var N=S.dehydrated;if(Id(a),y)if(a.flags&256)a.flags&=-257,a=Wg(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(i(558));else if(xi||tr(n,a,c,!1),y=(c&n.childLanes)!==0,xi||y){if(d=Vt,d!==null&&(N=Vo(d,c),N!==0&&N!==S.retryLane))throw S.retryLane=N,la(n,N),en(d,n,N),Xf;uu(),a=Wg(n,a,c)}else n=S.treeContext,Bn=hr(N.nextSibling),si=a,fn=!0,wr=null,Ha=!1,n!==null&&Mf(a,n),a=qf(a,d),a.flags|=4096;return a}return n=ya(n.child,{mode:d.mode,children:d.children}),n.ref=a.ref,a.child=n,n.return=a,n}function ul(n,a){var c=a.ref;if(c===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(n===null||n.ref!==c)&&(a.flags|=4194816)}}function iu(n,a,c,d,y){return uo(a),c=Of(n,a,c,d,void 0,y),d=Pd(),n!==null&&!xi?(Bd(n,a,y),fi(n,a,y)):(fn&&d&&Qs(a),a.flags|=1,Bi(n,a,c,y),a.child)}function dc(n,a,c,d,y,S){return uo(a),a.updateQueue=null,c=sl(a,d,c,y),cg(n),d=Pd(),n!==null&&!xi?(Bd(n,a,S),fi(n,a,S)):(fn&&d&&Qs(a),a.flags|=1,Bi(n,a,c,S),a.child)}function Zf(n,a,c,d,y){if(uo(a),a.stateNode===null){var S=io,N=c.contextType;typeof N=="object"&&N!==null&&(S=Pt(N)),S=new c(d,S),a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=hc,a.stateNode=S,S._reactInternals=a,S=a.stateNode,S.props=d,S.state=a.memoizedState,S.refs={},rc(a),N=c.contextType,S.context=typeof N=="object"&&N!==null?Pt(N):io,S.state=a.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(Hf(a,c,N,d),S.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(N=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),N!==S.state&&hc.enqueueReplaceState(S,S.state,null),Jl(a,d,S,y),oc(),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(n===null){S=a.stateNode;var k=a.memoizedProps,Q=go(c,k);S.props=Q;var pe=S.context,we=c.contextType;N=io,typeof we=="object"&&we!==null&&(N=Pt(we));var Ie=c.getDerivedStateFromProps;we=typeof Ie=="function"||typeof S.getSnapshotBeforeUpdate=="function",k=a.pendingProps!==k,we||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(k||pe!==N)&&ap(a,S,d,N),ua=!1;var ve=a.memoizedState;S.state=ve,Jl(a,d,S,y),oc(),pe=a.memoizedState,k||ve!==pe||ua?(typeof Ie=="function"&&(Hf(a,c,Ie,d),pe=a.memoizedState),(Q=ua||ip(a,c,Q,d,ve,pe,N))?(we||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=pe),S.props=d,S.state=pe,S.context=N,d=Q):(typeof S.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{S=a.stateNode,Nd(n,a),N=a.memoizedProps,we=go(c,N),S.props=we,Ie=a.pendingProps,ve=S.context,pe=c.contextType,Q=io,typeof pe=="object"&&pe!==null&&(Q=Pt(pe)),k=c.getDerivedStateFromProps,(pe=typeof k=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==Ie||ve!==Q)&&ap(a,S,d,Q),ua=!1,ve=a.memoizedState,S.state=ve,Jl(a,d,S,y),oc();var Me=a.memoizedState;N!==Ie||ve!==Me||ua||n!==null&&n.dependencies!==null&&nc(n.dependencies)?(typeof k=="function"&&(Hf(a,c,k,d),Me=a.memoizedState),(we=ua||ip(a,c,we,d,ve,Me,Q)||n!==null&&n.dependencies!==null&&nc(n.dependencies))?(pe||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(d,Me,Q),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(d,Me,Q)),typeof S.componentDidUpdate=="function"&&(a.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof S.componentDidUpdate!="function"||N===n.memoizedProps&&ve===n.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||N===n.memoizedProps&&ve===n.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=Me),S.props=d,S.state=Me,S.context=Q,d=we):(typeof S.componentDidUpdate!="function"||N===n.memoizedProps&&ve===n.memoizedState||(a.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||N===n.memoizedProps&&ve===n.memoizedState||(a.flags|=1024),d=!1)}return S=d,ul(n,a),d=(a.flags&128)!==0,S||d?(S=a.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:S.render(),a.flags|=1,n!==null&&d?(a.child=Dr(a,n.child,null,y),a.child=Dr(a,null,c,y)):Bi(n,a,c,y),a.memoizedState=S.state,n=a.child):n=fi(n,a,y),n}function qg(n,a,c,d){return oo(),a.flags|=256,Bi(n,a,c,d),a.child}var cp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ea(n){return{baseLanes:n,cachePool:Dd()}}function jf(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=da),n}function Yg(n,a,c){var d=a.pendingProps,y=!1,S=(a.flags&128)!==0,N;if((N=S)||(N=n!==null&&n.memoizedState===null?!1:(hn.current&2)!==0),N&&(y=!0,a.flags&=-129),N=(a.flags&32)!==0,a.flags&=-33,n===null){if(fn){if(y?Ur(a):ba(),(n=Bn)?(n=lb(n,Ha),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ar!==null?{id:Kn,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},c=Gl(n),c.return=a,a.child=c,si=a,Bn=null)):n=null,n===null)throw Js(a);return f_(n)?a.lanes=32:a.lanes=536870912,null}var k=d.children;return d=d.fallback,y?(ba(),y=a.mode,k=Qf({mode:"hidden",children:k},y),d=ao(d,y,c,null),k.return=a,d.return=a,k.sibling=d,a.child=k,d=a.child,d.memoizedState=ea(c),d.childLanes=jf(n,N,c),a.memoizedState=cp,ir(null,d)):(Ur(a),pc(a,k))}var Q=n.memoizedState;if(Q!==null&&(k=Q.dehydrated,k!==null)){if(S)a.flags&256?(Ur(a),a.flags&=-257,a=fp(n,a,c)):a.memoizedState!==null?(ba(),a.child=n.child,a.flags|=128,a=null):(ba(),k=d.fallback,y=a.mode,d=Qf({mode:"visible",children:d.children},y),k=ao(k,y,c,null),k.flags|=2,d.return=a,k.return=a,d.sibling=k,a.child=d,Dr(a,n.child,null,c),d=a.child,d.memoizedState=ea(c),d.childLanes=jf(n,N,c),a.memoizedState=cp,a=ir(null,d));else if(Ur(a),f_(k)){if(N=k.nextSibling&&k.nextSibling.dataset,N)var pe=N.dgst;N=pe,d=Error(i(419)),d.stack="",d.digest=N,Ks({value:d,source:null,stack:null}),a=fp(n,a,c)}else if(xi||tr(n,a,c,!1),N=(c&n.childLanes)!==0,xi||N){if(N=Vt,N!==null&&(d=Vo(N,c),d!==0&&d!==Q.retryLane))throw Q.retryLane=d,la(n,d),en(N,n,d),Xf;c_(k)||uu(),a=fp(n,a,c)}else c_(k)?(a.flags|=192,a.child=n.child,a=null):(n=Q.treeContext,Bn=hr(k.nextSibling),si=a,fn=!0,wr=null,Ha=!1,n!==null&&Mf(a,n),a=pc(a,d.children),a.flags|=4096);return a}return y?(ba(),k=d.fallback,y=a.mode,Q=n.child,pe=Q.sibling,d=ya(Q,{mode:"hidden",children:d.children}),d.subtreeFlags=Q.subtreeFlags&65011712,pe!==null?k=ya(pe,k):(k=ao(k,y,c,null),k.flags|=2),k.return=a,d.return=a,d.sibling=k,a.child=d,ir(null,d),d=a.child,k=n.child.memoizedState,k===null?k=ea(c):(y=k.cachePool,y!==null?(Q=_i._currentValue,y=y.parent!==Q?{parent:Q,pool:Q}:y):y=Dd(),k={baseLanes:k.baseLanes|c,cachePool:y}),d.memoizedState=k,d.childLanes=jf(n,N,c),a.memoizedState=cp,ir(n.child,d)):(Ur(a),c=n.child,n=c.sibling,c=ya(c,{mode:"visible",children:d.children}),c.return=a,c.sibling=null,n!==null&&(N=a.deletions,N===null?(a.deletions=[n],a.flags|=16):N.push(n)),a.child=c,a.memoizedState=null,c)}function pc(n,a){return a=Qf({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Qf(n,a){return n=Jn(22,n,null,a),n.lanes=0,n}function fp(n,a,c){return Dr(a,n.child,null,c),n=pc(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function Zg(n,a,c){n.lanes|=a;var d=n.alternate;d!==null&&(d.lanes|=a),Tf(n.return,a,c)}function cl(n,a,c,d,y,S){var N=n.memoizedState;N===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:y,treeForkCount:S}:(N.isBackwards=a,N.rendering=null,N.renderingStartTime=0,N.last=d,N.tail=c,N.tailMode=y,N.treeForkCount=S)}function Ea(n,a,c){var d=a.pendingProps,y=d.revealOrder,S=d.tail;d=d.children;var N=hn.current,k=(N&2)!==0;if(k?(N=N&1|2,a.flags|=128):N&=1,Ee(hn,N),Bi(n,a,d,c),d=fn?Wl:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Zg(n,c,a);else if(n.tag===19)Zg(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(y){case"forwards":for(c=a.child,y=null;c!==null;)n=c.alternate,n!==null&&Xa(n)===null&&(y=c),c=c.sibling;c=y,c===null?(y=a.child,a.child=null):(y=c.sibling,c.sibling=null),cl(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(n=y.alternate,n!==null&&Xa(n)===null){a.child=y;break}n=y.sibling,y.sibling=c,c=y,y=n}cl(a,!0,c,null,S,d);break;case"together":cl(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function fi(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),ur|=a.lanes,(c&a.childLanes)===0)if(n!==null){if(tr(n,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(i(153));if(a.child!==null){for(n=a.child,c=ya(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=ya(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function Jf(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&nc(n)))}function Ky(n,a,c){switch(a.tag){case 3:Je(a,a.stateNode.containerInfo),Cr(a,_i,n.memoizedState.cache),oo();break;case 27:case 5:ut(a);break;case 4:Je(a,a.stateNode.containerInfo);break;case 10:Cr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Id(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?Yg(n,a,c):(Ur(a),n=fi(n,a,c),n!==null?n.sibling:null);Ur(a);break;case 19:var y=(n.flags&128)!==0;if(d=(c&a.childLanes)!==0,d||(tr(n,a,c,!1),d=(c&a.childLanes)!==0),y){if(d)return Ea(n,a,c);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Ee(hn,hn.current),d)break;return null;case 22:return a.lanes=0,ll(n,a,c,a.pendingProps);case 24:Cr(a,_i,n.memoizedState.cache)}return fi(n,a,c)}function Kf(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)xi=!0;else{if(!Jf(n,c)&&(a.flags&128)===0)return xi=!1,Ky(n,a,c);xi=(n.flags&131072)!==0}else xi=!1,fn&&(a.flags&1048576)!==0&&tg(a,Wl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(n=$o(a.elementType),a.type=n,typeof n=="function")_f(n)?(d=go(n,d),a.tag=1,a=Zf(null,a,n,d,c)):(a.tag=0,a=iu(null,a,n,d,c));else{if(n!=null){var y=n.$$typeof;if(y===L){a.tag=11,a=up(null,a,n,d,c);break e}else if(y===H){a.tag=14,a=ol(null,a,n,d,c);break e}}throw a=ue(n)||n,Error(i(306,a,""))}}return a;case 0:return iu(n,a,a.type,a.pendingProps,c);case 1:return d=a.type,y=go(d,a.pendingProps),Zf(n,a,d,y,c);case 3:e:{if(Je(a,a.stateNode.containerInfo),n===null)throw Error(i(387));d=a.pendingProps;var S=a.memoizedState;y=S.element,Nd(n,a),Jl(a,d,null,c);var N=a.memoizedState;if(d=N.cache,Cr(a,_i,d),d!==S.cache&&Af(a,[_i],c,!0),oc(),d=N.element,S.isDehydrated)if(S={element:d,isDehydrated:!1,cache:N.cache},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){a=qg(n,a,d,c);break e}else if(d!==y){y=ka(Error(i(424)),a),Ks(y),a=qg(n,a,d,c);break e}else for(n=a.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Bn=hr(n.firstChild),si=a,fn=!0,wr=null,Ha=!0,c=Uf(a,null,d,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(oo(),d===y){a=fi(n,a,c);break e}Bi(n,a,d,c)}a=a.child}return a;case 26:return ul(n,a),n===null?(c=pb(a.type,null,a.pendingProps,null))?a.memoizedState=c:fn||(c=a.type,n=a.pendingProps,d=Kg(fe.current).createElement(c),d[Qn]=a,d[Ti]=n,ma(d,c,n),V(d),a.stateNode=d):a.memoizedState=pb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return ut(a),n===null&&fn&&(d=a.stateNode=fb(a.type,a.pendingProps,fe.current),si=a,Ha=!0,y=Bn,du(a.type)?(h_=y,Bn=hr(d.firstChild)):Bn=y),Bi(n,a,a.pendingProps.children,c),ul(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&fn&&((y=d=Bn)&&(d=tA(d,a.type,a.pendingProps,Ha),d!==null?(a.stateNode=d,si=a,Bn=hr(d.firstChild),Ha=!1,y=!0):y=!1),y||Js(a)),ut(a),y=a.type,S=a.pendingProps,N=n!==null?n.memoizedProps:null,d=S.children,o_(y,S)?d=null:N!==null&&o_(y,N)&&(a.flags|=32),a.memoizedState!==null&&(y=Of(n,a,rl,null,null,c),bp._currentValue=y),ul(n,a),Bi(n,a,d,c),a.child;case 6:return n===null&&fn&&((n=c=Bn)&&(c=nA(c,a.pendingProps,Ha),c!==null?(a.stateNode=c,si=a,Bn=null,n=!0):n=!1),n||Js(a)),null;case 13:return Yg(n,a,c);case 4:return Je(a,a.stateNode.containerInfo),d=a.pendingProps,n===null?a.child=Dr(a,null,d,c):Bi(n,a,d,c),a.child;case 11:return up(n,a,a.type,a.pendingProps,c);case 7:return Bi(n,a,a.pendingProps,c),a.child;case 8:return Bi(n,a,a.pendingProps.children,c),a.child;case 12:return Bi(n,a,a.pendingProps.children,c),a.child;case 10:return d=a.pendingProps,Cr(a,a.type,d.value),Bi(n,a,d.children,c),a.child;case 9:return y=a.type._context,d=a.pendingProps.children,uo(a),y=Pt(y),d=d(y),a.flags|=1,Bi(n,a,d,c),a.child;case 14:return ol(n,a,a.type,a.pendingProps,c);case 15:return Wf(n,a,a.type,a.pendingProps,c);case 19:return Ea(n,a,c);case 31:return Yf(n,a,c);case 22:return ll(n,a,c,a.pendingProps);case 24:return uo(a),d=Pt(_i),n===null?(y=Cf(),y===null&&(y=Vt,S=Ad(),y.pooledCache=S,S.refCount++,S!==null&&(y.pooledCacheLanes|=c),y=S),a.memoizedState={parent:d,cache:y},rc(a),Cr(a,_i,y)):((n.lanes&c)!==0&&(Nd(n,a),Jl(a,null,null,c),oc()),y=n.memoizedState,S=a.memoizedState,y.parent!==d?(y={parent:d,cache:d},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Cr(a,_i,d)):(d=S.cache,Cr(a,_i,d),d!==y.cache&&Af(a,[_i],c,!0))),Bi(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ar(n){n.flags|=4}function mc(n,a,c,d,y){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(y&335544128)===y)if(n.stateNode.complete)n.flags|=8192;else if(ni())n.flags|=8192;else throw nr=Rf,ac}else n.flags&=-16777217}function hp(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!_b(a))if(ni())n.flags|=8192;else throw nr=Rf,ac}function Ir(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?dn():536870912,n.lanes|=a,Xn|=a)}function sr(n,a){if(!fn)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function In(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,d=0;if(a)for(var y=n.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=n,y=y.sibling;else for(y=n.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=n,y=y.sibling;return n.subtreeFlags|=d,n.childLanes=c,a}function gc(n,a,c){var d=a.pendingProps;switch(bf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return In(a),null;case 1:return In(a),null;case 3:return c=a.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),er(_i),et(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(Yl(a)?ar(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ef())),In(a),null;case 26:var y=a.type,S=a.memoizedState;return n===null?(ar(a),S!==null?(In(a),hp(a,S)):(In(a),mc(a,y,null,d,c))):S?S!==n.memoizedState?(ar(a),In(a),hp(a,S)):(In(a),a.flags&=-16777217):(n=n.memoizedProps,n!==d&&ar(a),In(a),mc(a,y,n,d,c)),null;case 27:if(Jt(a),c=fe.current,y=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&ar(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return In(a),null}n=Oe.current,Yl(a)?ng(a):(n=fb(y,d,c),a.stateNode=n,ar(a))}return In(a),null;case 5:if(Jt(a),y=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&ar(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return In(a),null}if(S=Oe.current,Yl(a))ng(a);else{var N=Kg(fe.current);switch(S){case 1:S=N.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:S=N.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":S=N.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":S=N.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":S=N.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof d.is=="string"?N.createElement("select",{is:d.is}):N.createElement("select"),d.multiple?S.multiple=!0:d.size&&(S.size=d.size);break;default:S=typeof d.is=="string"?N.createElement(y,{is:d.is}):N.createElement(y)}}S[Qn]=a,S[Ti]=d;e:for(N=a.child;N!==null;){if(N.tag===5||N.tag===6)S.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===a)break e;for(;N.sibling===null;){if(N.return===null||N.return===a)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}a.stateNode=S;e:switch(ma(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&&ar(a)}}return In(a),mc(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,c),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==d&&ar(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(n=fe.current,Yl(a)){if(n=a.stateNode,c=a.memoizedProps,d=null,y=si,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}n[Qn]=a,n=!!(n.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||eb(n.nodeValue,c)),n||Js(a,!0)}else n=Kg(n).createTextNode(d),n[Qn]=a,a.stateNode=n}return In(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(d=Yl(a),c!==null){if(n===null){if(!d)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Qn]=a}else oo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;In(a),n=!1}else c=Ef(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(ui(a),a):(ui(a),null);if((a.flags&128)!==0)throw Error(i(558))}return In(a),null;case 13:if(d=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(y=Yl(a),d!==null&&d.dehydrated!==null){if(n===null){if(!y)throw Error(i(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));y[Qn]=a}else oo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;In(a),y=!1}else y=Ef(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(ui(a),a):(ui(a),null)}return ui(a),(a.flags&128)!==0?(a.lanes=c,a):(c=d!==null,n=n!==null&&n.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!==n&&c&&(a.child.flags|=8192),Ir(a,a.updateQueue),In(a),null);case 4:return et(),n===null&&n_(a.stateNode.containerInfo),In(a),null;case 10:return er(a.type),In(a),null;case 19:if(se(hn),d=a.memoizedState,d===null)return In(a),null;if(y=(a.flags&128)!==0,S=d.rendering,S===null)if(y)sr(d,!1);else{if(ei!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(S=Xa(n),S!==null){for(a.flags|=128,sr(d,!1),n=S.updateQueue,a.updateQueue=n,Ir(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)Hl(c,n),c=c.sibling;return Ee(hn,hn.current&1|2),fn&&js(a,d.treeForkCount),a.child}n=n.sibling}d.tail!==null&&O()>hi&&(a.flags|=128,y=!0,sr(d,!1),a.lanes=4194304)}else{if(!y)if(n=Xa(S),n!==null){if(a.flags|=128,y=!0,n=n.updateQueue,a.updateQueue=n,Ir(a,n),sr(d,!0),d.tail===null&&d.tailMode==="hidden"&&!S.alternate&&!fn)return In(a),null}else 2*O()-d.renderingStartTime>hi&&c!==536870912&&(a.flags|=128,y=!0,sr(d,!1),a.lanes=4194304);d.isBackwards?(S.sibling=a.child,a.child=S):(n=d.last,n!==null?n.sibling=S:a.child=S,d.last=S)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=O(),n.sibling=null,c=hn.current,Ee(hn,y?c&1|2:c&1),fn&&js(a,d.treeForkCount),n):(In(a),null);case 22:case 23:return ui(a),lc(),d=a.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(c&536870912)!==0&&(a.flags&128)===0&&(In(a),a.subtreeFlags&6&&(a.flags|=8192)):In(a),c=a.updateQueue,c!==null&&Ir(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==c&&(a.flags|=2048),n!==null&&se(co),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),er(_i),In(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function ds(n,a){switch(bf(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return er(_i),et(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Jt(a),null;case 31:if(a.memoizedState!==null){if(ui(a),a.alternate===null)throw Error(i(340));oo()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(ui(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));oo()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return se(hn),null;case 4:return et(),null;case 10:return er(a.type),null;case 22:case 23:return ui(a),lc(),n!==null&&se(co),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return er(_i),null;case 25:return null;default:return null}}function Wa(n,a){switch(bf(a),a.tag){case 3:er(_i),et();break;case 26:case 27:case 5:Jt(a);break;case 4:et();break;case 31:a.memoizedState!==null&&ui(a);break;case 13:ui(a);break;case 19:se(hn);break;case 10:er(a.type);break;case 22:case 23:ui(a),lc(),n!==null&&se(co);break;case 24:er(_i)}}function ps(n,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&n)===n){d=void 0;var S=c.create,N=c.inst;d=S(),N.destroy=d}c=c.next}while(c!==y)}}catch(k){bn(a,a.return,k)}}function qi(n,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&n)===n){var N=d.inst,k=N.destroy;if(k!==void 0){N.destroy=void 0,y=a;var Q=c,pe=k;try{pe()}catch(we){bn(y,Q,we)}}}d=d.next}while(d!==S)}}catch(we){bn(a,a.return,we)}}function Us(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{og(a,c)}catch(d){bn(n,n.return,d)}}}function Fi(n,a,c){c.props=go(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(d){bn(n,a,d)}}function Or(n,a){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:d=n.stateNode;break;default:d=n.stateNode}typeof c=="function"?n.refCleanup=c(d):c.current=d}}catch(y){bn(n,a,y)}}function Yi(n,a){var c=n.ref,d=n.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(y){bn(n,a,y)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){bn(n,a,y)}else c.current=null}function vc(n){var a=n.type,c=n.memoizedProps,d=n.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){bn(n,n.return,y)}}function Ri(n,a,c){try{var d=n.stateNode;jT(d,n.type,c,a),d[Ti]=a}catch(y){bn(n,n.return,y)}}function Zn(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&du(n.type)||n.tag===4}function un(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Zn(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&du(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function rr(n,a,c){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(n),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Mr));else if(d!==4&&(d===27&&du(n.type)&&(c=n.stateNode,a=null),n=n.child,n!==null))for(rr(n,a,c),n=n.sibling;n!==null;)rr(n,a,c),n=n.sibling}function fa(n,a,c){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(d!==4&&(d===27&&du(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(fa(n,a,c),n=n.sibling;n!==null;)fa(n,a,c),n=n.sibling}function $f(n){var a=n.stateNode,c=n.memoizedProps;try{for(var d=n.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);ma(a,d,c),a[Qn]=n,a[Ti]=c}catch(S){bn(n,n.return,S)}}var ms=!1,Fn=!1,Ls=!1,jg=typeof WeakSet=="function"?WeakSet:Set,Vi=null;function $y(n,a){if(n=n.containerInfo,s_=s0,n=Jm(n),Sd(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.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 N=0,k=-1,Q=-1,pe=0,we=0,Ie=n,ve=null;t:for(;;){for(var Me;Ie!==c||y!==0&&Ie.nodeType!==3||(k=N+y),Ie!==S||d!==0&&Ie.nodeType!==3||(Q=N+d),Ie.nodeType===3&&(N+=Ie.nodeValue.length),(Me=Ie.firstChild)!==null;)ve=Ie,Ie=Me;for(;;){if(Ie===n)break t;if(ve===c&&++pe===y&&(k=N),ve===S&&++we===d&&(Q=N),(Me=Ie.nextSibling)!==null)break;Ie=ve,ve=Ie.parentNode}Ie=Me}c=k===-1||Q===-1?null:{start:k,end:Q}}else c=null}c=c||{start:0,end:0}}else c=null;for(r_={focusedElem:n,selectionRange:c},s0=!1,Vi=a;Vi!==null;)if(a=Vi,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Vi=n;else for(;Vi!==null;){switch(a=Vi,S=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)y=n[c],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&S!==null){n=void 0,c=a,y=S.memoizedProps,S=S.memoizedState,d=c.stateNode;try{var xt=go(c.type,y);n=d.getSnapshotBeforeUpdate(xt,S),d.__reactInternalSnapshotBeforeUpdate=n}catch(zt){bn(c,c.return,zt)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,c=n.nodeType,c===9)u_(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":u_(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=a.sibling,n!==null){n.return=a.return,Vi=n;break}Vi=a.return}}function jn(n,a,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ys(n,c),d&4&&ps(5,c);break;case 1:if(ys(n,c),d&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(N){bn(c,c.return,N)}else{var y=go(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(y,a,n.__reactInternalSnapshotBeforeUpdate)}catch(N){bn(c,c.return,N)}}d&64&&Us(c),d&512&&Or(c,c.return);break;case 3:if(ys(n,c),d&64&&(n=c.updateQueue,n!==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{og(n,a)}catch(N){bn(c,c.return,N)}}break;case 27:a===null&&d&4&&$f(c);case 26:case 5:ys(n,c),a===null&&d&4&&vc(c),d&512&&Or(c,c.return);break;case 12:ys(n,c);break;case 31:ys(n,c),d&4&&vo(n,c);break;case 13:ys(n,c),d&4&&au(n,c),d&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=p.bind(null,c),iA(n,c))));break;case 22:if(d=c.memoizedState!==null||ms,!d){a=a!==null&&a.memoizedState!==null||Fn,y=ms;var S=Fn;ms=d,(Fn=a)&&!S?ha(n,c,(c.subtreeFlags&8772)!==0):ys(n,c),ms=y,Fn=S}break;case 30:break;default:ys(n,c)}}function yc(n){var a=n.alternate;a!==null&&(n.alternate=null,yc(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&xr(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Rn=null,ta=!1;function gs(n,a,c){for(c=c.child;c!==null;)eh(n,a,c),c=c.sibling}function eh(n,a,c){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(Be,c)}catch{}switch(c.tag){case 26:Fn||Yi(c,a),gs(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Fn||Yi(c,a);var d=Rn,y=ta;du(c.type)&&(Rn=c.stateNode,ta=!1),gs(n,a,c),_p(c.stateNode),Rn=d,ta=y;break;case 5:Fn||Yi(c,a);case 6:if(d=Rn,y=ta,Rn=null,gs(n,a,c),Rn=d,ta=y,Rn!==null)if(ta)try{(Rn.nodeType===9?Rn.body:Rn.nodeName==="HTML"?Rn.ownerDocument.body:Rn).removeChild(c.stateNode)}catch(S){bn(c,a,S)}else try{Rn.removeChild(c.stateNode)}catch(S){bn(c,a,S)}break;case 18:Rn!==null&&(ta?(n=Rn,rb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),lh(n)):rb(Rn,c.stateNode));break;case 4:d=Rn,y=ta,Rn=c.stateNode.containerInfo,ta=!0,gs(n,a,c),Rn=d,ta=y;break;case 0:case 11:case 14:case 15:qi(2,c,a),Fn||qi(4,c,a),gs(n,a,c);break;case 1:Fn||(Yi(c,a),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Fi(c,a,d)),gs(n,a,c);break;case 21:gs(n,a,c);break;case 22:Fn=(d=Fn)||c.memoizedState!==null,gs(n,a,c),Fn=d;break;default:gs(n,a,c)}}function vo(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{lh(n)}catch(c){bn(a,a.return,c)}}}function au(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{lh(n)}catch(c){bn(a,a.return,c)}}function dp(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new jg),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new jg),a;default:throw Error(i(435,n.tag))}}function zr(n,a){var c=dp(n);a.forEach(function(d){if(!c.has(d)){c.add(d);var y=v.bind(null,n,d);d.then(y,y)}})}function Di(n,a){var c=a.deletions;if(c!==null)for(var d=0;d<c.length;d++){var y=c[d],S=n,N=a,k=N;e:for(;k!==null;){switch(k.tag){case 27:if(du(k.type)){Rn=k.stateNode,ta=!1;break e}break;case 5:Rn=k.stateNode,ta=!1;break e;case 3:case 4:Rn=k.stateNode.containerInfo,ta=!0;break e}k=k.return}if(Rn===null)throw Error(i(160));eh(S,N,y),Rn=null,ta=!1,S=y.alternate,S!==null&&(S.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)yo(a,n),a=a.sibling}var vs=null;function yo(n,a){var c=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Di(a,n),Ni(n),d&4&&(qi(3,n,n.return),ps(3,n),qi(5,n,n.return));break;case 1:Di(a,n),Ni(n),d&512&&(Fn||c===null||Yi(c,c.return)),d&64&&ms&&(n=n.updateQueue,n!==null&&(d=n.callbacks,d!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var y=vs;if(Di(a,n),Ni(n),d&512&&(Fn||c===null||Yi(c,c.return)),d&4){var S=c!==null?c.memoizedState:null;if(d=n.memoizedState,c===null)if(d===null)if(n.stateNode===null){e:{d=n.type,c=n.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":S=y.getElementsByTagName("title")[0],(!S||S[Rs]||S[Qn]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=y.createElement(d),y.head.insertBefore(S,y.querySelector("head > title"))),ma(S,d,c),S[Qn]=n,V(S),d=S;break e;case"link":var N=vb("link","href",y).get(d+(c.href||""));if(N){for(var k=0;k<N.length;k++)if(S=N[k],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)){N.splice(k,1);break t}}S=y.createElement(d),ma(S,d,c),y.head.appendChild(S);break;case"meta":if(N=vb("meta","content",y).get(d+(c.content||""))){for(k=0;k<N.length;k++)if(S=N[k],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)){N.splice(k,1);break t}}S=y.createElement(d),ma(S,d,c),y.head.appendChild(S);break;default:throw Error(i(468,d))}S[Qn]=n,V(S),d=S}n.stateNode=d}else yb(y,n.type,n.stateNode);else n.stateNode=gb(y,d,n.memoizedProps);else S!==d?(S===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):S.count--,d===null?yb(y,n.type,n.stateNode):gb(y,d,n.memoizedProps)):d===null&&n.stateNode!==null&&Ri(n,n.memoizedProps,c.memoizedProps)}break;case 27:Di(a,n),Ni(n),d&512&&(Fn||c===null||Yi(c,c.return)),c!==null&&d&4&&Ri(n,n.memoizedProps,c.memoizedProps);break;case 5:if(Di(a,n),Ni(n),d&512&&(Fn||c===null||Yi(c,c.return)),n.flags&32){y=n.stateNode;try{yi(y,"")}catch(xt){bn(n,n.return,xt)}}d&4&&n.stateNode!=null&&(y=n.memoizedProps,Ri(n,y,c!==null?c.memoizedProps:y)),d&1024&&(Ls=!0);break;case 6:if(Di(a,n),Ni(n),d&4){if(n.stateNode===null)throw Error(i(162));d=n.memoizedProps,c=n.stateNode;try{c.nodeValue=d}catch(xt){bn(n,n.return,xt)}}break;case 3:if(t0=null,y=vs,vs=$g(a.containerInfo),Di(a,n),vs=y,Ni(n),d&4&&c!==null&&c.memoizedState.isDehydrated)try{lh(a.containerInfo)}catch(xt){bn(n,n.return,xt)}Ls&&(Ls=!1,th(n));break;case 4:d=vs,vs=$g(n.stateNode.containerInfo),Di(a,n),Ni(n),vs=d;break;case 12:Di(a,n),Ni(n);break;case 31:Di(a,n),Ni(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,zr(n,d)));break;case 13:Di(a,n),Ni(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(su=O()),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,zr(n,d)));break;case 22:y=n.memoizedState!==null;var Q=c!==null&&c.memoizedState!==null,pe=ms,we=Fn;if(ms=pe||y,Fn=we||Q,Di(a,n),Fn=we,ms=pe,Ni(n),d&8192)e:for(a=n.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(c===null||Q||ms||Fn||or(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){Q=c=a;try{if(S=Q.stateNode,y)N=S.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{k=Q.stateNode;var Ie=Q.memoizedProps.style,ve=Ie!=null&&Ie.hasOwnProperty("display")?Ie.display:null;k.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(xt){bn(Q,Q.return,xt)}}}else if(a.tag===6){if(c===null){Q=a;try{Q.stateNode.nodeValue=y?"":Q.memoizedProps}catch(xt){bn(Q,Q.return,xt)}}}else if(a.tag===18){if(c===null){Q=a;try{var Me=Q.stateNode;y?ob(Me,!0):ob(Q.stateNode,!1)}catch(xt){bn(Q,Q.return,xt)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=n.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,zr(n,c))));break;case 19:Di(a,n),Ni(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,zr(n,d)));break;case 30:break;case 21:break;default:Di(a,n),Ni(n)}}function Ni(n){var a=n.flags;if(a&2){try{for(var c,d=n.return;d!==null;){if(Zn(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var y=c.stateNode,S=un(n);fa(n,S,y);break;case 5:var N=c.stateNode;c.flags&32&&(yi(N,""),c.flags&=-33);var k=un(n);fa(n,k,N);break;case 3:case 4:var Q=c.stateNode.containerInfo,pe=un(n);rr(n,pe,Q);break;default:throw Error(i(161))}}catch(we){bn(n,n.return,we)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function th(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;th(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function ys(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)jn(n,a.alternate,a),a=a.sibling}function or(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:qi(4,a,a.return),or(a);break;case 1:Yi(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Fi(a,a.return,c),or(a);break;case 27:_p(a.stateNode);case 26:case 5:Yi(a,a.return),or(a);break;case 22:a.memoizedState===null&&or(a);break;case 30:or(a);break;default:or(a)}n=n.sibling}}function ha(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,y=n,S=a,N=S.flags;switch(S.tag){case 0:case 11:case 15:ha(y,S,c),ps(4,S);break;case 1:if(ha(y,S,c),d=S,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(pe){bn(d,d.return,pe)}if(d=S,y=d.updateQueue,y!==null){var k=d.stateNode;try{var Q=y.shared.hiddenCallbacks;if(Q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Q.length;y++)Kl(Q[y],k)}catch(pe){bn(d,d.return,pe)}}c&&N&64&&Us(S),Or(S,S.return);break;case 27:$f(S);case 26:case 5:ha(y,S,c),c&&d===null&&N&4&&vc(S),Or(S,S.return);break;case 12:ha(y,S,c);break;case 31:ha(y,S,c),c&&N&4&&vo(y,S);break;case 13:ha(y,S,c),c&&N&4&&au(y,S);break;case 22:S.memoizedState===null&&ha(y,S,c),Or(S,S.return);break;case 30:break;default:ha(y,S,c)}a=a.sibling}}function _o(n,a){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Jo(c))}function fl(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Jo(n))}function Zi(n,a,c,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)pp(n,a,c,d),a=a.sibling}function pp(n,a,c,d){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Zi(n,a,c,d),y&2048&&ps(9,a);break;case 1:Zi(n,a,c,d);break;case 3:Zi(n,a,c,d),y&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Jo(n)));break;case 12:if(y&2048){Zi(n,a,c,d),n=a.stateNode;try{var S=a.memoizedProps,N=S.id,k=S.onPostCommit;typeof k=="function"&&k(N,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){bn(a,a.return,Q)}}else Zi(n,a,c,d);break;case 31:Zi(n,a,c,d);break;case 13:Zi(n,a,c,d);break;case 23:break;case 22:S=a.stateNode,N=a.alternate,a.memoizedState!==null?S._visibility&2?Zi(n,a,c,d):lr(n,a):S._visibility&2?Zi(n,a,c,d):(S._visibility|=2,ji(n,a,c,d,(a.subtreeFlags&10256)!==0||!1)),y&2048&&_o(N,a);break;case 24:Zi(n,a,c,d),y&2048&&fl(a.alternate,a);break;default:Zi(n,a,c,d)}}function ji(n,a,c,d,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var S=n,N=a,k=c,Q=d,pe=N.flags;switch(N.tag){case 0:case 11:case 15:ji(S,N,k,Q,y),ps(8,N);break;case 23:break;case 22:var we=N.stateNode;N.memoizedState!==null?we._visibility&2?ji(S,N,k,Q,y):lr(S,N):(we._visibility|=2,ji(S,N,k,Q,y)),y&&pe&2048&&_o(N.alternate,N);break;case 24:ji(S,N,k,Q,y),y&&pe&2048&&fl(N.alternate,N);break;default:ji(S,N,k,Q,y)}a=a.sibling}}function lr(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,d=a,y=d.flags;switch(d.tag){case 22:lr(c,d),y&2048&&_o(d.alternate,d);break;case 24:lr(c,d),y&2048&&fl(d.alternate,d);break;default:lr(c,d)}a=a.sibling}}var hl=8192;function qa(n,a,c){if(n.subtreeFlags&hl)for(n=n.child;n!==null;)nh(n,a,c),n=n.sibling}function nh(n,a,c){switch(n.tag){case 26:qa(n,a,c),n.flags&hl&&n.memoizedState!==null&&mA(c,vs,n.memoizedState,n.memoizedProps);break;case 5:qa(n,a,c);break;case 3:case 4:var d=vs;vs=$g(n.stateNode.containerInfo),qa(n,a,c),vs=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=hl,hl=16777216,qa(n,a,c),hl=d):qa(n,a,c));break;default:qa(n,a,c)}}function dl(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function xo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];Vi=d,ri(d,n)}dl(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ta(n),n=n.sibling}function Ta(n){switch(n.tag){case 0:case 11:case 15:xo(n),n.flags&2048&&qi(9,n,n.return);break;case 3:xo(n);break;case 12:xo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Aa(n)):xo(n);break;default:xo(n)}}function Aa(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];Vi=d,ri(d,n)}dl(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:qi(8,a,a.return),Aa(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Aa(a));break;default:Aa(a)}n=n.sibling}}function ri(n,a){for(;Vi!==null;){var c=Vi;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:Jo(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Vi=d;else e:for(c=n;Vi!==null;){d=Vi;var y=d.sibling,S=d.return;if(yc(d),d===c){Vi=null;break e}if(y!==null){y.return=S,Vi=y;break e}Vi=S}}}var Pr={getCacheForType:function(n){var a=Pt(_i),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return Pt(_i).controller.signal}},Wt=typeof WeakMap=="function"?WeakMap:Map,Et=0,Vt=null,$t=null,jt=0,pn=0,na=null,_s=!1,Is=!1,mp=!1,Ya=0,ei=0,ur=0,So=0,_c=0,da=0,Xn=0,pl=null,oi=null,li=!1,su=0,gp=0,hi=1/0,ti=null,di=null,Dn=0,Za=null,ru=null,xs=0,ou=0,lu=null,xc=null,bo=0,ml=null;function ja(){return(Et&2)!==0&&jt!==0?jt&-jt:q.T!==null?_e():ko()}function sn(){if(da===0)if((jt&536870912)===0||fn){var n=Ge;Ge<<=1,(Ge&3932160)===0&&(Ge=262144),da=n}else da=536870912;return n=Sa.current,n!==null&&(n.flags|=32),da}function en(n,a,c){(n===Vt&&(pn===2||pn===9)||n.cancelPendingCommit!==null)&&(Eo(n,0),Si(n,jt,da,!1)),Xi(n,c),((Et&2)===0||n!==Vt)&&(n===Vt&&((Et&2)===0&&(So|=c),ei===4&&Si(n,jt,da,!1)),ke(n))}function rn(n,a,c){if((Et&6)!==0)throw Error(i(327));var d=!c&&(a&127)===0&&(a&n.expiredLanes)===0||je(n,a),y=d?Sc(n,a):pa(n,a,!0),S=d;do{if(y===0){Is&&!d&&Si(n,a,0,!1);break}else{if(c=n.current.alternate,S&&!Nn(c)){y=pa(n,a,!1),S=!1;continue}if(y===2){if(S=a,n.errorRecoveryDisabledLanes&S)var N=0;else N=n.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){a=N;e:{var k=n;y=pl;var Q=k.current.memoizedState.isDehydrated;if(Q&&(Eo(k,N).flags|=256),N=pa(k,N,!1),N!==2){if(mp&&!Q){k.errorRecoveryDisabledLanes|=S,So|=S,y=4;break e}S=oi,oi=y,S!==null&&(oi===null?oi=S:oi.push.apply(oi,S))}y=N}if(S=!1,y!==2)continue}}if(y===1){Eo(n,0),Si(n,a,0,!0);break}e:{switch(d=n,S=y,S){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Si(d,a,da,!_s);break e;case 2:oi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(y=su+300-O(),10<y)){if(Si(d,a,da,!_s),Ne(d,0,!0)!==0)break e;xs=a,d.timeoutHandle=ab(cn.bind(null,d,c,oi,ti,li,a,da,So,Xn,_s,S,"Throttled",-0,0),y);break e}cn(d,c,oi,ti,li,a,da,So,Xn,_s,S,null,-0,0)}}break}while(!0);ke(n)}function cn(n,a,c,d,y,S,N,k,Q,pe,we,Ie,ve,Me){if(n.timeoutHandle=-1,Ie=a.subtreeFlags,Ie&8192||(Ie&16785408)===16785408){Ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mr},nh(a,S,Ie);var xt=(S&62914560)===S?su-O():(S&4194048)===S?gp-O():0;if(xt=gA(Ie,xt),xt!==null){xs=S,n.cancelPendingCommit=xt(Fr.bind(null,n,a,S,c,d,y,N,k,Q,we,Ie,null,ve,Me)),Si(n,S,N,!pe);return}}Fr(n,a,S,c,d,y,N,k,Q)}function Nn(n){for(var a=n;;){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(!oa(S(),y))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Si(n,a,c,d){a&=~_c,a&=~So,n.suspendedLanes|=a,n.pingedLanes&=~a,d&&(n.warmLanes|=a),d=n.expirationTimes;for(var y=a;0<y;){var S=31-lt(y),N=1<<S;d[S]=-1,y&=~N}c!==0&&Zr(n,c,a)}function Os(){return(Et&6)===0?(dt(0),!1):!0}function Mo(){if($t!==null){if(pn===0)var n=$t.return;else n=$t,$s=lo=null,Fd(n),nl=null,il=0,n=$t;for(;n!==null;)Wa(n.alternate,n),n=n.return;$t=null}}function Eo(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,KT(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),xs=0,Mo(),Vt=n,$t=c=ya(n.current,null),jt=a,pn=0,na=null,_s=!1,Is=je(n,a),mp=!1,Xn=da=_c=So=ur=ei=0,oi=pl=null,li=!1,(a&8)!==0&&(a|=a&32);var d=n.entangledLanes;if(d!==0)for(n=n.entanglements,d&=a;0<d;){var y=31-lt(d),S=1<<y;a|=n[y],d&=~S}return Ya=a,ec(),c}function cr(n,a){Xt=null,q.H=nu,a===Ko||a===Kt?(a=el(),pn=3):a===ac?(a=el(),pn=4):pn=a===Xf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,na=a,$t===null&&(ei=1,Gf(n,ka(a,n.current)))}function ni(){var n=Sa.current;return n===null?!0:(jt&4194048)===jt?ca===null:(jt&62914560)===jt||(jt&536870912)!==0?n===ca:!1}function Br(){var n=q.H;return q.H=nu,n===null?nu:n}function To(){var n=q.A;return q.A=Pr,n}function uu(){ei=4,_s||(jt&4194048)!==jt&&Sa.current!==null||(Is=!0),(ur&134217727)===0&&(So&134217727)===0||Vt===null||Si(Vt,jt,da,!1)}function pa(n,a,c){var d=Et;Et|=2;var y=Br(),S=To();(Vt!==n||jt!==a)&&(ti=null,Eo(n,a)),a=!1;var N=ei;e:do try{if(pn!==0&&$t!==null){var k=$t,Q=na;switch(pn){case 8:Mo(),N=6;break e;case 3:case 2:case 9:case 6:Sa.current===null&&(a=!0);var pe=pn;if(pn=0,na=null,gl(n,k,Q,pe),c&&Is){N=0;break e}break;default:pe=pn,pn=0,na=null,gl(n,k,Q,pe)}}cu(),N=ei;break}catch(we){cr(n,we)}while(!0);return a&&n.shellSuspendCounter++,$s=lo=null,Et=d,q.H=y,q.A=S,$t===null&&(Vt=null,jt=0,ec()),N}function cu(){for(;$t!==null;)ih($t)}function Sc(n,a){var c=Et;Et|=2;var d=Br(),y=To();Vt!==n||jt!==a?(ti=null,hi=O()+500,Eo(n,a)):Is=je(n,a);e:do try{if(pn!==0&&$t!==null){a=$t;var S=na;t:switch(pn){case 1:pn=0,na=null,gl(n,a,S,1);break;case 2:case 9:if(xa(S)){pn=0,na=null,bc(a);break}a=function(){pn!==2&&pn!==9||Vt!==n||(pn=7),ke(n)},S.then(a,a);break e;case 3:pn=7;break e;case 4:pn=5;break e;case 7:xa(S)?(pn=0,na=null,bc(a)):(pn=0,na=null,gl(n,a,S,7));break;case 5:var N=null;switch($t.tag){case 26:N=$t.memoizedState;case 5:case 27:var k=$t;if(N?_b(N):k.stateNode.complete){pn=0,na=null;var Q=k.sibling;if(Q!==null)$t=Q;else{var pe=k.return;pe!==null?($t=pe,Ao(pe)):$t=null}break t}}pn=0,na=null,gl(n,a,S,5);break;case 6:pn=0,na=null,gl(n,a,S,6);break;case 8:Mo(),ei=6;break e;default:throw Error(i(462))}}wa();break}catch(we){cr(n,we)}while(!0);return $s=lo=null,q.H=d,q.A=y,Et=c,$t!==null?0:(Vt=null,jt=0,ec(),ei)}function wa(){for(;$t!==null&&!We();)ih($t)}function ih(n){var a=Kf(n.alternate,n,Ya);n.memoizedProps=n.pendingProps,a===null?Ao(n):$t=a}function bc(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=dc(c,a,a.pendingProps,a.type,void 0,jt);break;case 11:a=dc(c,a,a.pendingProps,a.type.render,a.ref,jt);break;case 5:Fd(a);default:Wa(c,a),a=$t=Hl(a,Ya),a=Kf(c,a,Ya)}n.memoizedProps=n.pendingProps,a===null?Ao(n):$t=a}function gl(n,a,c,d){$s=lo=null,Fd(a),nl=null,il=0;var y=a.return;try{if(Ci(n,y,a,c,jt)){ei=1,Gf(n,ka(c,n.current)),$t=null;return}}catch(S){if(y!==null)throw $t=y,S;ei=1,Gf(n,ka(c,n.current)),$t=null;return}a.flags&32768?(fn||d===1?n=!0:Is||(jt&536870912)!==0?n=!1:(_s=n=!0,(d===2||d===9||d===3||d===6)&&(d=Sa.current,d!==null&&d.tag===13&&(d.flags|=16384))),Mc(a,n)):Ao(a)}function Ao(n){var a=n;do{if((a.flags&32768)!==0){Mc(a,_s);return}n=a.return;var c=gc(a.alternate,a,Ya);if(c!==null){$t=c;return}if(a=a.sibling,a!==null){$t=a;return}$t=a=n}while(a!==null);ei===0&&(ei=5)}function Mc(n,a){do{var c=ds(n.alternate,n);if(c!==null){c.flags&=32767,$t=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(n=n.sibling,n!==null)){$t=n;return}$t=n=c}while(n!==null);ei=6,$t=null}function Fr(n,a,c,d,y,S,N,k,Q){n.cancelPendingCommit=null;do fu();while(Dn!==0);if((Et&6)!==0)throw Error(i(327));if(a!==null){if(a===n.current)throw Error(i(177));if(S=a.lanes|a.childLanes,S|=zi,va(n,c,S,N,k,Q),n===Vt&&($t=Vt=null,jt=0),ru=a,Za=n,xs=c,ou=S,lu=y,xc=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,T(be,function(){return ah(),null})):(n.callbackNode=null,n.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,y=K.p,K.p=2,N=Et,Et|=4;try{$y(n,a,c)}finally{Et=N,K.p=y,q.T=d}}Dn=1,bi(),Vr(),vl()}}function bi(){if(Dn===1){Dn=0;var n=Za,a=ru,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=q.T,q.T=null;var d=K.p;K.p=2;var y=Et;Et|=4;try{yo(a,n);var S=r_,N=Jm(n.containerInfo),k=S.focusedElem,Q=S.selectionRange;if(N!==k&&k&&k.ownerDocument&&Pn(k.ownerDocument.documentElement,k)){if(Q!==null&&Sd(k)){var pe=Q.start,we=Q.end;if(we===void 0&&(we=pe),"selectionStart"in k)k.selectionStart=pe,k.selectionEnd=Math.min(we,k.value.length);else{var Ie=k.ownerDocument||document,ve=Ie&&Ie.defaultView||window;if(ve.getSelection){var Me=ve.getSelection(),xt=k.textContent.length,zt=Math.min(Q.start,xt),kn=Q.end===void 0?zt:Math.min(Q.end,xt);!Me.extend&&zt>kn&&(N=kn,kn=zt,zt=N);var re=Fl(k,zt),ee=Fl(k,kn);if(re&&ee&&(Me.rangeCount!==1||Me.anchorNode!==re.node||Me.anchorOffset!==re.offset||Me.focusNode!==ee.node||Me.focusOffset!==ee.offset)){var de=Ie.createRange();de.setStart(re.node,re.offset),Me.removeAllRanges(),zt>kn?(Me.addRange(de),Me.extend(ee.node,ee.offset)):(de.setEnd(ee.node,ee.offset),Me.addRange(de))}}}}for(Ie=[],Me=k;Me=Me.parentNode;)Me.nodeType===1&&Ie.push({element:Me,left:Me.scrollLeft,top:Me.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<Ie.length;k++){var De=Ie[k];De.element.scrollLeft=De.left,De.element.scrollTop=De.top}}s0=!!s_,r_=s_=null}finally{Et=y,K.p=d,q.T=c}}n.current=a,Dn=2}}function Vr(){if(Dn===2){Dn=0;var n=Za,a=ru,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=q.T,q.T=null;var d=K.p;K.p=2;var y=Et;Et|=4;try{jn(n,a.alternate,a)}finally{Et=y,K.p=d,q.T=c}}Dn=3}}function vl(){if(Dn===4||Dn===3){Dn=0,G();var n=Za,a=ru,c=xs,d=xc;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Dn=5:(Dn=0,ru=Za=null,fr(n,n.pendingLanes));var y=n.pendingLanes;if(y===0&&(di=null),_r(c),a=a.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(Be,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=q.T,y=K.p,K.p=2,q.T=null;try{for(var S=n.onRecoverableError,N=0;N<d.length;N++){var k=d[N];S(k.value,{componentStack:k.stack})}}finally{q.T=a,K.p=y}}(xs&3)!==0&&fu(),ke(n),y=n.pendingLanes,(c&261930)!==0&&(y&42)!==0?n===ml?bo++:(bo=0,ml=n):bo=0,dt(0)}}function fr(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Jo(a)))}function fu(){return bi(),Vr(),vl(),ah()}function ah(){if(Dn!==5)return!1;var n=Za,a=ou;ou=0;var c=_r(xs),d=q.T,y=K.p;try{K.p=32>c?32:c,q.T=null,c=lu,lu=null;var S=Za,N=xs;if(Dn=0,ru=Za=null,xs=0,(Et&6)!==0)throw Error(i(331));var k=Et;if(Et|=4,Ta(S.current),pp(S,S.current,N,c),Et=k,dt(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(Be,S)}catch{}return!0}finally{K.p=y,q.T=d,fr(n,a)}}function vp(n,a,c){a=ka(c,a),a=op(n.stateNode,a,2),n=fo(n,a,2),n!==null&&(Xi(n,2),ke(n))}function bn(n,a,c){if(n.tag===3)vp(n,n,c);else for(;a!==null;){if(a.tag===3){vp(a,n,c);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(di===null||!di.has(d))){n=ka(c,n),c=lp(2),d=fo(a,c,2),d!==null&&(Xg(c,d,a,n),Xi(d,2),ke(d));break}}a=a.return}}function Ec(n,a,c){var d=n.pingCache;if(d===null){d=n.pingCache=new Wt;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)||(mp=!0,y.add(c),n=r.bind(null,n,a,c),a.then(n,n))}function r(n,a,c){var d=n.pingCache;d!==null&&d.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Vt===n&&(jt&c)===c&&(ei===4||ei===3&&(jt&62914560)===jt&&300>O()-su?(Et&2)===0&&Eo(n,0):_c|=c,Xn===jt&&(Xn=0)),ke(n)}function l(n,a){a===0&&(a=dn()),n=la(n,a),n!==null&&(Xi(n,a),ke(n))}function p(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),l(n,c)}function v(n,a){var c=0;switch(n.tag){case 31:case 13:var d=n.stateNode,y=n.memoizedState;y!==null&&(c=y.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),l(n,c)}function T(n,a){return tt(n,a)}var w=null,F=null,J=!1,xe=!1,ze=!1,Qe=0;function ke(n){n!==F&&n.next===null&&(F===null?w=F=n:F=F.next=n),xe=!0,J||(J=!0,le())}function dt(n,a){if(!ze&&xe){ze=!0;do for(var c=!1,d=w;d!==null;){if(n!==0){var y=d.pendingLanes;if(y===0)var S=0;else{var N=d.suspendedLanes,k=d.pingedLanes;S=(1<<31-lt(42|n)+1)-1,S&=y&~(N&~k),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(c=!0,ge(d,S))}else S=jt,S=Ne(d,d===Vt?S:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(S&3)===0||je(d,S)||(c=!0,ge(d,S));d=d.next}while(c);ze=!1}}function Gt(){pi()}function pi(){xe=J=!1;var n=0;Qe!==0&&JT()&&(n=Qe);for(var a=O(),c=null,d=w;d!==null;){var y=d.next,S=hu(d,a);S===0?(d.next=null,c===null?w=y:c.next=y,y===null&&(F=c)):(c=d,(n!==0||(S&3)!==0)&&(xe=!0)),d=y}Dn!==0&&Dn!==5||dt(n),Qe!==0&&(Qe=0)}function hu(n,a){for(var c=n.suspendedLanes,d=n.pingedLanes,y=n.expirationTimes,S=n.pendingLanes&-62914561;0<S;){var N=31-lt(S),k=1<<N,Q=y[N];Q===-1?((k&c)===0||(k&d)!==0)&&(y[N]=Bt(k,a)):Q<=a&&(n.expiredLanes|=k),S&=~k}if(a=Vt,c=jt,c=Ne(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,c===0||n===a&&(pn===2||pn===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&Mt(d),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||je(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(d!==null&&Mt(d),_r(c)){case 2:case 8:c=Le;break;case 32:c=be;break;case 268435456:c=Ze;break;default:c=be}return d=wo.bind(null,n),c=tt(c,d),n.callbackPriority=a,n.callbackNode=c,a}return d!==null&&d!==null&&Mt(d),n.callbackPriority=2,n.callbackNode=null,2}function wo(n,a){if(Dn!==0&&Dn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(fu()&&n.callbackNode!==c)return null;var d=jt;return d=Ne(n,n===Vt?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(rn(n,d,a),hu(n,O()),n.callbackNode!=null&&n.callbackNode===c?wo.bind(null,n):null)}function ge(n,a){if(fu())return null;rn(n,a,!0)}function le(){$T(function(){(Et&6)!==0?tt(Se,Gt):pi()})}function _e(){if(Qe===0){var n=Rr;n===0&&(n=it,it<<=1,(it&261888)===0&&(it=256)),Qe=n}return Qe}function Ye(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Vu(""+n)}function Nt(n,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,n.id&&c.setAttribute("form",n.id),a.parentNode.insertBefore(c,a),n=new FormData(n),c.parentNode.removeChild(c),n}function ii(n,a,c,d,y){if(a==="submit"&&c&&c.stateNode===y){var S=Ye((y[Ti]||null).action),N=d.submitter;N&&(a=(a=N[Ti]||null)?Ye(a.formAction):N.getAttribute("formAction"),a!==null&&(S=a,N=null));var k=new Gu("action","action",null,d,y);n.push({event:k,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Qe!==0){var Q=N?Nt(y,N):new FormData(y);$d(c,{pending:!0,data:Q,method:y.method,action:S},null,Q)}}else typeof S=="function"&&(k.preventDefault(),Q=N?Nt(y,N):new FormData(y),$d(c,{pending:!0,data:Q,method:y.method,action:S},S,Q))},currentTarget:y}]})}}for(var Lt=0;Lt<Ku.length;Lt++){var yn=Ku[Lt],ki=yn.toLowerCase(),Mn=yn[0].toUpperCase()+yn.slice(1);rs(ki,"on"+Mn)}rs(vf,"onAnimationEnd"),rs(Ju,"onAnimationIteration"),rs(Md,"onAnimationStart"),rs("dblclick","onDoubleClick"),rs("focusin","onFocus"),rs("focusout","onBlur"),rs($m,"onTransitionRun"),rs(Wy,"onTransitionStart"),rs(eg,"onTransitionCancel"),rs(Ed,"onTransitionEnd"),oe("onMouseEnter",["mouseout","mouseover"]),oe("onMouseLeave",["mouseout","mouseover"]),oe("onPointerEnter",["pointerout","pointerover"]),oe("onPointerLeave",["pointerout","pointerover"]),me("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),me("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),me("onBeforeInput",["compositionend","keypress","textInput","paste"]),me("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),me("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),me("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ss="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(" "),e_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ss));function QS(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var d=n[c],y=d.event;d=d.listeners;e:{var S=void 0;if(a)for(var N=d.length-1;0<=N;N--){var k=d[N],Q=k.instance,pe=k.currentTarget;if(k=k.listener,Q!==S&&y.isPropagationStopped())break e;S=k,y.currentTarget=pe;try{S(y)}catch(we){$u(we)}y.currentTarget=null,S=Q}else for(N=0;N<d.length;N++){if(k=d[N],Q=k.instance,pe=k.currentTarget,k=k.listener,Q!==S&&y.isPropagationStopped())break e;S=k,y.currentTarget=pe;try{S(y)}catch(we){$u(we)}y.currentTarget=null,S=Q}}}}function mn(n,a){var c=a[Ba];c===void 0&&(c=a[Ba]=new Set);var d=n+"__bubble";c.has(d)||(JS(a,n,2,!1),c.add(d))}function t_(n,a,c){var d=0;a&&(d|=4),JS(c,n,d,a)}var Qg="_reactListening"+Math.random().toString(36).slice(2);function n_(n){if(!n[Qg]){n[Qg]=!0,ie.forEach(function(c){c!=="selectionchange"&&(e_.has(c)||t_(c,!1,n),t_(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Qg]||(a[Qg]=!0,t_("selectionchange",!1,a))}}function JS(n,a,c,d){switch(Ab(a)){case 2:var y=_A;break;case 8:y=xA;break;default:y=v_}c=y.bind(null,a,c,n),y=void 0,!sd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),d?y!==void 0?n.addEventListener(a,c,{capture:!0,passive:y}):n.addEventListener(a,c,!0):y!==void 0?n.addEventListener(a,c,{passive:y}):n.addEventListener(a,c,!1)}function i_(n,a,c,d,y){var S=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var N=d.tag;if(N===3||N===4){var k=d.stateNode.containerInfo;if(k===y)break;if(N===4)for(N=d.return;N!==null;){var Q=N.tag;if((Q===3||Q===4)&&N.stateNode.containerInfo===y)return;N=N.return}for(;k!==null;){if(N=Sr(k),N===null)return;if(Q=N.tag,Q===5||Q===6||Q===26||Q===27){d=S=N;continue e}k=k.parentNode}}d=d.return}ad(function(){var pe=S,we=af(c),Ie=[];e:{var ve=ss.get(n);if(ve!==void 0){var Me=Gu,xt=n;switch(n){case"keypress":if(Hu(c)===0)break e;case"keydown":case"keyup":Me=qo;break;case"focusin":xt="focus",Me=lf;break;case"focusout":xt="blur",Me=lf;break;case"beforeblur":case"afterblur":Me=lf;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":Me=rd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Me=Lm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Me=Fm;break;case vf:case Ju:case Md:Me=Hy;break;case Ed:Me=Xy;break;case"scroll":case"scrollend":Me=Nm;break;case"wheel":Me=km;break;case"copy":case"cut":case"paste":Me=Om;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Me=ud;break;case"toggle":case"beforetoggle":Me=Gm}var zt=(a&4)!==0,kn=!zt&&(n==="scroll"||n==="scrollend"),re=zt?ve!==null?ve+"Capture":null:ve;zt=[];for(var ee=pe,de;ee!==null;){var De=ee;if(de=De.stateNode,De=De.tag,De!==5&&De!==26&&De!==27||de===null||re===null||(De=Dl(ee,re),De!=null&&zt.push(yp(ee,De,de))),kn)break;ee=ee.return}0<zt.length&&(ve=new Me(ve,xt,null,c,we),Ie.push({event:ve,listeners:zt}))}}if((a&7)===0){e:{if(ve=n==="mouseover"||n==="pointerover",Me=n==="mouseout"||n==="pointerout",ve&&c!==nf&&(xt=c.relatedTarget||c.fromElement)&&(Sr(xt)||xt[Pa]))break e;if((Me||ve)&&(ve=we.window===we?we:(ve=we.ownerDocument)?ve.defaultView||ve.parentWindow:window,Me?(xt=c.relatedTarget||c.toElement,Me=pe,xt=xt?Sr(xt):null,xt!==null&&(kn=u(xt),zt=xt.tag,xt!==kn||zt!==5&&zt!==27&&zt!==6)&&(xt=null)):(Me=null,xt=pe),Me!==xt)){if(zt=rd,De="onMouseLeave",re="onMouseEnter",ee="mouse",(n==="pointerout"||n==="pointerover")&&(zt=ud,De="onPointerLeave",re="onPointerEnter",ee="pointer"),kn=Me==null?ve:Kr(Me),de=xt==null?ve:Kr(xt),ve=new zt(De,ee+"leave",Me,c,we),ve.target=kn,ve.relatedTarget=de,De=null,Sr(we)===pe&&(zt=new zt(re,ee+"enter",xt,c,we),zt.target=de,zt.relatedTarget=kn,De=zt),kn=De,Me&&xt)t:{for(zt=qT,re=Me,ee=xt,de=0,De=re;De;De=zt(De))de++;De=0;for(var Rt=ee;Rt;Rt=zt(Rt))De++;for(;0<de-De;)re=zt(re),de--;for(;0<De-de;)ee=zt(ee),De--;for(;de--;){if(re===ee||ee!==null&&re===ee.alternate){zt=re;break t}re=zt(re),ee=zt(ee)}zt=null}else zt=null;Me!==null&&KS(Ie,ve,Me,zt,!1),xt!==null&&kn!==null&&KS(Ie,kn,xt,zt,!0)}}e:{if(ve=pe?Kr(pe):window,Me=ve.nodeName&&ve.nodeName.toLowerCase(),Me==="select"||Me==="input"&&ve.type==="file")var wn=gd;else if(md(ve))if(Ws)wn=Qm;else{wn=_d;var bt=Zm}else Me=ve.nodeName,!Me||Me.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?pe&&is(pe.elementType)&&(wn=gd):wn=jm;if(wn&&(wn=wn(n,pe))){mf(Ie,wn,c,we);break e}bt&&bt(n,ve,pe),n==="focusout"&&pe&&ve.type==="number"&&pe.memoizedProps.value!=null&&Gn(ve,"number",ve.value)}switch(bt=pe?Kr(pe):window,n){case"focusin":(md(bt)||bt.contentEditable==="true")&&(qs=bt,Ys=pe,Vl=null);break;case"focusout":Vl=Ys=qs=null;break;case"mousedown":gf=!0;break;case"contextmenu":case"mouseup":case"dragend":gf=!1,kl(Ie,c,we);break;case"selectionchange":if(Km)break;case"keydown":case"keyup":kl(Ie,c,we)}var nn;if(Yo)e:{switch(n){case"compositionstart":var _n="onCompositionStart";break e;case"compositionend":_n="onCompositionEnd";break e;case"compositionupdate":_n="onCompositionUpdate";break e}_n=void 0}else Zo?pf(n,c)&&(_n="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(_n="onCompositionStart");_n&&(fd&&c.locale!=="ko"&&(Zo||_n!=="onCompositionStart"?_n==="onCompositionEnd"&&Zo&&(nn=ku()):(Va=we,rf="value"in Va?Va.value:Va.textContent,Zo=!0)),bt=Jg(pe,_n),0<bt.length&&(_n=new uf(_n,n,null,c,we),Ie.push({event:_n,listeners:bt}),nn?_n.data=nn:(nn=hd(c),nn!==null&&(_n.data=nn)))),(nn=df?qm(n,c):dd(n,c))&&(_n=Jg(pe,"onBeforeInput"),0<_n.length&&(bt=new uf("onBeforeInput","beforeinput",null,c,we),Ie.push({event:bt,listeners:_n}),bt.data=nn)),ii(Ie,n,pe,c,we)}QS(Ie,a)})}function yp(n,a,c){return{instance:n,listener:a,currentTarget:c}}function Jg(n,a){for(var c=a+"Capture",d=[];n!==null;){var y=n,S=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||S===null||(y=Dl(n,c),y!=null&&d.unshift(yp(n,y,S)),y=Dl(n,a),y!=null&&d.push(yp(n,y,S))),n.tag===3)return d;n=n.return}return[]}function qT(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function KS(n,a,c,d,y){for(var S=a._reactName,N=[];c!==null&&c!==d;){var k=c,Q=k.alternate,pe=k.stateNode;if(k=k.tag,Q!==null&&Q===d)break;k!==5&&k!==26&&k!==27||pe===null||(Q=pe,y?(pe=Dl(c,S),pe!=null&&N.unshift(yp(c,pe,Q))):y||(pe=Dl(c,S),pe!=null&&N.push(yp(c,pe,Q)))),c=c.return}N.length!==0&&n.push({event:a,listeners:N})}var YT=/\r\n?/g,ZT=/\u0000|\uFFFD/g;function $S(n){return(typeof n=="string"?n:""+n).replace(YT,`
|
|
`).replace(ZT,"")}function eb(n,a){return a=$S(a),$S(n)===a}function Vn(n,a,c,d,y,S){switch(c){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||yi(n,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&yi(n,""+d);break;case"className":At(n,"class",d);break;case"tabIndex":At(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":At(n,c,d);break;case"style":Go(n,d,S);break;case"data":if(a!=="object"){At(n,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||c!=="href")){n.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(c);break}d=Vu(""+d),n.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){n.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"&&Vn(n,a,"name",y.name,y,null),Vn(n,a,"formEncType",y.formEncType,y,null),Vn(n,a,"formMethod",y.formMethod,y,null),Vn(n,a,"formTarget",y.formTarget,y,null)):(Vn(n,a,"encType",y.encType,y,null),Vn(n,a,"method",y.method,y,null),Vn(n,a,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(c);break}d=Vu(""+d),n.setAttribute(c,d);break;case"onClick":d!=null&&(n.onclick=Mr);break;case"onScroll":d!=null&&mn("scroll",n);break;case"onScrollEnd":d!=null&&mn("scrollend",n);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.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"){n.removeAttribute("xlink:href");break}c=Vu(""+d),n.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"?n.setAttribute(c,""+d):n.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"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":d===!0?n.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(c,d):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(c,d):n.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(c):n.setAttribute(c,d);break;case"popover":mn("beforetoggle",n),mn("toggle",n),vt(n,"popover",d);break;case"xlinkActuate":_t(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":_t(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":_t(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":_t(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":_t(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":_t(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":_t(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":_t(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":_t(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":vt(n,"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=Rm.get(c)||c,vt(n,c,d))}}function a_(n,a,c,d,y,S){switch(c){case"style":Go(n,d,S);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"children":typeof d=="string"?yi(n,d):(typeof d=="number"||typeof d=="bigint")&&yi(n,""+d);break;case"onScroll":d!=null&&mn("scroll",n);break;case"onScrollEnd":d!=null&&mn("scrollend",n);break;case"onClick":d!=null&&(n.onclick=Mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ye.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=n[Ti]||null,S=S!=null?S[c]:null,typeof S=="function"&&n.removeEventListener(a,S,y),typeof d=="function")){typeof S!="function"&&S!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(a,d,y);break e}c in n?n[c]=d:d===!0?n.setAttribute(c,""):vt(n,c,d)}}}function ma(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":mn("error",n),mn("load",n);var d=!1,y=!1,S;for(S in c)if(c.hasOwnProperty(S)){var N=c[S];if(N!=null)switch(S){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Vn(n,a,S,N,c,null)}}y&&Vn(n,a,"srcSet",c.srcSet,c,null),d&&Vn(n,a,"src",c.src,c,null);return;case"input":mn("invalid",n);var k=S=N=y=null,Q=null,pe=null;for(d in c)if(c.hasOwnProperty(d)){var we=c[d];if(we!=null)switch(d){case"name":y=we;break;case"type":N=we;break;case"checked":Q=we;break;case"defaultChecked":pe=we;break;case"value":S=we;break;case"defaultValue":k=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(i(137,a));break;default:Vn(n,a,d,we,c,null)}}Ds(n,S,k,Q,pe,N,y,!1);return;case"select":mn("invalid",n),d=N=S=null;for(y in c)if(c.hasOwnProperty(y)&&(k=c[y],k!=null))switch(y){case"value":S=k;break;case"defaultValue":N=k;break;case"multiple":d=k;default:Vn(n,a,y,k,c,null)}a=S,c=N,n.multiple=!!d,a!=null?sa(n,!!d,a,!1):c!=null&&sa(n,!!d,c,!0);return;case"textarea":mn("invalid",n),S=y=d=null;for(N in c)if(c.hasOwnProperty(N)&&(k=c[N],k!=null))switch(N){case"value":d=k;break;case"defaultValue":y=k;break;case"children":S=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(i(91));break;default:Vn(n,a,N,k,c,null)}Ai(n,d,y,S);return;case"option":for(Q in c)c.hasOwnProperty(Q)&&(d=c[Q],d!=null)&&(Q==="selected"?n.selected=d&&typeof d!="function"&&typeof d!="symbol":Vn(n,a,Q,d,c,null));return;case"dialog":mn("beforetoggle",n),mn("toggle",n),mn("cancel",n),mn("close",n);break;case"iframe":case"object":mn("load",n);break;case"video":case"audio":for(d=0;d<Ss.length;d++)mn(Ss[d],n);break;case"image":mn("error",n),mn("load",n);break;case"details":mn("toggle",n);break;case"embed":case"source":case"link":mn("error",n),mn("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(pe in c)if(c.hasOwnProperty(pe)&&(d=c[pe],d!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Vn(n,a,pe,d,c,null)}return;default:if(is(a)){for(we in c)c.hasOwnProperty(we)&&(d=c[we],d!==void 0&&a_(n,a,we,d,c,void 0));return}}for(k in c)c.hasOwnProperty(k)&&(d=c[k],d!=null&&Vn(n,a,k,d,c,null))}function jT(n,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,N=null,k=null,Q=null,pe=null,we=null;for(Me in c){var Ie=c[Me];if(c.hasOwnProperty(Me)&&Ie!=null)switch(Me){case"checked":break;case"value":break;case"defaultValue":Q=Ie;default:d.hasOwnProperty(Me)||Vn(n,a,Me,null,d,Ie)}}for(var ve in d){var Me=d[ve];if(Ie=c[ve],d.hasOwnProperty(ve)&&(Me!=null||Ie!=null))switch(ve){case"type":S=Me;break;case"name":y=Me;break;case"checked":pe=Me;break;case"defaultChecked":we=Me;break;case"value":N=Me;break;case"defaultValue":k=Me;break;case"children":case"dangerouslySetInnerHTML":if(Me!=null)throw Error(i(137,a));break;default:Me!==Ie&&Vn(n,a,ve,Me,d,Ie)}}vi(n,N,k,Q,pe,we,S,y);return;case"select":Me=N=k=ve=null;for(S in c)if(Q=c[S],c.hasOwnProperty(S)&&Q!=null)switch(S){case"value":break;case"multiple":Me=Q;default:d.hasOwnProperty(S)||Vn(n,a,S,null,d,Q)}for(y in d)if(S=d[y],Q=c[y],d.hasOwnProperty(y)&&(S!=null||Q!=null))switch(y){case"value":ve=S;break;case"defaultValue":k=S;break;case"multiple":N=S;default:S!==Q&&Vn(n,a,y,S,d,Q)}a=k,c=N,d=Me,ve!=null?sa(n,!!c,ve,!1):!!d!=!!c&&(a!=null?sa(n,!!c,a,!0):sa(n,!!c,c?[]:"",!1));return;case"textarea":Me=ve=null;for(k in c)if(y=c[k],c.hasOwnProperty(k)&&y!=null&&!d.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Vn(n,a,k,null,d,y)}for(N in d)if(y=d[N],S=c[N],d.hasOwnProperty(N)&&(y!=null||S!=null))switch(N){case"value":ve=y;break;case"defaultValue":Me=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==S&&Vn(n,a,N,y,d,S)}En(n,ve,Me);return;case"option":for(var xt in c)ve=c[xt],c.hasOwnProperty(xt)&&ve!=null&&!d.hasOwnProperty(xt)&&(xt==="selected"?n.selected=!1:Vn(n,a,xt,null,d,ve));for(Q in d)ve=d[Q],Me=c[Q],d.hasOwnProperty(Q)&&ve!==Me&&(ve!=null||Me!=null)&&(Q==="selected"?n.selected=ve&&typeof ve!="function"&&typeof ve!="symbol":Vn(n,a,Q,ve,d,Me));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 zt in c)ve=c[zt],c.hasOwnProperty(zt)&&ve!=null&&!d.hasOwnProperty(zt)&&Vn(n,a,zt,null,d,ve);for(pe in d)if(ve=d[pe],Me=c[pe],d.hasOwnProperty(pe)&&ve!==Me&&(ve!=null||Me!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(i(137,a));break;default:Vn(n,a,pe,ve,d,Me)}return;default:if(is(a)){for(var kn in c)ve=c[kn],c.hasOwnProperty(kn)&&ve!==void 0&&!d.hasOwnProperty(kn)&&a_(n,a,kn,void 0,d,ve);for(we in d)ve=d[we],Me=c[we],!d.hasOwnProperty(we)||ve===Me||ve===void 0&&Me===void 0||a_(n,a,we,ve,d,Me);return}}for(var re in c)ve=c[re],c.hasOwnProperty(re)&&ve!=null&&!d.hasOwnProperty(re)&&Vn(n,a,re,null,d,ve);for(Ie in d)ve=d[Ie],Me=c[Ie],!d.hasOwnProperty(Ie)||ve===Me||ve==null&&Me==null||Vn(n,a,Ie,ve,d,Me)}function tb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function QT(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var y=c[d],S=y.transferSize,N=y.initiatorType,k=y.duration;if(S&&k&&tb(N)){for(N=0,k=y.responseEnd,d+=1;d<c.length;d++){var Q=c[d],pe=Q.startTime;if(pe>k)break;var we=Q.transferSize,Ie=Q.initiatorType;we&&tb(Ie)&&(Q=Q.responseEnd,N+=we*(Q<k?1:(k-pe)/(Q-pe)))}if(--d,a+=8*(S+N)/(y.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var s_=null,r_=null;function Kg(n){return n.nodeType===9?n:n.ownerDocument}function nb(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ib(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function o_(n,a){return n==="textarea"||n==="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 l_=null;function JT(){var n=window.event;return n&&n.type==="popstate"?n===l_?!1:(l_=n,!0):(l_=null,!1)}var ab=typeof setTimeout=="function"?setTimeout:void 0,KT=typeof clearTimeout=="function"?clearTimeout:void 0,sb=typeof Promise=="function"?Promise:void 0,$T=typeof queueMicrotask=="function"?queueMicrotask:typeof sb<"u"?function(n){return sb.resolve(null).then(n).catch(eA)}:ab;function eA(n){setTimeout(function(){throw n})}function du(n){return n==="head"}function rb(n,a){var c=a,d=0;do{var y=c.nextSibling;if(n.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"||c==="/&"){if(d===0){n.removeChild(y),lh(a);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")_p(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,_p(c);for(var S=c.firstChild;S;){var N=S.nextSibling,k=S.nodeName;S[Rs]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&S.rel.toLowerCase()==="stylesheet"||c.removeChild(S),S=N}}else c==="body"&&_p(n.ownerDocument.body);c=y}while(c);lh(a)}function ob(n,a){var c=n;n=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(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=d}while(c)}function u_(n){var a=n.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":u_(c),xr(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function tA(n,a,c,d){for(;n.nodeType===1;){var y=c;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[Rs])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(S=n.getAttribute("rel"),S==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(S!==y.rel||n.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||n.getAttribute("title")!==(y.title==null?null:y.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(S=n.getAttribute("src"),(S!==(y.src==null?null:y.src)||n.getAttribute("type")!==(y.type==null?null:y.type)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&S&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var S=y.name==null?null:""+y.name;if(y.type==="hidden"&&n.getAttribute("name")===S)return n}else return n;if(n=hr(n.nextSibling),n===null)break}return null}function nA(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=hr(n.nextSibling),n===null))return null;return n}function lb(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=hr(n.nextSibling),n===null))return null;return n}function c_(n){return n.data==="$?"||n.data==="$~"}function f_(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function iA(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var d=function(){a(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function hr(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var h_=null;function ub(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return hr(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function cb(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return n;a--}else c!=="/$"&&c!=="/&"||a++}n=n.previousSibling}return null}function fb(n,a,c){switch(a=Kg(c),n){case"html":if(n=a.documentElement,!n)throw Error(i(452));return n;case"head":if(n=a.head,!n)throw Error(i(453));return n;case"body":if(n=a.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function _p(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);xr(n)}var dr=new Map,hb=new Set;function $g(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var yl=K.d;K.d={f:aA,r:sA,D:rA,C:oA,L:lA,m:uA,X:fA,S:cA,M:hA};function aA(){var n=yl.f(),a=Os();return n||a}function sA(n){var a=br(n);a!==null&&a.tag===5&&a.type==="form"?Og(a):yl.r(n)}var sh=typeof document>"u"?null:document;function db(n,a,c){var d=sh;if(d&&typeof a=="string"&&a){var y=Ot(a);y='link[rel="'+n+'"][href="'+y+'"]',typeof c=="string"&&(y+='[crossorigin="'+c+'"]'),hb.has(y)||(hb.add(y),n={rel:n,crossOrigin:c,href:a},d.querySelector(y)===null&&(a=d.createElement("link"),ma(a,"link",n),V(a),d.head.appendChild(a)))}}function rA(n){yl.D(n),db("dns-prefetch",n,null)}function oA(n,a){yl.C(n,a),db("preconnect",n,a)}function lA(n,a,c){yl.L(n,a,c);var d=sh;if(d&&n&&a){var y='link[rel="preload"][as="'+Ot(a)+'"]';a==="image"&&c&&c.imageSrcSet?(y+='[imagesrcset="'+Ot(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(y+='[imagesizes="'+Ot(c.imageSizes)+'"]')):y+='[href="'+Ot(n)+'"]';var S=y;switch(a){case"style":S=rh(n);break;case"script":S=oh(n)}dr.has(S)||(n=x({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),dr.set(S,n),d.querySelector(y)!==null||a==="style"&&d.querySelector(xp(S))||a==="script"&&d.querySelector(Sp(S))||(a=d.createElement("link"),ma(a,"link",n),V(a),d.head.appendChild(a)))}}function uA(n,a){yl.m(n,a);var c=sh;if(c&&n){var d=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Ot(d)+'"][href="'+Ot(n)+'"]',S=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=oh(n)}if(!dr.has(S)&&(n=x({rel:"modulepreload",href:n},a),dr.set(S,n),c.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Sp(S)))return}d=c.createElement("link"),ma(d,"link",n),V(d),c.head.appendChild(d)}}}function cA(n,a,c){yl.S(n,a,c);var d=sh;if(d&&n){var y=Gs(d).hoistableStyles,S=rh(n);a=a||"default";var N=y.get(S);if(!N){var k={loading:0,preload:null};if(N=d.querySelector(xp(S)))k.loading=5;else{n=x({rel:"stylesheet",href:n,"data-precedence":a},c),(c=dr.get(S))&&d_(n,c);var Q=N=d.createElement("link");V(Q),ma(Q,"link",n),Q._p=new Promise(function(pe,we){Q.onload=pe,Q.onerror=we}),Q.addEventListener("load",function(){k.loading|=1}),Q.addEventListener("error",function(){k.loading|=2}),k.loading|=4,e0(N,a,d)}N={type:"stylesheet",instance:N,count:1,state:k},y.set(S,N)}}}function fA(n,a){yl.X(n,a);var c=sh;if(c&&n){var d=Gs(c).hoistableScripts,y=oh(n),S=d.get(y);S||(S=c.querySelector(Sp(y)),S||(n=x({src:n,async:!0},a),(a=dr.get(y))&&p_(n,a),S=c.createElement("script"),V(S),ma(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},d.set(y,S))}}function hA(n,a){yl.M(n,a);var c=sh;if(c&&n){var d=Gs(c).hoistableScripts,y=oh(n),S=d.get(y);S||(S=c.querySelector(Sp(y)),S||(n=x({src:n,async:!0,type:"module"},a),(a=dr.get(y))&&p_(n,a),S=c.createElement("script"),V(S),ma(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},d.set(y,S))}}function pb(n,a,c,d){var y=(y=fe.current)?$g(y):null;if(!y)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=rh(c.href),c=Gs(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"){n=rh(c.href);var S=Gs(y).hoistableStyles,N=S.get(n);if(N||(y=y.ownerDocument||y,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(n,N),(S=y.querySelector(xp(n)))&&!S._p&&(N.instance=S,N.state.loading=5),dr.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},dr.set(n,c),S||dA(y,n,c,N.state))),a&&d===null)throw Error(i(528,""));return N}if(a&&d!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=oh(c),c=Gs(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(i(444,n))}}function rh(n){return'href="'+Ot(n)+'"'}function xp(n){return'link[rel="stylesheet"]['+n+"]"}function mb(n){return x({},n,{"data-precedence":n.precedence,precedence:null})}function dA(n,a,c,d){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=n.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),ma(a,"link",c),V(a),n.head.appendChild(a))}function oh(n){return'[src="'+Ot(n)+'"]'}function Sp(n){return"script[async]"+n}function gb(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var d=n.querySelector('style[data-href~="'+Ot(c.href)+'"]');if(d)return a.instance=d,V(d),d;var y=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),V(d),ma(d,"style",y),e0(d,c.precedence,n),a.instance=d;case"stylesheet":y=rh(c.href);var S=n.querySelector(xp(y));if(S)return a.state.loading|=4,a.instance=S,V(S),S;d=mb(c),(y=dr.get(y))&&d_(d,y),S=(n.ownerDocument||n).createElement("link"),V(S);var N=S;return N._p=new Promise(function(k,Q){N.onload=k,N.onerror=Q}),ma(S,"link",d),a.state.loading|=4,e0(S,c.precedence,n),a.instance=S;case"script":return S=oh(c.src),(y=n.querySelector(Sp(S)))?(a.instance=y,V(y),y):(d=c,(y=dr.get(S))&&(d=x({},c),p_(d,y)),n=n.ownerDocument||n,y=n.createElement("script"),V(y),ma(y,"link",d),n.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,e0(d,c.precedence,n));return a.instance}function e0(n,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,N=0;N<d.length;N++){var k=d[N];if(k.dataset.precedence===a)S=k;else if(S!==y)break}S?S.parentNode.insertBefore(n,S.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(n,a.firstChild))}function d_(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function p_(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var t0=null;function vb(n,a,c){if(t0===null){var d=new Map,y=t0=new Map;y.set(c,d)}else y=t0,d=y.get(c),d||(d=new Map,y.set(c,d));if(d.has(n))return d;for(d.set(n,null),c=c.getElementsByTagName(n),y=0;y<c.length;y++){var S=c[y];if(!(S[Rs]||S[Qn]||n==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var N=S.getAttribute(a)||"";N=n+N;var k=d.get(N);k?k.push(S):d.set(N,[S])}}return d}function yb(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function pA(n,a,c){if(c===1||a.itemProp!=null)return!1;switch(n){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"?(n=a.disabled,typeof a.precedence=="string"&&n==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 _b(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function mA(n,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=rh(d.href),S=a.querySelector(xp(y));if(S){a=S._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=n0.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=S,V(S);return}S=a.ownerDocument||a,d=mb(d),(y=dr.get(y))&&d_(d,y),S=S.createElement("link"),V(S);var N=S;N._p=new Promise(function(k,Q){N.onload=k,N.onerror=Q}),ma(S,"link",d),c.instance=S}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=n0.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var m_=0;function gA(n,a){return n.stylesheets&&n.count===0&&a0(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var d=setTimeout(function(){if(n.stylesheets&&a0(n,n.stylesheets),n.unsuspend){var S=n.unsuspend;n.unsuspend=null,S()}},6e4+a);0<n.imgBytes&&m_===0&&(m_=62500*QT());var y=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&a0(n,n.stylesheets),n.unsuspend)){var S=n.unsuspend;n.unsuspend=null,S()}},(n.imgBytes>m_?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function n0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)a0(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var i0=null;function a0(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,i0=new Map,a.forEach(vA,n),i0=null,n0.call(n))}function vA(n,a){if(!(a.state.loading&4)){var c=i0.get(n);if(c)var d=c.get(null);else{c=new Map,i0.set(n,c);for(var y=n.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<y.length;S++){var N=y[S];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(c.set(N.dataset.precedence,N),d=N)}d&&c.set(null,d)}y=a.instance,N=y.getAttribute("data-precedence"),S=c.get(N)||d,S===d&&c.set(null,y),c.set(N,y),this.count++,d=n0.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),S?S.parentNode.insertBefore(y,S.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(y,n.firstChild)),a.state.loading|=4}}var bp={$$typeof:U,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function yA(n,a,c,d,y,S,N,k,Q){this.tag=1,this.containerInfo=n,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=gn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gn(0),this.hiddenUpdates=gn(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=S,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function xb(n,a,c,d,y,S,N,k,Q,pe,we,Ie){return n=new yA(n,a,c,N,Q,pe,we,Ie,k),a=1,S===!0&&(a|=24),S=Jn(3,null,null,a),n.current=S,S.stateNode=n,a=Ad(),a.refCount++,n.pooledCache=a,a.refCount++,S.memoizedState={element:d,isDehydrated:c,cache:a},rc(S),n}function Sb(n){return n?(n=io,n):io}function bb(n,a,c,d,y,S){y=Sb(y),d.context===null?d.context=y:d.pendingContext=y,d=Nr(a),d.payload={element:c},S=S===void 0?null:S,S!==null&&(d.callback=S),c=fo(n,d,a),c!==null&&(en(c,n,a),ho(c,n,a))}function Mb(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function g_(n,a){Mb(n,a),(n=n.alternate)&&Mb(n,a)}function Eb(n){if(n.tag===13||n.tag===31){var a=la(n,67108864);a!==null&&en(a,n,67108864),g_(n,67108864)}}function Tb(n){if(n.tag===13||n.tag===31){var a=ja();a=Qr(a);var c=la(n,a);c!==null&&en(c,n,a),g_(n,a)}}var s0=!0;function _A(n,a,c,d){var y=q.T;q.T=null;var S=K.p;try{K.p=2,v_(n,a,c,d)}finally{K.p=S,q.T=y}}function xA(n,a,c,d){var y=q.T;q.T=null;var S=K.p;try{K.p=8,v_(n,a,c,d)}finally{K.p=S,q.T=y}}function v_(n,a,c,d){if(s0){var y=y_(d);if(y===null)i_(n,a,d,r0,c),wb(n,d);else if(bA(y,n,a,c,d))d.stopPropagation();else if(wb(n,d),a&4&&-1<SA.indexOf(n)){for(;y!==null;){var S=br(y);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var N=Fe(S.pendingLanes);if(N!==0){var k=S;for(k.pendingLanes|=2,k.entangledLanes|=2;N;){var Q=1<<31-lt(N);k.entanglements[1]|=Q,N&=~Q}ke(S),(Et&6)===0&&(hi=O()+500,dt(0))}}break;case 31:case 13:k=la(S,2),k!==null&&en(k,S,2),Os(),g_(S,2)}if(S=y_(d),S===null&&i_(n,a,d,r0,c),S===y)break;y=S}y!==null&&d.stopPropagation()}else i_(n,a,d,null,c)}}function y_(n){return n=af(n),__(n)}var r0=null;function __(n){if(r0=null,n=Sr(n),n!==null){var a=u(n);if(a===null)n=null;else{var c=a.tag;if(c===13){if(n=f(a),n!==null)return n;n=null}else if(c===31){if(n=h(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return r0=n,null}function Ab(n){switch(n){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(ne()){case Se:return 2;case Le:return 8;case be:case ct:return 32;case Ze:return 268435456;default:return 32}default:return 32}}var x_=!1,pu=null,mu=null,gu=null,Mp=new Map,Ep=new Map,vu=[],SA="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 wb(n,a){switch(n){case"focusin":case"focusout":pu=null;break;case"dragenter":case"dragleave":mu=null;break;case"mouseover":case"mouseout":gu=null;break;case"pointerover":case"pointerout":Mp.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ep.delete(a.pointerId)}}function Tp(n,a,c,d,y,S){return n===null||n.nativeEvent!==S?(n={blockedOn:a,domEventName:c,eventSystemFlags:d,nativeEvent:S,targetContainers:[y]},a!==null&&(a=br(a),a!==null&&Eb(a)),n):(n.eventSystemFlags|=d,a=n.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),n)}function bA(n,a,c,d,y){switch(a){case"focusin":return pu=Tp(pu,n,a,c,d,y),!0;case"dragenter":return mu=Tp(mu,n,a,c,d,y),!0;case"mouseover":return gu=Tp(gu,n,a,c,d,y),!0;case"pointerover":var S=y.pointerId;return Mp.set(S,Tp(Mp.get(S)||null,n,a,c,d,y)),!0;case"gotpointercapture":return S=y.pointerId,Ep.set(S,Tp(Ep.get(S)||null,n,a,c,d,y)),!0}return!1}function Cb(n){var a=Sr(n.target);if(a!==null){var c=u(a);if(c!==null){if(a=c.tag,a===13){if(a=f(c),a!==null){n.blockedOn=a,Ki(n.priority,function(){Tb(c)});return}}else if(a===31){if(a=h(c),a!==null){n.blockedOn=a,Ki(n.priority,function(){Tb(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function o0(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=y_(n.nativeEvent);if(c===null){c=n.nativeEvent;var d=new c.constructor(c.type,c);nf=d,c.target.dispatchEvent(d),nf=null}else return a=br(c),a!==null&&Eb(a),n.blockedOn=c,!1;a.shift()}return!0}function Rb(n,a,c){o0(n)&&c.delete(a)}function MA(){x_=!1,pu!==null&&o0(pu)&&(pu=null),mu!==null&&o0(mu)&&(mu=null),gu!==null&&o0(gu)&&(gu=null),Mp.forEach(Rb),Ep.forEach(Rb)}function l0(n,a){n.blockedOn===a&&(n.blockedOn=null,x_||(x_=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,MA)))}var u0=null;function Db(n){u0!==n&&(u0=n,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){u0===n&&(u0=null);for(var a=0;a<n.length;a+=3){var c=n[a],d=n[a+1],y=n[a+2];if(typeof d!="function"){if(__(d||c)===null)continue;break}var S=br(c);S!==null&&(n.splice(a,3),a-=3,$d(S,{pending:!0,data:y,method:c.method,action:d},d,y))}}))}function lh(n){function a(Q){return l0(Q,n)}pu!==null&&l0(pu,n),mu!==null&&l0(mu,n),gu!==null&&l0(gu,n),Mp.forEach(a),Ep.forEach(a);for(var c=0;c<vu.length;c++){var d=vu[c];d.blockedOn===n&&(d.blockedOn=null)}for(;0<vu.length&&(c=vu[0],c.blockedOn===null);)Cb(c),c.blockedOn===null&&vu.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var y=c[d],S=c[d+1],N=y[Ti]||null;if(typeof S=="function")N||Db(c);else if(N){var k=null;if(S&&S.hasAttribute("formAction")){if(y=S,N=S[Ti]||null)k=N.formAction;else if(__(y)!==null)continue}else k=N.action;typeof k=="function"?c[d+1]=k:(c.splice(d,3),d-=3),Db(c)}}}function Nb(){function n(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(N){return y=N})},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",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function S_(n){this._internalRoot=n}c0.prototype.render=S_.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,d=ja();bb(c,d,n,a,null,null)},c0.prototype.unmount=S_.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;bb(n.current,2,null,n,null,null),Os(),a[Pa]=null}};function c0(n){this._internalRoot=n}c0.prototype.unstable_scheduleHydration=function(n){if(n){var a=ko();n={blockedOn:null,target:n,priority:a};for(var c=0;c<vu.length&&a!==0&&a<vu[c].priority;c++);vu.splice(c,0,n),c===0&&Cb(n)}};var Ub=e.version;if(Ub!=="19.2.3")throw Error(i(527,Ub,"19.2.3"));K.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=g(a),n=n!==null?_(n):null,n=n===null?null:n.stateNode,n};var EA={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var f0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!f0.isDisabled&&f0.supportsFiber)try{Be=f0.inject(EA),Xe=f0}catch{}}return wp.createRoot=function(n,a){if(!s(n))throw Error(i(299));var c=!1,d="",y=Hg,S=sp,N=rp;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&&(N=a.onRecoverableError)),a=xb(n,1,!1,null,null,c,d,null,y,S,N,Nb),n[Pa]=a.current,n_(n),new S_(a)},wp.hydrateRoot=function(n,a,c){if(!s(n))throw Error(i(299));var d=!1,y="",S=Hg,N=sp,k=rp,Q=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&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(k=c.onRecoverableError),c.formState!==void 0&&(Q=c.formState)),a=xb(n,1,!0,a,c??null,d,y,Q,S,N,k,Nb),a.context=Sb(null),c=a.current,d=ja(),d=Qr(d),y=Nr(d),y.callback=null,fo(c,y,d),c=d,a.current.lanes=c,Xi(a,c),ke(a),n[Pa]=a.current,n_(n),new c0(a)},wp.version="19.2.3",wp}var Hb;function LA(){if(Hb)return E_.exports;Hb=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),E_.exports=UA(),E_.exports}var LO=LA();const ay="182",IA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},OA={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},P1=0,Cx=1,B1=2,zA=3,F1=0,zh=1,Xp=2,kc=3,Cl=0,ts=1,No=2,Io=0,Wc=1,Rx=2,Dx=3,Nx=4,V1=5,wu=100,k1=101,H1=102,G1=103,X1=104,W1=200,q1=201,Y1=202,Z1=203,lv=204,uv=205,j1=206,Q1=207,J1=208,K1=209,$1=210,eE=211,tE=212,nE=213,iE=214,cv=0,fv=1,hv=2,Zc=3,dv=4,pv=5,mv=6,gv=7,_m=0,aE=1,sE=2,mr=0,eS=1,tS=2,nS=3,sy=4,iS=5,aS=6,sS=7,Ux="attached",rE="detached",ry=300,Oo=301,Uu=302,em=303,tm=304,jh=306,nm=1e3,As=1001,im=1002,Li=1003,rS=1004,PA=1004,Lh=1005,BA=1005,ai=1006,Wp=1007,FA=1007,Uo=1008,VA=1008,Ka=1009,oS=1010,lS=1011,Bh=1012,oy=1013,gr=1014,es=1015,zo=1016,ly=1017,uy=1018,Fh=1020,uS=35902,cS=35899,fS=1021,hS=1022,La=1023,Po=1026,Ru=1027,cy=1028,xm=1029,jc=1030,fy=1031,kA=1032,hy=1033,qp=33776,Yp=33777,Zp=33778,jp=33779,vv=35840,yv=35841,_v=35842,xv=35843,Sv=36196,bv=37492,Mv=37496,Ev=37488,Tv=37489,Av=37490,wv=37491,Cv=37808,Rv=37809,Dv=37810,Nv=37811,Uv=37812,Lv=37813,Iv=37814,Ov=37815,zv=37816,Pv=37817,Bv=37818,Fv=37819,Vv=37820,kv=37821,Hv=36492,Gv=36494,Xv=36495,Wv=36283,qv=36284,Yv=36285,Zv=36286,oE=2200,lE=2201,uE=2202,am=2300,jv=2301,av=2302,Hc=2400,Gc=2401,sm=2402,dy=2500,dS=2501,HA=0,GA=1,XA=2,cE=3200,WA=3201,qA=3202,YA=3203,zu=0,fE=1,Tl="",Ua="srgb",Lu="srgb-linear",rm="linear",On="srgb",ZA="",jA="rg",QA="ga",JA=0,Fc=7680,KA=7681,$A=7682,ew=7683,tw=34055,nw=34056,iw=5386,aw=512,sw=513,rw=514,ow=515,lw=516,uw=517,cw=518,Lx=519,hE=512,dE=513,pE=514,py=515,mE=516,gE=517,my=518,vE=519,om=35044,fw=35048,hw=35040,dw=35045,pw=35049,mw=35041,gw=35046,vw=35050,yw=35042,_w="100",Ix="300 es",Fs=2e3,Vh=2001,xw={COMPUTE:"compute",RENDER:"render"},Sw={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},bw={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function yE(o){for(let e=o.length-1;e>=0;--e)if(o[e]>=65535)return!0;return!1}const Mw={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ih(o,e){return new Mw[o](e)}function _E(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}function lm(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}function xE(){const o=lm("canvas");return o.style.display="block",o}const Gb={};let Iu=null;function Ew(o){Iu=o}function Tw(){return Iu}function um(...o){const e="THREE."+o.shift();Iu?Iu("log",e,...o):console.log(e,...o)}function rt(...o){const e="THREE."+o.shift();Iu?Iu("warn",e,...o):console.warn(e,...o)}function Tt(...o){const e="THREE."+o.shift();Iu?Iu("error",e,...o):console.error(e,...o)}function kh(...o){const e=o.join(" ");e in Gb||(Gb[e]=!0,rt(...o))}function Aw(o,e,t){return new Promise(function(i,s){function u(){switch(o.clientWaitSync(e,o.SYNC_FLUSH_COMMANDS_BIT,0)){case o.WAIT_FAILED:s();break;case o.TIMEOUT_EXPIRED:setTimeout(u,t);break;default:i()}}setTimeout(u,t)})}class Bo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const s=i[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 i=t[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let u=0,f=s.length;u<f;u++)s[u].call(this,e);e.target=null}}}const Ra=["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 Xb=1234567;const qc=Math.PI/180,Hh=180/Math.PI;function Vs(){const o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ra[o&255]+Ra[o>>8&255]+Ra[o>>16&255]+Ra[o>>24&255]+"-"+Ra[e&255]+Ra[e>>8&255]+"-"+Ra[e>>16&15|64]+Ra[e>>24&255]+"-"+Ra[t&63|128]+Ra[t>>8&255]+"-"+Ra[t>>16&255]+Ra[t>>24&255]+Ra[i&255]+Ra[i>>8&255]+Ra[i>>16&255]+Ra[i>>24&255]).toLowerCase()}function Ft(o,e,t){return Math.max(e,Math.min(t,o))}function pS(o,e){return(o%e+e)%e}function ww(o,e,t,i,s){return i+(o-e)*(s-i)/(t-e)}function Cw(o,e,t){return o!==e?(t-o)/(e-o):0}function Qp(o,e,t){return(1-t)*o+t*e}function Rw(o,e,t,i){return Qp(o,e,1-Math.exp(-t*i))}function Dw(o,e=1){return e-Math.abs(pS(o,e*2)-e)}function Nw(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*(3-2*o))}function Uw(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*o*(o*(o*6-15)+10))}function Lw(o,e){return o+Math.floor(Math.random()*(e-o+1))}function Iw(o,e){return o+Math.random()*(e-o)}function Ow(o){return o*(.5-Math.random())}function zw(o){o!==void 0&&(Xb=o);let e=Xb+=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 Pw(o){return o*qc}function Bw(o){return o*Hh}function Fw(o){return(o&o-1)===0&&o!==0}function Vw(o){return Math.pow(2,Math.ceil(Math.log(o)/Math.LN2))}function kw(o){return Math.pow(2,Math.floor(Math.log(o)/Math.LN2))}function Hw(o,e,t,i,s){const u=Math.cos,f=Math.sin,h=u(t/2),m=f(t/2),g=u((e+i)/2),_=f((e+i)/2),x=u((e-i)/2),b=f((e-i)/2),M=u((i-e)/2),A=f((i-e)/2);switch(s){case"XYX":o.set(h*_,m*x,m*b,h*g);break;case"YZY":o.set(m*b,h*_,m*x,h*g);break;case"ZXZ":o.set(m*x,m*b,h*_,h*g);break;case"XZX":o.set(h*_,m*A,m*M,h*g);break;case"YXY":o.set(m*M,h*_,m*A,h*g);break;case"ZYZ":o.set(m*A,m*M,h*_,h*g);break;default:rt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function $a(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return o/4294967295;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int32Array:return Math.max(o/2147483647,-1);case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("Invalid component type.")}}function tn(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return Math.round(o*4294967295);case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int32Array:return Math.round(o*2147483647);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("Invalid component type.")}}const SE={DEG2RAD:qc,RAD2DEG:Hh,generateUUID:Vs,clamp:Ft,euclideanModulo:pS,mapLinear:ww,inverseLerp:Cw,lerp:Qp,damp:Rw,pingpong:Dw,smoothstep:Nw,smootherstep:Uw,randInt:Lw,randFloat:Iw,randFloatSpread:Ow,seededRandom:zw,degToRad:Pw,radToDeg:Bw,isPowerOfTwo:Fw,ceilPowerOfTwo:Vw,floorPowerOfTwo:kw,setQuaternionFromProperEuler:Hw,normalize:tn,denormalize:$a};class Pe{constructor(e=0,t=0){Pe.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,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+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=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ft(i,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 i=this.dot(e)/t;return Math.acos(Ft(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),s=Math.sin(t),u=this.x-e.x,f=this.y-e.y;return this.x=u*i-f*s+e.x,this.y=u*s+f*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ws{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,u,f,h){let m=i[s+0],g=i[s+1],_=i[s+2],x=i[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 C=m*b+g*M+_*A+x*R;C<0&&(b=-b,M=-M,A=-A,R=-R,C=-C);let E=1-h;if(C<.9995){const D=Math.acos(C),U=Math.sin(D);E=Math.sin(E*D)/U,h=Math.sin(h*D)/U,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 D=1/Math.sqrt(m*m+g*g+_*_+x*x);m*=D,g*=D,_*=D,x*=D}}e[t]=m,e[t+1]=g,e[t+2]=_,e[t+3]=x}static multiplyQuaternionsFlat(e,t,i,s,u,f){const h=i[s],m=i[s+1],g=i[s+2],_=i[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,i,s){return this._x=e,this._y=t,this._z=i,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 i=e._x,s=e._y,u=e._z,f=e._order,h=Math.cos,m=Math.sin,g=h(i/2),_=h(s/2),x=h(u/2),b=m(i/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:rt("Quaternion: .setFromEuler() encountered an unknown order: "+f)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=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=i+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(i>h&&i>x){const M=2*Math.sqrt(1+i-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-i-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-i-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 i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ft(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);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 i=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=i*_+f*h+s*g-u*m,this._y=s*_+f*m+u*h-i*g,this._z=u*_+f*g+i*m-s*h,this._w=f*_-i*h-s*m-u*g,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let i=e._x,s=e._y,u=e._z,f=e._w,h=this.dot(e);h<0&&(i=-i,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+i*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+i*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,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),u=Math.sqrt(i);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 Y{constructor(e=0,t=0,i=0){Y.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(Wb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wb.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,u=e.elements;return this.x=u[0]*t+u[3]*i+u[6]*s,this.y=u[1]*t+u[4]*i+u[7]*s,this.z=u[2]*t+u[5]*i+u[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,u=e.elements,f=1/(u[3]*t+u[7]*i+u[11]*s+u[15]);return this.x=(u[0]*t+u[4]*i+u[8]*s+u[12])*f,this.y=(u[1]*t+u[5]*i+u[9]*s+u[13])*f,this.z=(u[2]*t+u[6]*i+u[10]*s+u[14])*f,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,u=e.x,f=e.y,h=e.z,m=e.w,g=2*(f*s-h*i),_=2*(h*t-u*s),x=2*(u*i-f*t);return this.x=t+m*g+f*x-h*_,this.y=i+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,i=this.y,s=this.z,u=e.elements;return this.x=u[0]*t+u[4]*i+u[8]*s,this.y=u[1]*t+u[5]*i+u[9]*s,this.z=u[2]*t+u[6]*i+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=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this.z=Ft(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this.z=Ft(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ft(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=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-i*m,this.z=i*h-s*f,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return C_.copy(this).projectOnVector(e),this.sub(C_)}reflect(e){return this.sub(C_.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 i=this.dot(e)/t;return Math.acos(Ft(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+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,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,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,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const C_=new Y,Wb=new ws;class Qt{constructor(e,t,i,s,u,f,h,m,g){Qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,u,f,h,m,g)}set(e,t,i,s,u,f,h,m,g){const _=this.elements;return _[0]=e,_[1]=s,_[2]=h,_[3]=t,_[4]=u,_[5]=m,_[6]=i,_[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,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,s=t.elements,u=this.elements,f=i[0],h=i[3],m=i[6],g=i[1],_=i[4],x=i[7],b=i[2],M=i[5],A=i[8],R=s[0],C=s[3],E=s[6],D=s[1],U=s[4],L=s[7],B=s[2],P=s[5],H=s[8];return u[0]=f*R+h*D+m*B,u[3]=f*C+h*U+m*P,u[6]=f*E+h*L+m*H,u[1]=g*R+_*D+x*B,u[4]=g*C+_*U+x*P,u[7]=g*E+_*L+x*H,u[2]=b*R+M*D+A*B,u[5]=b*C+M*U+A*P,u[8]=b*E+M*L+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],i=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-i*u*_+i*h*m+s*u*g-s*f*m}invert(){const e=this.elements,t=e[0],i=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+i*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-_*i)*R,e[2]=(h*i-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]=(i*m-g*t)*R,e[8]=(f*t-i*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,i,s,u,f,h){const m=Math.cos(u),g=Math.sin(u);return this.set(i*m,i*g,-i*(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(R_.makeScale(e,t)),this}rotate(e){return this.premultiply(R_.makeRotation(-e)),this}translate(e,t){return this.premultiply(R_.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const R_=new Qt,qb=new Qt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Yb=new Qt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gw(){const o={enabled:!0,workingColorSpace:Lu,spaces:{},convert:function(s,u,f){return this.enabled===!1||u===f||!u||!f||(this.spaces[u].transfer===On&&(s.r=wl(s.r),s.g=wl(s.g),s.b=wl(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===On&&(s.r=Ph(s.r),s.g=Ph(s.g),s.b=Ph(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===Tl?rm: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 kh("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),o.workingToColorSpace(s,u)},toWorkingColorSpace:function(s,u){return kh("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),o.colorSpaceToWorking(s,u)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return o.define({[Lu]:{primaries:e,whitePoint:i,transfer:rm,toXYZ:qb,fromXYZ:Yb,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ua},outputColorSpaceConfig:{drawingBufferColorSpace:Ua}},[Ua]:{primaries:e,whitePoint:i,transfer:On,toXYZ:qb,fromXYZ:Yb,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ua}}}),o}const xn=Gw();function wl(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Ph(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}let uh;class bE{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{uh===void 0&&(uh=lm("canvas")),uh.width=e.width,uh.height=e.height;const s=uh.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=uh}return i.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=lm("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),u=s.data;for(let f=0;f<u.length;f++)u[f]=wl(u[f]/255)*255;return i.putImageData(s,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(wl(t[i]/255)*255):t[i]=wl(t[i]);return{data:t,width:e.width,height:e.height}}else return rt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Xw=0;class Du{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xw++}),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 i={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(D_(s[f].image)):u.push(D_(s[f]))}else u=D_(s);i.url=u}return t||(e.images[this.uuid]=i),i}}function D_(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?bE.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(rt("Texture: Unable to serialize Texture."),{})}let Ww=0;const N_=new Y;class Ei extends Bo{constructor(e=Ei.DEFAULT_IMAGE,t=Ei.DEFAULT_MAPPING,i=As,s=As,u=ai,f=Uo,h=La,m=Ka,g=Ei.DEFAULT_ANISOTROPY,_=Tl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ww++}),this.uuid=Vs(),this.name="",this.source=new Du(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=u,this.minFilter=f,this.anisotropy=g,this.format=h,this.internalFormat=null,this.type=m,this.offset=new Pe(0,0),this.repeat=new Pe(1,1),this.center=new Pe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qt,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(N_).x}get height(){return this.source.getSize(N_).y}get depth(){return this.source.getSize(N_).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 i=e[t];if(i===void 0){rt(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){rt(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ry)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case nm:e.x=e.x-Math.floor(e.x);break;case As:e.x=e.x<0?0:1;break;case im: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 nm:e.y=e.y-Math.floor(e.y);break;case As:e.y=e.y<0?0:1;break;case im: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++}}Ei.DEFAULT_IMAGE=null;Ei.DEFAULT_MAPPING=ry;Ei.DEFAULT_ANISOTROPY=1;class Wn{constructor(e=0,t=0,i=0,s=1){Wn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,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,i,s){return this.x=e,this.y=t,this.z=i,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,i=this.y,s=this.z,u=this.w,f=e.elements;return this.x=f[0]*t+f[4]*i+f[8]*s+f[12]*u,this.y=f[1]*t+f[5]*i+f[9]*s+f[13]*u,this.z=f[2]*t+f[6]*i+f[10]*s+f[14]*u,this.w=f[3]*t+f[7]*i+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,i,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],C=m[6],E=m[10];if(Math.abs(_-b)<.01&&Math.abs(x-R)<.01&&Math.abs(A-C)<.01){if(Math.abs(_+b)<.1&&Math.abs(x+R)<.1&&Math.abs(A+C)<.1&&Math.abs(g+M+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const U=(g+1)/2,L=(M+1)/2,B=(E+1)/2,P=(_+b)/4,H=(x+R)/4,W=(A+C)/4;return U>L&&U>B?U<.01?(i=0,s=.707106781,u=.707106781):(i=Math.sqrt(U),s=P/i,u=H/i):L>B?L<.01?(i=.707106781,s=0,u=.707106781):(s=Math.sqrt(L),i=P/s,u=W/s):B<.01?(i=.707106781,s=.707106781,u=0):(u=Math.sqrt(B),i=H/u,s=W/u),this.set(i,s,u,t),this}let D=Math.sqrt((C-A)*(C-A)+(x-R)*(x-R)+(b-_)*(b-_));return Math.abs(D)<.001&&(D=1),this.x=(C-A)/D,this.y=(x-R)/D,this.z=(b-_)/D,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=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this.z=Ft(this.z,e.z,t.z),this.w=Ft(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this.z=Ft(this.z,e,t),this.w=Ft(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ft(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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 mS extends Bo{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ai,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Wn(0,0,e,t),this.scissorTest=!1,this.viewport=new Wn(0,0,e,t);const s={width:e,height:t,depth:i.depth},u=new Ei(s);this.textures=[];const f=i.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(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:ai,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 i=0;i<this.textures.length;i++)this.textures[i].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,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;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=i,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,i=e.textures.length;t<i;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 Du(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 ks extends mS{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class gy extends Ei{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Li,this.minFilter=Li,this.wrapR=As,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class qw extends ks{constructor(e=1,t=1,i=1,s={}){super(e,t,s),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new gy(null,e,t,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class vy extends Ei{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=Li,this.minFilter=Li,this.wrapR=As,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yw extends ks{constructor(e=1,t=1,i=1,s={}){super(e,t,s),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new vy(null,e,t,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class Ia{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-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,i=e.length;t<i;t+=3)this.expandByPoint(kr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(kr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=kr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 i=e.geometry;if(i!==void 0){const u=i.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,kr):kr.fromBufferAttribute(u,f),kr.applyMatrix4(e.matrixWorld),this.expandByPoint(kr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),h0.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),h0.copy(i.boundingBox)),h0.applyMatrix4(e.matrixWorld),this.union(h0)}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,kr),kr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Cp),d0.subVectors(this.max,Cp),ch.subVectors(e.a,Cp),fh.subVectors(e.b,Cp),hh.subVectors(e.c,Cp),_u.subVectors(fh,ch),xu.subVectors(hh,fh),Tc.subVectors(ch,hh);let t=[0,-_u.z,_u.y,0,-xu.z,xu.y,0,-Tc.z,Tc.y,_u.z,0,-_u.x,xu.z,0,-xu.x,Tc.z,0,-Tc.x,-_u.y,_u.x,0,-xu.y,xu.x,0,-Tc.y,Tc.x,0];return!U_(t,ch,fh,hh,d0)||(t=[1,0,0,0,1,0,0,0,1],!U_(t,ch,fh,hh,d0))?!1:(p0.crossVectors(_u,xu),t=[p0.x,p0.y,p0.z],U_(t,ch,fh,hh,d0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,kr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(kr).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:(_l[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_l[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_l[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_l[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_l[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_l[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_l[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_l[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_l),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 _l=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],kr=new Y,h0=new Ia,ch=new Y,fh=new Y,hh=new Y,_u=new Y,xu=new Y,Tc=new Y,Cp=new Y,d0=new Y,p0=new Y,Ac=new Y;function U_(o,e,t,i,s){for(let u=0,f=o.length-3;u<=f;u+=3){Ac.fromArray(o,u);const h=s.x*Math.abs(Ac.x)+s.y*Math.abs(Ac.y)+s.z*Math.abs(Ac.z),m=e.dot(Ac),g=t.dot(Ac),_=i.dot(Ac);if(Math.max(-Math.max(m,g,_),Math.min(m,g,_))>h)return!1}return!0}const Zw=new Ia,Rp=new Y,L_=new Y;class ga{constructor(e=new Y,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 i=this.center;t!==void 0?i.copy(t):Zw.setFromPoints(e).getCenter(i);let s=0;for(let u=0,f=e.length;u<f;u++)s=Math.max(s,i.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 i=this.center.distanceToSquared(e);return t.copy(e),i>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;Rp.subVectors(e,this.center);const t=Rp.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(Rp,s/i),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):(L_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Rp.copy(e.center).add(L_)),this.expandByPoint(Rp.copy(e.center).sub(L_))),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 xl=new Y,I_=new Y,m0=new Y,Su=new Y,O_=new Y,g0=new Y,z_=new Y;class Qh{constructor(e=new Y,t=new Y(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,xl)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=xl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xl.copy(this.origin).addScaledVector(this.direction,t),xl.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){I_.copy(e).add(t).multiplyScalar(.5),m0.copy(t).sub(e).normalize(),Su.copy(this.origin).sub(I_);const u=e.distanceTo(t)*.5,f=-this.direction.dot(m0),h=Su.dot(this.direction),m=-Su.dot(m0),g=Su.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 i&&i.copy(this.origin).addScaledVector(this.direction,x),s&&s.copy(I_).addScaledVector(m0,b),M}intersectSphere(e,t){xl.subVectors(e.center,this.origin);const i=xl.dot(this.direction),s=xl.dot(xl)-i*i,u=e.radius*e.radius;if(s>u)return null;const f=Math.sqrt(u-s),h=i-f,m=i+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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,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?(i=(e.min.x-b.x)*g,s=(e.max.x-b.x)*g):(i=(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)*_),i>f||u>s||((u>i||isNaN(i))&&(i=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),i>m||h>s)||((h>i||i!==i)&&(i=h),(m<s||s!==s)&&(s=m),s<0)?null:this.at(i>=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,xl)!==null}intersectTriangle(e,t,i,s,u){O_.subVectors(t,e),g0.subVectors(i,e),z_.crossVectors(O_,g0);let f=this.direction.dot(z_),h;if(f>0){if(s)return null;h=1}else if(f<0)h=-1,f=-f;else return null;Su.subVectors(this.origin,e);const m=h*this.direction.dot(g0.crossVectors(Su,g0));if(m<0)return null;const g=h*this.direction.dot(O_.cross(Su));if(g<0||m+g>f)return null;const _=-h*Su.dot(z_);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 kt{constructor(e,t,i,s,u,f,h,m,g,_,x,b,M,A,R,C){kt.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,i,s,u,f,h,m,g,_,x,b,M,A,R,C)}set(e,t,i,s,u,f,h,m,g,_,x,b,M,A,R,C){const E=this.elements;return E[0]=e,E[4]=t,E[8]=i,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]=C,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 kt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,s=1/dh.setFromMatrixColumn(e,0).length(),u=1/dh.setFromMatrixColumn(e,1).length(),f=1/dh.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*u,t[5]=i[5]*u,t[6]=i[6]*u,t[7]=0,t[8]=i[8]*f,t[9]=i[9]*f,t[10]=i[10]*f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,u=e.z,f=Math.cos(i),h=Math.sin(i),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(jw,e,Qw)}lookAt(e,t,i){const s=this.elements;return zs.subVectors(e,t),zs.lengthSq()===0&&(zs.z=1),zs.normalize(),bu.crossVectors(i,zs),bu.lengthSq()===0&&(Math.abs(i.z)===1?zs.x+=1e-4:zs.z+=1e-4,zs.normalize(),bu.crossVectors(i,zs)),bu.normalize(),v0.crossVectors(zs,bu),s[0]=bu.x,s[4]=v0.x,s[8]=zs.x,s[1]=bu.y,s[5]=v0.y,s[9]=zs.y,s[2]=bu.z,s[6]=v0.z,s[10]=zs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,u=this.elements,f=i[0],h=i[4],m=i[8],g=i[12],_=i[1],x=i[5],b=i[9],M=i[13],A=i[2],R=i[6],C=i[10],E=i[14],D=i[3],U=i[7],L=i[11],B=i[15],P=s[0],H=s[4],W=s[8],I=s[12],z=s[1],j=s[5],ae=s[9],$=s[13],ue=s[2],he=s[6],q=s[10],K=s[14],ce=s[3],Ae=s[7],Ce=s[11],X=s[15];return u[0]=f*P+h*z+m*ue+g*ce,u[4]=f*H+h*j+m*he+g*Ae,u[8]=f*W+h*ae+m*q+g*Ce,u[12]=f*I+h*$+m*K+g*X,u[1]=_*P+x*z+b*ue+M*ce,u[5]=_*H+x*j+b*he+M*Ae,u[9]=_*W+x*ae+b*q+M*Ce,u[13]=_*I+x*$+b*K+M*X,u[2]=A*P+R*z+C*ue+E*ce,u[6]=A*H+R*j+C*he+E*Ae,u[10]=A*W+R*ae+C*q+E*Ce,u[14]=A*I+R*$+C*K+E*X,u[3]=D*P+U*z+L*ue+B*ce,u[7]=D*H+U*j+L*he+B*Ae,u[11]=D*W+U*ae+L*q+B*Ce,u[15]=D*I+U*$+L*K+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],i=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],C=e[11],E=e[15],D=m*M-g*b,U=h*M-g*x,L=h*b-m*x,B=f*M-g*_,P=f*b-m*_,H=f*x-h*_;return t*(R*D-C*U+E*L)-i*(A*D-C*B+E*P)+s*(A*U-R*B+E*H)-u*(A*L-R*P+C*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,i){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]=i),this}invert(){const e=this.elements,t=e[0],i=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],C=e[14],E=e[15],D=x*C*g-R*b*g+R*m*M-h*C*M-x*m*E+h*b*E,U=A*b*g-_*C*g-A*m*M+f*C*M+_*m*E-f*b*E,L=_*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*C-f*x*C,P=t*D+i*U+s*L+u*B;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const H=1/P;return e[0]=D*H,e[1]=(R*b*u-x*C*u-R*s*M+i*C*M+x*s*E-i*b*E)*H,e[2]=(h*C*u-R*m*u+R*s*g-i*C*g-h*s*E+i*m*E)*H,e[3]=(x*m*u-h*b*u-x*s*g+i*b*g+h*s*M-i*m*M)*H,e[4]=U*H,e[5]=(_*C*u-A*b*u+A*s*M-t*C*M-_*s*E+t*b*E)*H,e[6]=(A*m*u-f*C*u-A*s*g+t*C*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]=L*H,e[9]=(A*x*u-_*R*u-A*i*M+t*R*M+_*i*E-t*x*E)*H,e[10]=(f*R*u-A*h*u+A*i*g-t*R*g-f*i*E+t*h*E)*H,e[11]=(_*h*u-f*x*u-_*i*g+t*x*g+f*i*M-t*h*M)*H,e[12]=B*H,e[13]=(_*R*s-A*x*s+A*i*b-t*R*b-_*i*C+t*x*C)*H,e[14]=(A*h*s-f*R*s-A*i*m+t*R*m+f*i*C-t*h*C)*H,e[15]=(f*x*s-_*h*s+_*i*m-t*x*m-f*i*b+t*h*b)*H,this}scale(e){const t=this.elements,i=e.x,s=e.y,u=e.z;return t[0]*=i,t[4]*=s,t[8]*=u,t[1]*=i,t[5]*=s,t[9]*=u,t[2]*=i,t[6]*=s,t[10]*=u,t[3]*=i,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],i=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,i,s))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),u=1-i,f=e.x,h=e.y,m=e.z,g=u*f,_=u*h;return this.set(g*f+i,g*h-s*m,g*m+s*h,0,g*h+s*m,_*h+i,_*m-s*f,0,g*m-s*h,_*m+s*f,u*m*m+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,u,f){return this.set(1,i,u,0,e,1,f,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){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*_,C=f*x,E=h*x,D=m*g,U=m*_,L=m*x,B=i.x,P=i.y,H=i.z;return s[0]=(1-(R+E))*B,s[1]=(M+L)*B,s[2]=(A-U)*B,s[3]=0,s[4]=(M-L)*P,s[5]=(1-(b+E))*P,s[6]=(C+D)*P,s[7]=0,s[8]=(A+U)*H,s[9]=(C-D)*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,i){const s=this.elements;if(e.x=s[12],e.y=s[13],e.z=s[14],this.determinant()===0)return i.set(1,1,1),t.identity(),this;let u=dh.set(s[0],s[1],s[2]).length();const f=dh.set(s[4],s[5],s[6]).length(),h=dh.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),Hr.copy(this);const g=1/u,_=1/f,x=1/h;return Hr.elements[0]*=g,Hr.elements[1]*=g,Hr.elements[2]*=g,Hr.elements[4]*=_,Hr.elements[5]*=_,Hr.elements[6]*=_,Hr.elements[8]*=x,Hr.elements[9]*=x,Hr.elements[10]*=x,t.setFromRotationMatrix(Hr),i.x=u,i.y=f,i.z=h,this}makePerspective(e,t,i,s,u,f,h=Fs,m=!1){const g=this.elements,_=2*u/(t-e),x=2*u/(i-s),b=(t+e)/(t-e),M=(i+s)/(i-s);let A,R;if(m)A=u/(f-u),R=f*u/(f-u);else if(h===Fs)A=-(f+u)/(f-u),R=-2*f*u/(f-u);else if(h===Vh)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,i,s,u,f,h=Fs,m=!1){const g=this.elements,_=2/(t-e),x=2/(i-s),b=-(t+e)/(t-e),M=-(i+s)/(i-s);let A,R;if(m)A=1/(f-u),R=f/(f-u);else if(h===Fs)A=-2/(f-u),R=-(f+u)/(f-u);else if(h===Vh)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,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const dh=new Y,Hr=new kt,jw=new Y(0,0,0),Qw=new Y(1,1,1),bu=new Y,v0=new Y,zs=new Y,Zb=new kt,jb=new ws;class Hs{constructor(e=0,t=0,i=0,s=Hs.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,s=this._order){return this._x=e,this._y=t,this._z=i,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,i=!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(Ft(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(-Ft(_,-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(Ft(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(-Ft(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(Ft(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(-Ft(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:rt("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Zb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zb,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return jb.setFromEuler(this),this.setFromQuaternion(jb,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}}Hs.DEFAULT_ORDER="XYZ";class Gh{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 Jw=0;const Qb=new Y,ph=new ws,Sl=new kt,y0=new Y,Dp=new Y,Kw=new Y,$w=new ws,Jb=new Y(1,0,0),Kb=new Y(0,1,0),$b=new Y(0,0,1),eM={type:"added"},eC={type:"removed"},mh={type:"childadded",child:null},P_={type:"childremoved",child:null};class An extends Bo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jw++}),this.uuid=Vs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=An.DEFAULT_UP.clone();const e=new Y,t=new Hs,i=new ws,s=new Y(1,1,1);function u(){i.setFromEuler(t,!1)}function f(){t.setFromQuaternion(i,void 0,!1)}t._onChange(u),i._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:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new kt},normalMatrix:{value:new Qt}}),this.matrix=new kt,this.matrixWorld=new kt,this.matrixAutoUpdate=An.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=An.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Gh,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 ph.setFromAxisAngle(e,t),this.quaternion.multiply(ph),this}rotateOnWorldAxis(e,t){return ph.setFromAxisAngle(e,t),this.quaternion.premultiply(ph),this}rotateX(e){return this.rotateOnAxis(Jb,e)}rotateY(e){return this.rotateOnAxis(Kb,e)}rotateZ(e){return this.rotateOnAxis($b,e)}translateOnAxis(e,t){return Qb.copy(e).applyQuaternion(this.quaternion),this.position.add(Qb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Jb,e)}translateY(e){return this.translateOnAxis(Kb,e)}translateZ(e){return this.translateOnAxis($b,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Sl.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?y0.copy(e):y0.set(e,t,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Dp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Sl.lookAt(Dp,y0,this.up):Sl.lookAt(y0,Dp,this.up),this.quaternion.setFromRotationMatrix(Sl),s&&(Sl.extractRotation(s.matrixWorld),ph.setFromRotationMatrix(Sl),this.quaternion.premultiply(ph.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Tt("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(eM),mh.child=e,this.dispatchEvent(mh),mh.child=null):Tt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(eC),P_.child=e,this.dispatchEvent(P_),P_.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),Sl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Sl.multiply(e.parent.matrixWorld)),e.applyMatrix4(Sl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(eM),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 i=0,s=this.children.length;i<s;i++){const f=this.children[i].getObjectByProperty(e,t);if(f!==void 0)return f}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const s=this.children;for(let u=0,f=s.length;u<f;u++)s[u].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dp,e,Kw),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dp,$w,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 i=0,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].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 i=0,s=t.length;i<s;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.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&&(i.geometries=h),m.length>0&&(i.materials=m),g.length>0&&(i.textures=g),_.length>0&&(i.images=_),x.length>0&&(i.shapes=x),b.length>0&&(i.skeletons=b),M.length>0&&(i.animations=M),A.length>0&&(i.nodes=A)}return i.object=s,i;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 i=0;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}}An.DEFAULT_UP=new Y(0,1,0);An.DEFAULT_MATRIX_AUTO_UPDATE=!0;An.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Gr=new Y,bl=new Y,B_=new Y,Ml=new Y,gh=new Y,vh=new Y,tM=new Y,F_=new Y,V_=new Y,k_=new Y,H_=new Wn,G_=new Wn,X_=new Wn;class Ts{constructor(e=new Y,t=new Y,i=new Y){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,s){s.subVectors(i,t),Gr.subVectors(e,t),s.cross(Gr);const u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(e,t,i,s,u){Gr.subVectors(s,t),bl.subVectors(i,t),B_.subVectors(e,t);const f=Gr.dot(Gr),h=Gr.dot(bl),m=Gr.dot(B_),g=bl.dot(bl),_=bl.dot(B_),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,i,s){return this.getBarycoord(e,t,i,s,Ml)===null?!1:Ml.x>=0&&Ml.y>=0&&Ml.x+Ml.y<=1}static getInterpolation(e,t,i,s,u,f,h,m){return this.getBarycoord(e,t,i,s,Ml)===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,Ml.x),m.addScaledVector(f,Ml.y),m.addScaledVector(h,Ml.z),m)}static getInterpolatedAttribute(e,t,i,s,u,f){return H_.setScalar(0),G_.setScalar(0),X_.setScalar(0),H_.fromBufferAttribute(e,t),G_.fromBufferAttribute(e,i),X_.fromBufferAttribute(e,s),f.setScalar(0),f.addScaledVector(H_,u.x),f.addScaledVector(G_,u.y),f.addScaledVector(X_,u.z),f}static isFrontFacing(e,t,i,s){return Gr.subVectors(i,t),bl.subVectors(e,t),Gr.cross(bl).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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 Gr.subVectors(this.c,this.b),bl.subVectors(this.a,this.b),Gr.cross(bl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ts.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ts.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,s,u){return Ts.getInterpolation(e,this.a,this.b,this.c,t,i,s,u)}containsPoint(e){return Ts.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ts.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,u=this.c;let f,h;gh.subVectors(s,i),vh.subVectors(u,i),F_.subVectors(e,i);const m=gh.dot(F_),g=vh.dot(F_);if(m<=0&&g<=0)return t.copy(i);V_.subVectors(e,s);const _=gh.dot(V_),x=vh.dot(V_);if(_>=0&&x<=_)return t.copy(s);const b=m*x-_*g;if(b<=0&&m>=0&&_<=0)return f=m/(m-_),t.copy(i).addScaledVector(gh,f);k_.subVectors(e,u);const M=gh.dot(k_),A=vh.dot(k_);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(i).addScaledVector(vh,h);const C=_*A-M*x;if(C<=0&&x-_>=0&&M-A>=0)return tM.subVectors(u,s),h=(x-_)/(x-_+(M-A)),t.copy(s).addScaledVector(tM,h);const E=1/(C+R+b);return f=R*E,h=b*E,t.copy(i).addScaledVector(gh,f).addScaledVector(vh,h)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ME={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},Mu={h:0,s:0,l:0},_0={h:0,s:0,l:0};function W_(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}class pt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===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,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ua){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xn.colorSpaceToWorking(this,t),this}setRGB(e,t,i,s=xn.workingColorSpace){return this.r=e,this.g=t,this.b=i,xn.colorSpaceToWorking(this,s),this}setHSL(e,t,i,s=xn.workingColorSpace){if(e=pS(e,1),t=Ft(t,0,1),i=Ft(i,0,1),t===0)this.r=this.g=this.b=i;else{const u=i<=.5?i*(1+t):i+t-i*t,f=2*i-u;this.r=W_(f,u,e+1/3),this.g=W_(f,u,e),this.b=W_(f,u,e-1/3)}return xn.colorSpaceToWorking(this,s),this}setStyle(e,t=Ua){function i(u){u!==void 0&&parseFloat(u)<1&&rt("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 i(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 i(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 i(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,t);break;default:rt("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);rt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ua){const i=ME[e.toLowerCase()];return i!==void 0?this.setHex(i,t):rt("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=wl(e.r),this.g=wl(e.g),this.b=wl(e.b),this}copyLinearToSRGB(e){return this.r=Ph(e.r),this.g=Ph(e.g),this.b=Ph(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ua){return xn.workingToColorSpace(Da.copy(this),e),Math.round(Ft(Da.r*255,0,255))*65536+Math.round(Ft(Da.g*255,0,255))*256+Math.round(Ft(Da.b*255,0,255))}getHexString(e=Ua){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=xn.workingColorSpace){xn.workingToColorSpace(Da.copy(this),t);const i=Da.r,s=Da.g,u=Da.b,f=Math.max(i,s,u),h=Math.min(i,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 i:m=(s-u)/x+(s<u?6:0);break;case s:m=(u-i)/x+2;break;case u:m=(i-s)/x+4;break}m/=6}return e.h=m,e.s=g,e.l=_,e}getRGB(e,t=xn.workingColorSpace){return xn.workingToColorSpace(Da.copy(this),t),e.r=Da.r,e.g=Da.g,e.b=Da.b,e}getStyle(e=Ua){xn.workingToColorSpace(Da.copy(this),e);const t=Da.r,i=Da.g,s=Da.b;return e!==Ua?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,t,i){return this.getHSL(Mu),this.setHSL(Mu.h+e,Mu.s+t,Mu.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Mu),e.getHSL(_0);const i=Qp(Mu.h,_0.h,t),s=Qp(Mu.s,_0.s,t),u=Qp(Mu.l,_0.l,t);return this.setHSL(i,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,i=this.g,s=this.b,u=e.elements;return this.r=u[0]*t+u[3]*i+u[6]*s,this.g=u[1]*t+u[4]*i+u[7]*s,this.b=u[2]*t+u[5]*i+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 Da=new pt;pt.NAMES=ME;let tC=0;class Oa extends Bo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tC++}),this.uuid=Vs(),this.name="",this.type="Material",this.blending=Wc,this.side=Cl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=lv,this.blendDst=uv,this.blendEquation=wu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new pt(0,0,0),this.blendAlpha=0,this.depthFunc=Zc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Lx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Fc,this.stencilZFail=Fc,this.stencilZPass=Fc,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 i=e[t];if(i===void 0){rt(`Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){rt(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Wc&&(i.blending=this.blending),this.side!==Cl&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==lv&&(i.blendSrc=this.blendSrc),this.blendDst!==uv&&(i.blendDst=this.blendDst),this.blendEquation!==wu&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Zc&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Lx&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Fc&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Fc&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Fc&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.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&&(i.textures=u),f.length>0&&(i.images=f)}return i}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 i=null;if(t!==null){const s=t.length;i=new Array(s);for(let u=0;u!==s;++u)i[u]=t[u].clone()}return this.clippingPlanes=i,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 Pu extends Oa{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new pt(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 Hs,this.combine=_m,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 Al=nC();function nC(){const o=new ArrayBuffer(4),e=new Float32Array(o),t=new Uint32Array(o),i=new Uint32Array(512),s=new Uint32Array(512);for(let m=0;m<256;++m){const g=m-127;g<-27?(i[m]=0,i[m|256]=32768,s[m]=24,s[m|256]=24):g<-14?(i[m]=1024>>-g-14,i[m|256]=1024>>-g-14|32768,s[m]=-g-1,s[m|256]=-g-1):g<=15?(i[m]=g+15<<10,i[m|256]=g+15<<10|32768,s[m]=13,s[m|256]=13):g<128?(i[m]=31744,i[m|256]=64512,s[m]=24,s[m|256]=24):(i[m]=31744,i[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:i,shiftTable:s,mantissaTable:u,exponentTable:f,offsetTable:h}}function Ms(o){Math.abs(o)>65504&&rt("DataUtils.toHalfFloat(): Value out of range."),o=Ft(o,-65504,65504),Al.floatView[0]=o;const e=Al.uint32View[0],t=e>>23&511;return Al.baseTable[t]+((e&8388607)>>Al.shiftTable[t])}function kp(o){const e=o>>10;return Al.uint32View[0]=Al.mantissaTable[Al.offsetTable[e]+(o&1023)]+Al.exponentTable[e],Al.floatView[0]}class iC{static toHalfFloat(e){return Ms(e)}static fromHalfFloat(e){return kp(e)}}const Hi=new Y,x0=new Pe;let aC=0;class Hn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:aC++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=om,this.updateRanges=[],this.gpuType=es,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,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,u=this.itemSize;s<u;s++)this.array[e+s]=t.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)x0.fromBufferAttribute(this,t),x0.applyMatrix3(e),this.setXY(t,x0.x,x0.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyMatrix3(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyMatrix4(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyNormalMatrix(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.transformDirection(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=$a(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=tn(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=$a(t,this.array)),t}setX(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=$a(t,this.array)),t}setY(e,t){return this.normalized&&(t=tn(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=$a(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tn(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=$a(t,this.array)),t}setW(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,s){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,t,i,s,u){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array),u=tn(u,this.array)),this.array[e+0]=t,this.array[e+1]=i,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!==om&&(e.usage=this.usage),e}}class sC extends Hn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class rC extends Hn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class oC extends Hn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class lC extends Hn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class gS extends Hn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class uC extends Hn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class vS extends Hn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class cC extends Hn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=kp(this.array[e*this.itemSize]);return this.normalized&&(t=$a(t,this.array)),t}setX(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize]=Ms(t),this}getY(e){let t=kp(this.array[e*this.itemSize+1]);return this.normalized&&(t=$a(t,this.array)),t}setY(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize+1]=Ms(t),this}getZ(e){let t=kp(this.array[e*this.itemSize+2]);return this.normalized&&(t=$a(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize+2]=Ms(t),this}getW(e){let t=kp(this.array[e*this.itemSize+3]);return this.normalized&&(t=$a(t,this.array)),t}setW(e,t){return this.normalized&&(t=tn(t,this.array)),this.array[e*this.itemSize+3]=Ms(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array)),this.array[e+0]=Ms(t),this.array[e+1]=Ms(i),this}setXYZ(e,t,i,s){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array)),this.array[e+0]=Ms(t),this.array[e+1]=Ms(i),this.array[e+2]=Ms(s),this}setXYZW(e,t,i,s,u){return e*=this.itemSize,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array),u=tn(u,this.array)),this.array[e+0]=Ms(t),this.array[e+1]=Ms(i),this.array[e+2]=Ms(s),this.array[e+3]=Ms(u),this}}class yt extends Hn{constructor(e,t,i){super(new Float32Array(e),t,i)}}let fC=0;const pr=new kt,q_=new An,yh=new Y,Ps=new Ia,Np=new Ia,ia=new Y;class Yt extends Bo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fC++}),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(yE(e)?vS:gS)(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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}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 i=this.attributes.normal;if(i!==void 0){const u=new Qt().getNormalMatrix(e);i.applyNormalMatrix(u),i.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 pr.makeRotationFromQuaternion(e),this.applyMatrix4(pr),this}rotateX(e){return pr.makeRotationX(e),this.applyMatrix4(pr),this}rotateY(e){return pr.makeRotationY(e),this.applyMatrix4(pr),this}rotateZ(e){return pr.makeRotationZ(e),this.applyMatrix4(pr),this}translate(e,t,i){return pr.makeTranslation(e,t,i),this.applyMatrix4(pr),this}scale(e,t,i){return pr.makeScale(e,t,i),this.applyMatrix4(pr),this}lookAt(e){return q_.lookAt(e),q_.updateMatrix(),this.applyMatrix4(q_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(yh).negate(),this.translate(yh.x,yh.y,yh.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let s=0,u=e.length;s<u;s++){const f=e[s];i.push(f.x,f.y,f.z||0)}this.setAttribute("position",new yt(i,3))}else{const i=Math.min(e.length,t.count);for(let s=0;s<i;s++){const u=e[s];t.setXYZ(s,u.x,u.y,u.z||0)}e.length>t.count&&rt("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 Ia);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i<s;i++){const u=t[i];Ps.setFromBufferAttribute(u),this.morphTargetsRelative?(ia.addVectors(this.boundingBox.min,Ps.min),this.boundingBox.expandByPoint(ia),ia.addVectors(this.boundingBox.max,Ps.max),this.boundingBox.expandByPoint(ia)):(this.boundingBox.expandByPoint(Ps.min),this.boundingBox.expandByPoint(Ps.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tt('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 ga);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Y,1/0);return}if(e){const i=this.boundingSphere.center;if(Ps.setFromBufferAttribute(e),t)for(let u=0,f=t.length;u<f;u++){const h=t[u];Np.setFromBufferAttribute(h),this.morphTargetsRelative?(ia.addVectors(Ps.min,Np.min),Ps.expandByPoint(ia),ia.addVectors(Ps.max,Np.max),Ps.expandByPoint(ia)):(Ps.expandByPoint(Np.min),Ps.expandByPoint(Np.max))}Ps.getCenter(i);let s=0;for(let u=0,f=e.count;u<f;u++)ia.fromBufferAttribute(e,u),s=Math.max(s,i.distanceToSquared(ia));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++)ia.fromBufferAttribute(h,g),m&&(yh.fromBufferAttribute(e,g),ia.add(yh)),s=Math.max(s,i.distanceToSquared(ia))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Tt('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){Tt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,s=t.normal,u=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Hn(new Float32Array(4*i.count),4));const f=this.getAttribute("tangent"),h=[],m=[];for(let W=0;W<i.count;W++)h[W]=new Y,m[W]=new Y;const g=new Y,_=new Y,x=new Y,b=new Pe,M=new Pe,A=new Pe,R=new Y,C=new Y;function E(W,I,z){g.fromBufferAttribute(i,W),_.fromBufferAttribute(i,I),x.fromBufferAttribute(i,z),b.fromBufferAttribute(u,W),M.fromBufferAttribute(u,I),A.fromBufferAttribute(u,z),_.sub(g),x.sub(g),M.sub(b),A.sub(b);const j=1/(M.x*A.y-A.x*M.y);isFinite(j)&&(R.copy(_).multiplyScalar(A.y).addScaledVector(x,-M.y).multiplyScalar(j),C.copy(x).multiplyScalar(M.x).addScaledVector(_,-A.x).multiplyScalar(j),h[W].add(R),h[I].add(R),h[z].add(R),m[W].add(C),m[I].add(C),m[z].add(C))}let D=this.groups;D.length===0&&(D=[{start:0,count:e.count}]);for(let W=0,I=D.length;W<I;++W){const z=D[W],j=z.start,ae=z.count;for(let $=j,ue=j+ae;$<ue;$+=3)E(e.getX($+0),e.getX($+1),e.getX($+2))}const U=new Y,L=new Y,B=new Y,P=new Y;function H(W){B.fromBufferAttribute(s,W),P.copy(B);const I=h[W];U.copy(I),U.sub(B.multiplyScalar(B.dot(I))).normalize(),L.crossVectors(P,I);const j=L.dot(m[W])<0?-1:1;f.setXYZW(W,U.x,U.y,U.z,j)}for(let W=0,I=D.length;W<I;++W){const z=D[W],j=z.start,ae=z.count;for(let $=j,ue=j+ae;$<ue;$+=3)H(e.getX($+0)),H(e.getX($+1)),H(e.getX($+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Hn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let b=0,M=i.count;b<M;b++)i.setXYZ(b,0,0,0);const s=new Y,u=new Y,f=new Y,h=new Y,m=new Y,g=new Y,_=new Y,x=new Y;if(e)for(let b=0,M=e.count;b<M;b+=3){const A=e.getX(b+0),R=e.getX(b+1),C=e.getX(b+2);s.fromBufferAttribute(t,A),u.fromBufferAttribute(t,R),f.fromBufferAttribute(t,C),_.subVectors(f,u),x.subVectors(s,u),_.cross(x),h.fromBufferAttribute(i,A),m.fromBufferAttribute(i,R),g.fromBufferAttribute(i,C),h.add(_),m.add(_),g.add(_),i.setXYZ(A,h.x,h.y,h.z),i.setXYZ(R,m.x,m.y,m.z),i.setXYZ(C,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),i.setXYZ(b+0,_.x,_.y,_.z),i.setXYZ(b+1,_.x,_.y,_.z),i.setXYZ(b+2,_.x,_.y,_.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)ia.fromBufferAttribute(e,t),ia.normalize(),e.setXYZ(t,ia.x,ia.y,ia.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,C=m.length;R<C;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 Hn(b,_,x)}if(this.index===null)return rt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Yt,i=this.index.array,s=this.attributes;for(const h in s){const m=s[h],g=e(m,i);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,i);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 i=this.attributes;for(const m in i){const g=i[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 i=e.index;i!==null&&this.setIndex(i.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 nM=new kt,wc=new Qh,S0=new ga,iM=new Y,b0=new Y,M0=new Y,E0=new Y,Y_=new Y,T0=new Y,aM=new Y,A0=new Y;class Gi extends An{constructor(e=new Yt,t=new Pu){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,i=Object.keys(t);if(i.length>0){const s=t[i[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 i=this.geometry,s=i.attributes.position,u=i.morphAttributes.position,f=i.morphTargetsRelative;t.fromBufferAttribute(s,e);const h=this.morphTargetInfluences;if(u&&h){T0.set(0,0,0);for(let m=0,g=u.length;m<g;m++){const _=h[m],x=u[m];_!==0&&(Y_.fromBufferAttribute(x,e),f?T0.addScaledVector(Y_,_):T0.addScaledVector(Y_.sub(t),_))}t.add(T0)}return t}raycast(e,t){const i=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),S0.copy(i.boundingSphere),S0.applyMatrix4(u),wc.copy(e.ray).recast(e.near),!(S0.containsPoint(wc.origin)===!1&&(wc.intersectSphere(S0,iM)===null||wc.origin.distanceToSquared(iM)>(e.far-e.near)**2))&&(nM.copy(u).invert(),wc.copy(e.ray).applyMatrix4(nM),!(i.boundingBox!==null&&wc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,wc)))}_computeIntersections(e,t,i){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 C=b[A],E=f[C.materialIndex],D=Math.max(C.start,M.start),U=Math.min(h.count,Math.min(C.start+C.count,M.start+M.count));for(let L=D,B=U;L<B;L+=3){const P=h.getX(L),H=h.getX(L+1),W=h.getX(L+2);s=w0(this,E,e,i,g,_,x,P,H,W),s&&(s.faceIndex=Math.floor(L/3),s.face.materialIndex=C.materialIndex,t.push(s))}}else{const A=Math.max(0,M.start),R=Math.min(h.count,M.start+M.count);for(let C=A,E=R;C<E;C+=3){const D=h.getX(C),U=h.getX(C+1),L=h.getX(C+2);s=w0(this,f,e,i,g,_,x,D,U,L),s&&(s.faceIndex=Math.floor(C/3),t.push(s))}}else if(m!==void 0)if(Array.isArray(f))for(let A=0,R=b.length;A<R;A++){const C=b[A],E=f[C.materialIndex],D=Math.max(C.start,M.start),U=Math.min(m.count,Math.min(C.start+C.count,M.start+M.count));for(let L=D,B=U;L<B;L+=3){const P=L,H=L+1,W=L+2;s=w0(this,E,e,i,g,_,x,P,H,W),s&&(s.faceIndex=Math.floor(L/3),s.face.materialIndex=C.materialIndex,t.push(s))}}else{const A=Math.max(0,M.start),R=Math.min(m.count,M.start+M.count);for(let C=A,E=R;C<E;C+=3){const D=C,U=C+1,L=C+2;s=w0(this,f,e,i,g,_,x,D,U,L),s&&(s.faceIndex=Math.floor(C/3),t.push(s))}}}}function hC(o,e,t,i,s,u,f,h){let m;if(e.side===ts?m=i.intersectTriangle(f,u,s,!0,h):m=i.intersectTriangle(s,u,f,e.side===Cl,h),m===null)return null;A0.copy(h),A0.applyMatrix4(o.matrixWorld);const g=t.ray.origin.distanceTo(A0);return g<t.near||g>t.far?null:{distance:g,point:A0.clone(),object:o}}function w0(o,e,t,i,s,u,f,h,m,g){o.getVertexPosition(h,b0),o.getVertexPosition(m,M0),o.getVertexPosition(g,E0);const _=hC(o,e,t,i,b0,M0,E0,aM);if(_){const x=new Y;Ts.getBarycoord(aM,b0,M0,E0,x),s&&(_.uv=Ts.getInterpolatedAttribute(s,h,m,g,x,new Pe)),u&&(_.uv1=Ts.getInterpolatedAttribute(u,h,m,g,x,new Pe)),f&&(_.normal=Ts.getInterpolatedAttribute(f,h,m,g,x,new Y),_.normal.dot(i.direction)>0&&_.normal.multiplyScalar(-1));const b={a:h,b:m,c:g,normal:new Y,materialIndex:0};Ts.getNormal(b0,M0,E0,b.normal),_.face=b,_.barycoord=x}return _}class $c extends Yt{constructor(e=1,t=1,i=1,s=1,u=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,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,i,t,e,f,u,0),A("z","y","x",1,-1,i,t,-e,f,u,1),A("x","z","y",1,1,e,i,t,s,f,2),A("x","z","y",1,-1,e,i,-t,s,f,3),A("x","y","z",1,-1,e,t,i,s,u,4),A("x","y","z",-1,-1,e,t,-i,s,u,5),this.setIndex(m),this.setAttribute("position",new yt(g,3)),this.setAttribute("normal",new yt(_,3)),this.setAttribute("uv",new yt(x,2));function A(R,C,E,D,U,L,B,P,H,W,I){const z=L/H,j=B/W,ae=L/2,$=B/2,ue=P/2,he=H+1,q=W+1;let K=0,ce=0;const Ae=new Y;for(let Ce=0;Ce<q;Ce++){const X=Ce*j-$;for(let se=0;se<he;se++){const Ee=se*z-ae;Ae[R]=Ee*D,Ae[C]=X*U,Ae[E]=ue,g.push(Ae.x,Ae.y,Ae.z),Ae[R]=0,Ae[C]=0,Ae[E]=P>0?1:-1,_.push(Ae.x,Ae.y,Ae.z),x.push(se/H),x.push(1-Ce/W),K+=1}}for(let Ce=0;Ce<W;Ce++)for(let X=0;X<H;X++){const se=b+X+he*Ce,Ee=b+X+he*(Ce+1),Oe=b+(X+1)+he*(Ce+1),nt=b+(X+1)+he*Ce;m.push(se,Ee,nt),m.push(Ee,Oe,nt),ce+=6}h.addGroup(M,ce,I),M+=ce,b+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $c(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Xh(o){const e={};for(const t in o){e[t]={};for(const i in o[t]){const s=o[t][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(rt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=s.clone():Array.isArray(s)?e[t][i]=s.slice():e[t][i]=s}}return e}function Ja(o){const e={};for(let t=0;t<o.length;t++){const i=Xh(o[t]);for(const s in i)e[s]=i[s]}return e}function dC(o){const e=[];for(let t=0;t<o.length;t++)e.push(o[t].clone());return e}function EE(o){const e=o.getRenderTarget();return e===null?o.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xn.workingColorSpace}const TE={clone:Xh,merge:Ja};var pC=`void main() {
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
}`,mC=`void main() {
|
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
}`;class vr extends Oa{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=pC,this.fragmentShader=mC,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=Xh(e.uniforms),this.uniformsGroups=dC(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 i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class yy extends An{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kt,this.projectionMatrix=new kt,this.projectionMatrixInverse=new kt,this.coordinateSystem=Fs,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 Eu=new Y,sM=new Pe,rM=new Pe;class aa extends yy{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,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=Hh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Hh*2*Math.atan(Math.tan(qc*.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,i){Eu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Eu.x,Eu.y).multiplyScalar(-e/Eu.z),Eu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Eu.x,Eu.y).multiplyScalar(-e/Eu.z)}getViewSize(e,t){return this.getViewBounds(e,sM,rM),t.subVectors(rM,sM)}setViewOffset(e,t,i,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=i,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(qc*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,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*i/g,s*=f.width/m,i*=f.height/g}const h=this.filmOffset;h!==0&&(u+=e*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(u,u+s,t,t-i,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 _h=-90,xh=1;class AE extends An{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new aa(_h,xh,e,t);s.layers=this.layers,this.add(s);const u=new aa(_h,xh,e,t);u.layers=this.layers,this.add(u);const f=new aa(_h,xh,e,t);f.layers=this.layers,this.add(f);const h=new aa(_h,xh,e,t);h.layers=this.layers,this.add(h);const m=new aa(_h,xh,e,t);m.layers=this.layers,this.add(m);const g=new aa(_h,xh,e,t);g.layers=this.layers,this.add(g)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,u,f,h,m]=t;for(const g of t)this.remove(g);if(e===Fs)i.up.set(0,1,0),i.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===Vh)i.up.set(0,-1,0),i.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:i,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=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,u),e.setRenderTarget(i,1,s),e.render(t,f),e.setRenderTarget(i,2,s),e.render(t,h),e.setRenderTarget(i,3,s),e.render(t,m),e.setRenderTarget(i,4,s),e.render(t,g),i.texture.generateMipmaps=R,e.setRenderTarget(i,5,s),e.render(t,_),e.setRenderTarget(x,b,M),e.xr.enabled=A,i.texture.needsPMREMUpdate=!0}}class Sm extends Ei{constructor(e=[],t=Oo,i,s,u,f,h,m,g,_){super(e,t,i,s,u,f,h,m,g,_),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class yS extends ks{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Sm(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 i={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 $c(5,5,5),u=new vr({name:"CubemapFromEquirect",uniforms:Xh(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:ts,blending:Io});u.uniforms.tEquirect.value=t;const f=new Gi(s,u),h=t.minFilter;return t.minFilter===Uo&&(t.minFilter=ai),new AE(1,10,this).update(e,f),t.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(e,t=!0,i=!0,s=!0){const u=e.getRenderTarget();for(let f=0;f<6;f++)e.setRenderTarget(this,f),e.clear(t,i,s);e.setRenderTarget(u)}}class Oh extends An{constructor(){super(),this.isGroup=!0,this.type="Group"}}const gC={type:"move"};class sv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oh,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 Oh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){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 C=t.getJointPose(R,i),E=this._getHandJoint(g,R);C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=C.radius),E.visible=C!==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,i),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,i),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(gC)))}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 i=new Oh;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class _y{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new pt(e),this.density=t}clone(){return new _y(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class xy{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new pt(e),this.near=t,this.far=i}clone(){return new xy(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class _S extends An{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 Hs,this.environmentIntensity=1,this.environmentRotation=new Hs,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 Sy{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=om,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,i){e*=this.stride,i*=t.stride;for(let s=0,u=this.stride;s<u;s++)this.array[e+s]=t.array[i+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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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 Qa=new Y;class Qc{constructor(e,t,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,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,i=this.data.count;t<i;t++)Qa.fromBufferAttribute(this,t),Qa.applyMatrix4(e),this.setXYZ(t,Qa.x,Qa.y,Qa.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Qa.fromBufferAttribute(this,t),Qa.applyNormalMatrix(e),this.setXYZ(t,Qa.x,Qa.y,Qa.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Qa.fromBufferAttribute(this,t),Qa.transformDirection(e),this.setXYZ(t,Qa.x,Qa.y,Qa.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=$a(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=tn(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tn(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=$a(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=$a(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=$a(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=$a(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=s,this}setXYZW(e,t,i,s,u){return e=e*this.data.stride+this.offset,this.normalized&&(t=tn(t,this.array),i=tn(i,this.array),s=tn(s,this.array),u=tn(u,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=s,this.data.array[e+3]=u,this}clone(e){if(e===void 0){um("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)t.push(this.data.array[s+u])}return new Hn(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 Qc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){um("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const s=i*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 xS extends Oa{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new pt(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 Sh;const Up=new Y,bh=new Y,Mh=new Y,Eh=new Pe,Lp=new Pe,wE=new kt,C0=new Y,Ip=new Y,R0=new Y,oM=new Pe,Z_=new Pe,lM=new Pe;class CE extends An{constructor(e=new xS){if(super(),this.isSprite=!0,this.type="Sprite",Sh===void 0){Sh=new Yt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Sy(t,5);Sh.setIndex([0,1,2,0,2,3]),Sh.setAttribute("position",new Qc(i,3,0,!1)),Sh.setAttribute("uv",new Qc(i,2,3,!1))}this.geometry=Sh,this.material=e,this.center=new Pe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Tt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),bh.setFromMatrixScale(this.matrixWorld),wE.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Mh.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&bh.multiplyScalar(-Mh.z);const i=this.material.rotation;let s,u;i!==0&&(u=Math.cos(i),s=Math.sin(i));const f=this.center;D0(C0.set(-.5,-.5,0),Mh,f,bh,s,u),D0(Ip.set(.5,-.5,0),Mh,f,bh,s,u),D0(R0.set(.5,.5,0),Mh,f,bh,s,u),oM.set(0,0),Z_.set(1,0),lM.set(1,1);let h=e.ray.intersectTriangle(C0,Ip,R0,!1,Up);if(h===null&&(D0(Ip.set(-.5,.5,0),Mh,f,bh,s,u),Z_.set(0,1),h=e.ray.intersectTriangle(C0,R0,Ip,!1,Up),h===null))return;const m=e.ray.origin.distanceTo(Up);m<e.near||m>e.far||t.push({distance:m,point:Up.clone(),uv:Ts.getInterpolation(Up,C0,Ip,R0,oM,Z_,lM,new Pe),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 D0(o,e,t,i,s,u){Eh.subVectors(o,t).addScalar(.5).multiply(i),s!==void 0?(Lp.x=u*Eh.x-s*Eh.y,Lp.y=s*Eh.x+u*Eh.y):Lp.copy(Eh),o.copy(e),o.x+=Lp.x,o.y+=Lp.y,o.applyMatrix4(wE)}const N0=new Y,uM=new Y;class RE extends An{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 i=0,s=t.length;i<s;i++){const u=t[i];this.addLevel(u.object.clone(),u.distance,u.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=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:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const s=t.splice(i,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 i,s;for(i=1,s=t.length;i<s;i++){let u=t[i].distance;if(t[i].object.visible&&(u-=u*t[i].hysteresis),e<u)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){N0.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(N0);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){N0.setFromMatrixPosition(e.matrixWorld),uM.setFromMatrixPosition(this.matrixWorld);const i=N0.distanceTo(uM)/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),i>=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 i=this.levels;for(let s=0,u=i.length;s<u;s++){const f=i[s];t.object.levels.push({object:f.object.uuid,distance:f.distance,hysteresis:f.hysteresis})}return t}}const cM=new Y,fM=new Wn,hM=new Wn,vC=new Y,dM=new kt,U0=new Y,j_=new ga,pM=new kt,Q_=new Qh;class DE extends Gi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ux,this.bindMatrix=new kt,this.bindMatrixInverse=new kt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ia),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,U0),this.boundingBox.expandByPoint(U0)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ga),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,U0),this.boundingSphere.expandByPoint(U0)}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 i=this.material,s=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),j_.copy(this.boundingSphere),j_.applyMatrix4(s),e.ray.intersectsSphere(j_)!==!1&&(pM.copy(s).invert(),Q_.copy(e.ray).applyMatrix4(pM),!(this.boundingBox!==null&&Q_.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Q_)))}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 Wn,t=this.geometry.attributes.skinWeight;for(let i=0,s=t.count;i<s;i++){e.fromBufferAttribute(t,i);const u=1/e.manhattanLength();u!==1/0?e.multiplyScalar(u):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ux?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===rE?this.bindMatrixInverse.copy(this.bindMatrix).invert():rt("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,s=this.geometry;fM.fromBufferAttribute(s.attributes.skinIndex,e),hM.fromBufferAttribute(s.attributes.skinWeight,e),cM.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let u=0;u<4;u++){const f=hM.getComponent(u);if(f!==0){const h=fM.getComponent(u);dM.multiplyMatrices(i.bones[h].matrixWorld,i.boneInverses[h]),t.addScaledVector(vC.copy(cM).applyMatrix4(dM),f)}}return t.applyMatrix4(this.bindMatrixInverse)}}class SS extends An{constructor(){super(),this.isBone=!0,this.type="Bone"}}class qr extends Ei{constructor(e=null,t=1,i=1,s,u,f,h,m,g=Li,_=Li,x,b){super(null,f,h,m,g,_,s,u,x,b),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const mM=new kt,yC=new kt;class by{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){rt("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,s=this.bones.length;i<s;i++)this.boneInverses.push(new kt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new kt;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,s=this.boneTexture;for(let u=0,f=e.length;u<f;u++){const h=e[u]?e[u].matrixWorld:yC;mM.multiplyMatrices(h,t[u]),mM.toArray(i,u*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new by(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 i=new qr(t,e,e,La,es);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;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 i=0,s=e.bones.length;i<s;i++){const u=e.bones[i];let f=t[u];f===void 0&&(rt("Skeleton: No bone found with UUID:",u),f=new SS),this.bones.push(f),this.boneInverses.push(new kt().fromArray(e.boneInverses[i]))}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,i=this.boneInverses;for(let s=0,u=t.length;s<u;s++){const f=t[s];e.bones.push(f.uuid);const h=i[s];e.boneInverses.push(h.toArray())}return e}}class Wh extends Hn{constructor(e,t,i,s=1){super(e,t,i),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 Th=new kt,gM=new kt,L0=[],vM=new Ia,_C=new kt,Op=new Gi,zp=new ga;class NE extends Gi{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Wh(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<i;s++)this.setMatrixAt(s,_C)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ia),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Th),vM.copy(e.boundingBox).applyMatrix4(Th),this.boundingBox.union(vM)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ga),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Th),zp.copy(e.boundingSphere).applyMatrix4(Th),this.boundingSphere.union(zp)}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 i=t.morphTargetInfluences,s=this.morphTexture.source.data.data,u=i.length+1,f=e*u+1;for(let h=0;h<i.length;h++)i[h]=s[f+h]}raycast(e,t){const i=this.matrixWorld,s=this.count;if(Op.geometry=this.geometry,Op.material=this.material,Op.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),zp.copy(this.boundingSphere),zp.applyMatrix4(i),e.ray.intersectsSphere(zp)!==!1))for(let u=0;u<s;u++){this.getMatrixAt(u,Th),gM.multiplyMatrices(i,Th),Op.matrixWorld=gM,Op.raycast(e,L0);for(let f=0,h=L0.length;f<h;f++){const m=L0[f];m.instanceId=u,m.object=this,t.push(m)}L0.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Wh(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 i=t.morphTargetInfluences,s=i.length+1;this.morphTexture===null&&(this.morphTexture=new qr(new Float32Array(s*this.count),s,this.count,cy,es));const u=this.morphTexture.source.data.data;let f=0;for(let g=0;g<i.length;g++)f+=i[g];const h=this.geometry.morphTargetsRelative?1:1-f,m=s*e;u[m]=h,u.set(i,m+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const J_=new Y,xC=new Y,SC=new Qt;class Au{constructor(e=new Y(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,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=J_.subVectors(i,t).cross(xC.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 i=e.delta(J_),s=this.normal.dot(i);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(i,u)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||SC.getNormalMatrix(e),s=this.coplanarPoint(J_).applyMatrix4(e),u=this.normal.applyMatrix3(i).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 Cc=new ga,bC=new Pe(.5,.5),I0=new Y;class Jh{constructor(e=new Au,t=new Au,i=new Au,s=new Au,u=new Au,f=new Au){this.planes=[e,t,i,s,u,f]}set(e,t,i,s,u,f){const h=this.planes;return h[0].copy(e),h[1].copy(t),h[2].copy(i),h[3].copy(s),h[4].copy(u),h[5].copy(f),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Fs,i=!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],C=u[10],E=u[11],D=u[12],U=u[13],L=u[14],B=u[15];if(s[0].setComponents(g-f,M-_,E-A,B-D).normalize(),s[1].setComponents(g+f,M+_,E+A,B+D).normalize(),s[2].setComponents(g+h,M+x,E+R,B+U).normalize(),s[3].setComponents(g-h,M-x,E-R,B-U).normalize(),i)s[4].setComponents(m,b,C,L).normalize(),s[5].setComponents(g-m,M-b,E-C,B-L).normalize();else if(s[4].setComponents(g-m,M-b,E-C,B-L).normalize(),t===Fs)s[5].setComponents(g+m,M+b,E+C,B+L).normalize();else if(t===Vh)s[5].setComponents(m,b,C,L).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(),Cc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Cc.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Cc)}intersectsSprite(e){Cc.center.set(0,0,0);const t=bC.distanceTo(e.center);return Cc.radius=.7071067811865476+t,Cc.applyMatrix4(e.matrixWorld),this.intersectsSphere(Cc)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let u=0;u<6;u++)if(t[u].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const s=t[i];if(I0.x=s.normal.x>0?e.max.x:e.min.x,I0.y=s.normal.y>0?e.max.y:e.min.y,I0.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(I0)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Co=new kt,Ro=new Jh;class My{constructor(){this.coordinateSystem=Fs}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const s=t.cameras[i];if(Co.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ro.setFromProjectionMatrix(Co,s.coordinateSystem,s.reversedDepth),Ro.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const s=t.cameras[i];if(Co.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ro.setFromProjectionMatrix(Co,s.coordinateSystem,s.reversedDepth),Ro.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const s=t.cameras[i];if(Co.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ro.setFromProjectionMatrix(Co,s.coordinateSystem,s.reversedDepth),Ro.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const s=t.cameras[i];if(Co.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ro.setFromProjectionMatrix(Co,s.coordinateSystem,s.reversedDepth),Ro.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const s=t.cameras[i];if(Co.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ro.setFromProjectionMatrix(Co,s.coordinateSystem,s.reversedDepth),Ro.containsPoint(e))return!0}return!1}clone(){return new My}}function K_(o,e){return o-e}function MC(o,e){return o.z-e.z}function EC(o,e){return e.z-o.z}class TC{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,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=i,h.index=s}reset(){this.list.length=0,this.index=0}}const bs=new kt,AC=new pt(1,1,1),yM=new Jh,wC=new My,O0=new Ia,Rc=new ga,Pp=new Y,_M=new Y,CC=new Y,$_=new TC,Na=new Gi,z0=[];function RC(o,e,t=0){const i=e.itemSize;if(o.isInterleavedBufferAttribute||o.array.constructor!==e.array.constructor){const s=o.count;for(let u=0;u<s;u++)for(let f=0;f<i;f++)e.setComponent(u+t,f,o.getComponent(u,f))}else e.array.set(o.array,t*i);e.needsUpdate=!0}function Dc(o,e){if(o.constructor!==e.constructor){const t=Math.min(o.length,e.length);for(let i=0;i<t;i++)e[i]=o[i]}else{const t=Math.min(o.length,e.length);e.set(new o.constructor(o.buffer,0,t))}}class UE extends Gi{constructor(e,t,i=t*2,s){super(new Yt,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=i,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),i=new qr(t,e,e,La,es);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new qr(t,e,e,xm,gr);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new qr(t,e,e,La,es);i.colorSpace=xn.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=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(i*m),x=new Hn(_,m,g);t.setAttribute(u,x)}if(e.getIndex()!==null){const u=i>65535?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Hn(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 i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=e.getAttribute(i),u=t.getAttribute(i);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 Ia);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,s=t.length;i<s;i++){if(t[i].active===!1)continue;const u=t[i].geometryIndex;this.getMatrixAt(i,bs),this.getBoundingBoxAt(u,O0).applyMatrix4(bs),e.union(O0)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ga);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,s=t.length;i<s;i++){if(t[i].active===!1)continue;const u=t[i].geometryIndex;this.getMatrixAt(i,bs),this.getBoundingSphereAt(u,Rc).applyMatrix4(bs),e.union(Rc)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(K_),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=i):(s=this._instanceInfo.length,this._instanceInfo.push(i));const u=this._matricesTexture;bs.identity().toArray(u.image.data,s*16),u.needsUpdate=!0;const f=this._colorsTexture;return f&&(AC.toArray(f.image.data,s*4),f.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(e,t=-1,i=-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=i===-1?f.count:i),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(K_),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 i=this.geometry,s=i.getIndex()!==null,u=i.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 i.attributes){const x=t.getAttribute(_),b=i.getAttribute(_);RC(x,b,m);const M=x.itemSize;for(let A=x.count,R=g;A<R;A++){const C=m+A;for(let E=0;E<M;E++)b.setComponent(C,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 i=this._instanceInfo;for(let s=0,u=i.length;s<u;s++)i[s].active&&i[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 i=this._geometryInfo,s=i.map((f,h)=>h).sort((f,h)=>i[f].vertexStart-i[h].vertexStart),u=this.geometry;for(let f=0,h=i.length;f<h;f++){const m=s[f],g=i[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 C=_;C<_+b;C++)A[C]=A[C]+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:C}=A;R.copyWithin(e*C,_*C,(_+x)*C),A.addUpdateRange(e*C,x*C),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 i=this.geometry,s=this._geometryInfo[e];if(s.boundingBox===null){const u=new Ia,f=i.index,h=i.attributes.position;for(let m=s.start,g=s.start+s.count;m<g;m++){let _=m;f&&(_=f.getX(_)),u.expandByPoint(Pp.fromBufferAttribute(h,_))}s.boundingBox=u}return t.copy(s.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[e];if(s.boundingSphere===null){const u=new ga;this.getBoundingBoxAt(e,O0),O0.getCenter(u.center);const f=i.index,h=i.attributes.position;let m=0;for(let g=s.start,_=s.start+s.count;g<_;g++){let x=g;f&&(x=f.getX(x)),Pp.fromBufferAttribute(h,x),m=Math.max(m,u.center.distanceToSquared(Pp))}u.radius=Math.sqrt(m),s.boundingSphere=u}return t.copy(s.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const i=this._matricesTexture,s=this._matricesTexture.image.data;return t.toArray(s,e*16),i.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 i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(K_);t[t.length-1]===i.length-1;)i.pop(),t.pop();if(e<i.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);Dc(this._multiDrawCounts,s),Dc(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(),Dc(f.image.data,this._indirectTexture.image.data),h.dispose(),this._initMatricesTexture(),Dc(h.image.data,this._matricesTexture.image.data),m&&(m.dispose(),this._initColorsTexture(),Dc(m.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(h=>h.active);if(Math.max(...i.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(...i.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 Yt,this._initializeGeometry(u));const f=this.geometry;u.index&&Dc(u.index.array,f.index.array);for(const h in u.attributes)Dc(u.attributes[h].array,f.attributes[h].array)}raycast(e,t){const i=this._instanceInfo,s=this._geometryInfo,u=this.matrixWorld,f=this.geometry;Na.material=this.material,Na.geometry.index=f.index,Na.geometry.attributes=f.attributes,Na.geometry.boundingBox===null&&(Na.geometry.boundingBox=new Ia),Na.geometry.boundingSphere===null&&(Na.geometry.boundingSphere=new ga);for(let h=0,m=i.length;h<m;h++){if(!i[h].visible||!i[h].active)continue;const g=i[h].geometryIndex,_=s[g];Na.geometry.setDrawRange(_.start,_.count),this.getMatrixAt(h,Na.matrixWorld).premultiply(u),this.getBoundingBoxAt(g,Na.geometry.boundingBox),this.getBoundingSphereAt(g,Na.geometry.boundingSphere),Na.raycast(e,z0);for(let x=0,b=z0.length;x<b;x++){const M=z0[x];M.object=this,M.batchId=h,t.push(M)}z0.length=0}Na.material=null,Na.geometry.index=null,Na.geometry.attributes={},Na.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,i,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=i.isArrayCamera?wC:yM;b&&!i.isArrayCamera&&(bs.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),yM.setFromProjectionMatrix(bs,i.coordinateSystem,i.reversedDepth));let C=0;if(this.sortObjects){bs.copy(this.matrixWorld).invert(),Pp.setFromMatrixPosition(i.matrixWorld).applyMatrix4(bs),_M.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(bs);for(let U=0,L=m.length;U<L;U++)if(m[U].visible&&m[U].active){const B=m[U].geometryIndex;this.getMatrixAt(U,bs),this.getBoundingSphereAt(B,Rc).applyMatrix4(bs);let P=!1;if(b&&(P=!R.intersectsSphere(Rc,i)),!P){const H=x[B],W=CC.subVectors(Rc.center,Pp).dot(_M);$_.push(H.start,H.count,W,U)}}const E=$_.list,D=this.customSort;D===null?E.sort(u.transparent?EC:MC):D.call(this,E,i);for(let U=0,L=E.length;U<L;U++){const B=E[U];g[C]=B.start*h,_[C]=B.count,A[C]=B.index,C++}$_.reset()}else for(let E=0,D=m.length;E<D;E++)if(m[E].visible&&m[E].active){const U=m[E].geometryIndex;let L=!1;if(b&&(this.getMatrixAt(E,bs),this.getBoundingSphereAt(U,Rc).applyMatrix4(bs),L=!R.intersectsSphere(Rc,i)),!L){const B=x[U];g[C]=B.start*h,_[C]=B.count,A[C]=E,C++}}M.needsUpdate=!0,this._multiDrawCount=C,this._visibilityChanged=!1}onBeforeShadow(e,t,i,s,u,f){this.onBeforeRender(e,null,s,u,f)}}class ns extends Oa{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new pt(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 Qv=new Y,Jv=new Y,xM=new kt,Bp=new Qh,P0=new ga,ex=new Y,SM=new Y;class Ou extends An{constructor(e=new Yt,t=new ns){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,i=[0];for(let s=1,u=t.count;s<u;s++)Qv.fromBufferAttribute(t,s-1),Jv.fromBufferAttribute(t,s),i[s]=i[s-1],i[s]+=Qv.distanceTo(Jv);e.setAttribute("lineDistance",new yt(i,1))}else rt("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,s=this.matrixWorld,u=e.params.Line.threshold,f=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),P0.copy(i.boundingSphere),P0.applyMatrix4(s),P0.radius+=u,e.ray.intersectsSphere(P0)===!1)return;xM.copy(s).invert(),Bp.copy(e.ray).applyMatrix4(xM);const h=u/((this.scale.x+this.scale.y+this.scale.z)/3),m=h*h,g=this.isLineSegments?2:1,_=i.index,b=i.attributes.position;if(_!==null){const M=Math.max(0,f.start),A=Math.min(_.count,f.start+f.count);for(let R=M,C=A-1;R<C;R+=g){const E=_.getX(R),D=_.getX(R+1),U=B0(this,e,Bp,m,E,D,R);U&&t.push(U)}if(this.isLineLoop){const R=_.getX(A-1),C=_.getX(M),E=B0(this,e,Bp,m,R,C,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,C=A-1;R<C;R+=g){const E=B0(this,e,Bp,m,R,R+1,R);E&&t.push(E)}if(this.isLineLoop){const R=B0(this,e,Bp,m,A-1,M,A-1);R&&t.push(R)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[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 B0(o,e,t,i,s,u,f){const h=o.geometry.attributes.position;if(Qv.fromBufferAttribute(h,s),Jv.fromBufferAttribute(h,u),t.distanceSqToSegment(Qv,Jv,ex,SM)>i)return;ex.applyMatrix4(o.matrixWorld);const g=e.ray.origin.distanceTo(ex);if(!(g<e.near||g>e.far))return{distance:g,point:SM.clone().applyMatrix4(o.matrixWorld),index:f,face:null,faceIndex:null,barycoord:null,object:o}}const bM=new Y,MM=new Y;class Fo extends Ou{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,i=[];for(let s=0,u=t.count;s<u;s+=2)bM.fromBufferAttribute(t,s),MM.fromBufferAttribute(t,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+bM.distanceTo(MM);e.setAttribute("lineDistance",new yt(i,1))}else rt("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LE extends Ou{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class bS extends Oa{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new pt(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 EM=new kt,Ox=new Qh,F0=new ga,V0=new Y;class IE extends An{constructor(e=new Yt,t=new bS){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 i=this.geometry,s=this.matrixWorld,u=e.params.Points.threshold,f=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),F0.copy(i.boundingSphere),F0.applyMatrix4(s),F0.radius+=u,e.ray.intersectsSphere(F0)===!1)return;EM.copy(s).invert(),Ox.copy(e.ray).applyMatrix4(EM);const h=u/((this.scale.x+this.scale.y+this.scale.z)/3),m=h*h,g=i.index,x=i.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 C=g.getX(A);V0.fromBufferAttribute(x,C),TM(V0,C,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++)V0.fromBufferAttribute(x,A),TM(V0,A,m,s,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[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 TM(o,e,t,i,s,u,f){const h=Ox.distanceSqToPoint(o);if(h<t){const m=new Y;Ox.closestPointToPoint(o,m),m.applyMatrix4(i);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 OE extends Ei{constructor(e,t,i,s,u=ai,f=ai,h,m,g){super(e,t,i,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 DC extends OE{constructor(e,t,i,s,u,f,h,m){super({},e,t,i,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 NC extends Ei{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Li,this.minFilter=Li,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ey extends Ei{constructor(e,t,i,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:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class UC extends Ey{constructor(e,t,i,s,u,f){super(e,t,i,u,f),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=As,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class LC extends Ey{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Oo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class IC extends Ei{constructor(e,t,i,s,u,f,h,m,g){super(e,t,i,s,u,f,h,m,g),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qh extends Ei{constructor(e,t,i=gr,s,u,f,h=Li,m=Li,g,_=Po,x=1){if(_!==Po&&_!==Ru)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,_,i,g),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Du(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 zE extends qh{constructor(e,t=gr,i=Oo,s,u,f=Li,h=Li,m,g=Po){const _={width:e,height:e,depth:1},x=[_,_,_,_,_,_];super(e,e,t,i,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 MS extends Ei{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ty extends Yt{constructor(e=1,t=1,i=4,s=8,u=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:s,heightSegments:u},t=Math.max(0,t),i=Math.max(1,Math.floor(i)),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=i*2+u,R=s+1,C=new Y,E=new Y;for(let D=0;D<=A;D++){let U=0,L=0,B=0,P=0;if(D<=i){const I=D/i,z=I*Math.PI/2;L=-_-e*Math.cos(z),B=e*Math.sin(z),P=-e*Math.cos(z),U=I*x}else if(D<=i+u){const I=(D-i)/u;L=-_+I*t,B=e,P=0,U=x+I*b}else{const I=(D-i-u)/i,z=I*Math.PI/2;L=_+e*Math.sin(z),B=e*Math.cos(z),P=e*Math.sin(z),U=x+b+I*x}const H=Math.max(0,Math.min(1,U/M));let W=0;D===0?W=.5/s:D===A&&(W=-.5/s);for(let I=0;I<=s;I++){const z=I/s,j=z*Math.PI*2,ae=Math.sin(j),$=Math.cos(j);E.x=-B*$,E.y=L,E.z=B*ae,h.push(E.x,E.y,E.z),C.set(-B*$,P,B*ae),C.normalize(),m.push(C.x,C.y,C.z),g.push(z+W,H)}if(D>0){const I=(D-1)*R;for(let z=0;z<s;z++){const j=I+z,ae=I+z+1,$=D*R+z,ue=D*R+z+1;f.push(j,ae,$),f.push(ae,ue,$)}}}this.setIndex(f),this.setAttribute("position",new yt(h,3)),this.setAttribute("normal",new yt(m,3)),this.setAttribute("uv",new yt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ty(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Ay extends Yt{constructor(e=1,t=32,i=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:s},t=Math.max(3,t);const u=[],f=[],h=[],m=[],g=new Y,_=new Pe;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=i+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 yt(f,3)),this.setAttribute("normal",new yt(h,3)),this.setAttribute("uv",new yt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ay(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class bm extends Yt{constructor(e=1,t=1,i=1,s=32,u=1,f=!1,h=0,m=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,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=[],C=i/2;let E=0;D(),f===!1&&(e>0&&U(!0),t>0&&U(!1)),this.setIndex(_),this.setAttribute("position",new yt(x,3)),this.setAttribute("normal",new yt(b,3)),this.setAttribute("uv",new yt(M,2));function D(){const L=new Y,B=new Y;let P=0;const H=(t-e)/i;for(let W=0;W<=u;W++){const I=[],z=W/u,j=z*(t-e)+e;for(let ae=0;ae<=s;ae++){const $=ae/s,ue=$*m+h,he=Math.sin(ue),q=Math.cos(ue);B.x=j*he,B.y=-z*i+C,B.z=j*q,x.push(B.x,B.y,B.z),L.set(he,H,q).normalize(),b.push(L.x,L.y,L.z),M.push($,1-z),I.push(A++)}R.push(I)}for(let W=0;W<s;W++)for(let I=0;I<u;I++){const z=R[I][W],j=R[I+1][W],ae=R[I+1][W+1],$=R[I][W+1];(e>0||I!==0)&&(_.push(z,j,$),P+=3),(t>0||I!==u-1)&&(_.push(j,ae,$),P+=3)}g.addGroup(E,P,0),E+=P}function U(L){const B=A,P=new Pe,H=new Y;let W=0;const I=L===!0?e:t,z=L===!0?1:-1;for(let ae=1;ae<=s;ae++)x.push(0,C*z,0),b.push(0,z,0),M.push(.5,.5),A++;const j=A;for(let ae=0;ae<=s;ae++){const ue=ae/s*m+h,he=Math.cos(ue),q=Math.sin(ue);H.x=I*q,H.y=C*z,H.z=I*he,x.push(H.x,H.y,H.z),b.push(0,z,0),P.x=he*.5+.5,P.y=q*.5*z+.5,M.push(P.x,P.y),A++}for(let ae=0;ae<s;ae++){const $=B+ae,ue=j+ae;L===!0?_.push(ue,ue+1,$):_.push(ue+1,ue,$),W+=3}g.addGroup(E,W,L===!0?1:2),E+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bm(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Mm extends bm{constructor(e=1,t=1,i=32,s=1,u=!1,f=0,h=Math.PI*2){super(0,e,t,i,s,u,f,h),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:s,openEnded:u,thetaStart:f,thetaLength:h}}static fromJSON(e){return new Mm(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Bu extends Yt{constructor(e=[],t=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:s};const u=[],f=[];h(s),g(i),_(),this.setAttribute("position",new yt(u,3)),this.setAttribute("normal",new yt(u.slice(),3)),this.setAttribute("uv",new yt(f,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function h(D){const U=new Y,L=new Y,B=new Y;for(let P=0;P<t.length;P+=3)M(t[P+0],U),M(t[P+1],L),M(t[P+2],B),m(U,L,B,D)}function m(D,U,L,B){const P=B+1,H=[];for(let W=0;W<=P;W++){H[W]=[];const I=D.clone().lerp(L,W/P),z=U.clone().lerp(L,W/P),j=P-W;for(let ae=0;ae<=j;ae++)ae===0&&W===P?H[W][ae]=I:H[W][ae]=I.clone().lerp(z,ae/j)}for(let W=0;W<P;W++)for(let I=0;I<2*(P-W)-1;I++){const z=Math.floor(I/2);I%2===0?(b(H[W][z+1]),b(H[W+1][z]),b(H[W][z])):(b(H[W][z+1]),b(H[W+1][z+1]),b(H[W+1][z]))}}function g(D){const U=new Y;for(let L=0;L<u.length;L+=3)U.x=u[L+0],U.y=u[L+1],U.z=u[L+2],U.normalize().multiplyScalar(D),u[L+0]=U.x,u[L+1]=U.y,u[L+2]=U.z}function _(){const D=new Y;for(let U=0;U<u.length;U+=3){D.x=u[U+0],D.y=u[U+1],D.z=u[U+2];const L=C(D)/2/Math.PI+.5,B=E(D)/Math.PI+.5;f.push(L,1-B)}A(),x()}function x(){for(let D=0;D<f.length;D+=6){const U=f[D+0],L=f[D+2],B=f[D+4],P=Math.max(U,L,B),H=Math.min(U,L,B);P>.9&&H<.1&&(U<.2&&(f[D+0]+=1),L<.2&&(f[D+2]+=1),B<.2&&(f[D+4]+=1))}}function b(D){u.push(D.x,D.y,D.z)}function M(D,U){const L=D*3;U.x=e[L+0],U.y=e[L+1],U.z=e[L+2]}function A(){const D=new Y,U=new Y,L=new Y,B=new Y,P=new Pe,H=new Pe,W=new Pe;for(let I=0,z=0;I<u.length;I+=9,z+=6){D.set(u[I+0],u[I+1],u[I+2]),U.set(u[I+3],u[I+4],u[I+5]),L.set(u[I+6],u[I+7],u[I+8]),P.set(f[z+0],f[z+1]),H.set(f[z+2],f[z+3]),W.set(f[z+4],f[z+5]),B.copy(D).add(U).add(L).divideScalar(3);const j=C(B);R(P,z+0,D,j),R(H,z+2,U,j),R(W,z+4,L,j)}}function R(D,U,L,B){B<0&&D.x===1&&(f[U]=D.x-1),L.x===0&&L.z===0&&(f[U]=B/2/Math.PI+.5)}function C(D){return Math.atan2(D.z,-D.x)}function E(D){return Math.atan2(-D.y,Math.sqrt(D.x*D.x+D.z*D.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bu(e.vertices,e.indices,e.radius,e.detail)}}class wy extends Bu{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,s=1/i,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,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,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 wy(e.radius,e.detail)}}const k0=new Y,H0=new Y,tx=new Y,G0=new Ts;class PE extends Yt{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(qc*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:C,c:E}=G0;if(R.fromBufferAttribute(h,g[0]),C.fromBufferAttribute(h,g[1]),E.fromBufferAttribute(h,g[2]),G0.getNormal(tx),x[0]=`${Math.round(R.x*s)},${Math.round(R.y*s)},${Math.round(R.z*s)}`,x[1]=`${Math.round(C.x*s)},${Math.round(C.y*s)},${Math.round(C.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 D=0;D<3;D++){const U=(D+1)%3,L=x[D],B=x[U],P=G0[_[D]],H=G0[_[U]],W=`${L}_${B}`,I=`${B}_${L}`;I in b&&b[I]?(tx.dot(b[I].normal)<=u&&(M.push(P.x,P.y,P.z),M.push(H.x,H.y,H.z)),b[I]=null):W in b||(b[W]={index0:g[D],index1:g[U],normal:tx.clone()})}}for(const A in b)if(b[A]){const{index0:R,index1:C}=b[A];k0.fromBufferAttribute(h,R),H0.fromBufferAttribute(h,C),M.push(k0.x,k0.y,k0.z),M.push(H0.x,H0.y,H0.z)}this.setAttribute("position",new yt(M,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Yr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){rt("Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,s=this.getPoint(0),u=0;t.push(0);for(let f=1;f<=e;f++)i=this.getPoint(f/e),u+=i.distanceTo(s),t.push(u),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let s=0;const u=i.length;let f;t?f=t:f=e*i[u-1];let h=0,m=u-1,g;for(;h<=m;)if(s=Math.floor(h+(m-h)/2),g=i[s]-f,g<0)h=s+1;else if(g>0)m=s-1;else{m=s;break}if(s=m,i[s]===f)return s/(u-1);const _=i[s],b=i[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 Pe:new Y);return m.copy(h).sub(f).normalize(),m}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new Y,s=[],u=[],f=[],h=new Y,m=new kt;for(let M=0;M<=e;M++){const A=M/e;s[M]=this.getTangentAt(A,new Y)}u[0]=new Y,f[0]=new Y;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=_,i.set(1,0,0)),x<=g&&(g=x,i.set(0,1,0)),b<=g&&i.set(0,0,1),h.crossVectors(s[0],i).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(Ft(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(Ft(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 Cy extends Yr{constructor(e=0,t=0,i=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=i,this.yRadius=s,this.aStartAngle=u,this.aEndAngle=f,this.aClockwise=h,this.aRotation=m}getPoint(e,t=new Pe){const i=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 i.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 BE extends Cy{constructor(e,t,i,s,u,f){super(e,t,i,i,s,u,f),this.isArcCurve=!0,this.type="ArcCurve"}}function ES(){let o=0,e=0,t=0,i=0;function s(u,f,h,m){o=u,e=h,t=-3*u+3*f-2*h-m,i=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 o+e*u+t*f+i*h}}}const X0=new Y,nx=new ES,ix=new ES,ax=new ES;class FE extends Yr{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=s}getPoint(e,t=new Y){const i=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]:(X0.subVectors(s[0],s[1]).add(s[0]),g=X0);const x=s[h%u],b=s[(h+1)%u];if(this.closed||h+2<u?_=s[(h+2)%u]:(X0.subVectors(s[u-1],s[u-2]).add(s[u-1]),_=X0),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),C=Math.pow(b.distanceToSquared(_),M);R<1e-4&&(R=1),A<1e-4&&(A=R),C<1e-4&&(C=R),nx.initNonuniformCatmullRom(g.x,x.x,b.x,_.x,A,R,C),ix.initNonuniformCatmullRom(g.y,x.y,b.y,_.y,A,R,C),ax.initNonuniformCatmullRom(g.z,x.z,b.z,_.z,A,R,C)}else this.curveType==="catmullrom"&&(nx.initCatmullRom(g.x,x.x,b.x,_.x,this.tension),ix.initCatmullRom(g.y,x.y,b.y,_.y,this.tension),ax.initCatmullRom(g.z,x.z,b.z,_.z,this.tension));return i.set(nx.calc(m),ix.calc(m),ax.calc(m)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;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,i=this.points.length;t<i;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,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(new Y().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function AM(o,e,t,i,s){const u=(i-e)*.5,f=(s-t)*.5,h=o*o,m=o*h;return(2*t-2*i+u+f)*m+(-3*t+3*i-2*u-f)*h+u*o+t}function OC(o,e){const t=1-o;return t*t*e}function zC(o,e){return 2*(1-o)*o*e}function PC(o,e){return o*o*e}function Jp(o,e,t,i){return OC(o,e)+zC(o,t)+PC(o,i)}function BC(o,e){const t=1-o;return t*t*t*e}function FC(o,e){const t=1-o;return 3*t*t*o*e}function VC(o,e){return 3*(1-o)*o*o*e}function kC(o,e){return o*o*o*e}function Kp(o,e,t,i,s){return BC(o,e)+FC(o,t)+VC(o,i)+kC(o,s)}class TS extends Yr{constructor(e=new Pe,t=new Pe,i=new Pe,s=new Pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new Pe){const i=t,s=this.v0,u=this.v1,f=this.v2,h=this.v3;return i.set(Kp(e,s.x,u.x,f.x,h.x),Kp(e,s.y,u.y,f.y,h.y)),i}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 VE extends Yr{constructor(e=new Y,t=new Y,i=new Y,s=new Y){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new Y){const i=t,s=this.v0,u=this.v1,f=this.v2,h=this.v3;return i.set(Kp(e,s.x,u.x,f.x,h.x),Kp(e,s.y,u.y,f.y,h.y),Kp(e,s.z,u.z,f.z,h.z)),i}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 AS extends Yr{constructor(e=new Pe,t=new Pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Pe){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Pe){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 kE extends Yr{constructor(e=new Y,t=new Y){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Y){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Y){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 wS extends Yr{constructor(e=new Pe,t=new Pe,i=new Pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Pe){const i=t,s=this.v0,u=this.v1,f=this.v2;return i.set(Jp(e,s.x,u.x,f.x),Jp(e,s.y,u.y,f.y)),i}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 CS extends Yr{constructor(e=new Y,t=new Y,i=new Y){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Y){const i=t,s=this.v0,u=this.v1,f=this.v2;return i.set(Jp(e,s.x,u.x,f.x),Jp(e,s.y,u.y,f.y),Jp(e,s.z,u.z,f.z)),i}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 RS extends Yr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Pe){const i=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 i.set(AM(h,m.x,g.x,_.x,x.x),AM(h,m.y,g.y,_.y,x.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(new Pe().fromArray(s))}return this}}var Kv=Object.freeze({__proto__:null,ArcCurve:BE,CatmullRomCurve3:FE,CubicBezierCurve:TS,CubicBezierCurve3:VE,EllipseCurve:Cy,LineCurve:AS,LineCurve3:kE,QuadraticBezierCurve:wS,QuadraticBezierCurve3:CS,SplineCurve:RS});class HE extends Yr{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 i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Kv[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),s=this.getCurveLengths();let u=0;for(;u<s.length;){if(s[u]>=i){const f=s[u]-i,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 i=0,s=this.curves.length;i<s;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;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];i&&i.equals(_)||(t.push(_),i=_)}}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,i=e.curves.length;t<i;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,i=this.curves.length;t<i;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,i=e.curves.length;t<i;t++){const s=e.curves[t];this.curves.push(new Kv[s.type]().fromJSON(s))}return this}}class $v extends HE{constructor(e){super(),this.type="Path",this.currentPoint=new Pe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new AS(this.currentPoint.clone(),new Pe(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,s){const u=new wS(this.currentPoint.clone(),new Pe(e,t),new Pe(i,s));return this.curves.push(u),this.currentPoint.set(i,s),this}bezierCurveTo(e,t,i,s,u,f){const h=new TS(this.currentPoint.clone(),new Pe(e,t),new Pe(i,s),new Pe(u,f));return this.curves.push(h),this.currentPoint.set(u,f),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new RS(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,s,u,f){const h=this.currentPoint.x,m=this.currentPoint.y;return this.absarc(e+h,t+m,i,s,u,f),this}absarc(e,t,i,s,u,f){return this.absellipse(e,t,i,i,s,u,f),this}ellipse(e,t,i,s,u,f,h,m){const g=this.currentPoint.x,_=this.currentPoint.y;return this.absellipse(e+g,t+_,i,s,u,f,h,m),this}absellipse(e,t,i,s,u,f,h,m){const g=new Cy(e,t,i,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 Yc extends $v{constructor(e){super(e),this.uuid=Vs(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,s=this.holes.length;i<s;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;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,i=this.holes.length;t<i;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,i=e.holes.length;t<i;t++){const s=e.holes[t];this.holes.push(new $v().fromJSON(s))}return this}}function HC(o,e,t=2){const i=e&&e.length,s=i?e[0]*t:o.length;let u=GE(o,0,s,t,!0);const f=[];if(!u||u.next===u.prev)return f;let h,m,g;if(i&&(u=YC(o,e,u,t)),o.length>80*t){h=o[0],m=o[1];let _=h,x=m;for(let b=t;b<s;b+=t){const M=o[b],A=o[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 cm(u,f,t,h,m,g,0),f}function GE(o,e,t,i,s){let u;if(s===a3(o,e,t,i)>0)for(let f=e;f<t;f+=i)u=wM(f/i|0,o[f],o[f+1],u);else for(let f=t-i;f>=e;f-=i)u=wM(f/i|0,o[f],o[f+1],u);return u&&Yh(u,u.next)&&(hm(u),u=u.next),u}function Jc(o,e){if(!o)return o;e||(e=o);let t=o,i;do if(i=!1,!t.steiner&&(Yh(t,t.next)||gi(t.prev,t,t.next)===0)){if(hm(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function cm(o,e,t,i,s,u,f){if(!o)return;!f&&u&&KC(o,i,s,u);let h=o;for(;o.prev!==o.next;){const m=o.prev,g=o.next;if(u?XC(o,i,s,u):GC(o)){e.push(m.i,o.i,g.i),hm(o),o=g.next,h=g.next;continue}if(o=g,o===h){f?f===1?(o=WC(Jc(o),e),cm(o,e,t,i,s,u,2)):f===2&&qC(o,e,t,i,s,u):cm(Jc(o),e,t,i,s,u,1);break}}}function GC(o){const e=o.prev,t=o,i=o.next;if(gi(e,t,i)>=0)return!1;const s=e.x,u=t.x,f=i.x,h=e.y,m=t.y,g=i.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=i.next;for(;A!==e;){if(A.x>=_&&A.x<=b&&A.y>=x&&A.y<=M&&Hp(s,h,u,m,f,g,A.x,A.y)&&gi(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function XC(o,e,t,i){const s=o.prev,u=o,f=o.next;if(gi(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),C=Math.max(_,x,b),E=zx(M,A,e,t,i),D=zx(R,C,e,t,i);let U=o.prevZ,L=o.nextZ;for(;U&&U.z>=E&&L&&L.z<=D;){if(U.x>=M&&U.x<=R&&U.y>=A&&U.y<=C&&U!==s&&U!==f&&Hp(h,_,m,x,g,b,U.x,U.y)&&gi(U.prev,U,U.next)>=0||(U=U.prevZ,L.x>=M&&L.x<=R&&L.y>=A&&L.y<=C&&L!==s&&L!==f&&Hp(h,_,m,x,g,b,L.x,L.y)&&gi(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;U&&U.z>=E;){if(U.x>=M&&U.x<=R&&U.y>=A&&U.y<=C&&U!==s&&U!==f&&Hp(h,_,m,x,g,b,U.x,U.y)&&gi(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;L&&L.z<=D;){if(L.x>=M&&L.x<=R&&L.y>=A&&L.y<=C&&L!==s&&L!==f&&Hp(h,_,m,x,g,b,L.x,L.y)&&gi(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function WC(o,e){let t=o;do{const i=t.prev,s=t.next.next;!Yh(i,s)&&WE(i,t,t.next,s)&&fm(i,s)&&fm(s,i)&&(e.push(i.i,t.i,s.i),hm(t),hm(t.next),t=o=s),t=t.next}while(t!==o);return Jc(t)}function qC(o,e,t,i,s,u){let f=o;do{let h=f.next.next;for(;h!==f.prev;){if(f.i!==h.i&&t3(f,h)){let m=qE(f,h);f=Jc(f,f.next),m=Jc(m,m.next),cm(f,e,t,i,s,u,0),cm(m,e,t,i,s,u,0);return}h=h.next}f=f.next}while(f!==o)}function YC(o,e,t,i){const s=[];for(let u=0,f=e.length;u<f;u++){const h=e[u]*i,m=u<f-1?e[u+1]*i:o.length,g=GE(o,h,m,i,!1);g===g.next&&(g.steiner=!0),s.push(e3(g))}s.sort(ZC);for(let u=0;u<s.length;u++)t=jC(s[u],t);return t}function ZC(o,e){let t=o.x-e.x;if(t===0&&(t=o.y-e.y,t===0)){const i=(o.next.y-o.y)/(o.next.x-o.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=i-s}return t}function jC(o,e){const t=QC(o,e);if(!t)return e;const i=qE(t,o);return Jc(i,i.next),Jc(t,t.next)}function QC(o,e){let t=e;const i=o.x,s=o.y;let u=-1/0,f;if(Yh(o,t))return t;do{if(Yh(o,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<=i&&x>u&&(u=x,f=t.x<t.next.x?t:t.next,x===i))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(i>=t.x&&t.x>=m&&i!==t.x&&XE(s<g?i:u,s,m,g,s<g?u:i,s,t.x,t.y)){const x=Math.abs(s-t.y)/(i-t.x);fm(t,o)&&(x<_||x===_&&(t.x>f.x||t.x===f.x&&JC(f,t)))&&(f=t,_=x)}t=t.next}while(t!==h);return f}function JC(o,e){return gi(o.prev,o,e.prev)<0&&gi(e.next,o,o.next)<0}function KC(o,e,t,i){let s=o;do s.z===0&&(s.z=zx(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==o);s.prevZ.nextZ=null,s.prevZ=null,$C(s)}function $C(o){let e,t=1;do{let i=o,s;o=null;let u=null;for(e=0;i;){e++;let f=i,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||i.z<=f.z)?(s=i,i=i.nextZ,h--):(s=f,f=f.nextZ,m--),u?u.nextZ=s:o=s,s.prevZ=u,u=s;i=f}u.nextZ=null,t*=2}while(e>1);return o}function zx(o,e,t,i,s){return o=(o-t)*s|0,e=(e-i)*s|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function e3(o){let e=o,t=o;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==o);return t}function XE(o,e,t,i,s,u,f,h){return(s-f)*(e-h)>=(o-f)*(u-h)&&(o-f)*(i-h)>=(t-f)*(e-h)&&(t-f)*(u-h)>=(s-f)*(i-h)}function Hp(o,e,t,i,s,u,f,h){return!(o===f&&e===h)&&XE(o,e,t,i,s,u,f,h)}function t3(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!n3(o,e)&&(fm(o,e)&&fm(e,o)&&i3(o,e)&&(gi(o.prev,o,e.prev)||gi(o,e.prev,e))||Yh(o,e)&&gi(o.prev,o,o.next)>0&&gi(e.prev,e,e.next)>0)}function gi(o,e,t){return(e.y-o.y)*(t.x-e.x)-(e.x-o.x)*(t.y-e.y)}function Yh(o,e){return o.x===e.x&&o.y===e.y}function WE(o,e,t,i){const s=q0(gi(o,e,t)),u=q0(gi(o,e,i)),f=q0(gi(t,i,o)),h=q0(gi(t,i,e));return!!(s!==u&&f!==h||s===0&&W0(o,t,e)||u===0&&W0(o,i,e)||f===0&&W0(t,o,i)||h===0&&W0(t,e,i))}function W0(o,e,t){return e.x<=Math.max(o.x,t.x)&&e.x>=Math.min(o.x,t.x)&&e.y<=Math.max(o.y,t.y)&&e.y>=Math.min(o.y,t.y)}function q0(o){return o>0?1:o<0?-1:0}function n3(o,e){let t=o;do{if(t.i!==o.i&&t.next.i!==o.i&&t.i!==e.i&&t.next.i!==e.i&&WE(t,t.next,o,e))return!0;t=t.next}while(t!==o);return!1}function fm(o,e){return gi(o.prev,o,o.next)<0?gi(o,e,o.next)>=0&&gi(o,o.prev,e)>=0:gi(o,e,o.prev)<0||gi(o,o.next,e)<0}function i3(o,e){let t=o,i=!1;const s=(o.x+e.x)/2,u=(o.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&&(i=!i),t=t.next;while(t!==o);return i}function qE(o,e){const t=Px(o.i,o.x,o.y),i=Px(e.i,e.x,e.y),s=o.next,u=e.prev;return o.next=e,e.prev=o,t.next=s,s.prev=t,i.next=t,t.prev=i,u.next=i,i.prev=u,i}function wM(o,e,t,i){const s=Px(o,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function hm(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Px(o,e,t){return{i:o,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function a3(o,e,t,i){let s=0;for(let u=e,f=t-i;u<t;u+=i)s+=(o[f]-o[u])*(o[u+1]+o[f+1]),f=u;return s}class s3{static triangulate(e,t,i=2){return HC(e,t,i)}}class Wr{static area(e){const t=e.length;let i=0;for(let s=t-1,u=0;u<t;s=u++)i+=e[s].x*e[u].y-e[u].x*e[s].y;return i*.5}static isClockWise(e){return Wr.area(e)<0}static triangulateShape(e,t){const i=[],s=[],u=[];CM(e),RM(i,e);let f=e.length;t.forEach(CM);for(let m=0;m<t.length;m++)s.push(f),f+=t[m].length,RM(i,t[m]);const h=s3.triangulate(i,s);for(let m=0;m<h.length;m+=3)u.push(h.slice(m,m+3));return u}}function CM(o){const e=o.length;e>2&&o[e-1].equals(o[0])&&o.pop()}function RM(o,e){for(let t=0;t<e.length;t++)o.push(e[t].x),o.push(e[t].y)}class Ry extends Yt{constructor(e=new Yc([new Pe(.5,.5),new Pe(-.5,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,s=[],u=[];for(let h=0,m=e.length;h<m;h++){const g=e[h];f(g)}this.setAttribute("position",new yt(s,3)),this.setAttribute("uv",new yt(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,C=t.bevelSegments!==void 0?t.bevelSegments:3;const E=t.extrudePath,D=t.UVGenerator!==void 0?t.UVGenerator:r3;let U,L=!1,B,P,H,W;if(E){U=E.getSpacedPoints(_),L=!0,b=!1;const Re=E.isCatmullRomCurve3?E.closed:!1;B=E.computeFrenetFrames(_,Re),P=new Y,H=new Y,W=new Y}b||(C=0,M=0,A=0,R=0);const I=h.extractPoints(g);let z=I.shape;const j=I.holes;if(!Wr.isClockWise(z)){z=z.reverse();for(let Re=0,Ve=j.length;Re<Ve;Re++){const Ue=j[Re];Wr.isClockWise(Ue)&&(j[Re]=Ue.reverse())}}function $(Re){const Ue=10000000000000001e-36;let Ke=Re[0];for(let Z=1;Z<=Re.length;Z++){const St=Z%Re.length,tt=Re[St],Mt=tt.x-Ke.x,We=tt.y-Ke.y,G=Mt*Mt+We*We,O=Math.max(Math.abs(tt.x),Math.abs(tt.y),Math.abs(Ke.x),Math.abs(Ke.y)),ne=Ue*O*O;if(G<=ne){Re.splice(St,1),Z--;continue}Ke=tt}}$(z),j.forEach($);const ue=j.length,he=z;for(let Re=0;Re<ue;Re++){const Ve=j[Re];z=z.concat(Ve)}function q(Re,Ve,Ue){return Ve||Tt("ExtrudeGeometry: vec does not exist"),Re.clone().addScaledVector(Ve,Ue)}const K=z.length;function ce(Re,Ve,Ue){let Ke,Z,St;const tt=Re.x-Ve.x,Mt=Re.y-Ve.y,We=Ue.x-Re.x,G=Ue.y-Re.y,O=tt*tt+Mt*Mt,ne=tt*G-Mt*We;if(Math.abs(ne)>Number.EPSILON){const Se=Math.sqrt(O),Le=Math.sqrt(We*We+G*G),be=Ve.x-Mt/Se,ct=Ve.y+tt/Se,Ze=Ue.x-G/Le,gt=Ue.y+We/Le,wt=((Ze-be)*G-(gt-ct)*We)/(tt*G-Mt*We);Ke=be+tt*wt-Re.x,Z=ct+Mt*wt-Re.y;const Be=Ke*Ke+Z*Z;if(Be<=2)return new Pe(Ke,Z);St=Math.sqrt(Be/2)}else{let Se=!1;tt>Number.EPSILON?We>Number.EPSILON&&(Se=!0):tt<-Number.EPSILON?We<-Number.EPSILON&&(Se=!0):Math.sign(Mt)===Math.sign(G)&&(Se=!0),Se?(Ke=-Mt,Z=tt,St=Math.sqrt(O)):(Ke=tt,Z=Mt,St=Math.sqrt(O/2))}return new Pe(Ke/St,Z/St)}const Ae=[];for(let Re=0,Ve=he.length,Ue=Ve-1,Ke=Re+1;Re<Ve;Re++,Ue++,Ke++)Ue===Ve&&(Ue=0),Ke===Ve&&(Ke=0),Ae[Re]=ce(he[Re],he[Ue],he[Ke]);const Ce=[];let X,se=Ae.concat();for(let Re=0,Ve=ue;Re<Ve;Re++){const Ue=j[Re];X=[];for(let Ke=0,Z=Ue.length,St=Z-1,tt=Ke+1;Ke<Z;Ke++,St++,tt++)St===Z&&(St=0),tt===Z&&(tt=0),X[Ke]=ce(Ue[Ke],Ue[St],Ue[tt]);Ce.push(X),se=se.concat(X)}let Ee;if(C===0)Ee=Wr.triangulateShape(he,j);else{const Re=[],Ve=[];for(let Ue=0;Ue<C;Ue++){const Ke=Ue/C,Z=M*Math.cos(Ke*Math.PI/2),St=A*Math.sin(Ke*Math.PI/2)+R;for(let tt=0,Mt=he.length;tt<Mt;tt++){const We=q(he[tt],Ae[tt],St);et(We.x,We.y,-Z),Ke===0&&Re.push(We)}for(let tt=0,Mt=ue;tt<Mt;tt++){const We=j[tt];X=Ce[tt];const G=[];for(let O=0,ne=We.length;O<ne;O++){const Se=q(We[O],X[O],St);et(Se.x,Se.y,-Z),Ke===0&&G.push(Se)}Ke===0&&Ve.push(G)}}Ee=Wr.triangulateShape(Re,Ve)}const Oe=Ee.length,nt=A+R;for(let Re=0;Re<K;Re++){const Ve=b?q(z[Re],se[Re],nt):z[Re];L?(H.copy(B.normals[0]).multiplyScalar(Ve.x),P.copy(B.binormals[0]).multiplyScalar(Ve.y),W.copy(U[0]).add(H).add(P),et(W.x,W.y,W.z)):et(Ve.x,Ve.y,0)}for(let Re=1;Re<=_;Re++)for(let Ve=0;Ve<K;Ve++){const Ue=b?q(z[Ve],se[Ve],nt):z[Ve];L?(H.copy(B.normals[Re]).multiplyScalar(Ue.x),P.copy(B.binormals[Re]).multiplyScalar(Ue.y),W.copy(U[Re]).add(H).add(P),et(W.x,W.y,W.z)):et(Ue.x,Ue.y,x/_*Re)}for(let Re=C-1;Re>=0;Re--){const Ve=Re/C,Ue=M*Math.cos(Ve*Math.PI/2),Ke=A*Math.sin(Ve*Math.PI/2)+R;for(let Z=0,St=he.length;Z<St;Z++){const tt=q(he[Z],Ae[Z],Ke);et(tt.x,tt.y,x+Ue)}for(let Z=0,St=j.length;Z<St;Z++){const tt=j[Z];X=Ce[Z];for(let Mt=0,We=tt.length;Mt<We;Mt++){const G=q(tt[Mt],X[Mt],Ke);L?et(G.x,G.y+U[_-1].y,U[_-1].x+Ue):et(G.x,G.y,x+Ue)}}}fe(),Te();function fe(){const Re=s.length/3;if(b){let Ve=0,Ue=K*Ve;for(let Ke=0;Ke<Oe;Ke++){const Z=Ee[Ke];ut(Z[2]+Ue,Z[1]+Ue,Z[0]+Ue)}Ve=_+C*2,Ue=K*Ve;for(let Ke=0;Ke<Oe;Ke++){const Z=Ee[Ke];ut(Z[0]+Ue,Z[1]+Ue,Z[2]+Ue)}}else{for(let Ve=0;Ve<Oe;Ve++){const Ue=Ee[Ve];ut(Ue[2],Ue[1],Ue[0])}for(let Ve=0;Ve<Oe;Ve++){const Ue=Ee[Ve];ut(Ue[0]+K*_,Ue[1]+K*_,Ue[2]+K*_)}}i.addGroup(Re,s.length/3-Re,0)}function Te(){const Re=s.length/3;let Ve=0;Je(he,Ve),Ve+=he.length;for(let Ue=0,Ke=j.length;Ue<Ke;Ue++){const Z=j[Ue];Je(Z,Ve),Ve+=Z.length}i.addGroup(Re,s.length/3-Re,1)}function Je(Re,Ve){let Ue=Re.length;for(;--Ue>=0;){const Ke=Ue;let Z=Ue-1;Z<0&&(Z=Re.length-1);for(let St=0,tt=_+C*2;St<tt;St++){const Mt=K*St,We=K*(St+1),G=Ve+Ke+Mt,O=Ve+Z+Mt,ne=Ve+Z+We,Se=Ve+Ke+We;Jt(G,O,ne,Se)}}}function et(Re,Ve,Ue){m.push(Re),m.push(Ve),m.push(Ue)}function ut(Re,Ve,Ue){on(Re),on(Ve),on(Ue);const Ke=s.length/3,Z=D.generateTopUV(i,s,Ke-3,Ke-2,Ke-1);Dt(Z[0]),Dt(Z[1]),Dt(Z[2])}function Jt(Re,Ve,Ue,Ke){on(Re),on(Ve),on(Ke),on(Ve),on(Ue),on(Ke);const Z=s.length/3,St=D.generateSideWallUV(i,s,Z-6,Z-3,Z-2,Z-1);Dt(St[0]),Dt(St[1]),Dt(St[3]),Dt(St[1]),Dt(St[2]),Dt(St[3])}function on(Re){s.push(m[Re*3+0]),s.push(m[Re*3+1]),s.push(m[Re*3+2])}function Dt(Re){u.push(Re.x),u.push(Re.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return o3(t,i,e)}static fromJSON(e,t){const i=[];for(let u=0,f=e.shapes.length;u<f;u++){const h=t[e.shapes[u]];i.push(h)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new Kv[s.type]().fromJSON(s)),new Ry(i,e.options)}}const r3={generateTopUV:function(o,e,t,i,s){const u=e[t*3],f=e[t*3+1],h=e[i*3],m=e[i*3+1],g=e[s*3],_=e[s*3+1];return[new Pe(u,f),new Pe(h,m),new Pe(g,_)]},generateSideWallUV:function(o,e,t,i,s,u){const f=e[t*3],h=e[t*3+1],m=e[t*3+2],g=e[i*3],_=e[i*3+1],x=e[i*3+2],b=e[s*3],M=e[s*3+1],A=e[s*3+2],R=e[u*3],C=e[u*3+1],E=e[u*3+2];return Math.abs(h-_)<Math.abs(f-g)?[new Pe(f,1-m),new Pe(g,1-x),new Pe(b,1-A),new Pe(R,1-E)]:[new Pe(h,1-m),new Pe(_,1-x),new Pe(M,1-A),new Pe(C,1-E)]}};function o3(o,e,t){if(t.shapes=[],Array.isArray(o))for(let i=0,s=o.length;i<s;i++){const u=o[i];t.shapes.push(u.uuid)}else t.shapes.push(o.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Dy extends Bu{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,s=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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 Dy(e.radius,e.detail)}}class Ny extends Yt{constructor(e=[new Pe(0,-.5),new Pe(.5,0),new Pe(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=Ft(s,0,Math.PI*2);const u=[],f=[],h=[],m=[],g=[],_=1/t,x=new Y,b=new Pe,M=new Y,A=new Y,R=new Y;let C=0,E=0;for(let D=0;D<=e.length-1;D++)switch(D){case 0:C=e[D+1].x-e[D].x,E=e[D+1].y-e[D].y,M.x=E*1,M.y=-C,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:C=e[D+1].x-e[D].x,E=e[D+1].y-e[D].y,M.x=E*1,M.y=-C,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 D=0;D<=t;D++){const U=i+D*_*s,L=Math.sin(U),B=Math.cos(U);for(let P=0;P<=e.length-1;P++){x.x=e[P].x*L,x.y=e[P].y,x.z=e[P].x*B,f.push(x.x,x.y,x.z),b.x=D/t,b.y=P/(e.length-1),h.push(b.x,b.y);const H=m[3*P+0]*L,W=m[3*P+1],I=m[3*P+0]*B;g.push(H,W,I)}}for(let D=0;D<t;D++)for(let U=0;U<e.length-1;U++){const L=U+D*e.length,B=L,P=L+e.length,H=L+e.length+1,W=L+1;u.push(B,P,W),u.push(H,W,P)}this.setIndex(u),this.setAttribute("position",new yt(f,3)),this.setAttribute("uv",new yt(h,2)),this.setAttribute("normal",new yt(g,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ny(e.points,e.segments,e.phiStart,e.phiLength)}}class Em extends Bu{constructor(e=1,t=0){const i=[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(i,s,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Em(e.radius,e.detail)}}class Kh extends Yt{constructor(e=1,t=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:s};const u=e/2,f=t/2,h=Math.floor(i),m=Math.floor(s),g=h+1,_=m+1,x=e/h,b=t/m,M=[],A=[],R=[],C=[];for(let E=0;E<_;E++){const D=E*b-f;for(let U=0;U<g;U++){const L=U*x-u;A.push(L,-D,0),R.push(0,0,1),C.push(U/h),C.push(1-E/m)}}for(let E=0;E<m;E++)for(let D=0;D<h;D++){const U=D+g*E,L=D+g*(E+1),B=D+1+g*(E+1),P=D+1+g*E;M.push(U,L,P),M.push(L,B,P)}this.setIndex(M),this.setAttribute("position",new yt(A,3)),this.setAttribute("normal",new yt(R,3)),this.setAttribute("uv",new yt(C,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kh(e.width,e.height,e.widthSegments,e.heightSegments)}}class Uy extends Yt{constructor(e=.5,t=1,i=32,s=1,u=0,f=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:s,thetaStart:u,thetaLength:f},i=Math.max(3,i),s=Math.max(1,s);const h=[],m=[],g=[],_=[];let x=e;const b=(t-e)/s,M=new Y,A=new Pe;for(let R=0;R<=s;R++){for(let C=0;C<=i;C++){const E=u+C/i*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 C=R*(i+1);for(let E=0;E<i;E++){const D=E+C,U=D,L=D+i+1,B=D+i+2,P=D+1;h.push(U,L,P),h.push(L,B,P)}}this.setIndex(h),this.setAttribute("position",new yt(m,3)),this.setAttribute("normal",new yt(g,3)),this.setAttribute("uv",new yt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Uy(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ly extends Yt{constructor(e=new Yc([new Pe(0,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],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(i),this.setAttribute("position",new yt(s,3)),this.setAttribute("normal",new yt(u,3)),this.setAttribute("uv",new yt(f,2));function g(_){const x=s.length/3,b=_.extractPoints(t);let M=b.shape;const A=b.holes;Wr.isClockWise(M)===!1&&(M=M.reverse());for(let C=0,E=A.length;C<E;C++){const D=A[C];Wr.isClockWise(D)===!0&&(A[C]=D.reverse())}const R=Wr.triangulateShape(M,A);for(let C=0,E=A.length;C<E;C++){const D=A[C];M=M.concat(D)}for(let C=0,E=M.length;C<E;C++){const D=M[C];s.push(D.x,D.y,0),u.push(0,0,1),f.push(D.x,D.y)}for(let C=0,E=R.length;C<E;C++){const D=R[C],U=D[0]+x,L=D[1]+x,B=D[2]+x;i.push(U,L,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 l3(t,e)}static fromJSON(e,t){const i=[];for(let s=0,u=e.shapes.length;s<u;s++){const f=t[e.shapes[s]];i.push(f)}return new Ly(i,e.curveSegments)}}function l3(o,e){if(e.shapes=[],Array.isArray(o))for(let t=0,i=o.length;t<i;t++){const s=o[t];e.shapes.push(s.uuid)}else e.shapes.push(o.uuid);return e}class Tm extends Yt{constructor(e=1,t=32,i=16,s=0,u=Math.PI*2,f=0,h=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:s,phiLength:u,thetaStart:f,thetaLength:h},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const m=Math.min(f+h,Math.PI);let g=0;const _=[],x=new Y,b=new Y,M=[],A=[],R=[],C=[];for(let E=0;E<=i;E++){const D=[],U=E/i;let L=0;E===0&&f===0?L=.5/t:E===i&&m===Math.PI&&(L=-.5/t);for(let B=0;B<=t;B++){const P=B/t;x.x=-e*Math.cos(s+P*u)*Math.sin(f+U*h),x.y=e*Math.cos(f+U*h),x.z=e*Math.sin(s+P*u)*Math.sin(f+U*h),A.push(x.x,x.y,x.z),b.copy(x).normalize(),R.push(b.x,b.y,b.z),C.push(P+L,1-U),D.push(g++)}_.push(D)}for(let E=0;E<i;E++)for(let D=0;D<t;D++){const U=_[E][D+1],L=_[E][D],B=_[E+1][D],P=_[E+1][D+1];(E!==0||f>0)&&M.push(U,L,P),(E!==i-1||m<Math.PI)&&M.push(L,B,P)}this.setIndex(M),this.setAttribute("position",new yt(A,3)),this.setAttribute("normal",new yt(R,3)),this.setAttribute("uv",new yt(C,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tm(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Iy extends Bu{constructor(e=1,t=0){const i=[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(i,s,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Iy(e.radius,e.detail)}}class Oy extends Yt{constructor(e=1,t=.4,i=12,s=48,u=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:s,arc:u},i=Math.floor(i),s=Math.floor(s);const f=[],h=[],m=[],g=[],_=new Y,x=new Y,b=new Y;for(let M=0;M<=i;M++)for(let A=0;A<=s;A++){const R=A/s*u,C=M/i*Math.PI*2;x.x=(e+t*Math.cos(C))*Math.cos(R),x.y=(e+t*Math.cos(C))*Math.sin(R),x.z=t*Math.sin(C),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/i)}for(let M=1;M<=i;M++)for(let A=1;A<=s;A++){const R=(s+1)*M+A-1,C=(s+1)*(M-1)+A-1,E=(s+1)*(M-1)+A,D=(s+1)*M+A;f.push(R,C,D),f.push(C,E,D)}this.setIndex(f),this.setAttribute("position",new yt(h,3)),this.setAttribute("normal",new yt(m,3)),this.setAttribute("uv",new yt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Oy(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class zy extends Yt{constructor(e=1,t=.4,i=64,s=8,u=2,f=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:s,p:u,q:f},i=Math.floor(i),s=Math.floor(s);const h=[],m=[],g=[],_=[],x=new Y,b=new Y,M=new Y,A=new Y,R=new Y,C=new Y,E=new Y;for(let U=0;U<=i;++U){const L=U/i*u*Math.PI*2;D(L,u,f,e,M),D(L+.01,u,f,e,A),C.subVectors(A,M),E.addVectors(A,M),R.crossVectors(C,E),E.crossVectors(R,C),R.normalize(),E.normalize();for(let B=0;B<=s;++B){const P=B/s*Math.PI*2,H=-t*Math.cos(P),W=t*Math.sin(P);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(U/i),_.push(B/s)}}for(let U=1;U<=i;U++)for(let L=1;L<=s;L++){const B=(s+1)*(U-1)+(L-1),P=(s+1)*U+(L-1),H=(s+1)*U+L,W=(s+1)*(U-1)+L;h.push(B,P,W),h.push(P,H,W)}this.setIndex(h),this.setAttribute("position",new yt(m,3)),this.setAttribute("normal",new yt(g,3)),this.setAttribute("uv",new yt(_,2));function D(U,L,B,P,H){const W=Math.cos(U),I=Math.sin(U),z=B/L*U,j=Math.cos(z);H.x=P*(2+j)*.5*W,H.y=P*(2+j)*I*.5,H.z=P*Math.sin(z)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zy(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Py extends Yt{constructor(e=new CS(new Y(-1,-1,0),new Y(-1,1,0),new Y(1,1,0)),t=64,i=1,s=8,u=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,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 Y,m=new Y,g=new Pe;let _=new Y;const x=[],b=[],M=[],A=[];R(),this.setIndex(A),this.setAttribute("position",new yt(x,3)),this.setAttribute("normal",new yt(b,3)),this.setAttribute("uv",new yt(M,2));function R(){for(let U=0;U<t;U++)C(U);C(u===!1?t:0),D(),E()}function C(U){_=e.getPointAt(U/t,_);const L=f.normals[U],B=f.binormals[U];for(let P=0;P<=s;P++){const H=P/s*Math.PI*2,W=Math.sin(H),I=-Math.cos(H);m.x=I*L.x+W*B.x,m.y=I*L.y+W*B.y,m.z=I*L.z+W*B.z,m.normalize(),b.push(m.x,m.y,m.z),h.x=_.x+i*m.x,h.y=_.y+i*m.y,h.z=_.z+i*m.z,x.push(h.x,h.y,h.z)}}function E(){for(let U=1;U<=t;U++)for(let L=1;L<=s;L++){const B=(s+1)*(U-1)+(L-1),P=(s+1)*U+(L-1),H=(s+1)*U+L,W=(s+1)*(U-1)+L;A.push(B,P,W),A.push(P,H,W)}}function D(){for(let U=0;U<=t;U++)for(let L=0;L<=s;L++)g.x=U/t,g.y=L/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 Py(new Kv[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class YE extends Yt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,s=new Y,u=new Y;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 C=0;C<3;C++){const E=h.getX(A+C),D=h.getX(A+(C+1)%3);s.fromBufferAttribute(f,E),u.fromBufferAttribute(f,D),DM(s,u,i)===!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),DM(s,u,i)===!0&&(t.push(s.x,s.y,s.z),t.push(u.x,u.y,u.z))}}this.setAttribute("position",new yt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function DM(o,e,t){const i=`${o.x},${o.y},${o.z}-${e.x},${e.y},${e.z}`,s=`${e.x},${e.y},${e.z}-${o.x},${o.y},${o.z}`;return t.has(i)===!0||t.has(s)===!0?!1:(t.add(i),t.add(s),!0)}var NM=Object.freeze({__proto__:null,BoxGeometry:$c,CapsuleGeometry:Ty,CircleGeometry:Ay,ConeGeometry:Mm,CylinderGeometry:bm,DodecahedronGeometry:wy,EdgesGeometry:PE,ExtrudeGeometry:Ry,IcosahedronGeometry:Dy,LatheGeometry:Ny,OctahedronGeometry:Em,PlaneGeometry:Kh,PolyhedronGeometry:Bu,RingGeometry:Uy,ShapeGeometry:Ly,SphereGeometry:Tm,TetrahedronGeometry:Iy,TorusGeometry:Oy,TorusKnotGeometry:zy,TubeGeometry:Py,WireframeGeometry:YE});class ZE extends Oa{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new pt(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 DS extends vr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class NS extends Oa{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new pt(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 pt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(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 Hs,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 US extends NS{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 Pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ft(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 pt(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 pt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new pt(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 jE extends Oa{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new pt(16777215),this.specular=new pt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hs,this.combine=_m,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 QE extends Oa{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(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 JE extends Oa{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(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 KE extends Oa{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new pt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hs,this.combine=_m,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 LS extends Oa{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=cE,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 IS extends Oa{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 $E extends Oa{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new Pe(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 eT extends ns{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 Xc(o,e){return!o||o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)}function tT(o){function e(s,u){return o[s]-o[u]}const t=o.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function Bx(o,e,t){const i=o.length,s=new o.constructor(i);for(let u=0,f=0;f!==i;++u){const h=t[u]*e;for(let m=0;m!==e;++m)s[f++]=o[h+m]}return s}function OS(o,e,t,i){let s=1,u=o[0];for(;u!==void 0&&u[i]===void 0;)u=o[s++];if(u===void 0)return;let f=u[i];if(f!==void 0)if(Array.isArray(f))do f=u[i],f!==void 0&&(e.push(u.time),t.push(...f)),u=o[s++];while(u!==void 0);else if(f.toArray!==void 0)do f=u[i],f!==void 0&&(e.push(u.time),f.toArray(t,t.length)),u=o[s++];while(u!==void 0);else do f=u[i],f!==void 0&&(e.push(u.time),t.push(f)),u=o[s++];while(u!==void 0)}function u3(o,e,t,i,s=30){const u=o.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>=i)){x.push(g.times[M]);for(let R=0;R<_;++R)b.push(g.values[M*_+R])}}x.length!==0&&(g.times=Xc(x,g.times.constructor),g.values=Xc(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 c3(o,e=0,t=o,i=30){i<=0&&(i=30);const s=t.tracks.length,u=e/i;for(let f=0;f<s;++f){const h=t.tracks[f],m=h.ValueTypeName;if(m==="bool"||m==="string")continue;const g=o.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=_,D=x-_;R=h.values.slice(E,D)}else if(u>=h.times[A]){const E=A*x+_,D=E+x-_;R=h.values.slice(E,D)}else{const E=h.createInterpolant(),D=_,U=x-_;E.evaluate(u),R=E.resultBuffer.slice(D,U)}m==="quaternion"&&new ws().fromArray(R).normalize().conjugate().toArray(R);const C=g.times.length;for(let E=0;E<C;++E){const D=E*M+b;if(m==="quaternion")ws.multiplyQuaternionsFlat(g.values,D,R,0,g.values,D);else{const U=M-b*2;for(let L=0;L<U;++L)g.values[D+L]-=R[L]}}}return o.blendMode=dS,o}class f3{static convertArray(e,t){return Xc(e,t)}static isTypedArray(e){return _E(e)}static getKeyframeOrder(e){return tT(e)}static sortedArray(e,t,i){return Bx(e,t,i)}static flattenJSON(e,t,i,s){OS(e,t,i,s)}static subclip(e,t,i,s,u=30){return u3(e,t,i,s,u)}static makeClipAdditive(e,t=0,i=e,s=30){return c3(e,t,i,s)}}class Am{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,s=t[i],u=t[i-1];e:{t:{let f;n:{i:if(!(e<s)){for(let h=i+2;;){if(s===void 0){if(e<u)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===h)break;if(u=s,s=t[++i],e<s)break t}f=t.length;break n}if(!(e>=u)){const h=t[1];e<h&&(i=2,u=h);for(let m=i-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===m)break;if(s=u,u=t[--i-1],e>=u)break t}f=i,i=0;break n}break e}for(;i<f;){const h=i+f>>>1;e<t[h]?f=h:i=h+1}if(s=t[i],u=t[i-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,u,s)}return this.interpolate_(i,u,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,u=e*s;for(let f=0;f!==s;++f)t[f]=i[u+f];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class nT extends Am{constructor(e,t,i,s){super(e,t,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Hc,endingEnd:Hc}}intervalChanged_(e,t,i){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 Gc:u=e,h=2*t-i;break;case sm:u=s.length-2,h=t+s[u]-s[u+1];break;default:u=e,h=i}if(m===void 0)switch(this.getSettings_().endingEnd){case Gc:f=e,m=2*i-t;break;case sm:f=1,m=i+s[1]-s[0];break;default:f=e-1,m=t}const g=(i-t)*.5,_=this.valueSize;this._weightPrev=g/(t-h),this._weightNext=g/(m-i),this._offsetPrev=u*_,this._offsetNext=f*_}interpolate_(e,t,i,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=(i-t)/(s-t),R=A*A,C=R*A,E=-b*C+2*b*R-b*A,D=(1+b)*C+(-1.5-2*b)*R+(-.5+b)*A+1,U=(-1-M)*C+(1.5+M)*R+.5*A,L=M*C-M*R;for(let B=0;B!==h;++B)u[B]=E*f[_+B]+D*f[g+B]+U*f[m+B]+L*f[x+B];return u}}class zS extends Am{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const u=this.resultBuffer,f=this.sampleValues,h=this.valueSize,m=e*h,g=m-h,_=(i-t)/(s-t),x=1-_;for(let b=0;b!==h;++b)u[b]=f[g+b]*x+f[m+b]*_;return u}}class iT extends Am{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class yr{constructor(e,t,i,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=Xc(t,this.TimeBufferType),this.values=Xc(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Xc(e.times,Array),values:Xc(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(i.interpolation=s)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new iT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new zS(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new nT(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case am:t=this.InterpolantFactoryMethodDiscrete;break;case jv:t=this.InterpolantFactoryMethodLinear;break;case av:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="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(i);return rt("KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return am;case this.InterpolantFactoryMethodLinear:return jv;case this.InterpolantFactoryMethodSmooth:return av}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]*=e}return this}trim(e,t){const i=this.times,s=i.length;let u=0,f=s-1;for(;u!==s&&i[u]<e;)++u;for(;f!==-1&&i[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=i.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&&(Tt("KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,u=i.length;u===0&&(Tt("KeyframeTrack: Track is empty.",this),e=!1);let f=null;for(let h=0;h!==u;h++){const m=i[h];if(typeof m=="number"&&isNaN(m)){Tt("KeyframeTrack: Time is not a valid number.",this,h,m),e=!1;break}if(f!==null&&f>m){Tt("KeyframeTrack: Out of order keys.",this,h,m,f),e=!1;break}f=m}if(s!==void 0&&_E(s))for(let h=0,m=s.length;h!==m;++h){const g=s[h];if(isNaN(g)){Tt("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(),i=this.getValueSize(),s=this.getInterpolation()===av,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*i,b=x-i,M=x+i;for(let A=0;A!==i;++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*i,b=f*i;for(let M=0;M!==i;++M)t[b+M]=t[x+M]}++f}}if(u>0){e[f]=e[u];for(let h=u*i,m=f*i,g=0;g!==i;++g)t[m+g]=t[h+g];++f}return f!==e.length?(this.times=e.slice(0,f),this.values=t.slice(0,f*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}yr.prototype.ValueTypeName="";yr.prototype.TimeBufferType=Float32Array;yr.prototype.ValueBufferType=Float32Array;yr.prototype.DefaultInterpolation=jv;class ef extends yr{constructor(e,t,i){super(e,t,i)}}ef.prototype.ValueTypeName="bool";ef.prototype.ValueBufferType=Array;ef.prototype.DefaultInterpolation=am;ef.prototype.InterpolantFactoryMethodLinear=void 0;ef.prototype.InterpolantFactoryMethodSmooth=void 0;class PS extends yr{constructor(e,t,i,s){super(e,t,i,s)}}PS.prototype.ValueTypeName="color";class dm extends yr{constructor(e,t,i,s){super(e,t,i,s)}}dm.prototype.ValueTypeName="number";class aT extends Am{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const u=this.resultBuffer,f=this.sampleValues,h=this.valueSize,m=(i-t)/(s-t);let g=e*h;for(let _=g+h;g!==_;g+=4)ws.slerpFlat(u,0,f,g-h,f,g,m);return u}}class wm extends yr{constructor(e,t,i,s){super(e,t,i,s)}InterpolantFactoryMethodLinear(e){return new aT(this.times,this.values,this.getValueSize(),e)}}wm.prototype.ValueTypeName="quaternion";wm.prototype.InterpolantFactoryMethodSmooth=void 0;class tf extends yr{constructor(e,t,i){super(e,t,i)}}tf.prototype.ValueTypeName="string";tf.prototype.ValueBufferType=Array;tf.prototype.DefaultInterpolation=am;tf.prototype.InterpolantFactoryMethodLinear=void 0;tf.prototype.InterpolantFactoryMethodSmooth=void 0;class pm extends yr{constructor(e,t,i,s){super(e,t,i,s)}}pm.prototype.ValueTypeName="vector";class mm{constructor(e="",t=-1,i=[],s=dy){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=Vs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let f=0,h=i.length;f!==h;++f)t.push(d3(i[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=[],i=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=i.length;u!==f;++u)t.push(yr.toJSON(i[u]));return s}static CreateFromMorphTargetSequence(e,t,i,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 _=tT(m);m=Bx(m,1,_),g=Bx(g,1,_),!s&&m[0]===0&&(m.push(u),g.push(g[0])),f.push(new dm(".morphTargetInfluences["+t[h].name+"]",m,g).scale(1/i))}return new this(e,-1,f)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const s=e;i=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<i.length;s++)if(i[s].name===t)return i[s];return null}static CreateClipsFromMorphTargetSequences(e,t,i){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,i));return f}static parseAnimation(e,t){if(rt("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Tt("AnimationClip: No animation in JSONLoader data."),null;const i=function(x,b,M,A,R){if(M.length!==0){const C=[],E=[];OS(M,C,E,A),C.length!==0&&R.push(new x(b,C,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 C=[],E=[];for(let D=0;D!==b[A].morphTargets.length;++D){const U=b[A];C.push(U.time),E.push(U.morphTarget===R?1:0)}s.push(new dm(".morphTargetInfluence["+R+"]",C,E))}m=M.length*f}else{const M=".bones["+t[x].name+"]";i(pm,M+".position",b,"pos",s),i(wm,M+".quaternion",b,"rot",s),i(pm,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 i=0,s=e.length;i!==s;++i){const u=this.tracks[i];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 i=0;i<this.tracks.length;i++)e.push(this.tracks[i].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 h3(o){switch(o.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return dm;case"vector":case"vector2":case"vector3":case"vector4":return pm;case"color":return PS;case"quaternion":return wm;case"bool":case"boolean":return ef;case"string":return tf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+o)}function d3(o){if(o.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=h3(o.type);if(o.times===void 0){const t=[],i=[];OS(o.keys,t,i,"value"),o.times=t,o.values=i}return e.parse!==void 0?e.parse(o):new e(o.name,o.times,o.values,o.interpolation)}const Lo={enabled:!1,files:{},add:function(o,e){this.enabled!==!1&&(this.files[o]=e)},get:function(o){if(this.enabled!==!1)return this.files[o]},remove:function(o){delete this.files[o]},clear:function(){this.files={}}};class BS{constructor(e,t,i){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=i,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 sT=new BS;class Cs{constructor(e){this.manager=e!==void 0?e:sT,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(s,u){i.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}}Cs.DEFAULT_MATERIAL_NAME="__DEFAULT";const El={};class p3 extends Error{constructor(e,t){super(e),this.response=t}}class Rl extends Cs{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=Lo.get(`file:${e}`);if(u!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(u),this.manager.itemEnd(e)},0),u;if(El[e]!==void 0){El[e].push({onLoad:t,onProgress:i,onError:s});return}El[e]=[],El[e].push({onLoad:t,onProgress:i,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&&rt("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||g.body===void 0||g.body.getReader===void 0)return g;const _=El[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 C=new ReadableStream({start(E){D();function D(){x.read().then(({done:U,value:L})=>{if(U)E.close();else{R+=L.byteLength;const B=new ProgressEvent("progress",{lengthComputable:A,loaded:R,total:M});for(let P=0,H=_.length;P<H;P++){const W=_[P];W.onProgress&&W.onProgress(B)}E.enqueue(L),D()}},U=>{E.error(U)})}}});return new Response(C)}else throw new p3(`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=>{Lo.add(`file:${e}`,g);const _=El[e];delete El[e];for(let x=0,b=_.length;x<b;x++){const M=_[x];M.onLoad&&M.onLoad(g)}}).catch(g=>{const _=El[e];if(_===void 0)throw this.manager.itemError(e),g;delete El[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 m3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=new Rl(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):Tt(m),u.manager.itemError(e)}},i,s)}parse(e){const t=[];for(let i=0;i<e.length;i++){const s=mm.parse(e[i]);t.push(s)}return t}}class g3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=[],h=new Ey,m=new Rl(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=ai),h.image=f,h.format=M.format,h.needsUpdate=!0,t&&t(h))},i,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=ai),h.format=b.format,h.needsUpdate=!0,t&&t(h)},i,s);return h}}const Ah=new WeakMap;class gm extends Cs{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=this,f=Lo.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=Ah.get(f);x===void 0&&(x=[],Ah.set(f,x)),x.push({onLoad:t,onError:s})}return f}const h=lm("img");function m(){_(),t&&t(this);const x=Ah.get(this)||[];for(let b=0;b<x.length;b++){const M=x[b];M.onLoad&&M.onLoad(this)}Ah.delete(this),u.manager.itemEnd(e)}function g(x){_(),s&&s(x),Lo.remove(`image:${e}`);const b=Ah.get(this)||[];for(let M=0;M<b.length;M++){const A=b[M];A.onError&&A.onError(x)}Ah.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),Lo.add(`image:${e}`,h),u.manager.itemStart(e),h.src=e,h}}class v3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=new Sm;u.colorSpace=Ua;const f=new gm(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 y3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=new qr,h=new Rl(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:As,f.wrapT=g.wrapT!==void 0?g.wrapT:As,f.magFilter=g.magFilter!==void 0?g.magFilter:ai,f.minFilter=g.minFilter!==void 0?g.minFilter:ai,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=Uo),g.mipmapCount===1&&(f.minFilter=ai),g.generateMipmaps!==void 0&&(f.generateMipmaps=g.generateMipmaps),f.needsUpdate=!0,t&&t(f,g)},i,s),f}}class _3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=new Ei,f=new gm(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)},i,s),u}}class Fu extends An{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new pt(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 rT extends Fu{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(An.DEFAULT_UP),this.updateMatrix(),this.groundColor=new pt(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 sx=new kt,UM=new Y,LM=new Y;class FS{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.mapType=Ka,this.map=null,this.mapPass=null,this.matrix=new kt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Jh,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Wn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;UM.setFromMatrixPosition(e.matrixWorld),t.position.copy(UM),LM.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(LM),t.updateMatrixWorld(),sx.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sx,t.coordinateSystem,t.reversedDepth),t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(sx)}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 x3 extends FS{constructor(){super(new aa(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,i=Hh*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,u=e.distance||t.far;(i!==t.fov||s!==t.aspect||u!==t.far)&&(t.fov=i,t.aspect=s,t.far=u,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class oT extends Fu{constructor(e,t,i=0,s=Math.PI/3,u=0,f=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(An.DEFAULT_UP),this.updateMatrix(),this.target=new An,this.distance=i,this.angle=s,this.penumbra=u,this.decay=f,this.map=null,this.shadow=new x3}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 S3 extends FS{constructor(){super(new aa(90,1,.5,500)),this.isPointLightShadow=!0}}class lT extends Fu{constructor(e,t,i=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new S3}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 $h extends yy{constructor(e=-1,t=1,i=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=i,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,i,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=i,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),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let u=i-e,f=i+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 b3 extends FS{constructor(){super(new $h(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class uT extends Fu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(An.DEFAULT_UP),this.updateMatrix(),this.target=new An,this.shadow=new b3}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 cT extends Fu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class fT extends Fu{constructor(e,t,i=10,s=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,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 VS{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Y)}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 i=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*i),t.addScaledVector(f[4],1.092548*(i*s)),t.addScaledVector(f[5],1.092548*(s*u)),t.addScaledVector(f[6],.315392*(3*u*u-1)),t.addScaledVector(f[7],1.092548*(i*u)),t.addScaledVector(f[8],.546274*(i*i-s*s)),t}getIrradianceAt(e,t){const i=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*i),t.addScaledVector(f[4],2*.429043*i*s),t.addScaledVector(f[5],2*.429043*s*u),t.addScaledVector(f[6],.743125*u*u-.247708),t.addScaledVector(f[7],2*.429043*i*u),t.addScaledVector(f[8],.429043*(i*i-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 i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],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 i=this.coefficients;for(let s=0;s<9;s++)i[s].fromArray(e,t+s*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].toArray(e,t+s*3);return e}static getBasisAt(e,t){const i=e.x,s=e.y,u=e.z;t[0]=.282095,t[1]=.488603*s,t[2]=.488603*u,t[3]=.488603*i,t[4]=1.092548*i*s,t[5]=1.092548*s*u,t[6]=.315392*(3*u*u-1),t[7]=1.092548*i*u,t[8]=.546274*(i*i-s*s)}}class hT extends Fu{constructor(e=new VS,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 By extends Cs{constructor(e){super(e),this.textures={}}load(e,t,i,s){const u=this,f=new Rl(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):Tt(m),u.manager.itemError(e)}},i,s)}parse(e){const t=this.textures;function i(u){return t[u]===void 0&&rt("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 pt().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=i(f.value);break;case"c":s.uniforms[u].value=new pt().setHex(f.value);break;case"v2":s.uniforms[u].value=new Pe().fromArray(f.value);break;case"v3":s.uniforms[u].value=new Y().fromArray(f.value);break;case"v4":s.uniforms[u].value=new Wn().fromArray(f.value);break;case"m3":s.uniforms[u].value=new Qt().fromArray(f.value);break;case"m4":s.uniforms[u].value=new kt().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=i(e.map)),e.matcap!==void 0&&(s.matcap=i(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=i(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 Pe().fromArray(u)}return e.displacementMap!==void 0&&(s.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=i(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=i(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new Pe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(s.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=i(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return By.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:ZE,SpriteMaterial:xS,RawShaderMaterial:DS,ShaderMaterial:vr,PointsMaterial:bS,MeshPhysicalMaterial:US,MeshStandardMaterial:NS,MeshPhongMaterial:jE,MeshToonMaterial:QE,MeshNormalMaterial:JE,MeshLambertMaterial:KE,MeshDepthMaterial:LS,MeshDistanceMaterial:IS,MeshBasicMaterial:Pu,MeshMatcapMaterial:$E,LineDashedMaterial:eT,LineBasicMaterial:ns,Material:Oa};return new t[e]}}class Fx{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 dT extends Yt{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 pT extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=new Rl(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):Tt(m),u.manager.itemError(e)}},i,s)}parse(e){const t={},i={};function s(M,A){if(t[A]!==void 0)return t[A];const C=M.interleavedBuffers[A],E=u(M,C.buffer),D=Ih(C.type,E),U=new Sy(D,C.stride);return U.uuid=C.uuid,t[A]=U,U}function u(M,A){if(i[A]!==void 0)return i[A];const C=M.arrayBuffers[A],E=new Uint32Array(C).buffer;return i[A]=E,E}const f=e.isInstancedBufferGeometry?new dT:new Yt,h=e.data.index;if(h!==void 0){const M=Ih(h.type,h.array);f.setIndex(new Hn(M,1))}const m=e.data.attributes;for(const M in m){const A=m[M];let R;if(A.isInterleavedBufferAttribute){const C=s(e.data,A.data);R=new Qc(C,A.itemSize,A.offset,A.normalized)}else{const C=Ih(A.type,A.array),E=A.isInstancedBufferAttribute?Wh:Hn;R=new E(C,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 C=0,E=A.length;C<E;C++){const D=A[C];let U;if(D.isInterleavedBufferAttribute){const L=s(e.data,D.data);U=new Qc(L,D.itemSize,D.offset,D.normalized)}else{const L=Ih(D.type,D.array);U=new Hn(L,D.itemSize,D.normalized)}D.name!==void 0&&(U.name=D.name),R.push(U)}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 ga().fromJSON(b)),e.name&&(f.name=e.name),e.userData&&(f.userData=e.userData),f}}class M3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=this.path===""?Fx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||f;const h=new Rl(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)),Tt("ObjectLoader: Can't load "+e);return}u.parse(g,t)},i,s)}async loadAsync(e,t){const i=this,s=this.path===""?Fx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const u=new Rl(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 i.parseAsync(h)}parse(e,t){const i=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,i),_=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),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),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 i=0,s=e.length;i<s;i++){const u=new Yc().fromJSON(e[i]);t[u.uuid]=u}return t}parseSkeletons(e,t){const i={},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 by().fromJSON(e[u],s);i[h.uuid]=h}return i}parseGeometries(e,t){const i={};if(e!==void 0){const s=new pT;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 NM?h=NM[m.type].fromJSON(m,t):rt(`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),i[m.uuid]=h}}return i}parseMaterials(e,t){const i={},s={};if(e!==void 0){const u=new By;u.setTextures(t);for(let f=0,h=e.length;f<h;f++){const m=e[f];i[m.uuid]===void 0&&(i[m.uuid]=u.parse(m)),s[m.uuid]=i[m.uuid]}}return s}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const s=e[i],u=mm.parse(s);t[u.uuid]=u}return t}parseImages(e,t){const i=this,s={};let u;function f(m){return i.manager.itemStart(m),u.load(m,function(){i.manager.itemEnd(m)},void 0,function(){i.manager.itemError(m),i.manager.itemEnd(m)})}function h(m){if(typeof m=="string"){const g=m,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(g)?g:i.resourcePath+g;return f(_)}else return m.data?{data:Ih(m.type,m.data),width:m.width,height:m.height}:null}if(e!==void 0&&e.length>0){const m=new BS(t);u=new gm(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 C=b[A],E=h(C);E!==null&&(E instanceof HTMLImageElement?M.push(E):M.push(new qr(E.data,E.width,E.height)))}s[x.uuid]=new Du(M)}else{const M=h(x.url);s[x.uuid]=new Du(M)}}}return s}async parseImagesAsync(e){const t=this,i={};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:Ih(f.type,f.data),width:f.width,height:f.height}:null}if(e!==void 0&&e.length>0){s=new gm(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 qr(A.data,A.width,A.height)))}i[m.uuid]=new Du(_)}else{const _=await u(m.url);i[m.uuid]=new Du(_)}}}return i}parseTextures(e,t){function i(u,f){return typeof u=="number"?u:(rt("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&&rt('ObjectLoader: No "image" specified for',h.uuid),t[h.image]===void 0&&rt("ObjectLoader: Undefined image",h.image);const m=t[h.image],g=m.data;let _;Array.isArray(g)?(_=new Sm,g.length===6&&(_.needsUpdate=!0)):(g&&g.data?_=new qr:_=new Ei,g&&(_.needsUpdate=!0)),_.source=m,_.uuid=h.uuid,h.name!==void 0&&(_.name=h.name),h.mapping!==void 0&&(_.mapping=i(h.mapping,E3)),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=i(h.wrap[0],IM),_.wrapT=i(h.wrap[1],IM)),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=i(h.minFilter,OM)),h.magFilter!==void 0&&(_.magFilter=i(h.magFilter,OM)),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,i,s,u){let f;function h(b){return t[b]===void 0&&rt("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 C=b[A];i[C]===void 0&&rt("ObjectLoader: Undefined material",C),M.push(i[C])}return M}return i[b]===void 0&&rt("ObjectLoader: Undefined material",b),i[b]}}function g(b){return s[b]===void 0&&rt("ObjectLoader: Undefined texture",b),s[b]}let _,x;switch(e.type){case"Scene":f=new _S,e.background!==void 0&&(Number.isInteger(e.background)?f.background=new pt(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 xy(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(f.fog=new _y(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 aa(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 $h(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 cT(e.color,e.intensity);break;case"DirectionalLight":f=new uT(e.color,e.intensity),f.target=e.target||"";break;case"PointLight":f=new lT(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":f=new fT(e.color,e.intensity,e.width,e.height);break;case"SpotLight":f=new oT(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),f.target=e.target||"";break;case"HemisphereLight":f=new rT(e.color,e.groundColor,e.intensity);break;case"LightProbe":const b=new VS().fromArray(e.sh);f=new hT(b,e.intensity);break;case"SkinnedMesh":_=h(e.geometry),x=m(e.material),f=new DE(_,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 Gi(_,x);break;case"InstancedMesh":_=h(e.geometry),x=m(e.material);const M=e.count,A=e.instanceMatrix,R=e.instanceColor;f=new NE(_,x,M),f.instanceMatrix=new Wh(new Float32Array(A.array),16),R!==void 0&&(f.instanceColor=new Wh(new Float32Array(R.array),R.itemSize));break;case"BatchedMesh":_=h(e.geometry),x=m(e.material),f=new UE(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(C=>{let E=null,D=null;return C.boundingBox!==void 0&&(E=new Ia().fromJSON(C.boundingBox)),C.boundingSphere!==void 0&&(D=new ga().fromJSON(C.boundingSphere)),{...C,boundingBox:E,boundingSphere:D}}),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 ga().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(f.boundingBox=new Ia().fromJSON(e.boundingBox));break;case"LOD":f=new RE;break;case"Line":f=new Ou(h(e.geometry),m(e.material));break;case"LineLoop":f=new LE(h(e.geometry),m(e.material));break;case"LineSegments":f=new Fo(h(e.geometry),m(e.material));break;case"PointCloud":case"Points":f=new IE(h(e.geometry),m(e.material));break;case"Sprite":f=new CE(m(e.material));break;case"Group":f=new Oh;break;case"Bone":f=new SS;break;default:f=new An}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,i,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(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const s=t[i.skeleton];s===void 0?rt("ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(s,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,s=e.getObjectByProperty("uuid",i);s!==void 0?t.target=s:t.target=new An}})}}const E3={UVMapping:ry,CubeReflectionMapping:Oo,CubeRefractionMapping:Uu,EquirectangularReflectionMapping:em,EquirectangularRefractionMapping:tm,CubeUVReflectionMapping:jh},IM={RepeatWrapping:nm,ClampToEdgeWrapping:As,MirroredRepeatWrapping:im},OM={NearestFilter:Li,NearestMipmapNearestFilter:rS,NearestMipmapLinearFilter:Lh,LinearFilter:ai,LinearMipmapNearestFilter:Wp,LinearMipmapLinearFilter:Uo},rx=new WeakMap;class T3 extends Cs{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&rt("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&rt("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const u=this,f=Lo.get(`image-bitmap:${e}`);if(f!==void 0){if(u.manager.itemStart(e),f.then){f.then(g=>{if(rx.has(f)===!0)s&&s(rx.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 Lo.add(`image-bitmap:${e}`,g),t&&t(g),u.manager.itemEnd(e),g}).catch(function(g){s&&s(g),rx.set(m,g),Lo.remove(`image-bitmap:${e}`),u.manager.itemError(e),u.manager.itemEnd(e)});Lo.add(`image-bitmap:${e}`,m),u.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Y0;class kS{static getContext(){return Y0===void 0&&(Y0=new(window.AudioContext||window.webkitAudioContext)),Y0}static setContext(e){Y0=e}}class A3 extends Cs{constructor(e){super(e)}load(e,t,i,s){const u=this,f=new Rl(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);kS.getContext().decodeAudioData(g,function(x){t(x)}).catch(h)}catch(g){h(g)}},i,s);function h(m){s?s(m):Tt(m),u.manager.itemError(e)}}}const zM=new kt,PM=new kt,Nc=new kt;class w3{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new aa,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new aa,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,Nc.copy(e.projectionMatrix);const s=t.eyeSep/2,u=s*t.near/t.focus,f=t.near*Math.tan(qc*t.fov*.5)/t.zoom;let h,m;PM.elements[12]=-s,zM.elements[12]=s,h=-f*t.aspect+u,m=f*t.aspect+u,Nc.elements[0]=2*t.near/(m-h),Nc.elements[8]=(m+h)/(m-h),this.cameraL.projectionMatrix.copy(Nc),h=-f*t.aspect-u,m=f*t.aspect-u,Nc.elements[0]=2*t.near/(m-h),Nc.elements[8]=(m+h)/(m-h),this.cameraR.projectionMatrix.copy(Nc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(PM),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(zM)}}class mT extends aa{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class HS{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 Uc=new Y,ox=new ws,C3=new Y,Lc=new Y,Ic=new Y;class R3 extends An{constructor(){super(),this.type="AudioListener",this.context=kS.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new HS}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(Uc,ox,C3),Lc.set(0,0,-1).applyQuaternion(ox),Ic.set(0,1,0).applyQuaternion(ox),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Uc.x,i),t.positionY.linearRampToValueAtTime(Uc.y,i),t.positionZ.linearRampToValueAtTime(Uc.z,i),t.forwardX.linearRampToValueAtTime(Lc.x,i),t.forwardY.linearRampToValueAtTime(Lc.y,i),t.forwardZ.linearRampToValueAtTime(Lc.z,i),t.upX.linearRampToValueAtTime(Ic.x,i),t.upY.linearRampToValueAtTime(Ic.y,i),t.upZ.linearRampToValueAtTime(Ic.z,i)}else t.setPosition(Uc.x,Uc.y,Uc.z),t.setOrientation(Lc.x,Lc.y,Lc.z,Ic.x,Ic.y,Ic.z)}}class gT extends An{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){rt("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){rt("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){rt("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){rt("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){rt("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?(rt("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){rt("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"?(rt("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 Oc=new Y,BM=new ws,D3=new Y,zc=new Y;class N3 extends gT{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,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Oc,BM,D3),zc.set(0,0,1).applyQuaternion(BM);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Oc.x,i),t.positionY.linearRampToValueAtTime(Oc.y,i),t.positionZ.linearRampToValueAtTime(Oc.z,i),t.orientationX.linearRampToValueAtTime(zc.x,i),t.orientationY.linearRampToValueAtTime(zc.y,i),t.orientationZ.linearRampToValueAtTime(zc.z,i)}else t.setPosition(Oc.x,Oc.y,Oc.z),t.setOrientation(zc.x,zc.y,zc.z)}}class U3{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 i=0;i<t.length;i++)e+=t[i];return e/t.length}}class vT{constructor(e,t,i){this.binding=e,this.valueSize=i;let s,u,f;switch(t){case"quaternion":s=this._slerp,u=this._slerpAdditive,f=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":s=this._select,u=this._select,f=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:s=this._lerp,u=this._lerpAdditive,f=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*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 i=this.buffer,s=this.valueSize,u=e*s+s;let f=this.cumulativeWeight;if(f===0){for(let h=0;h!==s;++h)i[u+h]=i[h];f=t}else{f+=t;const h=t/f;this._mixBufferRegion(i,u,0,h,s)}this.cumulativeWeight=f}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,s=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=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(i,s,m,1-u,t)}f>0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let m=t,g=t+t;m!==g;++m)if(i[m]!==i[m+t]){h.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let u=i,f=s;u!==f;++u)t[u]=t[s+u%i];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 i=e;i<t;i++)this.buffer[i]=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 i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,s,u){if(s>=.5)for(let f=0;f!==u;++f)e[t+f]=e[i+f]}_slerp(e,t,i,s){ws.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,u){const f=this._workIndex*u;ws.multiplyQuaternionsFlat(e,f,e,t,e,i),ws.slerpFlat(e,t,e,t,e,f,s)}_lerp(e,t,i,s,u){const f=1-s;for(let h=0;h!==u;++h){const m=t+h;e[m]=e[m]*f+e[i+h]*s}}_lerpAdditive(e,t,i,s,u){for(let f=0;f!==u;++f){const h=t+f;e[h]=e[h]+e[i+f]*s}}}const GS="\\[\\]\\.:\\/",L3=new RegExp("["+GS+"]","g"),XS="[^"+GS+"]",I3="[^"+GS.replace("\\.","")+"]",O3=/((?:WC+[\/:])*)/.source.replace("WC",XS),z3=/(WCOD+)?/.source.replace("WCOD",I3),P3=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",XS),B3=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",XS),F3=new RegExp("^"+O3+z3+P3+B3+"$"),V3=["material","materials","bones","map"];class k3{constructor(e,t,i){const s=i||Tn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=i.length;s!==u;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Tn{constructor(e,t,i){this.path=t,this.parsedPath=i||Tn.parseTrackName(t),this.node=Tn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Tn.Composite(e,t,i):new Tn(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(L3,"")}static parseTrackName(e){const t=F3.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const u=i.nodeName.substring(s+1);V3.indexOf(u)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=u)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=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=i(h.children);if(m)return m}return null},s=i(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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)e[t++]=i[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 i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let s=0,u=i.length;s!==u;++s)i[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,i=t.objectName,s=t.propertyName;let u=t.propertyIndex;if(e||(e=Tn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){rt("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let g=t.objectIndex;switch(i){case"materials":if(!e.material){Tt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Tt("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){Tt("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){Tt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Tt("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[i]===void 0){Tt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(g!==void 0){if(e[g]===void 0){Tt("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;Tt("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){Tt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Tt("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}}Tn.Composite=k3;Tn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tn.prototype.GetterByBindingType=[Tn.prototype._getValue_direct,Tn.prototype._getValue_array,Tn.prototype._getValue_arrayElement,Tn.prototype._getValue_toArray];Tn.prototype.SetterByBindingTypeAndVersioning=[[Tn.prototype._setValue_direct,Tn.prototype._setValue_direct_setNeedsUpdate,Tn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tn.prototype._setValue_array,Tn.prototype._setValue_array_setNeedsUpdate,Tn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tn.prototype._setValue_arrayElement,Tn.prototype._setValue_arrayElement_setNeedsUpdate,Tn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tn.prototype._setValue_fromArray,Tn.prototype._setValue_fromArray_setNeedsUpdate,Tn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class H3{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Vs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,s=arguments.length;i!==s;++i)e[arguments[i].uuid]=i;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,i=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,C=f;R!==C;++R)u[R].push(new Tn(b,i[R],s[R]))}else if(A<g){h=e[A];const R=--g,C=e[R];t[C.uuid]=A,e[A]=C,t[M]=R,e[R]=b;for(let E=0,D=f;E!==D;++E){const U=u[E],L=U[R];let B=U[A];U[A]=L,B===void 0&&(B=new Tn(b,i[E],s[E])),U[R]=B}}else e[A]!==h&&Tt("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,i=this._bindings,s=i.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=i[M],C=R[x],E=R[_];R[_]=C,R[x]=E}}}this.nCachedObjects_=u}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,s=i.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 C=0,E=s;C!==E;++C){const D=i[C],U=D[b],L=D[A];D[x]=U,D[b]=L,D.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 C=i[A];C[x]=C[b],C.pop()}}}this.nCachedObjects_=u}subscribe_(e,t){const i=this._bindingsIndicesByPath;let s=i[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,i[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 Tn(A,e,t)}return x}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const s=this._paths,u=this._parsedPaths,f=this._bindings,h=f.length-1,m=f[h],g=e[h];t[g]=i,f[i]=m,f.pop(),u[i]=u[h],u.pop(),s[i]=s[h],s.pop()}}}class yT{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const u=t.tracks,f=u.length,h=new Array(f),m={endingStart:Hc,endingEnd:Hc};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=lE,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,i=!1){if(e.fadeOut(t),this.fadeIn(t),i===!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,i=!1){return e.crossFadeFrom(this,t,i)}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,i){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+i,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,i,s){if(!this.enabled){this._updateWeight(e);return}const u=this._startTime;if(u!==null){const m=(e-u)*i;m<0||i===0?t=0:(this._startTime=null,t=i*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 dS:for(let _=0,x=m.length;_!==x;++_)m[_].evaluate(f),g[_].accumulateAdditive(h);break;case dy: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 i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.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 i=this._timeScaleInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,u=this._loopCount;const f=i===uE;if(e===0)return u===-1?s:f&&(u&1)===1?t-s:s;if(i===oE){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,i){const s=this._interpolantSettings;i?(s.endingStart=Gc,s.endingEnd=Gc):(e?s.endingStart=this.zeroSlopeAtStart?Gc:Hc:s.endingStart=sm,t?s.endingEnd=this.zeroSlopeAtEnd?Gc:Hc:s.endingEnd=sm)}_scheduleFading(e,t,i){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]=i,this}}const G3=new Float32Array(1);class X3 extends Bo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,u=s.length,f=e._propertyBindings,h=e._interpolants,m=i.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 vT(Tn.create(i,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 i=(e._localRoot||this._root).uuid,s=e._clip.uuid,u=this._actionsByClip[s];this._bindAction(e,u&&u.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const u=t[i];u.useCount++===0&&(this._lendBinding(u),u.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const u=t[i];--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,i){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[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],s=e._cacheIndex;i._cacheIndex=s,t[s]=i,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 i=0,s=t.length;i!==s;++i){const u=t[i];--u.referenceCount===0&&this._removeInactiveBinding(u)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,s=this._nActiveActions++,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=i,t[i]=u}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,s=--this._nActiveActions,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=i,t[i]=u}_addInactiveBinding(e,t,i){const s=this._bindingsByRootAndName,u=this._bindings;let f=s[t];f===void 0&&(f={},s[t]=f),f[i]=e,e._cacheIndex=u.length,u.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,s=i.rootNode.uuid,u=i.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,i=e._cacheIndex,s=this._nActiveBindings++,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=i,t[i]=u}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,s=--this._nActiveBindings,u=t[s];e._cacheIndex=s,t[s]=e,u._cacheIndex=i,t[i]=u}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new zS(new Float32Array(2),new Float32Array(2),1,G3),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,s=--this._nActiveControlInterpolants,u=t[s];e.__cacheIndex=s,t[s]=e,u.__cacheIndex=i,t[i]=u}clipAction(e,t,i){const s=t||this._root,u=s.uuid;let f=typeof e=="string"?mm.findByName(s,e):e;const h=f!==null?f.uuid:e,m=this._actionsByClip[h];let g=null;if(i===void 0&&(f!==null?i=f.blendMode:i=dy),m!==void 0){const x=m.actionByRoot[u];if(x!==void 0&&x.blendMode===i)return x;g=m.knownActions[0],f===null&&(f=g._clip)}if(f===null)return null;const _=new yT(this,f,t,i);return this._bindAction(_,g),this._addInactiveAction(_,h,u),_}existingAction(e,t){const i=t||this._root,s=i.uuid,u=typeof e=="string"?mm.findByName(i,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 i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,u=Math.sign(e),f=this._accuIndex^=1;for(let g=0;g!==i;++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,i=e.uuid,s=this._actionsByClip,u=s[i];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[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const f in i){const h=i[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 i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class W3 extends mS{constructor(e=1,t=1,i=1,s={}){super(e,t,s),this.isRenderTarget3D=!0,this.depth=i,this.texture=new vy(null,e,t,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class WS{constructor(e){this.value=e}clone(){return new WS(this.value.clone===void 0?this.value:this.value.clone())}}let q3=0;class Y3 extends Bo{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:q3++}),this.name="",this.usage=om,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 i=0,s=t.length;i<s;i++){const u=Array.isArray(t[i])?t[i]:[t[i]];for(let f=0;f<u.length;f++)this.uniforms.push(u[f].clone())}return this}clone(){return new this.constructor().copy(this)}}class Z3 extends Sy{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}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 j3{constructor(e,t,i,s,u,f=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,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 FM=new kt;class _T{constructor(e,t,i=0,s=1/0){this.ray=new Qh(e,t),this.near=i,this.far=s,this.camera=null,this.layers=new Gh,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):Tt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return FM.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(FM),this}intersectObject(e,t=!0,i=[]){return Vx(e,this,i,t),i.sort(VM),i}intersectObjects(e,t=!0,i=[]){for(let s=0,u=e.length;s<u;s++)Vx(e[s],this,i,t);return i.sort(VM),i}}function VM(o,e){return o.distance-e.distance}function Vx(o,e,t,i){let s=!0;if(o.layers.test(e.layers)&&o.raycast(e,t)===!1&&(s=!1),s===!0&&i===!0){const u=o.children;for(let f=0,h=u.length;f<h;f++)Vx(u[f],e,t,!0)}}class Q3{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=J3.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 J3(){this._document.hidden===!1&&this.reset()}class K3{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ft(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Ft(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class $3{constructor(e=1,t=0,i=0){this.radius=e,this.theta=t,this.y=i}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class qS{constructor(e,t,i,s){qS.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,s){const u=this.elements;return u[0]=e,u[2]=t,u[1]=i,u[3]=s,this}}const kM=new Pe;class eR{constructor(e=new Pe(1/0,1/0),t=new Pe(-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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=kM.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,kM).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 HM=new Y,Z0=new Y,wh=new Y,Ch=new Y,lx=new Y,tR=new Y,nR=new Y;class iR{constructor(e=new Y,t=new Y){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){HM.subVectors(e,this.start),Z0.subVectors(this.end,this.start);const i=Z0.dot(Z0);let u=Z0.dot(HM)/i;return t&&(u=Ft(u,0,1)),u}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(e,t=tR,i=nR){const s=10000000000000001e-32;let u,f;const h=this.start,m=e.start,g=this.end,_=e.end;wh.subVectors(g,h),Ch.subVectors(_,m),lx.subVectors(h,m);const x=wh.dot(wh),b=Ch.dot(Ch),M=Ch.dot(lx);if(x<=s&&b<=s)return t.copy(h),i.copy(m),t.sub(i),t.dot(t);if(x<=s)u=0,f=M/b,f=Ft(f,0,1);else{const A=wh.dot(lx);if(b<=s)f=0,u=Ft(-A/x,0,1);else{const R=wh.dot(Ch),C=x*b-R*R;C!==0?u=Ft((R*M-A*b)/C,0,1):u=0,f=(R*u+M)/b,f<0?(f=0,u=Ft(-A/x,0,1)):f>1&&(f=1,u=Ft((R-A)/x,0,1))}}return t.copy(h).add(wh.multiplyScalar(u)),i.copy(m).add(Ch.multiplyScalar(f)),t.sub(i),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 GM=new Y;class aR extends An{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Yt,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)}i.setAttribute("position",new yt(s,3));const u=new ns({fog:!1,toneMapped:!1});this.cone=new Fo(i,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),GM.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(GM),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Tu=new Y,j0=new kt,ux=new kt;class sR extends Fo{constructor(e){const t=xT(e),i=new Yt,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))}i.setAttribute("position",new yt(s,3)),i.setAttribute("color",new yt(u,3));const f=new ns({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,f),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const h=new pt(255),m=new pt(65280);this.setColors(h,m)}updateMatrixWorld(e){const t=this.bones,i=this.geometry,s=i.getAttribute("position");ux.copy(this.root.matrixWorld).invert();for(let u=0,f=0;u<t.length;u++){const h=t[u];h.parent&&h.parent.isBone&&(j0.multiplyMatrices(ux,h.matrixWorld),Tu.setFromMatrixPosition(j0),s.setXYZ(f,Tu.x,Tu.y,Tu.z),j0.multiplyMatrices(ux,h.parent.matrixWorld),Tu.setFromMatrixPosition(j0),s.setXYZ(f+1,Tu.x,Tu.y,Tu.z),f+=2)}i.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 xT(o){const e=[];o.isBone===!0&&e.push(o);for(let t=0;t<o.children.length;t++)e.push(...xT(o.children[t]));return e}class rR extends Gi{constructor(e,t,i){const s=new Tm(t,4,2),u=new Pu({wireframe:!0,fog:!1,toneMapped:!1});super(s,u),this.light=e,this.color=i,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 oR=new Y,XM=new pt,WM=new pt;class lR extends An{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const s=new Em(t);s.rotateY(Math.PI*.5),this.material=new Pu({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 Hn(f,3)),this.add(new Gi(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");XM.copy(this.light.color),WM.copy(this.light.groundColor);for(let i=0,s=t.count;i<s;i++){const u=i<s/2?XM:WM;t.setXYZ(i,u.r,u.g,u.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(oR.setFromMatrixPosition(this.light.matrixWorld).negate())}}class uR extends Fo{constructor(e=10,t=10,i=4473924,s=8947848){i=new pt(i),s=new pt(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?i: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 Yt;_.setAttribute("position",new yt(m,3)),_.setAttribute("color",new yt(g,3));const x=new ns({vertexColors:!0,toneMapped:!1});super(_,x),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class cR extends Fo{constructor(e=10,t=16,i=8,s=64,u=4473924,f=8947848){u=new pt(u),f=new pt(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<i;x++){const b=x&1?u:f,M=e-e/i*x;for(let A=0;A<s;A++){let R=A/s*(Math.PI*2),C=Math.sin(R)*M,E=Math.cos(R)*M;h.push(C,0,E),m.push(b.r,b.g,b.b),R=(A+1)/s*(Math.PI*2),C=Math.sin(R)*M,E=Math.cos(R)*M,h.push(C,0,E),m.push(b.r,b.g,b.b)}}const g=new Yt;g.setAttribute("position",new yt(h,3)),g.setAttribute("color",new yt(m,3));const _=new ns({vertexColors:!0,toneMapped:!1});super(g,_),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const qM=new Y,Q0=new Y,YM=new Y;class fR extends An{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let s=new Yt;s.setAttribute("position",new yt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const u=new ns({fog:!1,toneMapped:!1});this.lightPlane=new Ou(s,u),this.add(this.lightPlane),s=new Yt,s.setAttribute("position",new yt([0,0,0,0,0,1],3)),this.targetLine=new Ou(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),qM.setFromMatrixPosition(this.light.matrixWorld),Q0.setFromMatrixPosition(this.light.target.matrixWorld),YM.subVectors(Q0,qM),this.lightPlane.lookAt(Q0),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(Q0),this.targetLine.scale.z=YM.length()}}const J0=new Y,Mi=new yy;class hR extends Fo{constructor(e){const t=new Yt,i=new ns({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 yt(s,3)),t.setAttribute("color",new yt(u,3)),super(t,i),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 pt(16755200),_=new pt(16711680),x=new pt(43775),b=new pt(16777215),M=new pt(3355443);this.setColors(g,_,x,b,M)}setColors(e,t,i,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,i.r,i.g,i.b),h.setXYZ(33,i.r,i.g,i.b),h.setXYZ(34,i.r,i.g,i.b),h.setXYZ(35,i.r,i.g,i.b),h.setXYZ(36,i.r,i.g,i.b),h.setXYZ(37,i.r,i.g,i.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,i=1,s=1;let u,f;if(Mi.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)u=1,f=0;else if(this.camera.coordinateSystem===Fs)u=-1,f=1;else if(this.camera.coordinateSystem===Vh)u=0,f=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Ui("c",t,e,Mi,0,0,u),Ui("t",t,e,Mi,0,0,f),Ui("n1",t,e,Mi,-i,-s,u),Ui("n2",t,e,Mi,i,-s,u),Ui("n3",t,e,Mi,-i,s,u),Ui("n4",t,e,Mi,i,s,u),Ui("f1",t,e,Mi,-i,-s,f),Ui("f2",t,e,Mi,i,-s,f),Ui("f3",t,e,Mi,-i,s,f),Ui("f4",t,e,Mi,i,s,f),Ui("u1",t,e,Mi,i*.7,s*1.1,u),Ui("u2",t,e,Mi,-i*.7,s*1.1,u),Ui("u3",t,e,Mi,0,s*2,u),Ui("cf1",t,e,Mi,-i,0,f),Ui("cf2",t,e,Mi,i,0,f),Ui("cf3",t,e,Mi,0,-s,f),Ui("cf4",t,e,Mi,0,s,f),Ui("cn1",t,e,Mi,-i,0,u),Ui("cn2",t,e,Mi,i,0,u),Ui("cn3",t,e,Mi,0,-s,u),Ui("cn4",t,e,Mi,0,s,u),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ui(o,e,t,i,s,u,f){J0.set(s,u,f).unproject(i);const h=e[o];if(h!==void 0){const m=t.getAttribute("position");for(let g=0,_=h.length;g<_;g++)m.setXYZ(h[g],J0.x,J0.y,J0.z)}}const K0=new Ia;class dR extends Fo{constructor(e,t=16776960){const i=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 Yt;u.setIndex(new Hn(i,1)),u.setAttribute("position",new Hn(s,3)),super(u,new ns({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&K0.setFromObject(this.object),K0.isEmpty())return;const e=K0.min,t=K0.max,i=this.geometry.attributes.position,s=i.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,i.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 pR extends Fo{constructor(e,t=16776960){const i=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 Yt;u.setIndex(new Hn(i,1)),u.setAttribute("position",new yt(s,3)),super(u,new ns({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 mR extends Ou{constructor(e,t=1,i=16776960){const s=i,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 Yt;f.setAttribute("position",new yt(u,3)),f.computeBoundingSphere(),super(f,new ns({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 Yt;m.setAttribute("position",new yt(h,3)),m.computeBoundingSphere(),this.add(new Gi(m,new Pu({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 ZM=new Y;let $0,cx;class gR extends An{constructor(e=new Y(0,0,1),t=new Y(0,0,0),i=1,s=16776960,u=i*.2,f=u*.2){super(),this.type="ArrowHelper",$0===void 0&&($0=new Yt,$0.setAttribute("position",new yt([0,0,0,0,1,0],3)),cx=new Mm(.5,1,5,1),cx.translate(0,-.5,0)),this.position.copy(t),this.line=new Ou($0,new ns({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Gi(cx,new Pu({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,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{ZM.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(ZM,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),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 vR extends Fo{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Yt;s.setAttribute("position",new yt(t,3)),s.setAttribute("color",new yt(i,3));const u=new ns({vertexColors:!0,toneMapped:!1});super(s,u),this.type="AxesHelper"}setColors(e,t,i){const s=new pt,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(i),s.toArray(u,12),s.toArray(u,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class yR{constructor(){this.type="ShapePath",this.color=new pt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new $v,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.currentPath.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,u,f){return this.currentPath.bezierCurveTo(e,t,i,s,u,f),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(E){const D=[];for(let U=0,L=E.length;U<L;U++){const B=E[U],P=new Yc;P.curves=B.curves,D.push(P)}return D}function i(E,D){const U=D.length;let L=!1;for(let B=U-1,P=0;P<U;B=P++){let H=D[B],W=D[P],I=W.x-H.x,z=W.y-H.y;if(Math.abs(z)>Number.EPSILON){if(z<0&&(H=D[P],I=-I,W=D[B],z=-z),E.y<H.y||E.y>W.y)continue;if(E.y===H.y){if(E.x===H.x)return!0}else{const j=z*(E.x-H.x)-I*(E.y-H.y);if(j===0)return!0;if(j<0)continue;L=!L}}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 L}const s=Wr.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 Yc,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,D=u.length;E<D;E++)h=u[E],R=h.getPoints(),f=s(R),f=e?!f:f,f?(!_&&b[A]&&A++,b[A]={s:new Yc,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,D=0;for(let U=0,L=b.length;U<L;U++)x[U]=[];for(let U=0,L=b.length;U<L;U++){const B=M[U];for(let P=0;P<B.length;P++){const H=B[P];let W=!0;for(let I=0;I<b.length;I++)i(H.p,b[I].p)&&(U!==I&&D++,W?(W=!1,x[I].push(H)):E=!0);W&&x[U].push(H)}}D>0&&E===!1&&(M=x)}let C;for(let E=0,D=b.length;E<D;E++){m=b[E].s,g.push(m),C=M[E];for(let U=0,L=C.length;U<L;U++)m.holes.push(C[U].h)}return g}}class _R extends Bo{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){rt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function xR(o,e){const t=o.image&&o.image.width?o.image.width/o.image.height:1;return t>e?(o.repeat.x=1,o.repeat.y=t/e,o.offset.x=0,o.offset.y=(1-o.repeat.y)/2):(o.repeat.x=e/t,o.repeat.y=1,o.offset.x=(1-o.repeat.x)/2,o.offset.y=0),o}function SR(o,e){const t=o.image&&o.image.width?o.image.width/o.image.height:1;return t>e?(o.repeat.x=e/t,o.repeat.y=1,o.offset.x=(1-o.repeat.x)/2,o.offset.y=0):(o.repeat.x=1,o.repeat.y=t/e,o.offset.x=0,o.offset.y=(1-o.repeat.y)/2),o}function bR(o){return o.repeat.x=1,o.repeat.y=1,o.offset.x=0,o.offset.y=0,o}function kx(o,e,t,i){const s=MR(i);switch(t){case fS:return o*e;case cy:return o*e/s.components*s.byteLength;case xm:return o*e/s.components*s.byteLength;case jc:return o*e*2/s.components*s.byteLength;case fy:return o*e*2/s.components*s.byteLength;case hS:return o*e*3/s.components*s.byteLength;case La:return o*e*4/s.components*s.byteLength;case hy:return o*e*4/s.components*s.byteLength;case qp:case Yp:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*8;case Zp:case jp:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case yv:case xv:return Math.max(o,16)*Math.max(e,8)/4;case vv:case _v:return Math.max(o,8)*Math.max(e,8)/2;case Sv:case bv:case Ev:case Tv:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*8;case Mv:case Av:case wv:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case Cv:return Math.floor((o+3)/4)*Math.floor((e+3)/4)*16;case Rv:return Math.floor((o+4)/5)*Math.floor((e+3)/4)*16;case Dv:return Math.floor((o+4)/5)*Math.floor((e+4)/5)*16;case Nv:return Math.floor((o+5)/6)*Math.floor((e+4)/5)*16;case Uv:return Math.floor((o+5)/6)*Math.floor((e+5)/6)*16;case Lv:return Math.floor((o+7)/8)*Math.floor((e+4)/5)*16;case Iv:return Math.floor((o+7)/8)*Math.floor((e+5)/6)*16;case Ov:return Math.floor((o+7)/8)*Math.floor((e+7)/8)*16;case zv:return Math.floor((o+9)/10)*Math.floor((e+4)/5)*16;case Pv:return Math.floor((o+9)/10)*Math.floor((e+5)/6)*16;case Bv:return Math.floor((o+9)/10)*Math.floor((e+7)/8)*16;case Fv:return Math.floor((o+9)/10)*Math.floor((e+9)/10)*16;case Vv:return Math.floor((o+11)/12)*Math.floor((e+9)/10)*16;case kv:return Math.floor((o+11)/12)*Math.floor((e+11)/12)*16;case Hv:case Gv:case Xv:return Math.ceil(o/4)*Math.ceil(e/4)*16;case Wv:case qv:return Math.ceil(o/4)*Math.ceil(e/4)*8;case Yv:case Zv:return Math.ceil(o/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function MR(o){switch(o){case Ka:case oS:return{byteLength:1,components:1};case Bh:case lS:case zo:return{byteLength:2,components:1};case ly:case uy:return{byteLength:2,components:4};case gr:case oy:case es:return{byteLength:4,components:1};case uS:case cS:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${o}.`)}class ER{static contain(e,t){return xR(e,t)}static cover(e,t){return SR(e,t)}static fill(e){return bR(e)}static getByteLength(e,t,i,s){return kx(e,t,i,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ay}}));typeof window<"u"&&(window.__THREE__?rt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ay);function ST(){let o=null,e=!1,t=null,i=null;function s(u,f){t(u,f),i=o.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=o.requestAnimationFrame(s),e=!0)},stop:function(){o.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(u){t=u},setContext:function(u){o=u}}}function TR(o){const e=new WeakMap;function t(h,m){const g=h.array,_=h.usage,x=g.byteLength,b=o.createBuffer();o.bindBuffer(m,b),o.bufferData(m,g,_),h.onUploadCallback();let M;if(g instanceof Float32Array)M=o.FLOAT;else if(typeof Float16Array<"u"&&g instanceof Float16Array)M=o.HALF_FLOAT;else if(g instanceof Uint16Array)h.isFloat16BufferAttribute?M=o.HALF_FLOAT:M=o.UNSIGNED_SHORT;else if(g instanceof Int16Array)M=o.SHORT;else if(g instanceof Uint32Array)M=o.UNSIGNED_INT;else if(g instanceof Int32Array)M=o.INT;else if(g instanceof Int8Array)M=o.BYTE;else if(g instanceof Uint8Array)M=o.UNSIGNED_BYTE;else if(g instanceof Uint8ClampedArray)M=o.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 i(h,m,g){const _=m.array,x=m.updateRanges;if(o.bindBuffer(g,h),x.length===0)o.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];o.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&&(o.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.");i(g.buffer,h,m),g.version=h.version}}return{get:s,remove:u,update:f}}var AR=`#ifdef USE_ALPHAHASH
|
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
#endif`,wR=`#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`,CR=`#ifdef USE_ALPHAMAP
|
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
#endif`,RR=`#ifdef USE_ALPHAMAP
|
|
uniform sampler2D alphaMap;
|
|
#endif`,DR=`#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`,NR=`#ifdef USE_ALPHATEST
|
|
uniform float alphaTest;
|
|
#endif`,UR=`#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`,LR=`#ifdef USE_AOMAP
|
|
uniform sampler2D aoMap;
|
|
uniform float aoMapIntensity;
|
|
#endif`,IR=`#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`,OR=`#ifdef USE_BATCHING
|
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
#endif`,zR=`vec3 transformed = vec3( position );
|
|
#ifdef USE_ALPHAHASH
|
|
vPosition = vec3( position );
|
|
#endif`,PR=`vec3 objectNormal = vec3( normal );
|
|
#ifdef USE_TANGENT
|
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
#endif`,BR=`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`,FR=`#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`,VR=`#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`,kR=`#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`,HR=`#if NUM_CLIPPING_PLANES > 0
|
|
varying vec3 vClipPosition;
|
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
#endif`,GR=`#if NUM_CLIPPING_PLANES > 0
|
|
varying vec3 vClipPosition;
|
|
#endif`,XR=`#if NUM_CLIPPING_PLANES > 0
|
|
vClipPosition = - mvPosition.xyz;
|
|
#endif`,WR=`#if defined( USE_COLOR_ALPHA )
|
|
diffuseColor *= vColor;
|
|
#elif defined( USE_COLOR )
|
|
diffuseColor.rgb *= vColor;
|
|
#endif`,qR=`#if defined( USE_COLOR_ALPHA )
|
|
varying vec4 vColor;
|
|
#elif defined( USE_COLOR )
|
|
varying vec3 vColor;
|
|
#endif`,YR=`#if defined( USE_COLOR_ALPHA )
|
|
varying vec4 vColor;
|
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
varying vec3 vColor;
|
|
#endif`,ZR=`#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`,jR=`#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`,QR=`#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`,JR=`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`,KR=`#ifdef USE_DISPLACEMENTMAP
|
|
uniform sampler2D displacementMap;
|
|
uniform float displacementScale;
|
|
uniform float displacementBias;
|
|
#endif`,$R=`#ifdef USE_DISPLACEMENTMAP
|
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
#endif`,eD=`#ifdef USE_EMISSIVEMAP
|
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
#endif
|
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
#endif`,tD=`#ifdef USE_EMISSIVEMAP
|
|
uniform sampler2D emissiveMap;
|
|
#endif`,nD="gl_FragColor = linearToOutputTexel( gl_FragColor );",iD=`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 );
|
|
}`,aD=`#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`,sD=`#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`,rD=`#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`,oD=`#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`,lD=`#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`,uD=`#ifdef USE_FOG
|
|
vFogDepth = - mvPosition.z;
|
|
#endif`,cD=`#ifdef USE_FOG
|
|
varying float vFogDepth;
|
|
#endif`,fD=`#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`,hD=`#ifdef USE_FOG
|
|
uniform vec3 fogColor;
|
|
varying float vFogDepth;
|
|
#ifdef FOG_EXP2
|
|
uniform float fogDensity;
|
|
#else
|
|
uniform float fogNear;
|
|
uniform float fogFar;
|
|
#endif
|
|
#endif`,dD=`#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
|
|
}`,pD=`#ifdef USE_LIGHTMAP
|
|
uniform sampler2D lightMap;
|
|
uniform float lightMapIntensity;
|
|
#endif`,mD=`LambertMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb;
|
|
material.specularStrength = specularStrength;`,gD=`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`,vD=`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`,yD=`#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`,_D=`ToonMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb;`,xD=`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`,SD=`BlinnPhongMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb;
|
|
material.specularColor = specular;
|
|
material.specularShininess = shininess;
|
|
material.specularStrength = specularStrength;`,bD=`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`,MD=`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`,ED=`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 );
|
|
}`,TD=`
|
|
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`,AD=`#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`,wD=`#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`,CD=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
#endif`,RD=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
uniform float logDepthBufFC;
|
|
varying float vFragDepth;
|
|
varying float vIsPerspective;
|
|
#endif`,DD=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
varying float vFragDepth;
|
|
varying float vIsPerspective;
|
|
#endif`,ND=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
vFragDepth = 1.0 + gl_Position.w;
|
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
#endif`,UD=`#ifdef USE_MAP
|
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
#endif
|
|
diffuseColor *= sampledDiffuseColor;
|
|
#endif`,LD=`#ifdef USE_MAP
|
|
uniform sampler2D map;
|
|
#endif`,ID=`#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`,OD=`#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`,zD=`float metalnessFactor = metalness;
|
|
#ifdef USE_METALNESSMAP
|
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
metalnessFactor *= texelMetalness.b;
|
|
#endif`,PD=`#ifdef USE_METALNESSMAP
|
|
uniform sampler2D metalnessMap;
|
|
#endif`,BD=`#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`,FD=`#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`,VD=`#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`,kD=`#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`,HD=`#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`,GD=`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;`,XD=`#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`,WD=`#ifndef FLAT_SHADED
|
|
varying vec3 vNormal;
|
|
#ifdef USE_TANGENT
|
|
varying vec3 vTangent;
|
|
varying vec3 vBitangent;
|
|
#endif
|
|
#endif`,qD=`#ifndef FLAT_SHADED
|
|
varying vec3 vNormal;
|
|
#ifdef USE_TANGENT
|
|
varying vec3 vTangent;
|
|
varying vec3 vBitangent;
|
|
#endif
|
|
#endif`,YD=`#ifndef FLAT_SHADED
|
|
vNormal = normalize( transformedNormal );
|
|
#ifdef USE_TANGENT
|
|
vTangent = normalize( transformedTangent );
|
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
#endif
|
|
#endif`,ZD=`#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`,jD=`#ifdef USE_CLEARCOAT
|
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
#endif`,QD=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
#endif`,JD=`#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`,KD=`#ifdef USE_IRIDESCENCEMAP
|
|
uniform sampler2D iridescenceMap;
|
|
#endif
|
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
uniform sampler2D iridescenceThicknessMap;
|
|
#endif`,$D=`#ifdef OPAQUE
|
|
diffuseColor.a = 1.0;
|
|
#endif
|
|
#ifdef USE_TRANSMISSION
|
|
diffuseColor.a *= material.transmissionAlpha;
|
|
#endif
|
|
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,eN=`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 );
|
|
}`,tN=`#ifdef PREMULTIPLIED_ALPHA
|
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
#endif`,nN=`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;`,iN=`#ifdef DITHERING
|
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
#endif`,aN=`#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`,sN=`float roughnessFactor = roughness;
|
|
#ifdef USE_ROUGHNESSMAP
|
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
roughnessFactor *= texelRoughness.g;
|
|
#endif`,rN=`#ifdef USE_ROUGHNESSMAP
|
|
uniform sampler2D roughnessMap;
|
|
#endif`,oN=`#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`,lN=`#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`,uN=`#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`,cN=`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;
|
|
}`,fN=`#ifdef USE_SKINNING
|
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
#endif`,hN=`#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`,dN=`#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`,pN=`#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`,mN=`float specularStrength;
|
|
#ifdef USE_SPECULARMAP
|
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
specularStrength = texelSpecular.r;
|
|
#else
|
|
specularStrength = 1.0;
|
|
#endif`,gN=`#ifdef USE_SPECULARMAP
|
|
uniform sampler2D specularMap;
|
|
#endif`,vN=`#if defined( TONE_MAPPING )
|
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
#endif`,yN=`#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; }`,_N=`#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`,xN=`#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`,SN=`#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`,bN=`#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`,MN=`#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`,EN=`#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 TN=`varying vec2 vUv;
|
|
uniform mat3 uvTransform;
|
|
void main() {
|
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
}`,AN=`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>
|
|
}`,wN=`varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
gl_Position.z = gl_Position.w;
|
|
}`,CN=`#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>
|
|
}`,RN=`varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
gl_Position.z = gl_Position.w;
|
|
}`,DN=`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>
|
|
}`,NN=`#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;
|
|
}`,UN=`#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
|
|
}`,LN=`#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;
|
|
}`,IN=`#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 );
|
|
}`,ON=`varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
}`,zN=`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>
|
|
}`,PN=`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>
|
|
}`,BN=`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>
|
|
}`,FN=`#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>
|
|
}`,VN=`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>
|
|
}`,kN=`#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>
|
|
}`,HN=`#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>
|
|
}`,GN=`#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;
|
|
}`,XN=`#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>
|
|
}`,WN=`#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
|
|
}`,qN=`#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
|
|
}`,YN=`#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>
|
|
}`,ZN=`#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>
|
|
}`,jN=`#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
|
|
}`,QN=`#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>
|
|
}`,JN=`#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>
|
|
}`,KN=`#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>
|
|
}`,$N=`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>
|
|
}`,eU=`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>
|
|
}`,tU=`#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>
|
|
}`,nU=`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>
|
|
}`,iU=`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>
|
|
}`,aU=`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>
|
|
}`,an={alphahash_fragment:AR,alphahash_pars_fragment:wR,alphamap_fragment:CR,alphamap_pars_fragment:RR,alphatest_fragment:DR,alphatest_pars_fragment:NR,aomap_fragment:UR,aomap_pars_fragment:LR,batching_pars_vertex:IR,batching_vertex:OR,begin_vertex:zR,beginnormal_vertex:PR,bsdfs:BR,iridescence_fragment:FR,bumpmap_pars_fragment:VR,clipping_planes_fragment:kR,clipping_planes_pars_fragment:HR,clipping_planes_pars_vertex:GR,clipping_planes_vertex:XR,color_fragment:WR,color_pars_fragment:qR,color_pars_vertex:YR,color_vertex:ZR,common:jR,cube_uv_reflection_fragment:QR,defaultnormal_vertex:JR,displacementmap_pars_vertex:KR,displacementmap_vertex:$R,emissivemap_fragment:eD,emissivemap_pars_fragment:tD,colorspace_fragment:nD,colorspace_pars_fragment:iD,envmap_fragment:aD,envmap_common_pars_fragment:sD,envmap_pars_fragment:rD,envmap_pars_vertex:oD,envmap_physical_pars_fragment:yD,envmap_vertex:lD,fog_vertex:uD,fog_pars_vertex:cD,fog_fragment:fD,fog_pars_fragment:hD,gradientmap_pars_fragment:dD,lightmap_pars_fragment:pD,lights_lambert_fragment:mD,lights_lambert_pars_fragment:gD,lights_pars_begin:vD,lights_toon_fragment:_D,lights_toon_pars_fragment:xD,lights_phong_fragment:SD,lights_phong_pars_fragment:bD,lights_physical_fragment:MD,lights_physical_pars_fragment:ED,lights_fragment_begin:TD,lights_fragment_maps:AD,lights_fragment_end:wD,logdepthbuf_fragment:CD,logdepthbuf_pars_fragment:RD,logdepthbuf_pars_vertex:DD,logdepthbuf_vertex:ND,map_fragment:UD,map_pars_fragment:LD,map_particle_fragment:ID,map_particle_pars_fragment:OD,metalnessmap_fragment:zD,metalnessmap_pars_fragment:PD,morphinstance_vertex:BD,morphcolor_vertex:FD,morphnormal_vertex:VD,morphtarget_pars_vertex:kD,morphtarget_vertex:HD,normal_fragment_begin:GD,normal_fragment_maps:XD,normal_pars_fragment:WD,normal_pars_vertex:qD,normal_vertex:YD,normalmap_pars_fragment:ZD,clearcoat_normal_fragment_begin:jD,clearcoat_normal_fragment_maps:QD,clearcoat_pars_fragment:JD,iridescence_pars_fragment:KD,opaque_fragment:$D,packing:eN,premultiplied_alpha_fragment:tN,project_vertex:nN,dithering_fragment:iN,dithering_pars_fragment:aN,roughnessmap_fragment:sN,roughnessmap_pars_fragment:rN,shadowmap_pars_fragment:oN,shadowmap_pars_vertex:lN,shadowmap_vertex:uN,shadowmask_pars_fragment:cN,skinbase_vertex:fN,skinning_pars_vertex:hN,skinning_vertex:dN,skinnormal_vertex:pN,specularmap_fragment:mN,specularmap_pars_fragment:gN,tonemapping_fragment:vN,tonemapping_pars_fragment:yN,transmission_fragment:_N,transmission_pars_fragment:xN,uv_pars_fragment:SN,uv_pars_vertex:bN,uv_vertex:MN,worldpos_vertex:EN,background_vert:TN,background_frag:AN,backgroundCube_vert:wN,backgroundCube_frag:CN,cube_vert:RN,cube_frag:DN,depth_vert:NN,depth_frag:UN,distance_vert:LN,distance_frag:IN,equirect_vert:ON,equirect_frag:zN,linedashed_vert:PN,linedashed_frag:BN,meshbasic_vert:FN,meshbasic_frag:VN,meshlambert_vert:kN,meshlambert_frag:HN,meshmatcap_vert:GN,meshmatcap_frag:XN,meshnormal_vert:WN,meshnormal_frag:qN,meshphong_vert:YN,meshphong_frag:ZN,meshphysical_vert:jN,meshphysical_frag:QN,meshtoon_vert:JN,meshtoon_frag:KN,points_vert:$N,points_frag:eU,shadow_vert:tU,shadow_frag:nU,sprite_vert:iU,sprite_frag:aU},ot={common:{diffuse:{value:new pt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qt}},envmap:{envMap:{value:null},envMapRotation:{value:new Qt},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 Qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qt},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pt(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 pt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new pt(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}}},Xr={basic:{uniforms:Ja([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.fog]),vertexShader:an.meshbasic_vert,fragmentShader:an.meshbasic_frag},lambert:{uniforms:Ja([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,ot.lights,{emissive:{value:new pt(0)}}]),vertexShader:an.meshlambert_vert,fragmentShader:an.meshlambert_frag},phong:{uniforms:Ja([ot.common,ot.specularmap,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,ot.lights,{emissive:{value:new pt(0)},specular:{value:new pt(1118481)},shininess:{value:30}}]),vertexShader:an.meshphong_vert,fragmentShader:an.meshphong_frag},standard:{uniforms:Ja([ot.common,ot.envmap,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.roughnessmap,ot.metalnessmap,ot.fog,ot.lights,{emissive:{value:new pt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:an.meshphysical_vert,fragmentShader:an.meshphysical_frag},toon:{uniforms:Ja([ot.common,ot.aomap,ot.lightmap,ot.emissivemap,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.gradientmap,ot.fog,ot.lights,{emissive:{value:new pt(0)}}]),vertexShader:an.meshtoon_vert,fragmentShader:an.meshtoon_frag},matcap:{uniforms:Ja([ot.common,ot.bumpmap,ot.normalmap,ot.displacementmap,ot.fog,{matcap:{value:null}}]),vertexShader:an.meshmatcap_vert,fragmentShader:an.meshmatcap_frag},points:{uniforms:Ja([ot.points,ot.fog]),vertexShader:an.points_vert,fragmentShader:an.points_frag},dashed:{uniforms:Ja([ot.common,ot.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:an.linedashed_vert,fragmentShader:an.linedashed_frag},depth:{uniforms:Ja([ot.common,ot.displacementmap]),vertexShader:an.depth_vert,fragmentShader:an.depth_frag},normal:{uniforms:Ja([ot.common,ot.bumpmap,ot.normalmap,ot.displacementmap,{opacity:{value:1}}]),vertexShader:an.meshnormal_vert,fragmentShader:an.meshnormal_frag},sprite:{uniforms:Ja([ot.sprite,ot.fog]),vertexShader:an.sprite_vert,fragmentShader:an.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:an.background_vert,fragmentShader:an.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qt}},vertexShader:an.backgroundCube_vert,fragmentShader:an.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:an.cube_vert,fragmentShader:an.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:an.equirect_vert,fragmentShader:an.equirect_frag},distance:{uniforms:Ja([ot.common,ot.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:an.distance_vert,fragmentShader:an.distance_frag},shadow:{uniforms:Ja([ot.lights,ot.fog,{color:{value:new pt(0)},opacity:{value:1}}]),vertexShader:an.shadow_vert,fragmentShader:an.shadow_frag}};Xr.physical={uniforms:Ja([Xr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qt},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qt},sheen:{value:0},sheenColor:{value:new pt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qt},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qt},attenuationDistance:{value:0},attenuationColor:{value:new pt(0)},specularColor:{value:new pt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qt},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qt}}]),vertexShader:an.meshphysical_vert,fragmentShader:an.meshphysical_frag};const ev={r:0,b:0,g:0},Pc=new Hs,sU=new kt;function rU(o,e,t,i,s,u,f){const h=new pt(0);let m=u===!0?0:1,g,_,x=null,b=0,M=null;function A(U){let L=U.isScene===!0?U.background:null;return L&&L.isTexture&&(L=(U.backgroundBlurriness>0?t:e).get(L)),L}function R(U){let L=!1;const B=A(U);B===null?E(h,m):B&&B.isColor&&(E(B,1),L=!0);const P=o.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,f):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,f),(o.autoClear||L)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),o.clear(o.autoClearColor,o.autoClearDepth,o.autoClearStencil))}function C(U,L){const B=A(L);B&&(B.isCubeTexture||B.mapping===jh)?(_===void 0&&(_=new Gi(new $c(1,1,1),new vr({name:"BackgroundCubeMaterial",uniforms:Xh(Xr.backgroundCube.uniforms),vertexShader:Xr.backgroundCube.vertexShader,fragmentShader:Xr.backgroundCube.fragmentShader,side:ts,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),_.geometry.deleteAttribute("normal"),_.geometry.deleteAttribute("uv"),_.onBeforeRender=function(P,H,W){this.matrixWorld.copyPosition(W.matrixWorld)},Object.defineProperty(_.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(_)),Pc.copy(L.backgroundRotation),Pc.x*=-1,Pc.y*=-1,Pc.z*=-1,B.isCubeTexture&&B.isRenderTargetTexture===!1&&(Pc.y*=-1,Pc.z*=-1),_.material.uniforms.envMap.value=B,_.material.uniforms.flipEnvMap.value=B.isCubeTexture&&B.isRenderTargetTexture===!1?-1:1,_.material.uniforms.backgroundBlurriness.value=L.backgroundBlurriness,_.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,_.material.uniforms.backgroundRotation.value.setFromMatrix4(sU.makeRotationFromEuler(Pc)),_.material.toneMapped=xn.getTransfer(B.colorSpace)!==On,(x!==B||b!==B.version||M!==o.toneMapping)&&(_.material.needsUpdate=!0,x=B,b=B.version,M=o.toneMapping),_.layers.enableAll(),U.unshift(_,_.geometry,_.material,0,0,null)):B&&B.isTexture&&(g===void 0&&(g=new Gi(new Kh(2,2),new vr({name:"BackgroundMaterial",uniforms:Xh(Xr.background.uniforms),vertexShader:Xr.background.vertexShader,fragmentShader:Xr.background.fragmentShader,side:Cl,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=L.backgroundIntensity,g.material.toneMapped=xn.getTransfer(B.colorSpace)!==On,B.matrixAutoUpdate===!0&&B.updateMatrix(),g.material.uniforms.uvTransform.value.copy(B.matrix),(x!==B||b!==B.version||M!==o.toneMapping)&&(g.material.needsUpdate=!0,x=B,b=B.version,M=o.toneMapping),g.layers.enableAll(),U.unshift(g,g.geometry,g.material,0,0,null))}function E(U,L){U.getRGB(ev,EE(o)),i.buffers.color.setClear(ev.r,ev.g,ev.b,L,f)}function D(){_!==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(U,L=1){h.set(U),m=L,E(h,m)},getClearAlpha:function(){return m},setClearAlpha:function(U){m=U,E(h,m)},render:R,addToRenderList:C,dispose:D}}function oU(o,e){const t=o.getParameter(o.MAX_VERTEX_ATTRIBS),i={},s=b(null);let u=s,f=!1;function h(z,j,ae,$,ue){let he=!1;const q=x($,ae,j);u!==q&&(u=q,g(u.object)),he=M(z,$,ae,ue),he&&A(z,$,ae,ue),ue!==null&&e.update(ue,o.ELEMENT_ARRAY_BUFFER),(he||f)&&(f=!1,L(z,j,ae,$),ue!==null&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,e.get(ue).buffer))}function m(){return o.createVertexArray()}function g(z){return o.bindVertexArray(z)}function _(z){return o.deleteVertexArray(z)}function x(z,j,ae){const $=ae.wireframe===!0;let ue=i[z.id];ue===void 0&&(ue={},i[z.id]=ue);let he=ue[j.id];he===void 0&&(he={},ue[j.id]=he);let q=he[$];return q===void 0&&(q=b(m()),he[$]=q),q}function b(z){const j=[],ae=[],$=[];for(let ue=0;ue<t;ue++)j[ue]=0,ae[ue]=0,$[ue]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:j,enabledAttributes:ae,attributeDivisors:$,object:z,attributes:{},index:null}}function M(z,j,ae,$){const ue=u.attributes,he=j.attributes;let q=0;const K=ae.getAttributes();for(const ce in K)if(K[ce].location>=0){const Ce=ue[ce];let X=he[ce];if(X===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(X=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(X=z.instanceColor)),Ce===void 0||Ce.attribute!==X||X&&Ce.data!==X.data)return!0;q++}return u.attributesNum!==q||u.index!==$}function A(z,j,ae,$){const ue={},he=j.attributes;let q=0;const K=ae.getAttributes();for(const ce in K)if(K[ce].location>=0){let Ce=he[ce];Ce===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Ce=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Ce=z.instanceColor));const X={};X.attribute=Ce,Ce&&Ce.data&&(X.data=Ce.data),ue[ce]=X,q++}u.attributes=ue,u.attributesNum=q,u.index=$}function R(){const z=u.newAttributes;for(let j=0,ae=z.length;j<ae;j++)z[j]=0}function C(z){E(z,0)}function E(z,j){const ae=u.newAttributes,$=u.enabledAttributes,ue=u.attributeDivisors;ae[z]=1,$[z]===0&&(o.enableVertexAttribArray(z),$[z]=1),ue[z]!==j&&(o.vertexAttribDivisor(z,j),ue[z]=j)}function D(){const z=u.newAttributes,j=u.enabledAttributes;for(let ae=0,$=j.length;ae<$;ae++)j[ae]!==z[ae]&&(o.disableVertexAttribArray(ae),j[ae]=0)}function U(z,j,ae,$,ue,he,q){q===!0?o.vertexAttribIPointer(z,j,ae,ue,he):o.vertexAttribPointer(z,j,ae,$,ue,he)}function L(z,j,ae,$){R();const ue=$.attributes,he=ae.getAttributes(),q=j.defaultAttributeValues;for(const K in he){const ce=he[K];if(ce.location>=0){let Ae=ue[K];if(Ae===void 0&&(K==="instanceMatrix"&&z.instanceMatrix&&(Ae=z.instanceMatrix),K==="instanceColor"&&z.instanceColor&&(Ae=z.instanceColor)),Ae!==void 0){const Ce=Ae.normalized,X=Ae.itemSize,se=e.get(Ae);if(se===void 0)continue;const Ee=se.buffer,Oe=se.type,nt=se.bytesPerElement,fe=Oe===o.INT||Oe===o.UNSIGNED_INT||Ae.gpuType===oy;if(Ae.isInterleavedBufferAttribute){const Te=Ae.data,Je=Te.stride,et=Ae.offset;if(Te.isInstancedInterleavedBuffer){for(let ut=0;ut<ce.locationSize;ut++)E(ce.location+ut,Te.meshPerAttribute);z.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=Te.meshPerAttribute*Te.count)}else for(let ut=0;ut<ce.locationSize;ut++)C(ce.location+ut);o.bindBuffer(o.ARRAY_BUFFER,Ee);for(let ut=0;ut<ce.locationSize;ut++)U(ce.location+ut,X/ce.locationSize,Oe,Ce,Je*nt,(et+X/ce.locationSize*ut)*nt,fe)}else{if(Ae.isInstancedBufferAttribute){for(let Te=0;Te<ce.locationSize;Te++)E(ce.location+Te,Ae.meshPerAttribute);z.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=Ae.meshPerAttribute*Ae.count)}else for(let Te=0;Te<ce.locationSize;Te++)C(ce.location+Te);o.bindBuffer(o.ARRAY_BUFFER,Ee);for(let Te=0;Te<ce.locationSize;Te++)U(ce.location+Te,X/ce.locationSize,Oe,Ce,X*nt,X/ce.locationSize*Te*nt,fe)}}else if(q!==void 0){const Ce=q[K];if(Ce!==void 0)switch(Ce.length){case 2:o.vertexAttrib2fv(ce.location,Ce);break;case 3:o.vertexAttrib3fv(ce.location,Ce);break;case 4:o.vertexAttrib4fv(ce.location,Ce);break;default:o.vertexAttrib1fv(ce.location,Ce)}}}}D()}function B(){W();for(const z in i){const j=i[z];for(const ae in j){const $=j[ae];for(const ue in $)_($[ue].object),delete $[ue];delete j[ae]}delete i[z]}}function P(z){if(i[z.id]===void 0)return;const j=i[z.id];for(const ae in j){const $=j[ae];for(const ue in $)_($[ue].object),delete $[ue];delete j[ae]}delete i[z.id]}function H(z){for(const j in i){const ae=i[j];if(ae[z.id]===void 0)continue;const $=ae[z.id];for(const ue in $)_($[ue].object),delete $[ue];delete ae[z.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:P,releaseStatesOfProgram:H,initAttributes:R,enableAttribute:C,disableUnusedAttributes:D}}function lU(o,e,t){let i;function s(g){i=g}function u(g,_){o.drawArrays(i,g,_),t.update(_,i,1)}function f(g,_,x){x!==0&&(o.drawArraysInstanced(i,g,_,x),t.update(_,i,x))}function h(g,_,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,g,0,_,0,x);let M=0;for(let A=0;A<x;A++)M+=_[A];t.update(M,i,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(i,g,0,_,0,b,0,x);let A=0;for(let R=0;R<x;R++)A+=_[R]*b[R];t.update(A,i,1)}}this.setMode=s,this.render=u,this.renderInstances=f,this.renderMultiDraw=h,this.renderMultiDrawInstances=m}function uU(o,e,t,i){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=o.getParameter(H.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function f(H){return!(H!==La&&i.convert(H)!==o.getParameter(o.IMPLEMENTATION_COLOR_READ_FORMAT))}function h(H){const W=H===zo&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(H!==Ka&&i.convert(H)!==o.getParameter(o.IMPLEMENTATION_COLOR_READ_TYPE)&&H!==es&&!W)}function m(H){if(H==="highp"){if(o.getShaderPrecisionFormat(o.VERTEX_SHADER,o.HIGH_FLOAT).precision>0&&o.getShaderPrecisionFormat(o.FRAGMENT_SHADER,o.HIGH_FLOAT).precision>0)return"highp";H="mediump"}return H==="mediump"&&o.getShaderPrecisionFormat(o.VERTEX_SHADER,o.MEDIUM_FLOAT).precision>0&&o.getShaderPrecisionFormat(o.FRAGMENT_SHADER,o.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let g=t.precision!==void 0?t.precision:"highp";const _=m(g);_!==g&&(rt("WebGLRenderer:",g,"not supported, using",_,"instead."),g=_);const x=t.logarithmicDepthBuffer===!0,b=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),M=o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS),A=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS),R=o.getParameter(o.MAX_TEXTURE_SIZE),C=o.getParameter(o.MAX_CUBE_MAP_TEXTURE_SIZE),E=o.getParameter(o.MAX_VERTEX_ATTRIBS),D=o.getParameter(o.MAX_VERTEX_UNIFORM_VECTORS),U=o.getParameter(o.MAX_VARYING_VECTORS),L=o.getParameter(o.MAX_FRAGMENT_UNIFORM_VECTORS),B=o.getParameter(o.MAX_SAMPLES),P=o.getParameter(o.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:C,maxAttributes:E,maxVertexUniforms:D,maxVaryings:U,maxFragmentUniforms:L,maxSamples:B,samples:P}}function cU(o){const e=this;let t=null,i=0,s=!1,u=!1;const f=new Au,h=new Qt,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||i!==0||s;return s=b,i=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,C=x.clipShadows,E=o.get(x);if(!s||A===null||A.length===0||u&&!C)u?_(null):g();else{const D=u?0:i,U=D*4;let L=E.clippingState||null;m.value=L,L=_(A,b,U,M);for(let B=0;B!==U;++B)L[B]=t[B];E.clippingState=L,this.numIntersection=R?this.numPlanes:0,this.numPlanes+=D}};function g(){m.value!==t&&(m.value=t,m.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function _(x,b,M,A){const R=x!==null?x.length:0;let C=null;if(R!==0){if(C=m.value,A!==!0||C===null){const E=M+R*4,D=b.matrixWorldInverse;h.getNormalMatrix(D),(C===null||C.length<E)&&(C=new Float32Array(E));for(let U=0,L=M;U!==R;++U,L+=4)f.copy(x[U]).applyMatrix4(D,h),f.normal.toArray(C,L),C[L+3]=f.constant}m.value=C,m.needsUpdate=!0}return e.numPlanes=R,e.numIntersection=0,C}}function fU(o){let e=new WeakMap;function t(f,h){return h===em?f.mapping=Oo:h===tm&&(f.mapping=Uu),f}function i(f){if(f&&f.isTexture){const h=f.mapping;if(h===em||h===tm)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 yS(m.height);return g.fromEquirectangularTexture(o,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:i,dispose:u}}const Nu=4,jM=[.125,.215,.35,.446,.526,.582],Vc=20,hU=256,Fp=new $h,QM=new pt;let fx=null,hx=0,dx=0,px=!1;const dU=new Y;class Hx{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,i=.1,s=100,u={}){const{size:f=256,position:h=dU}=u;fx=this._renderer.getRenderTarget(),hx=this._renderer.getActiveCubeFace(),dx=this._renderer.getActiveMipmapLevel(),px=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(f);const m=this._allocateTargets();return m.depthBuffer=!0,this._sceneToCubeUV(e,i,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=$M(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=KM(),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(fx,hx,dx),this._renderer.xr.enabled=px,e.scissorTest=!1,Rh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Oo||e.mapping===Uu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),fx=this._renderer.getRenderTarget(),hx=this._renderer.getActiveCubeFace(),dx=this._renderer.getActiveMipmapLevel(),px=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:ai,minFilter:ai,generateMipmaps:!1,type:zo,format:La,colorSpace:Lu,depthBuffer:!1},s=JM(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=JM(e,t,i);const{_lodMax:u}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=pU(u)),this._blurMaterial=gU(u,e,t),this._ggxMaterial=mU(u,e,t)}return s}_compileMaterial(e){const t=new Gi(new Yt,e);this._renderer.compile(t,Fp)}_sceneToCubeUV(e,t,i,s,u){const m=new aa(90,1,t,i),g=[1,-1,1,1,1,1],_=[1,1,1,-1,-1,-1],x=this._renderer,b=x.autoClear,M=x.toneMapping;x.getClearColor(QM),x.toneMapping=mr,x.autoClear=!1,x.state.buffers.depth.getReversed()&&(x.setRenderTarget(s),x.clearDepth(),x.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gi(new $c,new Pu({name:"PMREM.Background",side:ts,depthWrite:!1,depthTest:!1})));const R=this._backgroundBox,C=R.material;let E=!1;const D=e.background;D?D.isColor&&(C.color.copy(D),e.background=null,E=!0):(C.color.copy(QM),E=!0);for(let U=0;U<6;U++){const L=U%3;L===0?(m.up.set(0,g[U],0),m.position.set(u.x,u.y,u.z),m.lookAt(u.x+_[U],u.y,u.z)):L===1?(m.up.set(0,0,g[U]),m.position.set(u.x,u.y,u.z),m.lookAt(u.x,u.y+_[U],u.z)):(m.up.set(0,g[U],0),m.position.set(u.x,u.y,u.z),m.lookAt(u.x,u.y,u.z+_[U]));const B=this._cubeSize;Rh(s,L*B,U>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=D}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Oo||e.mapping===Uu;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=$M()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=KM());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;Rh(t,0,0,3*m,2*m),i.setRenderTarget(t),i.render(f,Fp)}_applyPMREM(e){const t=this._renderer,i=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=i}_applyGGXFilter(e,t,i){const s=this._renderer,u=this._pingPongRenderTarget,f=this._ggxMaterial,h=this._lodMeshes[i];h.material=f;const m=f.uniforms,g=i/(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[i],C=3*R*(i>A-Nu?i-A+Nu:0),E=4*(this._cubeSize-R);m.envMap.value=e.texture,m.roughness.value=M,m.mipInt.value=A-t,Rh(u,C,E,3*R,2*R),s.setRenderTarget(u),s.render(h,Fp),m.envMap.value=u.texture,m.roughness.value=0,m.mipInt.value=A-i,Rh(e,C,E,3*R,2*R),s.setRenderTarget(e),s.render(h,Fp)}_blur(e,t,i,s,u){const f=this._pingPongRenderTarget;this._halfBlur(e,f,t,i,s,"latitudinal",u),this._halfBlur(f,e,i,i,s,"longitudinal",u)}_halfBlur(e,t,i,s,u,f,h){const m=this._renderer,g=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&Tt("blur direction must be either latitudinal or longitudinal!");const _=3,x=this._lodMeshes[s];x.material=g;const b=g.uniforms,M=this._sizeLods[i]-1,A=isFinite(u)?Math.PI/(2*M):2*Math.PI/(2*Vc-1),R=u/A,C=isFinite(u)?1+Math.floor(_*R):Vc;C>Vc&&rt(`sigmaRadians, ${u}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${Vc}`);const E=[];let D=0;for(let H=0;H<Vc;++H){const W=H/R,I=Math.exp(-W*W/2);E.push(I),H===0?D+=I:H<C&&(D+=2*I)}for(let H=0;H<E.length;H++)E[H]=E[H]/D;b.envMap.value=e.texture,b.samples.value=C,b.weights.value=E,b.latitudinal.value=f==="latitudinal",h&&(b.poleAxis.value=h);const{_lodMax:U}=this;b.dTheta.value=A,b.mipInt.value=U-i;const L=this._sizeLods[s],B=3*L*(s>U-Nu?s-U+Nu:0),P=4*(this._cubeSize-L);Rh(t,B,P,3*L,2*L),m.setRenderTarget(t),m.render(x,Fp)}}function pU(o){const e=[],t=[],i=[];let s=o;const u=o-Nu+1+jM.length;for(let f=0;f<u;f++){const h=Math.pow(2,s);e.push(h);let m=1/h;f>o-Nu?m=jM[f-o+Nu-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,C=2,E=1,D=new Float32Array(R*A*M),U=new Float32Array(C*A*M),L=new Float32Array(E*A*M);for(let P=0;P<M;P++){const H=P%3*2/3-1,W=P>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];D.set(I,R*A*P),U.set(b,C*A*P);const z=[P,P,P,P,P,P];L.set(z,E*A*P)}const B=new Yt;B.setAttribute("position",new Hn(D,R)),B.setAttribute("uv",new Hn(U,C)),B.setAttribute("faceIndex",new Hn(L,E)),i.push(new Gi(B,null)),s>Nu&&s--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function JM(o,e,t){const i=new ks(o,e,t);return i.texture.mapping=jh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Rh(o,e,t,i,s){o.viewport.set(e,t,i,s),o.scissor.set(e,t,i,s)}function mU(o,e,t){return new vr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:hU,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${o}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Fy(),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:Io,depthTest:!1,depthWrite:!1})}function gU(o,e,t){const i=new Float32Array(Vc),s=new Y(0,1,0);return new vr({name:"SphericalGaussianBlur",defines:{n:Vc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${o}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Fy(),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:Io,depthTest:!1,depthWrite:!1})}function KM(){return new vr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Fy(),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:Io,depthTest:!1,depthWrite:!1})}function $M(){return new vr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Fy(),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:Io,depthTest:!1,depthWrite:!1})}function Fy(){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 vU(o){let e=new WeakMap,t=null;function i(h){if(h&&h.isTexture){const m=h.mapping,g=m===em||m===tm,_=m===Oo||m===Uu;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 Hx(o)),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 Hx(o)),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:i,dispose:f}}function yU(o){const e={};function t(i){if(e[i]!==void 0)return e[i];const s=o.getExtension(i);return e[i]=s,s}return{has:function(i){return t(i)!==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(i){const s=t(i);return s===null&&kh("WebGLRenderer: "+i+" extension not supported."),s}}}function _U(o,e,t,i){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)),i.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],o.ARRAY_BUFFER)}function g(x){const b=[],M=x.index,A=x.attributes.position;let R=0;if(M!==null){const D=M.array;R=M.version;for(let U=0,L=D.length;U<L;U+=3){const B=D[U+0],P=D[U+1],H=D[U+2];b.push(B,P,P,H,H,B)}}else if(A!==void 0){const D=A.array;R=A.version;for(let U=0,L=D.length/3-1;U<L;U+=3){const B=U+0,P=U+1,H=U+2;b.push(B,P,P,H,H,B)}}else return;const C=new(yE(b)?vS:gS)(b,1);C.version=R;const E=u.get(x);E&&e.remove(E),u.set(x,C)}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 xU(o,e,t){let i;function s(b){i=b}let u,f;function h(b){u=b.type,f=b.bytesPerElement}function m(b,M){o.drawElements(i,M,u,b*f),t.update(M,i,1)}function g(b,M,A){A!==0&&(o.drawElementsInstanced(i,M,u,b*f,A),t.update(M,i,A))}function _(b,M,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,M,0,u,b,0,A);let C=0;for(let E=0;E<A;E++)C+=M[E];t.update(C,i,1)}function x(b,M,A,R){if(A===0)return;const C=e.get("WEBGL_multi_draw");if(C===null)for(let E=0;E<b.length;E++)g(b[E]/f,M[E],R[E]);else{C.multiDrawElementsInstancedWEBGL(i,M,0,u,b,0,R,0,A);let E=0;for(let D=0;D<A;D++)E+=M[D]*R[D];t.update(E,i,1)}}this.setMode=s,this.setIndex=h,this.render=m,this.renderInstances=g,this.renderMultiDraw=_,this.renderMultiDrawInstances=x}function SU(o){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(u,f,h){switch(t.calls++,f){case o.TRIANGLES:t.triangles+=h*(u/3);break;case o.LINES:t.lines+=h*(u/2);break;case o.LINE_STRIP:t.lines+=h*(u-1);break;case o.LINE_LOOP:t.lines+=h*u;break;case o.POINTS:t.points+=h*u;break;default:Tt("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:i}}function bU(o,e,t){const i=new WeakMap,s=new Wn;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=i.get(h);if(b===void 0||b.count!==x){let I=function(){H.dispose(),i.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,C=h.morphAttributes.position||[],E=h.morphAttributes.normal||[],D=h.morphAttributes.color||[];let U=0;M===!0&&(U=1),A===!0&&(U=2),R===!0&&(U=3);let L=h.attributes.position.count*U,B=1;L>e.maxTextureSize&&(B=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const P=new Float32Array(L*B*4*x),H=new gy(P,L,B,x);H.type=es,H.needsUpdate=!0;const W=U*4;for(let z=0;z<x;z++){const j=C[z],ae=E[z],$=D[z],ue=L*B*4*z;for(let he=0;he<j.count;he++){const q=he*W;M===!0&&(s.fromBufferAttribute(j,he),P[ue+q+0]=s.x,P[ue+q+1]=s.y,P[ue+q+2]=s.z,P[ue+q+3]=0),A===!0&&(s.fromBufferAttribute(ae,he),P[ue+q+4]=s.x,P[ue+q+5]=s.y,P[ue+q+6]=s.z,P[ue+q+7]=0),R===!0&&(s.fromBufferAttribute($,he),P[ue+q+8]=s.x,P[ue+q+9]=s.y,P[ue+q+10]=s.z,P[ue+q+11]=$.itemSize===4?s.w:1)}}b={count:x,texture:H,size:new Pe(L,B)},i.set(h,b),h.addEventListener("dispose",I)}if(f.isInstancedMesh===!0&&f.morphTexture!==null)m.getUniforms().setValue(o,"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(o,"morphTargetBaseInfluence",A),m.getUniforms().setValue(o,"morphTargetInfluences",g)}m.getUniforms().setValue(o,"morphTargetsTexture",b.texture,t),m.getUniforms().setValue(o,"morphTargetsTextureSize",b.size)}return{update:u}}function MU(o,e,t,i){let s=new WeakMap;function u(m){const g=i.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,o.ARRAY_BUFFER),m.instanceColor!==null&&t.update(m.instanceColor,o.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 EU={[eS]:"LINEAR_TONE_MAPPING",[tS]:"REINHARD_TONE_MAPPING",[nS]:"CINEON_TONE_MAPPING",[sy]:"ACES_FILMIC_TONE_MAPPING",[aS]:"AGX_TONE_MAPPING",[sS]:"NEUTRAL_TONE_MAPPING",[iS]:"CUSTOM_TONE_MAPPING"};function TU(o,e,t,i,s){const u=new ks(e,t,{type:o,depthBuffer:i,stencilBuffer:s}),f=new ks(e,t,{type:zo,depthBuffer:!1,stencilBuffer:!1}),h=new Yt;h.setAttribute("position",new yt([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new yt([0,2,0,0,2,0],2));const m=new DS({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 Gi(h,m),_=new $h(-1,1,1,-1,0,1);let x=null,b=null,M=!1,A,R=null,C=[],E=!1;this.setSize=function(D,U){u.setSize(D,U),f.setSize(D,U);for(let L=0;L<C.length;L++){const B=C[L];B.setSize&&B.setSize(D,U)}},this.setEffects=function(D){C=D,E=C.length>0&&C[0].isRenderPass===!0;const U=u.width,L=u.height;for(let B=0;B<C.length;B++){const P=C[B];P.setSize&&P.setSize(U,L)}},this.begin=function(D,U){if(M||D.toneMapping===mr&&C.length===0)return!1;if(R=U,U!==null){const L=U.width,B=U.height;(u.width!==L||u.height!==B)&&this.setSize(L,B)}return E===!1&&D.setRenderTarget(u),A=D.toneMapping,D.toneMapping=mr,!0},this.hasRenderPass=function(){return E},this.end=function(D,U){D.toneMapping=A,M=!0;let L=u,B=f;for(let P=0;P<C.length;P++){const H=C[P];if(H.enabled!==!1&&(H.render(D,B,L,U),H.needsSwap!==!1)){const W=L;L=B,B=W}}if(x!==D.outputColorSpace||b!==D.toneMapping){x=D.outputColorSpace,b=D.toneMapping,m.defines={},xn.getTransfer(x)===On&&(m.defines.SRGB_TRANSFER="");const P=EU[b];P&&(m.defines[P]=""),m.needsUpdate=!0}m.uniforms.tDiffuse.value=L.texture,D.setRenderTarget(R),D.render(g,_),R=null,M=!1},this.isCompositing=function(){return M},this.dispose=function(){u.dispose(),f.dispose(),h.dispose(),m.dispose()}}const bT=new Ei,Gx=new qh(1,1),MT=new gy,ET=new vy,TT=new Sm,e1=[],t1=[],n1=new Float32Array(16),i1=new Float32Array(9),a1=new Float32Array(4);function ed(o,e,t){const i=o[0];if(i<=0||i>0)return o;const s=e*t;let u=e1[s];if(u===void 0&&(u=new Float32Array(s),e1[s]=u),e!==0){i.toArray(u,0);for(let f=1,h=0;f!==e;++f)h+=t,o[f].toArray(u,h)}return u}function Qi(o,e){if(o.length!==e.length)return!1;for(let t=0,i=o.length;t<i;t++)if(o[t]!==e[t])return!1;return!0}function Ji(o,e){for(let t=0,i=e.length;t<i;t++)o[t]=e[t]}function Vy(o,e){let t=t1[e];t===void 0&&(t=new Int32Array(e),t1[e]=t);for(let i=0;i!==e;++i)t[i]=o.allocateTextureUnit();return t}function AU(o,e){const t=this.cache;t[0]!==e&&(o.uniform1f(this.addr,e),t[0]=e)}function wU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qi(t,e))return;o.uniform2fv(this.addr,e),Ji(t,e)}}function CU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.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)&&(o.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Qi(t,e))return;o.uniform3fv(this.addr,e),Ji(t,e)}}function RU(o,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)&&(o.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(Qi(t,e))return;o.uniform4fv(this.addr,e),Ji(t,e)}}function DU(o,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qi(t,e))return;o.uniformMatrix2fv(this.addr,!1,e),Ji(t,e)}else{if(Qi(t,i))return;a1.set(i),o.uniformMatrix2fv(this.addr,!1,a1),Ji(t,i)}}function NU(o,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qi(t,e))return;o.uniformMatrix3fv(this.addr,!1,e),Ji(t,e)}else{if(Qi(t,i))return;i1.set(i),o.uniformMatrix3fv(this.addr,!1,i1),Ji(t,i)}}function UU(o,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qi(t,e))return;o.uniformMatrix4fv(this.addr,!1,e),Ji(t,e)}else{if(Qi(t,i))return;n1.set(i),o.uniformMatrix4fv(this.addr,!1,n1),Ji(t,i)}}function LU(o,e){const t=this.cache;t[0]!==e&&(o.uniform1i(this.addr,e),t[0]=e)}function IU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qi(t,e))return;o.uniform2iv(this.addr,e),Ji(t,e)}}function OU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qi(t,e))return;o.uniform3iv(this.addr,e),Ji(t,e)}}function zU(o,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)&&(o.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(Qi(t,e))return;o.uniform4iv(this.addr,e),Ji(t,e)}}function PU(o,e){const t=this.cache;t[0]!==e&&(o.uniform1ui(this.addr,e),t[0]=e)}function BU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qi(t,e))return;o.uniform2uiv(this.addr,e),Ji(t,e)}}function FU(o,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qi(t,e))return;o.uniform3uiv(this.addr,e),Ji(t,e)}}function VU(o,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)&&(o.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(Qi(t,e))return;o.uniform4uiv(this.addr,e),Ji(t,e)}}function kU(o,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(o.uniform1i(this.addr,s),i[0]=s);let u;this.type===o.SAMPLER_2D_SHADOW?(Gx.compareFunction=t.isReversedDepthBuffer()?my:py,u=Gx):u=bT,t.setTexture2D(e||u,s)}function HU(o,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(o.uniform1i(this.addr,s),i[0]=s),t.setTexture3D(e||ET,s)}function GU(o,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(o.uniform1i(this.addr,s),i[0]=s),t.setTextureCube(e||TT,s)}function XU(o,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(o.uniform1i(this.addr,s),i[0]=s),t.setTexture2DArray(e||MT,s)}function WU(o){switch(o){case 5126:return AU;case 35664:return wU;case 35665:return CU;case 35666:return RU;case 35674:return DU;case 35675:return NU;case 35676:return UU;case 5124:case 35670:return LU;case 35667:case 35671:return IU;case 35668:case 35672:return OU;case 35669:case 35673:return zU;case 5125:return PU;case 36294:return BU;case 36295:return FU;case 36296:return VU;case 35678:case 36198:case 36298:case 36306:case 35682:return kU;case 35679:case 36299:case 36307:return HU;case 35680:case 36300:case 36308:case 36293:return GU;case 36289:case 36303:case 36311:case 36292:return XU}}function qU(o,e){o.uniform1fv(this.addr,e)}function YU(o,e){const t=ed(e,this.size,2);o.uniform2fv(this.addr,t)}function ZU(o,e){const t=ed(e,this.size,3);o.uniform3fv(this.addr,t)}function jU(o,e){const t=ed(e,this.size,4);o.uniform4fv(this.addr,t)}function QU(o,e){const t=ed(e,this.size,4);o.uniformMatrix2fv(this.addr,!1,t)}function JU(o,e){const t=ed(e,this.size,9);o.uniformMatrix3fv(this.addr,!1,t)}function KU(o,e){const t=ed(e,this.size,16);o.uniformMatrix4fv(this.addr,!1,t)}function $U(o,e){o.uniform1iv(this.addr,e)}function eL(o,e){o.uniform2iv(this.addr,e)}function tL(o,e){o.uniform3iv(this.addr,e)}function nL(o,e){o.uniform4iv(this.addr,e)}function iL(o,e){o.uniform1uiv(this.addr,e)}function aL(o,e){o.uniform2uiv(this.addr,e)}function sL(o,e){o.uniform3uiv(this.addr,e)}function rL(o,e){o.uniform4uiv(this.addr,e)}function oL(o,e,t){const i=this.cache,s=e.length,u=Vy(t,s);Qi(i,u)||(o.uniform1iv(this.addr,u),Ji(i,u));let f;this.type===o.SAMPLER_2D_SHADOW?f=Gx:f=bT;for(let h=0;h!==s;++h)t.setTexture2D(e[h]||f,u[h])}function lL(o,e,t){const i=this.cache,s=e.length,u=Vy(t,s);Qi(i,u)||(o.uniform1iv(this.addr,u),Ji(i,u));for(let f=0;f!==s;++f)t.setTexture3D(e[f]||ET,u[f])}function uL(o,e,t){const i=this.cache,s=e.length,u=Vy(t,s);Qi(i,u)||(o.uniform1iv(this.addr,u),Ji(i,u));for(let f=0;f!==s;++f)t.setTextureCube(e[f]||TT,u[f])}function cL(o,e,t){const i=this.cache,s=e.length,u=Vy(t,s);Qi(i,u)||(o.uniform1iv(this.addr,u),Ji(i,u));for(let f=0;f!==s;++f)t.setTexture2DArray(e[f]||MT,u[f])}function fL(o){switch(o){case 5126:return qU;case 35664:return YU;case 35665:return ZU;case 35666:return jU;case 35674:return QU;case 35675:return JU;case 35676:return KU;case 5124:case 35670:return $U;case 35667:case 35671:return eL;case 35668:case 35672:return tL;case 35669:case 35673:return nL;case 5125:return iL;case 36294:return aL;case 36295:return sL;case 36296:return rL;case 35678:case 36198:case 36298:case 36306:case 35682:return oL;case 35679:case 36299:case 36307:return lL;case 35680:case 36300:case 36308:case 36293:return uL;case 36289:case 36303:case 36311:case 36292:return cL}}class hL{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=WU(t.type)}}class dL{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=fL(t.type)}}class pL{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const s=this.seq;for(let u=0,f=s.length;u!==f;++u){const h=s[u];h.setValue(e,t[h.id],i)}}}const mx=/(\w+)(\])?(\[|\.)?/g;function s1(o,e){o.seq.push(e),o.map[e.id]=e}function mL(o,e,t){const i=o.name,s=i.length;for(mx.lastIndex=0;;){const u=mx.exec(i),f=mx.lastIndex;let h=u[1];const m=u[2]==="]",g=u[3];if(m&&(h=h|0),g===void 0||g==="["&&f+2===s){s1(t,g===void 0?new hL(h,o,e):new dL(h,o,e));break}else{let x=t.map[h];x===void 0&&(x=new pL(h),s1(t,x)),t=x}}}class rv{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let f=0;f<i;++f){const h=e.getActiveUniform(t,f),m=e.getUniformLocation(t,h.name);mL(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,i,s){const u=this.map[t];u!==void 0&&u.setValue(e,i,s)}setOptional(e,t,i){const s=t[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,t,i,s){for(let u=0,f=t.length;u!==f;++u){const h=t[u],m=i[h.id];m.needsUpdate!==!1&&h.setValue(e,m.value,s)}}static seqWithValue(e,t){const i=[];for(let s=0,u=e.length;s!==u;++s){const f=e[s];f.id in t&&i.push(f)}return i}}function r1(o,e,t){const i=o.createShader(e);return o.shaderSource(i,t),o.compileShader(i),i}const gL=37297;let vL=0;function yL(o,e){const t=o.split(`
|
|
`),i=[],s=Math.max(e-6,0),u=Math.min(e+6,t.length);for(let f=s;f<u;f++){const h=f+1;i.push(`${h===e?">":" "} ${h}: ${t[f]}`)}return i.join(`
|
|
`)}const o1=new Qt;function _L(o){xn._getMatrix(o1,xn.workingColorSpace,o);const e=`mat3( ${o1.elements.map(t=>t.toFixed(4))} )`;switch(xn.getTransfer(o)){case rm:return[e,"LinearTransferOETF"];case On:return[e,"sRGBTransferOETF"];default:return rt("WebGLProgram: Unsupported color space: ",o),[e,"LinearTransferOETF"]}}function l1(o,e,t){const i=o.getShaderParameter(e,o.COMPILE_STATUS),u=(o.getShaderInfoLog(e)||"").trim();if(i&&u==="")return"";const f=/ERROR: 0:(\d+)/.exec(u);if(f){const h=parseInt(f[1]);return t.toUpperCase()+`
|
|
|
|
`+u+`
|
|
|
|
`+yL(o.getShaderSource(e),h)}else return u}function xL(o,e){const t=_L(e);return[`vec4 ${o}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
`)}const SL={[eS]:"Linear",[tS]:"Reinhard",[nS]:"Cineon",[sy]:"ACESFilmic",[aS]:"AgX",[sS]:"Neutral",[iS]:"Custom"};function bL(o,e){const t=SL[e];return t===void 0?(rt("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+o+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+o+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const tv=new Y;function ML(){xn.getLuminanceCoefficients(tv);const o=tv.x.toFixed(4),e=tv.y.toFixed(4),t=tv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${o}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
`)}function EL(o){return[o.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",o.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Gp).join(`
|
|
`)}function TL(o){const e=[];for(const t in o){const i=o[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
|
|
`)}function AL(o,e){const t={},i=o.getProgramParameter(e,o.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const u=o.getActiveAttrib(e,s),f=u.name;let h=1;u.type===o.FLOAT_MAT2&&(h=2),u.type===o.FLOAT_MAT3&&(h=3),u.type===o.FLOAT_MAT4&&(h=4),t[f]={type:u.type,location:o.getAttribLocation(e,f),locationSize:h}}return t}function Gp(o){return o!==""}function u1(o,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return o.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 c1(o,e){return o.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const wL=/^[ \t]*#include +<([\w\d./]+)>/gm;function Xx(o){return o.replace(wL,RL)}const CL=new Map;function RL(o,e){let t=an[e];if(t===void 0){const i=CL.get(e);if(i!==void 0)t=an[i],rt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Xx(t)}const DL=/#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 f1(o){return o.replace(DL,NL)}function NL(o,e,t,i){let s="";for(let u=parseInt(e);u<parseInt(t);u++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+u+" ]").replace(/UNROLLED_LOOP_INDEX/g,u);return s}function h1(o){let e=`precision ${o.precision} float;
|
|
precision ${o.precision} int;
|
|
precision ${o.precision} sampler2D;
|
|
precision ${o.precision} samplerCube;
|
|
precision ${o.precision} sampler3D;
|
|
precision ${o.precision} sampler2DArray;
|
|
precision ${o.precision} sampler2DShadow;
|
|
precision ${o.precision} samplerCubeShadow;
|
|
precision ${o.precision} sampler2DArrayShadow;
|
|
precision ${o.precision} isampler2D;
|
|
precision ${o.precision} isampler3D;
|
|
precision ${o.precision} isamplerCube;
|
|
precision ${o.precision} isampler2DArray;
|
|
precision ${o.precision} usampler2D;
|
|
precision ${o.precision} usampler3D;
|
|
precision ${o.precision} usamplerCube;
|
|
precision ${o.precision} usampler2DArray;
|
|
`;return o.precision==="highp"?e+=`
|
|
#define HIGH_PRECISION`:o.precision==="mediump"?e+=`
|
|
#define MEDIUM_PRECISION`:o.precision==="lowp"&&(e+=`
|
|
#define LOW_PRECISION`),e}const UL={[zh]:"SHADOWMAP_TYPE_PCF",[kc]:"SHADOWMAP_TYPE_VSM"};function LL(o){return UL[o.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const IL={[Oo]:"ENVMAP_TYPE_CUBE",[Uu]:"ENVMAP_TYPE_CUBE",[jh]:"ENVMAP_TYPE_CUBE_UV"};function OL(o){return o.envMap===!1?"ENVMAP_TYPE_CUBE":IL[o.envMapMode]||"ENVMAP_TYPE_CUBE"}const zL={[Uu]:"ENVMAP_MODE_REFRACTION"};function PL(o){return o.envMap===!1?"ENVMAP_MODE_REFLECTION":zL[o.envMapMode]||"ENVMAP_MODE_REFLECTION"}const BL={[_m]:"ENVMAP_BLENDING_MULTIPLY",[aE]:"ENVMAP_BLENDING_MIX",[sE]:"ENVMAP_BLENDING_ADD"};function FL(o){return o.envMap===!1?"ENVMAP_BLENDING_NONE":BL[o.combine]||"ENVMAP_BLENDING_NONE"}function VL(o){const e=o.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function kL(o,e,t,i){const s=o.getContext(),u=t.defines;let f=t.vertexShader,h=t.fragmentShader;const m=LL(t),g=OL(t),_=PL(t),x=FL(t),b=VL(t),M=EL(t),A=TL(u),R=s.createProgram();let C,E,D=t.glslVersion?"#version "+t.glslVersion+`
|
|
`:"";t.isRawShaderMaterial?(C=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(Gp).join(`
|
|
`),C.length>0&&(C+=`
|
|
`),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(Gp).join(`
|
|
`),E.length>0&&(E+=`
|
|
`)):(C=[h1(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(Gp).join(`
|
|
`),E=[h1(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!==mr?"#define TONE_MAPPING":"",t.toneMapping!==mr?an.tonemapping_pars_fragment:"",t.toneMapping!==mr?bL("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",an.colorspace_pars_fragment,xL("linearToOutputTexel",t.outputColorSpace),ML(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
`].filter(Gp).join(`
|
|
`)),f=Xx(f),f=u1(f,t),f=c1(f,t),h=Xx(h),h=u1(h,t),h=c1(h,t),f=f1(f),h=f1(h),t.isRawShaderMaterial!==!0&&(D=`#version 300 es
|
|
`,C=[M,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
`)+`
|
|
`+C,E=["#define varying in",t.glslVersion===Ix?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ix?"":"#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 U=D+C+f,L=D+E+h,B=r1(s,s.VERTEX_SHADER,U),P=r1(s,s.FRAGMENT_SHADER,L);s.attachShader(R,B),s.attachShader(R,P),t.index0AttributeName!==void 0?s.bindAttribLocation(R,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(R,0,"position"),s.linkProgram(R);function H(j){if(o.debug.checkShaderErrors){const ae=s.getProgramInfoLog(R)||"",$=s.getShaderInfoLog(B)||"",ue=s.getShaderInfoLog(P)||"",he=ae.trim(),q=$.trim(),K=ue.trim();let ce=!0,Ae=!0;if(s.getProgramParameter(R,s.LINK_STATUS)===!1)if(ce=!1,typeof o.debug.onShaderError=="function")o.debug.onShaderError(s,R,B,P);else{const Ce=l1(s,B,"vertex"),X=l1(s,P,"fragment");Tt("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(R,s.VALIDATE_STATUS)+`
|
|
|
|
Material Name: `+j.name+`
|
|
Material Type: `+j.type+`
|
|
|
|
Program Info Log: `+he+`
|
|
`+Ce+`
|
|
`+X)}else he!==""?rt("WebGLProgram: Program Info Log:",he):(q===""||K==="")&&(Ae=!1);Ae&&(j.diagnostics={runnable:ce,programLog:he,vertexShader:{log:q,prefix:C},fragmentShader:{log:K,prefix:E}})}s.deleteShader(B),s.deleteShader(P),W=new rv(s,R),I=AL(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 z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=s.getProgramParameter(R,gL)),z},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=vL++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=B,this.fragmentShader=P,this}let HL=0;class GL{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),u=this._getShaderStage(i),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 i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new XL(e),t.set(e,i)),i}}class XL{constructor(e){this.id=HL++,this.code=e,this.usedTimes=0}}function WL(o,e,t,i,s,u,f){const h=new Gh,m=new GL,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 C(I,z,j,ae,$){const ue=ae.fog,he=$.geometry,q=I.isMeshStandardMaterial?ae.environment:null,K=(I.isMeshStandardMaterial?t:e).get(I.envMap||q),ce=K&&K.mapping===jh?K.image.height:null,Ae=A[I.type];I.precision!==null&&(M=s.getMaxPrecision(I.precision),M!==I.precision&&rt("WebGLProgram.getParameters:",I.precision,"not supported, using",M,"instead."));const Ce=he.morphAttributes.position||he.morphAttributes.normal||he.morphAttributes.color,X=Ce!==void 0?Ce.length:0;let se=0;he.morphAttributes.position!==void 0&&(se=1),he.morphAttributes.normal!==void 0&&(se=2),he.morphAttributes.color!==void 0&&(se=3);let Ee,Oe,nt,fe;if(Ae){const gn=Xr[Ae];Ee=gn.vertexShader,Oe=gn.fragmentShader}else Ee=I.vertexShader,Oe=I.fragmentShader,m.update(I),nt=m.getVertexShaderID(I),fe=m.getFragmentShaderID(I);const Te=o.getRenderTarget(),Je=o.state.buffers.depth.getReversed(),et=$.isInstancedMesh===!0,ut=$.isBatchedMesh===!0,Jt=!!I.map,on=!!I.matcap,Dt=!!K,Re=!!I.aoMap,Ve=!!I.lightMap,Ue=!!I.bumpMap,Ke=!!I.normalMap,Z=!!I.displacementMap,St=!!I.emissiveMap,tt=!!I.metalnessMap,Mt=!!I.roughnessMap,We=I.anisotropy>0,G=I.clearcoat>0,O=I.dispersion>0,ne=I.iridescence>0,Se=I.sheen>0,Le=I.transmission>0,be=We&&!!I.anisotropyMap,ct=G&&!!I.clearcoatMap,Ze=G&&!!I.clearcoatNormalMap,gt=G&&!!I.clearcoatRoughnessMap,wt=ne&&!!I.iridescenceMap,Be=ne&&!!I.iridescenceThicknessMap,Xe=Se&&!!I.sheenColorMap,ft=Se&&!!I.sheenRoughnessMap,lt=!!I.specularMap,$e=!!I.specularColorMap,Zt=!!I.specularIntensityMap,te=Le&&!!I.transmissionMap,it=Le&&!!I.thicknessMap,Ge=!!I.gradientMap,st=!!I.alphaMap,Fe=I.alphaTest>0,Ne=!!I.alphaHash,je=!!I.extensions;let Bt=mr;I.toneMapped&&(Te===null||Te.isXRRenderTarget===!0)&&(Bt=o.toneMapping);const dn={shaderID:Ae,shaderType:I.type,shaderName:I.name,vertexShader:Ee,fragmentShader:Oe,defines:I.defines,customVertexShaderID:nt,customFragmentShaderID:fe,isRawShaderMaterial:I.isRawShaderMaterial===!0,glslVersion:I.glslVersion,precision:M,batching:ut,batchingColor:ut&&$._colorsTexture!==null,instancing:et,instancingColor:et&&$.instanceColor!==null,instancingMorph:et&&$.morphTexture!==null,outputColorSpace:Te===null?o.outputColorSpace:Te.isXRRenderTarget===!0?Te.texture.colorSpace:Lu,alphaToCoverage:!!I.alphaToCoverage,map:Jt,matcap:on,envMap:Dt,envMapMode:Dt&&K.mapping,envMapCubeUVHeight:ce,aoMap:Re,lightMap:Ve,bumpMap:Ue,normalMap:Ke,displacementMap:Z,emissiveMap:St,normalMapObjectSpace:Ke&&I.normalMapType===fE,normalMapTangentSpace:Ke&&I.normalMapType===zu,metalnessMap:tt,roughnessMap:Mt,anisotropy:We,anisotropyMap:be,clearcoat:G,clearcoatMap:ct,clearcoatNormalMap:Ze,clearcoatRoughnessMap:gt,dispersion:O,iridescence:ne,iridescenceMap:wt,iridescenceThicknessMap:Be,sheen:Se,sheenColorMap:Xe,sheenRoughnessMap:ft,specularMap:lt,specularColorMap:$e,specularIntensityMap:Zt,transmission:Le,transmissionMap:te,thicknessMap:it,gradientMap:Ge,opaque:I.transparent===!1&&I.blending===Wc&&I.alphaToCoverage===!1,alphaMap:st,alphaTest:Fe,alphaHash:Ne,combine:I.combine,mapUv:Jt&&R(I.map.channel),aoMapUv:Re&&R(I.aoMap.channel),lightMapUv:Ve&&R(I.lightMap.channel),bumpMapUv:Ue&&R(I.bumpMap.channel),normalMapUv:Ke&&R(I.normalMap.channel),displacementMapUv:Z&&R(I.displacementMap.channel),emissiveMapUv:St&&R(I.emissiveMap.channel),metalnessMapUv:tt&&R(I.metalnessMap.channel),roughnessMapUv:Mt&&R(I.roughnessMap.channel),anisotropyMapUv:be&&R(I.anisotropyMap.channel),clearcoatMapUv:ct&&R(I.clearcoatMap.channel),clearcoatNormalMapUv:Ze&&R(I.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:gt&&R(I.clearcoatRoughnessMap.channel),iridescenceMapUv:wt&&R(I.iridescenceMap.channel),iridescenceThicknessMapUv:Be&&R(I.iridescenceThicknessMap.channel),sheenColorMapUv:Xe&&R(I.sheenColorMap.channel),sheenRoughnessMapUv:ft&&R(I.sheenRoughnessMap.channel),specularMapUv:lt&&R(I.specularMap.channel),specularColorMapUv:$e&&R(I.specularColorMap.channel),specularIntensityMapUv:Zt&&R(I.specularIntensityMap.channel),transmissionMapUv:te&&R(I.transmissionMap.channel),thicknessMapUv:it&&R(I.thicknessMap.channel),alphaMapUv:st&&R(I.alphaMap.channel),vertexTangents:!!he.attributes.tangent&&(Ke||We),vertexColors:I.vertexColors,vertexAlphas:I.vertexColors===!0&&!!he.attributes.color&&he.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!he.attributes.uv&&(Jt||st),fog:!!ue,useFog:I.fog===!0,fogExp2:!!ue&&ue.isFogExp2,flatShading:I.flatShading===!0&&I.wireframe===!1,sizeAttenuation:I.sizeAttenuation===!0,logarithmicDepthBuffer:b,reversedDepthBuffer:Je,skinning:$.isSkinnedMesh===!0,morphTargets:he.morphAttributes.position!==void 0,morphNormals:he.morphAttributes.normal!==void 0,morphColors:he.morphAttributes.color!==void 0,morphTargetsCount:X,morphTextureStride:se,numDirLights:z.directional.length,numPointLights:z.point.length,numSpotLights:z.spot.length,numSpotLightMaps:z.spotLightMap.length,numRectAreaLights:z.rectArea.length,numHemiLights:z.hemi.length,numDirLightShadows:z.directionalShadowMap.length,numPointLightShadows:z.pointShadowMap.length,numSpotLightShadows:z.spotShadowMap.length,numSpotLightShadowsWithMaps:z.numSpotLightShadowsWithMaps,numLightProbes:z.numLightProbes,numClippingPlanes:f.numPlanes,numClipIntersection:f.numIntersection,dithering:I.dithering,shadowMapEnabled:o.shadowMap.enabled&&j.length>0,shadowMapType:o.shadowMap.type,toneMapping:Bt,decodeVideoTexture:Jt&&I.map.isVideoTexture===!0&&xn.getTransfer(I.map.colorSpace)===On,decodeVideoTextureEmissive:St&&I.emissiveMap.isVideoTexture===!0&&xn.getTransfer(I.emissiveMap.colorSpace)===On,premultipliedAlpha:I.premultipliedAlpha,doubleSided:I.side===No,flipSided:I.side===ts,useDepthPacking:I.depthPacking>=0,depthPacking:I.depthPacking||0,index0AttributeName:I.index0AttributeName,extensionClipCullDistance:je&&I.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(je&&I.extensions.multiDraw===!0||ut)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:I.customProgramCacheKey()};return dn.vertexUv1s=g.has(1),dn.vertexUv2s=g.has(2),dn.vertexUv3s=g.has(3),g.clear(),dn}function E(I){const z=[];if(I.shaderID?z.push(I.shaderID):(z.push(I.customVertexShaderID),z.push(I.customFragmentShaderID)),I.defines!==void 0)for(const j in I.defines)z.push(j),z.push(I.defines[j]);return I.isRawShaderMaterial===!1&&(D(z,I),U(z,I),z.push(o.outputColorSpace)),z.push(I.customProgramCacheKey),z.join()}function D(I,z){I.push(z.precision),I.push(z.outputColorSpace),I.push(z.envMapMode),I.push(z.envMapCubeUVHeight),I.push(z.mapUv),I.push(z.alphaMapUv),I.push(z.lightMapUv),I.push(z.aoMapUv),I.push(z.bumpMapUv),I.push(z.normalMapUv),I.push(z.displacementMapUv),I.push(z.emissiveMapUv),I.push(z.metalnessMapUv),I.push(z.roughnessMapUv),I.push(z.anisotropyMapUv),I.push(z.clearcoatMapUv),I.push(z.clearcoatNormalMapUv),I.push(z.clearcoatRoughnessMapUv),I.push(z.iridescenceMapUv),I.push(z.iridescenceThicknessMapUv),I.push(z.sheenColorMapUv),I.push(z.sheenRoughnessMapUv),I.push(z.specularMapUv),I.push(z.specularColorMapUv),I.push(z.specularIntensityMapUv),I.push(z.transmissionMapUv),I.push(z.thicknessMapUv),I.push(z.combine),I.push(z.fogExp2),I.push(z.sizeAttenuation),I.push(z.morphTargetsCount),I.push(z.morphAttributeCount),I.push(z.numDirLights),I.push(z.numPointLights),I.push(z.numSpotLights),I.push(z.numSpotLightMaps),I.push(z.numHemiLights),I.push(z.numRectAreaLights),I.push(z.numDirLightShadows),I.push(z.numPointLightShadows),I.push(z.numSpotLightShadows),I.push(z.numSpotLightShadowsWithMaps),I.push(z.numLightProbes),I.push(z.shadowMapType),I.push(z.toneMapping),I.push(z.numClippingPlanes),I.push(z.numClipIntersection),I.push(z.depthPacking)}function U(I,z){h.disableAll(),z.instancing&&h.enable(0),z.instancingColor&&h.enable(1),z.instancingMorph&&h.enable(2),z.matcap&&h.enable(3),z.envMap&&h.enable(4),z.normalMapObjectSpace&&h.enable(5),z.normalMapTangentSpace&&h.enable(6),z.clearcoat&&h.enable(7),z.iridescence&&h.enable(8),z.alphaTest&&h.enable(9),z.vertexColors&&h.enable(10),z.vertexAlphas&&h.enable(11),z.vertexUv1s&&h.enable(12),z.vertexUv2s&&h.enable(13),z.vertexUv3s&&h.enable(14),z.vertexTangents&&h.enable(15),z.anisotropy&&h.enable(16),z.alphaHash&&h.enable(17),z.batching&&h.enable(18),z.dispersion&&h.enable(19),z.batchingColor&&h.enable(20),z.gradientMap&&h.enable(21),I.push(h.mask),h.disableAll(),z.fog&&h.enable(0),z.useFog&&h.enable(1),z.flatShading&&h.enable(2),z.logarithmicDepthBuffer&&h.enable(3),z.reversedDepthBuffer&&h.enable(4),z.skinning&&h.enable(5),z.morphTargets&&h.enable(6),z.morphNormals&&h.enable(7),z.morphColors&&h.enable(8),z.premultipliedAlpha&&h.enable(9),z.shadowMapEnabled&&h.enable(10),z.doubleSided&&h.enable(11),z.flipSided&&h.enable(12),z.useDepthPacking&&h.enable(13),z.dithering&&h.enable(14),z.transmission&&h.enable(15),z.sheen&&h.enable(16),z.opaque&&h.enable(17),z.pointsUvs&&h.enable(18),z.decodeVideoTexture&&h.enable(19),z.decodeVideoTextureEmissive&&h.enable(20),z.alphaToCoverage&&h.enable(21),I.push(h.mask)}function L(I){const z=A[I.type];let j;if(z){const ae=Xr[z];j=TE.clone(ae.uniforms)}else j=I.uniforms;return j}function B(I,z){let j=x.get(z);return j!==void 0?++j.usedTimes:(j=new kL(o,z,I,u),_.push(j),x.set(z,j)),j}function P(I){if(--I.usedTimes===0){const z=_.indexOf(I);_[z]=_[_.length-1],_.pop(),x.delete(I.cacheKey),I.destroy()}}function H(I){m.remove(I)}function W(){m.dispose()}return{getParameters:C,getProgramCacheKey:E,getUniforms:L,acquireProgram:B,releaseProgram:P,releaseShaderCache:H,programs:_,dispose:W}}function qL(){let o=new WeakMap;function e(f){return o.has(f)}function t(f){let h=o.get(f);return h===void 0&&(h={},o.set(f,h)),h}function i(f){o.delete(f)}function s(f,h,m){o.get(f)[h]=m}function u(){o=new WeakMap}return{has:e,get:t,remove:i,update:s,dispose:u}}function YL(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.material.id!==e.material.id?o.material.id-e.material.id:o.z!==e.z?o.z-e.z:o.id-e.id}function d1(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?e.z-o.z:o.id-e.id}function p1(){const o=[];let e=0;const t=[],i=[],s=[];function u(){e=0,t.length=0,i.length=0,s.length=0}function f(x,b,M,A,R,C){let E=o[e];return E===void 0?(E={id:x.id,object:x,geometry:b,material:M,groupOrder:A,renderOrder:x.renderOrder,z:R,group:C},o[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=C),e++,E}function h(x,b,M,A,R,C){const E=f(x,b,M,A,R,C);M.transmission>0?i.push(E):M.transparent===!0?s.push(E):t.push(E)}function m(x,b,M,A,R,C){const E=f(x,b,M,A,R,C);M.transmission>0?i.unshift(E):M.transparent===!0?s.unshift(E):t.unshift(E)}function g(x,b){t.length>1&&t.sort(x||YL),i.length>1&&i.sort(b||d1),s.length>1&&s.sort(b||d1)}function _(){for(let x=e,b=o.length;x<b;x++){const M=o[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:i,transparent:s,init:u,push:h,unshift:m,finish:_,sort:g}}function ZL(){let o=new WeakMap;function e(i,s){const u=o.get(i);let f;return u===void 0?(f=new p1,o.set(i,[f])):s>=u.length?(f=new p1,u.push(f)):f=u[s],f}function t(){o=new WeakMap}return{get:e,dispose:t}}function jL(){const o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Y,color:new pt};break;case"SpotLight":t={position:new Y,direction:new Y,color:new pt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new pt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new pt,groundColor:new pt};break;case"RectAreaLight":t={color:new pt,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return o[e.id]=t,t}}}function QL(){const o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return o[e.id]=t,t}}}let JL=0;function KL(o,e){return(e.castShadow?2:0)-(o.castShadow?2:0)+(e.map?1:0)-(o.map?1:0)}function $L(o){const e=new jL,t=QL(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)i.probe.push(new Y);const s=new Y,u=new kt,f=new kt;function h(g){let _=0,x=0,b=0;for(let I=0;I<9;I++)i.probe[I].set(0,0,0);let M=0,A=0,R=0,C=0,E=0,D=0,U=0,L=0,B=0,P=0,H=0;g.sort(KL);for(let I=0,z=g.length;I<z;I++){const j=g[I],ae=j.color,$=j.intensity,ue=j.distance;let he=null;if(j.shadow&&j.shadow.map&&(j.shadow.map.texture.format===jc?he=j.shadow.map.texture:he=j.shadow.map.depthTexture||j.shadow.map.texture),j.isAmbientLight)_+=ae.r*$,x+=ae.g*$,b+=ae.b*$;else if(j.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(j.sh.coefficients[q],$);H++}else if(j.isDirectionalLight){const q=e.get(j);if(q.color.copy(j.color).multiplyScalar(j.intensity),j.castShadow){const K=j.shadow,ce=t.get(j);ce.shadowIntensity=K.intensity,ce.shadowBias=K.bias,ce.shadowNormalBias=K.normalBias,ce.shadowRadius=K.radius,ce.shadowMapSize=K.mapSize,i.directionalShadow[M]=ce,i.directionalShadowMap[M]=he,i.directionalShadowMatrix[M]=j.shadow.matrix,D++}i.directional[M]=q,M++}else if(j.isSpotLight){const q=e.get(j);q.position.setFromMatrixPosition(j.matrixWorld),q.color.copy(ae).multiplyScalar($),q.distance=ue,q.coneCos=Math.cos(j.angle),q.penumbraCos=Math.cos(j.angle*(1-j.penumbra)),q.decay=j.decay,i.spot[R]=q;const K=j.shadow;if(j.map&&(i.spotLightMap[B]=j.map,B++,K.updateMatrices(j),j.castShadow&&P++),i.spotLightMatrix[R]=K.matrix,j.castShadow){const ce=t.get(j);ce.shadowIntensity=K.intensity,ce.shadowBias=K.bias,ce.shadowNormalBias=K.normalBias,ce.shadowRadius=K.radius,ce.shadowMapSize=K.mapSize,i.spotShadow[R]=ce,i.spotShadowMap[R]=he,L++}R++}else if(j.isRectAreaLight){const q=e.get(j);q.color.copy(ae).multiplyScalar($),q.halfWidth.set(j.width*.5,0,0),q.halfHeight.set(0,j.height*.5,0),i.rectArea[C]=q,C++}else if(j.isPointLight){const q=e.get(j);if(q.color.copy(j.color).multiplyScalar(j.intensity),q.distance=j.distance,q.decay=j.decay,j.castShadow){const K=j.shadow,ce=t.get(j);ce.shadowIntensity=K.intensity,ce.shadowBias=K.bias,ce.shadowNormalBias=K.normalBias,ce.shadowRadius=K.radius,ce.shadowMapSize=K.mapSize,ce.shadowCameraNear=K.camera.near,ce.shadowCameraFar=K.camera.far,i.pointShadow[A]=ce,i.pointShadowMap[A]=he,i.pointShadowMatrix[A]=j.shadow.matrix,U++}i.point[A]=q,A++}else if(j.isHemisphereLight){const q=e.get(j);q.skyColor.copy(j.color).multiplyScalar($),q.groundColor.copy(j.groundColor).multiplyScalar($),i.hemi[E]=q,E++}}C>0&&(o.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ot.LTC_FLOAT_1,i.rectAreaLTC2=ot.LTC_FLOAT_2):(i.rectAreaLTC1=ot.LTC_HALF_1,i.rectAreaLTC2=ot.LTC_HALF_2)),i.ambient[0]=_,i.ambient[1]=x,i.ambient[2]=b;const W=i.hash;(W.directionalLength!==M||W.pointLength!==A||W.spotLength!==R||W.rectAreaLength!==C||W.hemiLength!==E||W.numDirectionalShadows!==D||W.numPointShadows!==U||W.numSpotShadows!==L||W.numSpotMaps!==B||W.numLightProbes!==H)&&(i.directional.length=M,i.spot.length=R,i.rectArea.length=C,i.point.length=A,i.hemi.length=E,i.directionalShadow.length=D,i.directionalShadowMap.length=D,i.pointShadow.length=U,i.pointShadowMap.length=U,i.spotShadow.length=L,i.spotShadowMap.length=L,i.directionalShadowMatrix.length=D,i.pointShadowMatrix.length=U,i.spotLightMatrix.length=L+B-P,i.spotLightMap.length=B,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=H,W.directionalLength=M,W.pointLength=A,W.spotLength=R,W.rectAreaLength=C,W.hemiLength=E,W.numDirectionalShadows=D,W.numPointShadows=U,W.numSpotShadows=L,W.numSpotMaps=B,W.numLightProbes=H,i.version=JL++)}function m(g,_){let x=0,b=0,M=0,A=0,R=0;const C=_.matrixWorldInverse;for(let E=0,D=g.length;E<D;E++){const U=g[E];if(U.isDirectionalLight){const L=i.directional[x];L.direction.setFromMatrixPosition(U.matrixWorld),s.setFromMatrixPosition(U.target.matrixWorld),L.direction.sub(s),L.direction.transformDirection(C),x++}else if(U.isSpotLight){const L=i.spot[M];L.position.setFromMatrixPosition(U.matrixWorld),L.position.applyMatrix4(C),L.direction.setFromMatrixPosition(U.matrixWorld),s.setFromMatrixPosition(U.target.matrixWorld),L.direction.sub(s),L.direction.transformDirection(C),M++}else if(U.isRectAreaLight){const L=i.rectArea[A];L.position.setFromMatrixPosition(U.matrixWorld),L.position.applyMatrix4(C),f.identity(),u.copy(U.matrixWorld),u.premultiply(C),f.extractRotation(u),L.halfWidth.set(U.width*.5,0,0),L.halfHeight.set(0,U.height*.5,0),L.halfWidth.applyMatrix4(f),L.halfHeight.applyMatrix4(f),A++}else if(U.isPointLight){const L=i.point[b];L.position.setFromMatrixPosition(U.matrixWorld),L.position.applyMatrix4(C),b++}else if(U.isHemisphereLight){const L=i.hemi[R];L.direction.setFromMatrixPosition(U.matrixWorld),L.direction.transformDirection(C),R++}}}return{setup:h,setupView:m,state:i}}function m1(o){const e=new $L(o),t=[],i=[];function s(_){g.camera=_,t.length=0,i.length=0}function u(_){t.push(_)}function f(_){i.push(_)}function h(){e.setup(t)}function m(_){e.setupView(t,_)}const g={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:g,setupLights:h,setupLightsView:m,pushLight:u,pushShadow:f}}function eI(o){let e=new WeakMap;function t(s,u=0){const f=e.get(s);let h;return f===void 0?(h=new m1(o),e.set(s,[h])):u>=f.length?(h=new m1(o),f.push(h)):h=f[u],h}function i(){e=new WeakMap}return{get:t,dispose:i}}const tI=`void main() {
|
|
gl_Position = vec4( position, 1.0 );
|
|
}`,nI=`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 );
|
|
}`,iI=[new Y(1,0,0),new Y(-1,0,0),new Y(0,1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1)],aI=[new Y(0,-1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,-1,0),new Y(0,-1,0)],g1=new kt,Vp=new Y,gx=new Y;function sI(o,e,t){let i=new Jh;const s=new Pe,u=new Pe,f=new Wn,h=new LS,m=new IS,g={},_=t.maxTextureSize,x={[Cl]:ts,[ts]:Cl,[No]:No},b=new vr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:tI,fragmentShader:nI}),M=b.clone();M.defines.HORIZONTAL_PASS=1;const A=new Yt;A.setAttribute("position",new Hn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new Gi(A,b),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zh;let E=this.type;this.render=function(P,H,W){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||P.length===0)return;P.type===Xp&&(rt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),P.type=zh);const I=o.getRenderTarget(),z=o.getActiveCubeFace(),j=o.getActiveMipmapLevel(),ae=o.state;ae.setBlending(Io),ae.buffers.depth.getReversed()===!0?ae.buffers.color.setClear(0,0,0,0):ae.buffers.color.setClear(1,1,1,1),ae.buffers.depth.setTest(!0),ae.setScissorTest(!1);const $=E!==this.type;$&&H.traverse(function(ue){ue.material&&(Array.isArray(ue.material)?ue.material.forEach(he=>he.needsUpdate=!0):ue.material.needsUpdate=!0)});for(let ue=0,he=P.length;ue<he;ue++){const q=P[ue],K=q.shadow;if(K===void 0){rt("WebGLShadowMap:",q,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;s.copy(K.mapSize);const ce=K.getFrameExtents();if(s.multiply(ce),u.copy(K.mapSize),(s.x>_||s.y>_)&&(s.x>_&&(u.x=Math.floor(_/ce.x),s.x=u.x*ce.x,K.mapSize.x=u.x),s.y>_&&(u.y=Math.floor(_/ce.y),s.y=u.y*ce.y,K.mapSize.y=u.y)),K.map===null||$===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===kc){if(q.isPointLight){rt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new ks(s.x,s.y,{format:jc,type:zo,minFilter:ai,magFilter:ai,generateMipmaps:!1}),K.map.texture.name=q.name+".shadowMap",K.map.depthTexture=new qh(s.x,s.y,es),K.map.depthTexture.name=q.name+".shadowMapDepth",K.map.depthTexture.format=Po,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Li,K.map.depthTexture.magFilter=Li}else{q.isPointLight?(K.map=new yS(s.x),K.map.depthTexture=new zE(s.x,gr)):(K.map=new ks(s.x,s.y),K.map.depthTexture=new qh(s.x,s.y,gr)),K.map.depthTexture.name=q.name+".shadowMap",K.map.depthTexture.format=Po;const Ce=o.state.buffers.depth.getReversed();this.type===zh?(K.map.depthTexture.compareFunction=Ce?my:py,K.map.depthTexture.minFilter=ai,K.map.depthTexture.magFilter=ai):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Li,K.map.depthTexture.magFilter=Li)}K.camera.updateProjectionMatrix()}const Ae=K.map.isWebGLCubeRenderTarget?6:1;for(let Ce=0;Ce<Ae;Ce++){if(K.map.isWebGLCubeRenderTarget)o.setRenderTarget(K.map,Ce),o.clear();else{Ce===0&&(o.setRenderTarget(K.map),o.clear());const X=K.getViewport(Ce);f.set(u.x*X.x,u.y*X.y,u.x*X.z,u.y*X.w),ae.viewport(f)}if(q.isPointLight){const X=K.camera,se=K.matrix,Ee=q.distance||X.far;Ee!==X.far&&(X.far=Ee,X.updateProjectionMatrix()),Vp.setFromMatrixPosition(q.matrixWorld),X.position.copy(Vp),gx.copy(X.position),gx.add(iI[Ce]),X.up.copy(aI[Ce]),X.lookAt(gx),X.updateMatrixWorld(),se.makeTranslation(-Vp.x,-Vp.y,-Vp.z),g1.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),K._frustum.setFromProjectionMatrix(g1,X.coordinateSystem,X.reversedDepth)}else K.updateMatrices(q);i=K.getFrustum(),L(H,W,K.camera,q,this.type)}K.isPointLightShadow!==!0&&this.type===kc&&D(K,W),K.needsUpdate=!1}E=this.type,C.needsUpdate=!1,o.setRenderTarget(I,z,j)};function D(P,H){const W=e.update(R);b.defines.VSM_SAMPLES!==P.blurSamples&&(b.defines.VSM_SAMPLES=P.blurSamples,M.defines.VSM_SAMPLES=P.blurSamples,b.needsUpdate=!0,M.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new ks(s.x,s.y,{format:jc,type:zo})),b.uniforms.shadow_pass.value=P.map.depthTexture,b.uniforms.resolution.value=P.mapSize,b.uniforms.radius.value=P.radius,o.setRenderTarget(P.mapPass),o.clear(),o.renderBufferDirect(H,null,W,b,R,null),M.uniforms.shadow_pass.value=P.mapPass.texture,M.uniforms.resolution.value=P.mapSize,M.uniforms.radius.value=P.radius,o.setRenderTarget(P.map),o.clear(),o.renderBufferDirect(H,null,W,M,R,null)}function U(P,H,W,I){let z=null;const j=W.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(j!==void 0)z=j;else if(z=W.isPointLight===!0?m:h,o.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 ae=z.uuid,$=H.uuid;let ue=g[ae];ue===void 0&&(ue={},g[ae]=ue);let he=ue[$];he===void 0&&(he=z.clone(),ue[$]=he,H.addEventListener("dispose",B)),z=he}if(z.visible=H.visible,z.wireframe=H.wireframe,I===kc?z.side=H.shadowSide!==null?H.shadowSide:H.side:z.side=H.shadowSide!==null?H.shadowSide:x[H.side],z.alphaMap=H.alphaMap,z.alphaTest=H.alphaToCoverage===!0?.5:H.alphaTest,z.map=H.map,z.clipShadows=H.clipShadows,z.clippingPlanes=H.clippingPlanes,z.clipIntersection=H.clipIntersection,z.displacementMap=H.displacementMap,z.displacementScale=H.displacementScale,z.displacementBias=H.displacementBias,z.wireframeLinewidth=H.wireframeLinewidth,z.linewidth=H.linewidth,W.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const ae=o.properties.get(z);ae.light=W}return z}function L(P,H,W,I,z){if(P.visible===!1)return;if(P.layers.test(H.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&z===kc)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,P.matrixWorld);const $=e.update(P),ue=P.material;if(Array.isArray(ue)){const he=$.groups;for(let q=0,K=he.length;q<K;q++){const ce=he[q],Ae=ue[ce.materialIndex];if(Ae&&Ae.visible){const Ce=U(P,Ae,I,z);P.onBeforeShadow(o,P,H,W,$,Ce,ce),o.renderBufferDirect(W,null,$,Ce,P,ce),P.onAfterShadow(o,P,H,W,$,Ce,ce)}}}else if(ue.visible){const he=U(P,ue,I,z);P.onBeforeShadow(o,P,H,W,$,he,null),o.renderBufferDirect(W,null,$,he,P,null),P.onAfterShadow(o,P,H,W,$,he,null)}}const ae=P.children;for(let $=0,ue=ae.length;$<ue;$++)L(ae[$],H,W,I,z)}function B(P){P.target.removeEventListener("dispose",B);for(const W in g){const I=g[W],z=P.target.uuid;z in I&&(I[z].dispose(),delete I[z])}}}const rI={[cv]:fv,[hv]:mv,[dv]:gv,[Zc]:pv,[fv]:cv,[mv]:hv,[gv]:dv,[pv]:Zc};function oI(o,e){function t(){let te=!1;const it=new Wn;let Ge=null;const st=new Wn(0,0,0,0);return{setMask:function(Fe){Ge!==Fe&&!te&&(o.colorMask(Fe,Fe,Fe,Fe),Ge=Fe)},setLocked:function(Fe){te=Fe},setClear:function(Fe,Ne,je,Bt,dn){dn===!0&&(Fe*=Bt,Ne*=Bt,je*=Bt),it.set(Fe,Ne,je,Bt),st.equals(it)===!1&&(o.clearColor(Fe,Ne,je,Bt),st.copy(it))},reset:function(){te=!1,Ge=null,st.set(-1,0,0,0)}}}function i(){let te=!1,it=!1,Ge=null,st=null,Fe=null;return{setReversed:function(Ne){if(it!==Ne){const je=e.get("EXT_clip_control");Ne?je.clipControlEXT(je.LOWER_LEFT_EXT,je.ZERO_TO_ONE_EXT):je.clipControlEXT(je.LOWER_LEFT_EXT,je.NEGATIVE_ONE_TO_ONE_EXT),it=Ne;const Bt=Fe;Fe=null,this.setClear(Bt)}},getReversed:function(){return it},setTest:function(Ne){Ne?Te(o.DEPTH_TEST):Je(o.DEPTH_TEST)},setMask:function(Ne){Ge!==Ne&&!te&&(o.depthMask(Ne),Ge=Ne)},setFunc:function(Ne){if(it&&(Ne=rI[Ne]),st!==Ne){switch(Ne){case cv:o.depthFunc(o.NEVER);break;case fv:o.depthFunc(o.ALWAYS);break;case hv:o.depthFunc(o.LESS);break;case Zc:o.depthFunc(o.LEQUAL);break;case dv:o.depthFunc(o.EQUAL);break;case pv:o.depthFunc(o.GEQUAL);break;case mv:o.depthFunc(o.GREATER);break;case gv:o.depthFunc(o.NOTEQUAL);break;default:o.depthFunc(o.LEQUAL)}st=Ne}},setLocked:function(Ne){te=Ne},setClear:function(Ne){Fe!==Ne&&(it&&(Ne=1-Ne),o.clearDepth(Ne),Fe=Ne)},reset:function(){te=!1,Ge=null,st=null,Fe=null,it=!1}}}function s(){let te=!1,it=null,Ge=null,st=null,Fe=null,Ne=null,je=null,Bt=null,dn=null;return{setTest:function(gn){te||(gn?Te(o.STENCIL_TEST):Je(o.STENCIL_TEST))},setMask:function(gn){it!==gn&&!te&&(o.stencilMask(gn),it=gn)},setFunc:function(gn,Xi,va){(Ge!==gn||st!==Xi||Fe!==va)&&(o.stencilFunc(gn,Xi,va),Ge=gn,st=Xi,Fe=va)},setOp:function(gn,Xi,va){(Ne!==gn||je!==Xi||Bt!==va)&&(o.stencilOp(gn,Xi,va),Ne=gn,je=Xi,Bt=va)},setLocked:function(gn){te=gn},setClear:function(gn){dn!==gn&&(o.clearStencil(gn),dn=gn)},reset:function(){te=!1,it=null,Ge=null,st=null,Fe=null,Ne=null,je=null,Bt=null,dn=null}}}const u=new t,f=new i,h=new s,m=new WeakMap,g=new WeakMap;let _={},x={},b=new WeakMap,M=[],A=null,R=!1,C=null,E=null,D=null,U=null,L=null,B=null,P=null,H=new pt(0,0,0),W=0,I=!1,z=null,j=null,ae=null,$=null,ue=null;const he=o.getParameter(o.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,K=0;const ce=o.getParameter(o.VERSION);ce.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(ce)[1]),q=K>=1):ce.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),q=K>=2);let Ae=null,Ce={};const X=o.getParameter(o.SCISSOR_BOX),se=o.getParameter(o.VIEWPORT),Ee=new Wn().fromArray(X),Oe=new Wn().fromArray(se);function nt(te,it,Ge,st){const Fe=new Uint8Array(4),Ne=o.createTexture();o.bindTexture(te,Ne),o.texParameteri(te,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(te,o.TEXTURE_MAG_FILTER,o.NEAREST);for(let je=0;je<Ge;je++)te===o.TEXTURE_3D||te===o.TEXTURE_2D_ARRAY?o.texImage3D(it,0,o.RGBA,1,1,st,0,o.RGBA,o.UNSIGNED_BYTE,Fe):o.texImage2D(it+je,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,Fe);return Ne}const fe={};fe[o.TEXTURE_2D]=nt(o.TEXTURE_2D,o.TEXTURE_2D,1),fe[o.TEXTURE_CUBE_MAP]=nt(o.TEXTURE_CUBE_MAP,o.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[o.TEXTURE_2D_ARRAY]=nt(o.TEXTURE_2D_ARRAY,o.TEXTURE_2D_ARRAY,1,1),fe[o.TEXTURE_3D]=nt(o.TEXTURE_3D,o.TEXTURE_3D,1,1),u.setClear(0,0,0,1),f.setClear(1),h.setClear(0),Te(o.DEPTH_TEST),f.setFunc(Zc),Ue(!1),Ke(Cx),Te(o.CULL_FACE),Re(Io);function Te(te){_[te]!==!0&&(o.enable(te),_[te]=!0)}function Je(te){_[te]!==!1&&(o.disable(te),_[te]=!1)}function et(te,it){return x[te]!==it?(o.bindFramebuffer(te,it),x[te]=it,te===o.DRAW_FRAMEBUFFER&&(x[o.FRAMEBUFFER]=it),te===o.FRAMEBUFFER&&(x[o.DRAW_FRAMEBUFFER]=it),!0):!1}function ut(te,it){let Ge=M,st=!1;if(te){Ge=b.get(it),Ge===void 0&&(Ge=[],b.set(it,Ge));const Fe=te.textures;if(Ge.length!==Fe.length||Ge[0]!==o.COLOR_ATTACHMENT0){for(let Ne=0,je=Fe.length;Ne<je;Ne++)Ge[Ne]=o.COLOR_ATTACHMENT0+Ne;Ge.length=Fe.length,st=!0}}else Ge[0]!==o.BACK&&(Ge[0]=o.BACK,st=!0);st&&o.drawBuffers(Ge)}function Jt(te){return A!==te?(o.useProgram(te),A=te,!0):!1}const on={[wu]:o.FUNC_ADD,[k1]:o.FUNC_SUBTRACT,[H1]:o.FUNC_REVERSE_SUBTRACT};on[G1]=o.MIN,on[X1]=o.MAX;const Dt={[W1]:o.ZERO,[q1]:o.ONE,[Y1]:o.SRC_COLOR,[lv]:o.SRC_ALPHA,[$1]:o.SRC_ALPHA_SATURATE,[J1]:o.DST_COLOR,[j1]:o.DST_ALPHA,[Z1]:o.ONE_MINUS_SRC_COLOR,[uv]:o.ONE_MINUS_SRC_ALPHA,[K1]:o.ONE_MINUS_DST_COLOR,[Q1]:o.ONE_MINUS_DST_ALPHA,[eE]:o.CONSTANT_COLOR,[tE]:o.ONE_MINUS_CONSTANT_COLOR,[nE]:o.CONSTANT_ALPHA,[iE]:o.ONE_MINUS_CONSTANT_ALPHA};function Re(te,it,Ge,st,Fe,Ne,je,Bt,dn,gn){if(te===Io){R===!0&&(Je(o.BLEND),R=!1);return}if(R===!1&&(Te(o.BLEND),R=!0),te!==V1){if(te!==C||gn!==I){if((E!==wu||L!==wu)&&(o.blendEquation(o.FUNC_ADD),E=wu,L=wu),gn)switch(te){case Wc:o.blendFuncSeparate(o.ONE,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA);break;case Rx:o.blendFunc(o.ONE,o.ONE);break;case Dx:o.blendFuncSeparate(o.ZERO,o.ONE_MINUS_SRC_COLOR,o.ZERO,o.ONE);break;case Nx:o.blendFuncSeparate(o.DST_COLOR,o.ONE_MINUS_SRC_ALPHA,o.ZERO,o.ONE);break;default:Tt("WebGLState: Invalid blending: ",te);break}else switch(te){case Wc:o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA);break;case Rx:o.blendFuncSeparate(o.SRC_ALPHA,o.ONE,o.ONE,o.ONE);break;case Dx:Tt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nx:Tt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Tt("WebGLState: Invalid blending: ",te);break}D=null,U=null,B=null,P=null,H.set(0,0,0),W=0,C=te,I=gn}return}Fe=Fe||it,Ne=Ne||Ge,je=je||st,(it!==E||Fe!==L)&&(o.blendEquationSeparate(on[it],on[Fe]),E=it,L=Fe),(Ge!==D||st!==U||Ne!==B||je!==P)&&(o.blendFuncSeparate(Dt[Ge],Dt[st],Dt[Ne],Dt[je]),D=Ge,U=st,B=Ne,P=je),(Bt.equals(H)===!1||dn!==W)&&(o.blendColor(Bt.r,Bt.g,Bt.b,dn),H.copy(Bt),W=dn),C=te,I=!1}function Ve(te,it){te.side===No?Je(o.CULL_FACE):Te(o.CULL_FACE);let Ge=te.side===ts;it&&(Ge=!Ge),Ue(Ge),te.blending===Wc&&te.transparent===!1?Re(Io):Re(te.blending,te.blendEquation,te.blendSrc,te.blendDst,te.blendEquationAlpha,te.blendSrcAlpha,te.blendDstAlpha,te.blendColor,te.blendAlpha,te.premultipliedAlpha),f.setFunc(te.depthFunc),f.setTest(te.depthTest),f.setMask(te.depthWrite),u.setMask(te.colorWrite);const st=te.stencilWrite;h.setTest(st),st&&(h.setMask(te.stencilWriteMask),h.setFunc(te.stencilFunc,te.stencilRef,te.stencilFuncMask),h.setOp(te.stencilFail,te.stencilZFail,te.stencilZPass)),St(te.polygonOffset,te.polygonOffsetFactor,te.polygonOffsetUnits),te.alphaToCoverage===!0?Te(o.SAMPLE_ALPHA_TO_COVERAGE):Je(o.SAMPLE_ALPHA_TO_COVERAGE)}function Ue(te){z!==te&&(te?o.frontFace(o.CW):o.frontFace(o.CCW),z=te)}function Ke(te){te!==P1?(Te(o.CULL_FACE),te!==j&&(te===Cx?o.cullFace(o.BACK):te===B1?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK))):Je(o.CULL_FACE),j=te}function Z(te){te!==ae&&(q&&o.lineWidth(te),ae=te)}function St(te,it,Ge){te?(Te(o.POLYGON_OFFSET_FILL),($!==it||ue!==Ge)&&(o.polygonOffset(it,Ge),$=it,ue=Ge)):Je(o.POLYGON_OFFSET_FILL)}function tt(te){te?Te(o.SCISSOR_TEST):Je(o.SCISSOR_TEST)}function Mt(te){te===void 0&&(te=o.TEXTURE0+he-1),Ae!==te&&(o.activeTexture(te),Ae=te)}function We(te,it,Ge){Ge===void 0&&(Ae===null?Ge=o.TEXTURE0+he-1:Ge=Ae);let st=Ce[Ge];st===void 0&&(st={type:void 0,texture:void 0},Ce[Ge]=st),(st.type!==te||st.texture!==it)&&(Ae!==Ge&&(o.activeTexture(Ge),Ae=Ge),o.bindTexture(te,it||fe[te]),st.type=te,st.texture=it)}function G(){const te=Ce[Ae];te!==void 0&&te.type!==void 0&&(o.bindTexture(te.type,null),te.type=void 0,te.texture=void 0)}function O(){try{o.compressedTexImage2D(...arguments)}catch(te){Tt("WebGLState:",te)}}function ne(){try{o.compressedTexImage3D(...arguments)}catch(te){Tt("WebGLState:",te)}}function Se(){try{o.texSubImage2D(...arguments)}catch(te){Tt("WebGLState:",te)}}function Le(){try{o.texSubImage3D(...arguments)}catch(te){Tt("WebGLState:",te)}}function be(){try{o.compressedTexSubImage2D(...arguments)}catch(te){Tt("WebGLState:",te)}}function ct(){try{o.compressedTexSubImage3D(...arguments)}catch(te){Tt("WebGLState:",te)}}function Ze(){try{o.texStorage2D(...arguments)}catch(te){Tt("WebGLState:",te)}}function gt(){try{o.texStorage3D(...arguments)}catch(te){Tt("WebGLState:",te)}}function wt(){try{o.texImage2D(...arguments)}catch(te){Tt("WebGLState:",te)}}function Be(){try{o.texImage3D(...arguments)}catch(te){Tt("WebGLState:",te)}}function Xe(te){Ee.equals(te)===!1&&(o.scissor(te.x,te.y,te.z,te.w),Ee.copy(te))}function ft(te){Oe.equals(te)===!1&&(o.viewport(te.x,te.y,te.z,te.w),Oe.copy(te))}function lt(te,it){let Ge=g.get(it);Ge===void 0&&(Ge=new WeakMap,g.set(it,Ge));let st=Ge.get(te);st===void 0&&(st=o.getUniformBlockIndex(it,te.name),Ge.set(te,st))}function $e(te,it){const st=g.get(it).get(te);m.get(it)!==st&&(o.uniformBlockBinding(it,st,te.__bindingPointIndex),m.set(it,st))}function Zt(){o.disable(o.BLEND),o.disable(o.CULL_FACE),o.disable(o.DEPTH_TEST),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SCISSOR_TEST),o.disable(o.STENCIL_TEST),o.disable(o.SAMPLE_ALPHA_TO_COVERAGE),o.blendEquation(o.FUNC_ADD),o.blendFunc(o.ONE,o.ZERO),o.blendFuncSeparate(o.ONE,o.ZERO,o.ONE,o.ZERO),o.blendColor(0,0,0,0),o.colorMask(!0,!0,!0,!0),o.clearColor(0,0,0,0),o.depthMask(!0),o.depthFunc(o.LESS),f.setReversed(!1),o.clearDepth(1),o.stencilMask(4294967295),o.stencilFunc(o.ALWAYS,0,4294967295),o.stencilOp(o.KEEP,o.KEEP,o.KEEP),o.clearStencil(0),o.cullFace(o.BACK),o.frontFace(o.CCW),o.polygonOffset(0,0),o.activeTexture(o.TEXTURE0),o.bindFramebuffer(o.FRAMEBUFFER,null),o.bindFramebuffer(o.DRAW_FRAMEBUFFER,null),o.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.useProgram(null),o.lineWidth(1),o.scissor(0,0,o.canvas.width,o.canvas.height),o.viewport(0,0,o.canvas.width,o.canvas.height),_={},Ae=null,Ce={},x={},b=new WeakMap,M=[],A=null,R=!1,C=null,E=null,D=null,U=null,L=null,B=null,P=null,H=new pt(0,0,0),W=0,I=!1,z=null,j=null,ae=null,$=null,ue=null,Ee.set(0,0,o.canvas.width,o.canvas.height),Oe.set(0,0,o.canvas.width,o.canvas.height),u.reset(),f.reset(),h.reset()}return{buffers:{color:u,depth:f,stencil:h},enable:Te,disable:Je,bindFramebuffer:et,drawBuffers:ut,useProgram:Jt,setBlending:Re,setMaterial:Ve,setFlipSided:Ue,setCullFace:Ke,setLineWidth:Z,setPolygonOffset:St,setScissorTest:tt,activeTexture:Mt,bindTexture:We,unbindTexture:G,compressedTexImage2D:O,compressedTexImage3D:ne,texImage2D:wt,texImage3D:Be,updateUBOMapping:lt,uniformBlockBinding:$e,texStorage2D:Ze,texStorage3D:gt,texSubImage2D:Se,texSubImage3D:Le,compressedTexSubImage2D:be,compressedTexSubImage3D:ct,scissor:Xe,viewport:ft,reset:Zt}}function lI(o,e,t,i,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 Pe,_=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):lm("canvas")}function R(G,O,ne){let Se=1;const Le=We(G);if((Le.width>ne||Le.height>ne)&&(Se=ne/Math.max(Le.width,Le.height)),Se<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 be=Math.floor(Se*Le.width),ct=Math.floor(Se*Le.height);x===void 0&&(x=A(be,ct));const Ze=O?A(be,ct):x;return Ze.width=be,Ze.height=ct,Ze.getContext("2d").drawImage(G,0,0,be,ct),rt("WebGLRenderer: Texture has been resized from ("+Le.width+"x"+Le.height+") to ("+be+"x"+ct+")."),Ze}else return"data"in G&&rt("WebGLRenderer: Image in DataTexture is too big ("+Le.width+"x"+Le.height+")."),G;return G}function C(G){return G.generateMipmaps}function E(G){o.generateMipmap(G)}function D(G){return G.isWebGLCubeRenderTarget?o.TEXTURE_CUBE_MAP:G.isWebGL3DRenderTarget?o.TEXTURE_3D:G.isWebGLArrayRenderTarget||G.isCompressedArrayTexture?o.TEXTURE_2D_ARRAY:o.TEXTURE_2D}function U(G,O,ne,Se,Le=!1){if(G!==null){if(o[G]!==void 0)return o[G];rt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+G+"'")}let be=O;if(O===o.RED&&(ne===o.FLOAT&&(be=o.R32F),ne===o.HALF_FLOAT&&(be=o.R16F),ne===o.UNSIGNED_BYTE&&(be=o.R8)),O===o.RED_INTEGER&&(ne===o.UNSIGNED_BYTE&&(be=o.R8UI),ne===o.UNSIGNED_SHORT&&(be=o.R16UI),ne===o.UNSIGNED_INT&&(be=o.R32UI),ne===o.BYTE&&(be=o.R8I),ne===o.SHORT&&(be=o.R16I),ne===o.INT&&(be=o.R32I)),O===o.RG&&(ne===o.FLOAT&&(be=o.RG32F),ne===o.HALF_FLOAT&&(be=o.RG16F),ne===o.UNSIGNED_BYTE&&(be=o.RG8)),O===o.RG_INTEGER&&(ne===o.UNSIGNED_BYTE&&(be=o.RG8UI),ne===o.UNSIGNED_SHORT&&(be=o.RG16UI),ne===o.UNSIGNED_INT&&(be=o.RG32UI),ne===o.BYTE&&(be=o.RG8I),ne===o.SHORT&&(be=o.RG16I),ne===o.INT&&(be=o.RG32I)),O===o.RGB_INTEGER&&(ne===o.UNSIGNED_BYTE&&(be=o.RGB8UI),ne===o.UNSIGNED_SHORT&&(be=o.RGB16UI),ne===o.UNSIGNED_INT&&(be=o.RGB32UI),ne===o.BYTE&&(be=o.RGB8I),ne===o.SHORT&&(be=o.RGB16I),ne===o.INT&&(be=o.RGB32I)),O===o.RGBA_INTEGER&&(ne===o.UNSIGNED_BYTE&&(be=o.RGBA8UI),ne===o.UNSIGNED_SHORT&&(be=o.RGBA16UI),ne===o.UNSIGNED_INT&&(be=o.RGBA32UI),ne===o.BYTE&&(be=o.RGBA8I),ne===o.SHORT&&(be=o.RGBA16I),ne===o.INT&&(be=o.RGBA32I)),O===o.RGB&&(ne===o.UNSIGNED_INT_5_9_9_9_REV&&(be=o.RGB9_E5),ne===o.UNSIGNED_INT_10F_11F_11F_REV&&(be=o.R11F_G11F_B10F)),O===o.RGBA){const ct=Le?rm:xn.getTransfer(Se);ne===o.FLOAT&&(be=o.RGBA32F),ne===o.HALF_FLOAT&&(be=o.RGBA16F),ne===o.UNSIGNED_BYTE&&(be=ct===On?o.SRGB8_ALPHA8:o.RGBA8),ne===o.UNSIGNED_SHORT_4_4_4_4&&(be=o.RGBA4),ne===o.UNSIGNED_SHORT_5_5_5_1&&(be=o.RGB5_A1)}return(be===o.R16F||be===o.R32F||be===o.RG16F||be===o.RG32F||be===o.RGBA16F||be===o.RGBA32F)&&e.get("EXT_color_buffer_float"),be}function L(G,O){let ne;return G?O===null||O===gr||O===Fh?ne=o.DEPTH24_STENCIL8:O===es?ne=o.DEPTH32F_STENCIL8:O===Bh&&(ne=o.DEPTH24_STENCIL8,rt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):O===null||O===gr||O===Fh?ne=o.DEPTH_COMPONENT24:O===es?ne=o.DEPTH_COMPONENT32F:O===Bh&&(ne=o.DEPTH_COMPONENT16),ne}function B(G,O){return C(G)===!0||G.isFramebufferTexture&&G.minFilter!==Li&&G.minFilter!==ai?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 P(G){const O=G.target;O.removeEventListener("dispose",P),W(O),O.isVideoTexture&&_.delete(O)}function H(G){const O=G.target;O.removeEventListener("dispose",H),z(O)}function W(G){const O=i.get(G);if(O.__webglInit===void 0)return;const ne=G.source,Se=b.get(ne);if(Se){const Le=Se[O.__cacheKey];Le.usedTimes--,Le.usedTimes===0&&I(G),Object.keys(Se).length===0&&b.delete(ne)}i.remove(G)}function I(G){const O=i.get(G);o.deleteTexture(O.__webglTexture);const ne=G.source,Se=b.get(ne);delete Se[O.__cacheKey],f.memory.textures--}function z(G){const O=i.get(G);if(G.depthTexture&&(G.depthTexture.dispose(),i.remove(G.depthTexture)),G.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++){if(Array.isArray(O.__webglFramebuffer[Se]))for(let Le=0;Le<O.__webglFramebuffer[Se].length;Le++)o.deleteFramebuffer(O.__webglFramebuffer[Se][Le]);else o.deleteFramebuffer(O.__webglFramebuffer[Se]);O.__webglDepthbuffer&&o.deleteRenderbuffer(O.__webglDepthbuffer[Se])}else{if(Array.isArray(O.__webglFramebuffer))for(let Se=0;Se<O.__webglFramebuffer.length;Se++)o.deleteFramebuffer(O.__webglFramebuffer[Se]);else o.deleteFramebuffer(O.__webglFramebuffer);if(O.__webglDepthbuffer&&o.deleteRenderbuffer(O.__webglDepthbuffer),O.__webglMultisampledFramebuffer&&o.deleteFramebuffer(O.__webglMultisampledFramebuffer),O.__webglColorRenderbuffer)for(let Se=0;Se<O.__webglColorRenderbuffer.length;Se++)O.__webglColorRenderbuffer[Se]&&o.deleteRenderbuffer(O.__webglColorRenderbuffer[Se]);O.__webglDepthRenderbuffer&&o.deleteRenderbuffer(O.__webglDepthRenderbuffer)}const ne=G.textures;for(let Se=0,Le=ne.length;Se<Le;Se++){const be=i.get(ne[Se]);be.__webglTexture&&(o.deleteTexture(be.__webglTexture),f.memory.textures--),i.remove(ne[Se])}i.remove(G)}let j=0;function ae(){j=0}function $(){const G=j;return G>=s.maxTextures&&rt("WebGLTextures: Trying to use "+G+" texture units while this GPU supports only "+s.maxTextures),j+=1,G}function ue(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 he(G,O){const ne=i.get(G);if(G.isVideoTexture&&tt(G),G.isRenderTargetTexture===!1&&G.isExternalTexture!==!0&&G.version>0&&ne.__version!==G.version){const Se=G.image;if(Se===null)rt("WebGLRenderer: Texture marked for update but no image data found.");else if(Se.complete===!1)rt("WebGLRenderer: Texture marked for update but image is incomplete");else{fe(ne,G,O);return}}else G.isExternalTexture&&(ne.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(o.TEXTURE_2D,ne.__webglTexture,o.TEXTURE0+O)}function q(G,O){const ne=i.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ne.__version!==G.version){fe(ne,G,O);return}else G.isExternalTexture&&(ne.__webglTexture=G.sourceTexture?G.sourceTexture:null);t.bindTexture(o.TEXTURE_2D_ARRAY,ne.__webglTexture,o.TEXTURE0+O)}function K(G,O){const ne=i.get(G);if(G.isRenderTargetTexture===!1&&G.version>0&&ne.__version!==G.version){fe(ne,G,O);return}t.bindTexture(o.TEXTURE_3D,ne.__webglTexture,o.TEXTURE0+O)}function ce(G,O){const ne=i.get(G);if(G.isCubeDepthTexture!==!0&&G.version>0&&ne.__version!==G.version){Te(ne,G,O);return}t.bindTexture(o.TEXTURE_CUBE_MAP,ne.__webglTexture,o.TEXTURE0+O)}const Ae={[nm]:o.REPEAT,[As]:o.CLAMP_TO_EDGE,[im]:o.MIRRORED_REPEAT},Ce={[Li]:o.NEAREST,[rS]:o.NEAREST_MIPMAP_NEAREST,[Lh]:o.NEAREST_MIPMAP_LINEAR,[ai]:o.LINEAR,[Wp]:o.LINEAR_MIPMAP_NEAREST,[Uo]:o.LINEAR_MIPMAP_LINEAR},X={[hE]:o.NEVER,[vE]:o.ALWAYS,[dE]:o.LESS,[py]:o.LEQUAL,[pE]:o.EQUAL,[my]:o.GEQUAL,[mE]:o.GREATER,[gE]:o.NOTEQUAL};function se(G,O){if(O.type===es&&e.has("OES_texture_float_linear")===!1&&(O.magFilter===ai||O.magFilter===Wp||O.magFilter===Lh||O.magFilter===Uo||O.minFilter===ai||O.minFilter===Wp||O.minFilter===Lh||O.minFilter===Uo)&&rt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),o.texParameteri(G,o.TEXTURE_WRAP_S,Ae[O.wrapS]),o.texParameteri(G,o.TEXTURE_WRAP_T,Ae[O.wrapT]),(G===o.TEXTURE_3D||G===o.TEXTURE_2D_ARRAY)&&o.texParameteri(G,o.TEXTURE_WRAP_R,Ae[O.wrapR]),o.texParameteri(G,o.TEXTURE_MAG_FILTER,Ce[O.magFilter]),o.texParameteri(G,o.TEXTURE_MIN_FILTER,Ce[O.minFilter]),O.compareFunction&&(o.texParameteri(G,o.TEXTURE_COMPARE_MODE,o.COMPARE_REF_TO_TEXTURE),o.texParameteri(G,o.TEXTURE_COMPARE_FUNC,X[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(O.magFilter===Li||O.minFilter!==Lh&&O.minFilter!==Uo||O.type===es&&e.has("OES_texture_float_linear")===!1)return;if(O.anisotropy>1||i.get(O).__currentAnisotropy){const ne=e.get("EXT_texture_filter_anisotropic");o.texParameterf(G,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,s.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy}}}function Ee(G,O){let ne=!1;G.__webglInit===void 0&&(G.__webglInit=!0,O.addEventListener("dispose",P));const Se=O.source;let Le=b.get(Se);Le===void 0&&(Le={},b.set(Se,Le));const be=ue(O);if(be!==G.__cacheKey){Le[be]===void 0&&(Le[be]={texture:o.createTexture(),usedTimes:0},f.memory.textures++,ne=!0),Le[be].usedTimes++;const ct=Le[G.__cacheKey];ct!==void 0&&(Le[G.__cacheKey].usedTimes--,ct.usedTimes===0&&I(O)),G.__cacheKey=be,G.__webglTexture=Le[be].texture}return ne}function Oe(G,O,ne){return Math.floor(Math.floor(G/ne)/O)}function nt(G,O,ne,Se){const be=G.updateRanges;if(be.length===0)t.texSubImage2D(o.TEXTURE_2D,0,0,0,O.width,O.height,ne,Se,O.data);else{be.sort((Be,Xe)=>Be.start-Xe.start);let ct=0;for(let Be=1;Be<be.length;Be++){const Xe=be[ct],ft=be[Be],lt=Xe.start+Xe.count,$e=Oe(ft.start,O.width,4),Zt=Oe(Xe.start,O.width,4);ft.start<=lt+1&&$e===Zt&&Oe(ft.start+ft.count-1,O.width,4)===$e?Xe.count=Math.max(Xe.count,ft.start+ft.count-Xe.start):(++ct,be[ct]=ft)}be.length=ct+1;const Ze=o.getParameter(o.UNPACK_ROW_LENGTH),gt=o.getParameter(o.UNPACK_SKIP_PIXELS),wt=o.getParameter(o.UNPACK_SKIP_ROWS);o.pixelStorei(o.UNPACK_ROW_LENGTH,O.width);for(let Be=0,Xe=be.length;Be<Xe;Be++){const ft=be[Be],lt=Math.floor(ft.start/4),$e=Math.ceil(ft.count/4),Zt=lt%O.width,te=Math.floor(lt/O.width),it=$e,Ge=1;o.pixelStorei(o.UNPACK_SKIP_PIXELS,Zt),o.pixelStorei(o.UNPACK_SKIP_ROWS,te),t.texSubImage2D(o.TEXTURE_2D,0,Zt,te,it,Ge,ne,Se,O.data)}G.clearUpdateRanges(),o.pixelStorei(o.UNPACK_ROW_LENGTH,Ze),o.pixelStorei(o.UNPACK_SKIP_PIXELS,gt),o.pixelStorei(o.UNPACK_SKIP_ROWS,wt)}}function fe(G,O,ne){let Se=o.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(Se=o.TEXTURE_2D_ARRAY),O.isData3DTexture&&(Se=o.TEXTURE_3D);const Le=Ee(G,O),be=O.source;t.bindTexture(Se,G.__webglTexture,o.TEXTURE0+ne);const ct=i.get(be);if(be.version!==ct.__version||Le===!0){t.activeTexture(o.TEXTURE0+ne);const Ze=xn.getPrimaries(xn.workingColorSpace),gt=O.colorSpace===Tl?null:xn.getPrimaries(O.colorSpace),wt=O.colorSpace===Tl||Ze===gt?o.NONE:o.BROWSER_DEFAULT_WEBGL;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,O.flipY),o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),o.pixelStorei(o.UNPACK_ALIGNMENT,O.unpackAlignment),o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,wt);let Be=R(O.image,!1,s.maxTextureSize);Be=Mt(O,Be);const Xe=u.convert(O.format,O.colorSpace),ft=u.convert(O.type);let lt=U(O.internalFormat,Xe,ft,O.colorSpace,O.isVideoTexture);se(Se,O);let $e;const Zt=O.mipmaps,te=O.isVideoTexture!==!0,it=ct.__version===void 0||Le===!0,Ge=be.dataReady,st=B(O,Be);if(O.isDepthTexture)lt=L(O.format===Ru,O.type),it&&(te?t.texStorage2D(o.TEXTURE_2D,1,lt,Be.width,Be.height):t.texImage2D(o.TEXTURE_2D,0,lt,Be.width,Be.height,0,Xe,ft,null));else if(O.isDataTexture)if(Zt.length>0){te&&it&&t.texStorage2D(o.TEXTURE_2D,st,lt,Zt[0].width,Zt[0].height);for(let Fe=0,Ne=Zt.length;Fe<Ne;Fe++)$e=Zt[Fe],te?Ge&&t.texSubImage2D(o.TEXTURE_2D,Fe,0,0,$e.width,$e.height,Xe,ft,$e.data):t.texImage2D(o.TEXTURE_2D,Fe,lt,$e.width,$e.height,0,Xe,ft,$e.data);O.generateMipmaps=!1}else te?(it&&t.texStorage2D(o.TEXTURE_2D,st,lt,Be.width,Be.height),Ge&&nt(O,Be,Xe,ft)):t.texImage2D(o.TEXTURE_2D,0,lt,Be.width,Be.height,0,Xe,ft,Be.data);else if(O.isCompressedTexture)if(O.isCompressedArrayTexture){te&&it&&t.texStorage3D(o.TEXTURE_2D_ARRAY,st,lt,Zt[0].width,Zt[0].height,Be.depth);for(let Fe=0,Ne=Zt.length;Fe<Ne;Fe++)if($e=Zt[Fe],O.format!==La)if(Xe!==null)if(te){if(Ge)if(O.layerUpdates.size>0){const je=kx($e.width,$e.height,O.format,O.type);for(const Bt of O.layerUpdates){const dn=$e.data.subarray(Bt*je/$e.data.BYTES_PER_ELEMENT,(Bt+1)*je/$e.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(o.TEXTURE_2D_ARRAY,Fe,0,0,Bt,$e.width,$e.height,1,Xe,dn)}O.clearLayerUpdates()}else t.compressedTexSubImage3D(o.TEXTURE_2D_ARRAY,Fe,0,0,0,$e.width,$e.height,Be.depth,Xe,$e.data)}else t.compressedTexImage3D(o.TEXTURE_2D_ARRAY,Fe,lt,$e.width,$e.height,Be.depth,0,$e.data,0,0);else rt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else te?Ge&&t.texSubImage3D(o.TEXTURE_2D_ARRAY,Fe,0,0,0,$e.width,$e.height,Be.depth,Xe,ft,$e.data):t.texImage3D(o.TEXTURE_2D_ARRAY,Fe,lt,$e.width,$e.height,Be.depth,0,Xe,ft,$e.data)}else{te&&it&&t.texStorage2D(o.TEXTURE_2D,st,lt,Zt[0].width,Zt[0].height);for(let Fe=0,Ne=Zt.length;Fe<Ne;Fe++)$e=Zt[Fe],O.format!==La?Xe!==null?te?Ge&&t.compressedTexSubImage2D(o.TEXTURE_2D,Fe,0,0,$e.width,$e.height,Xe,$e.data):t.compressedTexImage2D(o.TEXTURE_2D,Fe,lt,$e.width,$e.height,0,$e.data):rt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):te?Ge&&t.texSubImage2D(o.TEXTURE_2D,Fe,0,0,$e.width,$e.height,Xe,ft,$e.data):t.texImage2D(o.TEXTURE_2D,Fe,lt,$e.width,$e.height,0,Xe,ft,$e.data)}else if(O.isDataArrayTexture)if(te){if(it&&t.texStorage3D(o.TEXTURE_2D_ARRAY,st,lt,Be.width,Be.height,Be.depth),Ge)if(O.layerUpdates.size>0){const Fe=kx(Be.width,Be.height,O.format,O.type);for(const Ne of O.layerUpdates){const je=Be.data.subarray(Ne*Fe/Be.data.BYTES_PER_ELEMENT,(Ne+1)*Fe/Be.data.BYTES_PER_ELEMENT);t.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,Ne,Be.width,Be.height,1,Xe,ft,je)}O.clearLayerUpdates()}else t.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,0,Be.width,Be.height,Be.depth,Xe,ft,Be.data)}else t.texImage3D(o.TEXTURE_2D_ARRAY,0,lt,Be.width,Be.height,Be.depth,0,Xe,ft,Be.data);else if(O.isData3DTexture)te?(it&&t.texStorage3D(o.TEXTURE_3D,st,lt,Be.width,Be.height,Be.depth),Ge&&t.texSubImage3D(o.TEXTURE_3D,0,0,0,0,Be.width,Be.height,Be.depth,Xe,ft,Be.data)):t.texImage3D(o.TEXTURE_3D,0,lt,Be.width,Be.height,Be.depth,0,Xe,ft,Be.data);else if(O.isFramebufferTexture){if(it)if(te)t.texStorage2D(o.TEXTURE_2D,st,lt,Be.width,Be.height);else{let Fe=Be.width,Ne=Be.height;for(let je=0;je<st;je++)t.texImage2D(o.TEXTURE_2D,je,lt,Fe,Ne,0,Xe,ft,null),Fe>>=1,Ne>>=1}}else if(Zt.length>0){if(te&&it){const Fe=We(Zt[0]);t.texStorage2D(o.TEXTURE_2D,st,lt,Fe.width,Fe.height)}for(let Fe=0,Ne=Zt.length;Fe<Ne;Fe++)$e=Zt[Fe],te?Ge&&t.texSubImage2D(o.TEXTURE_2D,Fe,0,0,Xe,ft,$e):t.texImage2D(o.TEXTURE_2D,Fe,lt,Xe,ft,$e);O.generateMipmaps=!1}else if(te){if(it){const Fe=We(Be);t.texStorage2D(o.TEXTURE_2D,st,lt,Fe.width,Fe.height)}Ge&&t.texSubImage2D(o.TEXTURE_2D,0,0,0,Xe,ft,Be)}else t.texImage2D(o.TEXTURE_2D,0,lt,Xe,ft,Be);C(O)&&E(Se),ct.__version=be.version,O.onUpdate&&O.onUpdate(O)}G.__version=O.version}function Te(G,O,ne){if(O.image.length!==6)return;const Se=Ee(G,O),Le=O.source;t.bindTexture(o.TEXTURE_CUBE_MAP,G.__webglTexture,o.TEXTURE0+ne);const be=i.get(Le);if(Le.version!==be.__version||Se===!0){t.activeTexture(o.TEXTURE0+ne);const ct=xn.getPrimaries(xn.workingColorSpace),Ze=O.colorSpace===Tl?null:xn.getPrimaries(O.colorSpace),gt=O.colorSpace===Tl||ct===Ze?o.NONE:o.BROWSER_DEFAULT_WEBGL;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,O.flipY),o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),o.pixelStorei(o.UNPACK_ALIGNMENT,O.unpackAlignment),o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,gt);const wt=O.isCompressedTexture||O.image[0].isCompressedTexture,Be=O.image[0]&&O.image[0].isDataTexture,Xe=[];for(let Ne=0;Ne<6;Ne++)!wt&&!Be?Xe[Ne]=R(O.image[Ne],!0,s.maxCubemapSize):Xe[Ne]=Be?O.image[Ne].image:O.image[Ne],Xe[Ne]=Mt(O,Xe[Ne]);const ft=Xe[0],lt=u.convert(O.format,O.colorSpace),$e=u.convert(O.type),Zt=U(O.internalFormat,lt,$e,O.colorSpace),te=O.isVideoTexture!==!0,it=be.__version===void 0||Se===!0,Ge=Le.dataReady;let st=B(O,ft);se(o.TEXTURE_CUBE_MAP,O);let Fe;if(wt){te&&it&&t.texStorage2D(o.TEXTURE_CUBE_MAP,st,Zt,ft.width,ft.height);for(let Ne=0;Ne<6;Ne++){Fe=Xe[Ne].mipmaps;for(let je=0;je<Fe.length;je++){const Bt=Fe[je];O.format!==La?lt!==null?te?Ge&&t.compressedTexSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je,0,0,Bt.width,Bt.height,lt,Bt.data):t.compressedTexImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je,Zt,Bt.width,Bt.height,0,Bt.data):rt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?Ge&&t.texSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je,0,0,Bt.width,Bt.height,lt,$e,Bt.data):t.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je,Zt,Bt.width,Bt.height,0,lt,$e,Bt.data)}}}else{if(Fe=O.mipmaps,te&&it){Fe.length>0&&st++;const Ne=We(Xe[0]);t.texStorage2D(o.TEXTURE_CUBE_MAP,st,Zt,Ne.width,Ne.height)}for(let Ne=0;Ne<6;Ne++)if(Be){te?Ge&&t.texSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,Xe[Ne].width,Xe[Ne].height,lt,$e,Xe[Ne].data):t.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Zt,Xe[Ne].width,Xe[Ne].height,0,lt,$e,Xe[Ne].data);for(let je=0;je<Fe.length;je++){const dn=Fe[je].image[Ne].image;te?Ge&&t.texSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je+1,0,0,dn.width,dn.height,lt,$e,dn.data):t.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je+1,Zt,dn.width,dn.height,0,lt,$e,dn.data)}}else{te?Ge&&t.texSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,lt,$e,Xe[Ne]):t.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Zt,lt,$e,Xe[Ne]);for(let je=0;je<Fe.length;je++){const Bt=Fe[je];te?Ge&&t.texSubImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je+1,0,0,lt,$e,Bt.image[Ne]):t.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,je+1,Zt,lt,$e,Bt.image[Ne])}}}C(O)&&E(o.TEXTURE_CUBE_MAP),be.__version=Le.version,O.onUpdate&&O.onUpdate(O)}G.__version=O.version}function Je(G,O,ne,Se,Le,be){const ct=u.convert(ne.format,ne.colorSpace),Ze=u.convert(ne.type),gt=U(ne.internalFormat,ct,Ze,ne.colorSpace),wt=i.get(O),Be=i.get(ne);if(Be.__renderTarget=O,!wt.__hasExternalTextures){const Xe=Math.max(1,O.width>>be),ft=Math.max(1,O.height>>be);Le===o.TEXTURE_3D||Le===o.TEXTURE_2D_ARRAY?t.texImage3D(Le,be,gt,Xe,ft,O.depth,0,ct,Ze,null):t.texImage2D(Le,be,gt,Xe,ft,0,ct,Ze,null)}t.bindFramebuffer(o.FRAMEBUFFER,G),St(O)?h.framebufferTexture2DMultisampleEXT(o.FRAMEBUFFER,Se,Le,Be.__webglTexture,0,Z(O)):(Le===o.TEXTURE_2D||Le>=o.TEXTURE_CUBE_MAP_POSITIVE_X&&Le<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&o.framebufferTexture2D(o.FRAMEBUFFER,Se,Le,Be.__webglTexture,be),t.bindFramebuffer(o.FRAMEBUFFER,null)}function et(G,O,ne){if(o.bindRenderbuffer(o.RENDERBUFFER,G),O.depthBuffer){const Se=O.depthTexture,Le=Se&&Se.isDepthTexture?Se.type:null,be=L(O.stencilBuffer,Le),ct=O.stencilBuffer?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT;St(O)?h.renderbufferStorageMultisampleEXT(o.RENDERBUFFER,Z(O),be,O.width,O.height):ne?o.renderbufferStorageMultisample(o.RENDERBUFFER,Z(O),be,O.width,O.height):o.renderbufferStorage(o.RENDERBUFFER,be,O.width,O.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,ct,o.RENDERBUFFER,G)}else{const Se=O.textures;for(let Le=0;Le<Se.length;Le++){const be=Se[Le],ct=u.convert(be.format,be.colorSpace),Ze=u.convert(be.type),gt=U(be.internalFormat,ct,Ze,be.colorSpace);St(O)?h.renderbufferStorageMultisampleEXT(o.RENDERBUFFER,Z(O),gt,O.width,O.height):ne?o.renderbufferStorageMultisample(o.RENDERBUFFER,Z(O),gt,O.width,O.height):o.renderbufferStorage(o.RENDERBUFFER,gt,O.width,O.height)}}o.bindRenderbuffer(o.RENDERBUFFER,null)}function ut(G,O,ne){const Se=O.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(o.FRAMEBUFFER,G),!(O.depthTexture&&O.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Le=i.get(O.depthTexture);if(Le.__renderTarget=O,(!Le.__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),Se){if(Le.__webglInit===void 0&&(Le.__webglInit=!0,O.depthTexture.addEventListener("dispose",P)),Le.__webglTexture===void 0){Le.__webglTexture=o.createTexture(),t.bindTexture(o.TEXTURE_CUBE_MAP,Le.__webglTexture),se(o.TEXTURE_CUBE_MAP,O.depthTexture);const wt=u.convert(O.depthTexture.format),Be=u.convert(O.depthTexture.type);let Xe;O.depthTexture.format===Po?Xe=o.DEPTH_COMPONENT24:O.depthTexture.format===Ru&&(Xe=o.DEPTH24_STENCIL8);for(let ft=0;ft<6;ft++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Xe,O.width,O.height,0,wt,Be,null)}}else he(O.depthTexture,0);const be=Le.__webglTexture,ct=Z(O),Ze=Se?o.TEXTURE_CUBE_MAP_POSITIVE_X+ne:o.TEXTURE_2D,gt=O.depthTexture.format===Ru?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT;if(O.depthTexture.format===Po)St(O)?h.framebufferTexture2DMultisampleEXT(o.FRAMEBUFFER,gt,Ze,be,0,ct):o.framebufferTexture2D(o.FRAMEBUFFER,gt,Ze,be,0);else if(O.depthTexture.format===Ru)St(O)?h.framebufferTexture2DMultisampleEXT(o.FRAMEBUFFER,gt,Ze,be,0,ct):o.framebufferTexture2D(o.FRAMEBUFFER,gt,Ze,be,0);else throw new Error("Unknown depthTexture format")}function Jt(G){const O=i.get(G),ne=G.isWebGLCubeRenderTarget===!0;if(O.__boundDepthTexture!==G.depthTexture){const Se=G.depthTexture;if(O.__depthDisposeCallback&&O.__depthDisposeCallback(),Se){const Le=()=>{delete O.__boundDepthTexture,delete O.__depthDisposeCallback,Se.removeEventListener("dispose",Le)};Se.addEventListener("dispose",Le),O.__depthDisposeCallback=Le}O.__boundDepthTexture=Se}if(G.depthTexture&&!O.__autoAllocateDepthBuffer)if(ne)for(let Se=0;Se<6;Se++)ut(O.__webglFramebuffer[Se],G,Se);else{const Se=G.texture.mipmaps;Se&&Se.length>0?ut(O.__webglFramebuffer[0],G,0):ut(O.__webglFramebuffer,G,0)}else if(ne){O.__webglDepthbuffer=[];for(let Se=0;Se<6;Se++)if(t.bindFramebuffer(o.FRAMEBUFFER,O.__webglFramebuffer[Se]),O.__webglDepthbuffer[Se]===void 0)O.__webglDepthbuffer[Se]=o.createRenderbuffer(),et(O.__webglDepthbuffer[Se],G,!1);else{const Le=G.stencilBuffer?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT,be=O.__webglDepthbuffer[Se];o.bindRenderbuffer(o.RENDERBUFFER,be),o.framebufferRenderbuffer(o.FRAMEBUFFER,Le,o.RENDERBUFFER,be)}}else{const Se=G.texture.mipmaps;if(Se&&Se.length>0?t.bindFramebuffer(o.FRAMEBUFFER,O.__webglFramebuffer[0]):t.bindFramebuffer(o.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer===void 0)O.__webglDepthbuffer=o.createRenderbuffer(),et(O.__webglDepthbuffer,G,!1);else{const Le=G.stencilBuffer?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT,be=O.__webglDepthbuffer;o.bindRenderbuffer(o.RENDERBUFFER,be),o.framebufferRenderbuffer(o.FRAMEBUFFER,Le,o.RENDERBUFFER,be)}}t.bindFramebuffer(o.FRAMEBUFFER,null)}function on(G,O,ne){const Se=i.get(G);O!==void 0&&Je(Se.__webglFramebuffer,G,G.texture,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,0),ne!==void 0&&Jt(G)}function Dt(G){const O=G.texture,ne=i.get(G),Se=i.get(O);G.addEventListener("dispose",H);const Le=G.textures,be=G.isWebGLCubeRenderTarget===!0,ct=Le.length>1;if(ct||(Se.__webglTexture===void 0&&(Se.__webglTexture=o.createTexture()),Se.__version=O.version,f.memory.textures++),be){ne.__webglFramebuffer=[];for(let Ze=0;Ze<6;Ze++)if(O.mipmaps&&O.mipmaps.length>0){ne.__webglFramebuffer[Ze]=[];for(let gt=0;gt<O.mipmaps.length;gt++)ne.__webglFramebuffer[Ze][gt]=o.createFramebuffer()}else ne.__webglFramebuffer[Ze]=o.createFramebuffer()}else{if(O.mipmaps&&O.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Ze=0;Ze<O.mipmaps.length;Ze++)ne.__webglFramebuffer[Ze]=o.createFramebuffer()}else ne.__webglFramebuffer=o.createFramebuffer();if(ct)for(let Ze=0,gt=Le.length;Ze<gt;Ze++){const wt=i.get(Le[Ze]);wt.__webglTexture===void 0&&(wt.__webglTexture=o.createTexture(),f.memory.textures++)}if(G.samples>0&&St(G)===!1){ne.__webglMultisampledFramebuffer=o.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(o.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Ze=0;Ze<Le.length;Ze++){const gt=Le[Ze];ne.__webglColorRenderbuffer[Ze]=o.createRenderbuffer(),o.bindRenderbuffer(o.RENDERBUFFER,ne.__webglColorRenderbuffer[Ze]);const wt=u.convert(gt.format,gt.colorSpace),Be=u.convert(gt.type),Xe=U(gt.internalFormat,wt,Be,gt.colorSpace,G.isXRRenderTarget===!0),ft=Z(G);o.renderbufferStorageMultisample(o.RENDERBUFFER,ft,Xe,G.width,G.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+Ze,o.RENDERBUFFER,ne.__webglColorRenderbuffer[Ze])}o.bindRenderbuffer(o.RENDERBUFFER,null),G.depthBuffer&&(ne.__webglDepthRenderbuffer=o.createRenderbuffer(),et(ne.__webglDepthRenderbuffer,G,!0)),t.bindFramebuffer(o.FRAMEBUFFER,null)}}if(be){t.bindTexture(o.TEXTURE_CUBE_MAP,Se.__webglTexture),se(o.TEXTURE_CUBE_MAP,O);for(let Ze=0;Ze<6;Ze++)if(O.mipmaps&&O.mipmaps.length>0)for(let gt=0;gt<O.mipmaps.length;gt++)Je(ne.__webglFramebuffer[Ze][gt],G,O,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,gt);else Je(ne.__webglFramebuffer[Ze],G,O,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0);C(O)&&E(o.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ct){for(let Ze=0,gt=Le.length;Ze<gt;Ze++){const wt=Le[Ze],Be=i.get(wt);let Xe=o.TEXTURE_2D;(G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Xe=G.isWebGL3DRenderTarget?o.TEXTURE_3D:o.TEXTURE_2D_ARRAY),t.bindTexture(Xe,Be.__webglTexture),se(Xe,wt),Je(ne.__webglFramebuffer,G,wt,o.COLOR_ATTACHMENT0+Ze,Xe,0),C(wt)&&E(Xe)}t.unbindTexture()}else{let Ze=o.TEXTURE_2D;if((G.isWebGL3DRenderTarget||G.isWebGLArrayRenderTarget)&&(Ze=G.isWebGL3DRenderTarget?o.TEXTURE_3D:o.TEXTURE_2D_ARRAY),t.bindTexture(Ze,Se.__webglTexture),se(Ze,O),O.mipmaps&&O.mipmaps.length>0)for(let gt=0;gt<O.mipmaps.length;gt++)Je(ne.__webglFramebuffer[gt],G,O,o.COLOR_ATTACHMENT0,Ze,gt);else Je(ne.__webglFramebuffer,G,O,o.COLOR_ATTACHMENT0,Ze,0);C(O)&&E(Ze),t.unbindTexture()}G.depthBuffer&&Jt(G)}function Re(G){const O=G.textures;for(let ne=0,Se=O.length;ne<Se;ne++){const Le=O[ne];if(C(Le)){const be=D(G),ct=i.get(Le).__webglTexture;t.bindTexture(be,ct),E(be),t.unbindTexture()}}}const Ve=[],Ue=[];function Ke(G){if(G.samples>0){if(St(G)===!1){const O=G.textures,ne=G.width,Se=G.height;let Le=o.COLOR_BUFFER_BIT;const be=G.stencilBuffer?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT,ct=i.get(G),Ze=O.length>1;if(Ze)for(let wt=0;wt<O.length;wt++)t.bindFramebuffer(o.FRAMEBUFFER,ct.__webglMultisampledFramebuffer),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+wt,o.RENDERBUFFER,null),t.bindFramebuffer(o.FRAMEBUFFER,ct.__webglFramebuffer),o.framebufferTexture2D(o.DRAW_FRAMEBUFFER,o.COLOR_ATTACHMENT0+wt,o.TEXTURE_2D,null,0);t.bindFramebuffer(o.READ_FRAMEBUFFER,ct.__webglMultisampledFramebuffer);const gt=G.texture.mipmaps;gt&>.length>0?t.bindFramebuffer(o.DRAW_FRAMEBUFFER,ct.__webglFramebuffer[0]):t.bindFramebuffer(o.DRAW_FRAMEBUFFER,ct.__webglFramebuffer);for(let wt=0;wt<O.length;wt++){if(G.resolveDepthBuffer&&(G.depthBuffer&&(Le|=o.DEPTH_BUFFER_BIT),G.stencilBuffer&&G.resolveStencilBuffer&&(Le|=o.STENCIL_BUFFER_BIT)),Ze){o.framebufferRenderbuffer(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.RENDERBUFFER,ct.__webglColorRenderbuffer[wt]);const Be=i.get(O[wt]).__webglTexture;o.framebufferTexture2D(o.DRAW_FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,Be,0)}o.blitFramebuffer(0,0,ne,Se,0,0,ne,Se,Le,o.NEAREST),m===!0&&(Ve.length=0,Ue.length=0,Ve.push(o.COLOR_ATTACHMENT0+wt),G.depthBuffer&&G.resolveDepthBuffer===!1&&(Ve.push(be),Ue.push(be),o.invalidateFramebuffer(o.DRAW_FRAMEBUFFER,Ue)),o.invalidateFramebuffer(o.READ_FRAMEBUFFER,Ve))}if(t.bindFramebuffer(o.READ_FRAMEBUFFER,null),t.bindFramebuffer(o.DRAW_FRAMEBUFFER,null),Ze)for(let wt=0;wt<O.length;wt++){t.bindFramebuffer(o.FRAMEBUFFER,ct.__webglMultisampledFramebuffer),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+wt,o.RENDERBUFFER,ct.__webglColorRenderbuffer[wt]);const Be=i.get(O[wt]).__webglTexture;t.bindFramebuffer(o.FRAMEBUFFER,ct.__webglFramebuffer),o.framebufferTexture2D(o.DRAW_FRAMEBUFFER,o.COLOR_ATTACHMENT0+wt,o.TEXTURE_2D,Be,0)}t.bindFramebuffer(o.DRAW_FRAMEBUFFER,ct.__webglMultisampledFramebuffer)}else if(G.depthBuffer&&G.resolveDepthBuffer===!1&&m){const O=G.stencilBuffer?o.DEPTH_STENCIL_ATTACHMENT:o.DEPTH_ATTACHMENT;o.invalidateFramebuffer(o.DRAW_FRAMEBUFFER,[O])}}}function Z(G){return Math.min(s.maxSamples,G.samples)}function St(G){const O=i.get(G);return G.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function tt(G){const O=f.render.frame;_.get(G)!==O&&(_.set(G,O),G.update())}function Mt(G,O){const ne=G.colorSpace,Se=G.format,Le=G.type;return G.isCompressedTexture===!0||G.isVideoTexture===!0||ne!==Lu&&ne!==Tl&&(xn.getTransfer(ne)===On?(Se!==La||Le!==Ka)&&rt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Tt("WebGLTextures: Unsupported texture color space:",ne)),O}function We(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=$,this.resetTextureUnits=ae,this.setTexture2D=he,this.setTexture2DArray=q,this.setTexture3D=K,this.setTextureCube=ce,this.rebindTextures=on,this.setupRenderTarget=Dt,this.updateRenderTargetMipmap=Re,this.updateMultisampleRenderTarget=Ke,this.setupDepthRenderbuffer=Jt,this.setupFrameBufferTexture=Je,this.useMultisampledRTT=St,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function AT(o,e){function t(i,s=Tl){let u;const f=xn.getTransfer(s);if(i===Ka)return o.UNSIGNED_BYTE;if(i===ly)return o.UNSIGNED_SHORT_4_4_4_4;if(i===uy)return o.UNSIGNED_SHORT_5_5_5_1;if(i===uS)return o.UNSIGNED_INT_5_9_9_9_REV;if(i===cS)return o.UNSIGNED_INT_10F_11F_11F_REV;if(i===oS)return o.BYTE;if(i===lS)return o.SHORT;if(i===Bh)return o.UNSIGNED_SHORT;if(i===oy)return o.INT;if(i===gr)return o.UNSIGNED_INT;if(i===es)return o.FLOAT;if(i===zo)return o.HALF_FLOAT;if(i===fS)return o.ALPHA;if(i===hS)return o.RGB;if(i===La)return o.RGBA;if(i===Po)return o.DEPTH_COMPONENT;if(i===Ru)return o.DEPTH_STENCIL;if(i===cy)return o.RED;if(i===xm)return o.RED_INTEGER;if(i===jc)return o.RG;if(i===fy)return o.RG_INTEGER;if(i===hy)return o.RGBA_INTEGER;if(i===qp||i===Yp||i===Zp||i===jp)if(f===On)if(u=e.get("WEBGL_compressed_texture_s3tc_srgb"),u!==null){if(i===qp)return u.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Yp)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Zp)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===jp)return u.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(u=e.get("WEBGL_compressed_texture_s3tc"),u!==null){if(i===qp)return u.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Yp)return u.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Zp)return u.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===jp)return u.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===vv||i===yv||i===_v||i===xv)if(u=e.get("WEBGL_compressed_texture_pvrtc"),u!==null){if(i===vv)return u.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===yv)return u.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===_v)return u.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===xv)return u.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Sv||i===bv||i===Mv||i===Ev||i===Tv||i===Av||i===wv)if(u=e.get("WEBGL_compressed_texture_etc"),u!==null){if(i===Sv||i===bv)return f===On?u.COMPRESSED_SRGB8_ETC2:u.COMPRESSED_RGB8_ETC2;if(i===Mv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:u.COMPRESSED_RGBA8_ETC2_EAC;if(i===Ev)return u.COMPRESSED_R11_EAC;if(i===Tv)return u.COMPRESSED_SIGNED_R11_EAC;if(i===Av)return u.COMPRESSED_RG11_EAC;if(i===wv)return u.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Cv||i===Rv||i===Dv||i===Nv||i===Uv||i===Lv||i===Iv||i===Ov||i===zv||i===Pv||i===Bv||i===Fv||i===Vv||i===kv)if(u=e.get("WEBGL_compressed_texture_astc"),u!==null){if(i===Cv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:u.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Rv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:u.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Dv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:u.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Nv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:u.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Uv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:u.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Lv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:u.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Iv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:u.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Ov)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:u.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===zv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:u.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Pv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:u.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Bv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:u.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Fv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:u.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Vv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:u.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===kv)return f===On?u.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:u.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Hv||i===Gv||i===Xv)if(u=e.get("EXT_texture_compression_bptc"),u!==null){if(i===Hv)return f===On?u.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:u.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Gv)return u.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Xv)return u.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Wv||i===qv||i===Yv||i===Zv)if(u=e.get("EXT_texture_compression_rgtc"),u!==null){if(i===Wv)return u.COMPRESSED_RED_RGTC1_EXT;if(i===qv)return u.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Yv)return u.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Zv)return u.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Fh?o.UNSIGNED_INT_24_8:o[i]!==void 0?o[i]:null}return{convert:t}}const uI=`
|
|
void main() {
|
|
|
|
gl_Position = vec4( position, 1.0 );
|
|
|
|
}`,cI=`
|
|
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 fI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new MS(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new vr({vertexShader:uI,fragmentShader:cI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gi(new Kh(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class hI extends Bo{constructor(e,t){super();const i=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",C=new fI,E={},D=t.getContextAttributes();let U=null,L=null;const B=[],P=[],H=new Pe;let W=null;const I=new aa;I.viewport=new Wn;const z=new aa;z.viewport=new Wn;const j=[I,z],ae=new mT;let $=null,ue=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(fe){let Te=B[fe];return Te===void 0&&(Te=new sv,B[fe]=Te),Te.getTargetRaySpace()},this.getControllerGrip=function(fe){let Te=B[fe];return Te===void 0&&(Te=new sv,B[fe]=Te),Te.getGripSpace()},this.getHand=function(fe){let Te=B[fe];return Te===void 0&&(Te=new sv,B[fe]=Te),Te.getHandSpace()};function he(fe){const Te=P.indexOf(fe.inputSource);if(Te===-1)return;const Je=B[Te];Je!==void 0&&(Je.update(fe.inputSource,fe.frame,g||f),Je.dispatchEvent({type:fe.type,data:fe.inputSource}))}function q(){s.removeEventListener("select",he),s.removeEventListener("selectstart",he),s.removeEventListener("selectend",he),s.removeEventListener("squeeze",he),s.removeEventListener("squeezestart",he),s.removeEventListener("squeezeend",he),s.removeEventListener("end",q),s.removeEventListener("inputsourceschange",K);for(let fe=0;fe<B.length;fe++){const Te=P[fe];Te!==null&&(P[fe]=null,B[fe].disconnect(Te))}$=null,ue=null,C.reset();for(const fe in E)delete E[fe];e.setRenderTarget(U),M=null,b=null,x=null,s=null,L=null,nt.stop(),i.isPresenting=!1,e.setPixelRatio(W),e.setSize(H.width,H.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(fe){u=fe,i.isPresenting===!0&&rt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(fe){h=fe,i.isPresenting===!0&&rt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return g||f},this.setReferenceSpace=function(fe){g=fe},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(fe){if(s=fe,s!==null){if(U=e.getRenderTarget(),s.addEventListener("select",he),s.addEventListener("selectstart",he),s.addEventListener("selectend",he),s.addEventListener("squeeze",he),s.addEventListener("squeezestart",he),s.addEventListener("squeezeend",he),s.addEventListener("end",q),s.addEventListener("inputsourceschange",K),D.xrCompatible!==!0&&await t.makeXRCompatible(),W=e.getPixelRatio(),e.getSize(H),R&&"createProjectionLayer"in XRWebGLBinding.prototype){let Je=null,et=null,ut=null;D.depth&&(ut=D.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Je=D.stencil?Ru:Po,et=D.stencil?Fh:gr);const Jt={colorFormat:t.RGBA8,depthFormat:ut,scaleFactor:u};x=this.getBinding(),b=x.createProjectionLayer(Jt),s.updateRenderState({layers:[b]}),e.setPixelRatio(1),e.setSize(b.textureWidth,b.textureHeight,!1),L=new ks(b.textureWidth,b.textureHeight,{format:La,type:Ka,depthTexture:new qh(b.textureWidth,b.textureHeight,et,void 0,void 0,void 0,void 0,void 0,void 0,Je),stencilBuffer:D.stencil,colorSpace:e.outputColorSpace,samples:D.antialias?4:0,resolveDepthBuffer:b.ignoreDepthValues===!1,resolveStencilBuffer:b.ignoreDepthValues===!1})}else{const Je={antialias:D.antialias,alpha:!0,depth:D.depth,stencil:D.stencil,framebufferScaleFactor:u};M=new XRWebGLLayer(s,t,Je),s.updateRenderState({baseLayer:M}),e.setPixelRatio(1),e.setSize(M.framebufferWidth,M.framebufferHeight,!1),L=new ks(M.framebufferWidth,M.framebufferHeight,{format:La,type:Ka,colorSpace:e.outputColorSpace,stencilBuffer:D.stencil,resolveDepthBuffer:M.ignoreDepthValues===!1,resolveStencilBuffer:M.ignoreDepthValues===!1})}L.isXRRenderTarget=!0,this.setFoveation(m),g=null,f=await s.requestReferenceSpace(h),nt.setContext(s),nt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return C.getDepthTexture()};function K(fe){for(let Te=0;Te<fe.removed.length;Te++){const Je=fe.removed[Te],et=P.indexOf(Je);et>=0&&(P[et]=null,B[et].disconnect(Je))}for(let Te=0;Te<fe.added.length;Te++){const Je=fe.added[Te];let et=P.indexOf(Je);if(et===-1){for(let Jt=0;Jt<B.length;Jt++)if(Jt>=P.length){P.push(Je),et=Jt;break}else if(P[Jt]===null){P[Jt]=Je,et=Jt;break}if(et===-1)break}const ut=B[et];ut&&ut.connect(Je)}}const ce=new Y,Ae=new Y;function Ce(fe,Te,Je){ce.setFromMatrixPosition(Te.matrixWorld),Ae.setFromMatrixPosition(Je.matrixWorld);const et=ce.distanceTo(Ae),ut=Te.projectionMatrix.elements,Jt=Je.projectionMatrix.elements,on=ut[14]/(ut[10]-1),Dt=ut[14]/(ut[10]+1),Re=(ut[9]+1)/ut[5],Ve=(ut[9]-1)/ut[5],Ue=(ut[8]-1)/ut[0],Ke=(Jt[8]+1)/Jt[0],Z=on*Ue,St=on*Ke,tt=et/(-Ue+Ke),Mt=tt*-Ue;if(Te.matrixWorld.decompose(fe.position,fe.quaternion,fe.scale),fe.translateX(Mt),fe.translateZ(tt),fe.matrixWorld.compose(fe.position,fe.quaternion,fe.scale),fe.matrixWorldInverse.copy(fe.matrixWorld).invert(),ut[10]===-1)fe.projectionMatrix.copy(Te.projectionMatrix),fe.projectionMatrixInverse.copy(Te.projectionMatrixInverse);else{const We=on+tt,G=Dt+tt,O=Z-Mt,ne=St+(et-Mt),Se=Re*Dt/G*We,Le=Ve*Dt/G*We;fe.projectionMatrix.makePerspective(O,ne,Se,Le,We,G),fe.projectionMatrixInverse.copy(fe.projectionMatrix).invert()}}function X(fe,Te){Te===null?fe.matrixWorld.copy(fe.matrix):fe.matrixWorld.multiplyMatrices(Te.matrixWorld,fe.matrix),fe.matrixWorldInverse.copy(fe.matrixWorld).invert()}this.updateCamera=function(fe){if(s===null)return;let Te=fe.near,Je=fe.far;C.texture!==null&&(C.depthNear>0&&(Te=C.depthNear),C.depthFar>0&&(Je=C.depthFar)),ae.near=z.near=I.near=Te,ae.far=z.far=I.far=Je,($!==ae.near||ue!==ae.far)&&(s.updateRenderState({depthNear:ae.near,depthFar:ae.far}),$=ae.near,ue=ae.far),ae.layers.mask=fe.layers.mask|6,I.layers.mask=ae.layers.mask&3,z.layers.mask=ae.layers.mask&5;const et=fe.parent,ut=ae.cameras;X(ae,et);for(let Jt=0;Jt<ut.length;Jt++)X(ut[Jt],et);ut.length===2?Ce(ae,I,z):ae.projectionMatrix.copy(I.projectionMatrix),se(fe,ae,et)};function se(fe,Te,Je){Je===null?fe.matrix.copy(Te.matrixWorld):(fe.matrix.copy(Je.matrixWorld),fe.matrix.invert(),fe.matrix.multiply(Te.matrixWorld)),fe.matrix.decompose(fe.position,fe.quaternion,fe.scale),fe.updateMatrixWorld(!0),fe.projectionMatrix.copy(Te.projectionMatrix),fe.projectionMatrixInverse.copy(Te.projectionMatrixInverse),fe.isPerspectiveCamera&&(fe.fov=Hh*2*Math.atan(1/fe.projectionMatrix.elements[5]),fe.zoom=1)}this.getCamera=function(){return ae},this.getFoveation=function(){if(!(b===null&&M===null))return m},this.setFoveation=function(fe){m=fe,b!==null&&(b.fixedFoveation=fe),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=fe)},this.hasDepthSensing=function(){return C.texture!==null},this.getDepthSensingMesh=function(){return C.getMesh(ae)},this.getCameraTexture=function(fe){return E[fe]};let Ee=null;function Oe(fe,Te){if(_=Te.getViewerPose(g||f),A=Te,_!==null){const Je=_.views;M!==null&&(e.setRenderTargetFramebuffer(L,M.framebuffer),e.setRenderTarget(L));let et=!1;Je.length!==ae.cameras.length&&(ae.cameras.length=0,et=!0);for(let Dt=0;Dt<Je.length;Dt++){const Re=Je[Dt];let Ve=null;if(M!==null)Ve=M.getViewport(Re);else{const Ke=x.getViewSubImage(b,Re);Ve=Ke.viewport,Dt===0&&(e.setRenderTargetTextures(L,Ke.colorTexture,Ke.depthStencilTexture),e.setRenderTarget(L))}let Ue=j[Dt];Ue===void 0&&(Ue=new aa,Ue.layers.enable(Dt),Ue.viewport=new Wn,j[Dt]=Ue),Ue.matrix.fromArray(Re.transform.matrix),Ue.matrix.decompose(Ue.position,Ue.quaternion,Ue.scale),Ue.projectionMatrix.fromArray(Re.projectionMatrix),Ue.projectionMatrixInverse.copy(Ue.projectionMatrix).invert(),Ue.viewport.set(Ve.x,Ve.y,Ve.width,Ve.height),Dt===0&&(ae.matrix.copy(Ue.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale)),et===!0&&ae.cameras.push(Ue)}const ut=s.enabledFeatures;if(ut&&ut.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&R){x=i.getBinding();const Dt=x.getDepthInformation(Je[0]);Dt&&Dt.isValid&&Dt.texture&&C.init(Dt,s.renderState)}if(ut&&ut.includes("camera-access")&&R){e.state.unbindTexture(),x=i.getBinding();for(let Dt=0;Dt<Je.length;Dt++){const Re=Je[Dt].camera;if(Re){let Ve=E[Re];Ve||(Ve=new MS,E[Re]=Ve);const Ue=x.getCameraImage(Re);Ve.sourceTexture=Ue}}}}for(let Je=0;Je<B.length;Je++){const et=P[Je],ut=B[Je];et!==null&&ut!==void 0&&ut.update(et,Te,g||f)}Ee&&Ee(fe,Te),Te.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Te}),A=null}const nt=new ST;nt.setAnimationLoop(Oe),this.setAnimationLoop=function(fe){Ee=fe},this.dispose=function(){}}}const Bc=new Hs,dI=new kt;function pI(o,e){function t(C,E){C.matrixAutoUpdate===!0&&C.updateMatrix(),E.value.copy(C.matrix)}function i(C,E){E.color.getRGB(C.fogColor.value,EE(o)),E.isFog?(C.fogNear.value=E.near,C.fogFar.value=E.far):E.isFogExp2&&(C.fogDensity.value=E.density)}function s(C,E,D,U,L){E.isMeshBasicMaterial||E.isMeshLambertMaterial?u(C,E):E.isMeshToonMaterial?(u(C,E),x(C,E)):E.isMeshPhongMaterial?(u(C,E),_(C,E)):E.isMeshStandardMaterial?(u(C,E),b(C,E),E.isMeshPhysicalMaterial&&M(C,E,L)):E.isMeshMatcapMaterial?(u(C,E),A(C,E)):E.isMeshDepthMaterial?u(C,E):E.isMeshDistanceMaterial?(u(C,E),R(C,E)):E.isMeshNormalMaterial?u(C,E):E.isLineBasicMaterial?(f(C,E),E.isLineDashedMaterial&&h(C,E)):E.isPointsMaterial?m(C,E,D,U):E.isSpriteMaterial?g(C,E):E.isShadowMaterial?(C.color.value.copy(E.color),C.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function u(C,E){C.opacity.value=E.opacity,E.color&&C.diffuse.value.copy(E.color),E.emissive&&C.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.bumpMap&&(C.bumpMap.value=E.bumpMap,t(E.bumpMap,C.bumpMapTransform),C.bumpScale.value=E.bumpScale,E.side===ts&&(C.bumpScale.value*=-1)),E.normalMap&&(C.normalMap.value=E.normalMap,t(E.normalMap,C.normalMapTransform),C.normalScale.value.copy(E.normalScale),E.side===ts&&C.normalScale.value.negate()),E.displacementMap&&(C.displacementMap.value=E.displacementMap,t(E.displacementMap,C.displacementMapTransform),C.displacementScale.value=E.displacementScale,C.displacementBias.value=E.displacementBias),E.emissiveMap&&(C.emissiveMap.value=E.emissiveMap,t(E.emissiveMap,C.emissiveMapTransform)),E.specularMap&&(C.specularMap.value=E.specularMap,t(E.specularMap,C.specularMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest);const D=e.get(E),U=D.envMap,L=D.envMapRotation;U&&(C.envMap.value=U,Bc.copy(L),Bc.x*=-1,Bc.y*=-1,Bc.z*=-1,U.isCubeTexture&&U.isRenderTargetTexture===!1&&(Bc.y*=-1,Bc.z*=-1),C.envMapRotation.value.setFromMatrix4(dI.makeRotationFromEuler(Bc)),C.flipEnvMap.value=U.isCubeTexture&&U.isRenderTargetTexture===!1?-1:1,C.reflectivity.value=E.reflectivity,C.ior.value=E.ior,C.refractionRatio.value=E.refractionRatio),E.lightMap&&(C.lightMap.value=E.lightMap,C.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,C.lightMapTransform)),E.aoMap&&(C.aoMap.value=E.aoMap,C.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,C.aoMapTransform))}function f(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform))}function h(C,E){C.dashSize.value=E.dashSize,C.totalSize.value=E.dashSize+E.gapSize,C.scale.value=E.scale}function m(C,E,D,U){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.size.value=E.size*D,C.scale.value=U*.5,E.map&&(C.map.value=E.map,t(E.map,C.uvTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function g(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.rotation.value=E.rotation,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function _(C,E){C.specular.value.copy(E.specular),C.shininess.value=Math.max(E.shininess,1e-4)}function x(C,E){E.gradientMap&&(C.gradientMap.value=E.gradientMap)}function b(C,E){C.metalness.value=E.metalness,E.metalnessMap&&(C.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,C.metalnessMapTransform)),C.roughness.value=E.roughness,E.roughnessMap&&(C.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,C.roughnessMapTransform)),E.envMap&&(C.envMapIntensity.value=E.envMapIntensity)}function M(C,E,D){C.ior.value=E.ior,E.sheen>0&&(C.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),C.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(C.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,C.sheenColorMapTransform)),E.sheenRoughnessMap&&(C.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,C.sheenRoughnessMapTransform))),E.clearcoat>0&&(C.clearcoat.value=E.clearcoat,C.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(C.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,C.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(C.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===ts&&C.clearcoatNormalScale.value.negate())),E.dispersion>0&&(C.dispersion.value=E.dispersion),E.iridescence>0&&(C.iridescence.value=E.iridescence,C.iridescenceIOR.value=E.iridescenceIOR,C.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(C.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,C.iridescenceMapTransform)),E.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,C.iridescenceThicknessMapTransform))),E.transmission>0&&(C.transmission.value=E.transmission,C.transmissionSamplerMap.value=D.texture,C.transmissionSamplerSize.value.set(D.width,D.height),E.transmissionMap&&(C.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,C.transmissionMapTransform)),C.thickness.value=E.thickness,E.thicknessMap&&(C.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=E.attenuationDistance,C.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(C.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(C.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,C.anisotropyMapTransform))),C.specularIntensity.value=E.specularIntensity,C.specularColor.value.copy(E.specularColor),E.specularColorMap&&(C.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,C.specularColorMapTransform)),E.specularIntensityMap&&(C.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,C.specularIntensityMapTransform))}function A(C,E){E.matcap&&(C.matcap.value=E.matcap)}function R(C,E){const D=e.get(E).light;C.referencePosition.value.setFromMatrixPosition(D.matrixWorld),C.nearDistance.value=D.shadow.camera.near,C.farDistance.value=D.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function mI(o,e,t,i){let s={},u={},f=[];const h=o.getParameter(o.MAX_UNIFORM_BUFFER_BINDINGS);function m(D,U){const L=U.program;i.uniformBlockBinding(D,L)}function g(D,U){let L=s[D.id];L===void 0&&(A(D),L=_(D),s[D.id]=L,D.addEventListener("dispose",C));const B=U.program;i.updateUBOMapping(D,B);const P=e.render.frame;u[D.id]!==P&&(b(D),u[D.id]=P)}function _(D){const U=x();D.__bindingPointIndex=U;const L=o.createBuffer(),B=D.__size,P=D.usage;return o.bindBuffer(o.UNIFORM_BUFFER,L),o.bufferData(o.UNIFORM_BUFFER,B,P),o.bindBuffer(o.UNIFORM_BUFFER,null),o.bindBufferBase(o.UNIFORM_BUFFER,U,L),L}function x(){for(let D=0;D<h;D++)if(f.indexOf(D)===-1)return f.push(D),D;return Tt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function b(D){const U=s[D.id],L=D.uniforms,B=D.__cache;o.bindBuffer(o.UNIFORM_BUFFER,U);for(let P=0,H=L.length;P<H;P++){const W=Array.isArray(L[P])?L[P]:[L[P]];for(let I=0,z=W.length;I<z;I++){const j=W[I];if(M(j,P,I,B)===!0){const ae=j.__offset,$=Array.isArray(j.value)?j.value:[j.value];let ue=0;for(let he=0;he<$.length;he++){const q=$[he],K=R(q);typeof q=="number"||typeof q=="boolean"?(j.__data[0]=q,o.bufferSubData(o.UNIFORM_BUFFER,ae+ue,j.__data)):q.isMatrix3?(j.__data[0]=q.elements[0],j.__data[1]=q.elements[1],j.__data[2]=q.elements[2],j.__data[3]=0,j.__data[4]=q.elements[3],j.__data[5]=q.elements[4],j.__data[6]=q.elements[5],j.__data[7]=0,j.__data[8]=q.elements[6],j.__data[9]=q.elements[7],j.__data[10]=q.elements[8],j.__data[11]=0):(q.toArray(j.__data,ue),ue+=K.storage/Float32Array.BYTES_PER_ELEMENT)}o.bufferSubData(o.UNIFORM_BUFFER,ae,j.__data)}}}o.bindBuffer(o.UNIFORM_BUFFER,null)}function M(D,U,L,B){const P=D.value,H=U+"_"+L;if(B[H]===void 0)return typeof P=="number"||typeof P=="boolean"?B[H]=P:B[H]=P.clone(),!0;{const W=B[H];if(typeof P=="number"||typeof P=="boolean"){if(W!==P)return B[H]=P,!0}else if(W.equals(P)===!1)return W.copy(P),!0}return!1}function A(D){const U=D.uniforms;let L=0;const B=16;for(let H=0,W=U.length;H<W;H++){const I=Array.isArray(U[H])?U[H]:[U[H]];for(let z=0,j=I.length;z<j;z++){const ae=I[z],$=Array.isArray(ae.value)?ae.value:[ae.value];for(let ue=0,he=$.length;ue<he;ue++){const q=$[ue],K=R(q),ce=L%B,Ae=ce%K.boundary,Ce=ce+Ae;L+=Ae,Ce!==0&&B-Ce<K.storage&&(L+=B-Ce),ae.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),ae.__offset=L,L+=K.storage}}}const P=L%B;return P>0&&(L+=B-P),D.__size=L,D.__cache={},this}function R(D){const U={boundary:0,storage:0};return typeof D=="number"||typeof D=="boolean"?(U.boundary=4,U.storage=4):D.isVector2?(U.boundary=8,U.storage=8):D.isVector3||D.isColor?(U.boundary=16,U.storage=12):D.isVector4?(U.boundary=16,U.storage=16):D.isMatrix3?(U.boundary=48,U.storage=48):D.isMatrix4?(U.boundary=64,U.storage=64):D.isTexture?rt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):rt("WebGLRenderer: Unsupported uniform value type.",D),U}function C(D){const U=D.target;U.removeEventListener("dispose",C);const L=f.indexOf(U.__bindingPointIndex);f.splice(L,1),o.deleteBuffer(s[U.id]),delete s[U.id],delete u[U.id]}function E(){for(const D in s)o.deleteBuffer(s[D]);f=[],s={},u={}}return{bind:m,update:g,dispose:E}}const gI=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 Do=null;function vI(){return Do===null&&(Do=new qr(gI,16,16,jc,zo),Do.name="DFG_LUT",Do.minFilter=ai,Do.magFilter=ai,Do.wrapS=As,Do.wrapT=As,Do.generateMipmaps=!1,Do.needsUpdate=!0),Do}class wT{constructor(e={}){const{canvas:t=xE(),context:i=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=Ka}=e;this.isWebGLRenderer=!0;let A;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=i.getContextAttributes().alpha}else A=f;const R=M,C=new Set([hy,fy,xm]),E=new Set([Ka,gr,Bh,Fh,ly,uy]),D=new Uint32Array(4),U=new Int32Array(4);let L=null,B=null;const P=[],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=mr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let z=!1;this._outputColorSpace=Ua;let j=0,ae=0,$=null,ue=-1,he=null;const q=new Wn,K=new Wn;let ce=null;const Ae=new pt(0);let Ce=0,X=t.width,se=t.height,Ee=1,Oe=null,nt=null;const fe=new Wn(0,0,X,se),Te=new Wn(0,0,X,se);let Je=!1;const et=new Jh;let ut=!1,Jt=!1;const on=new kt,Dt=new Y,Re=new Wn,Ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ue=!1;function Ke(){return $===null?Ee:1}let Z=i;function St(V,ie){return t.getContext(V,ie)}try{const V={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${ay}`),t.addEventListener("webglcontextlost",Bt,!1),t.addEventListener("webglcontextrestored",dn,!1),t.addEventListener("webglcontextcreationerror",gn,!1),Z===null){const ie="webgl2";if(Z=St(ie,V),Z===null)throw St(ie)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(V){throw Tt("WebGLRenderer: "+V.message),V}let tt,Mt,We,G,O,ne,Se,Le,be,ct,Ze,gt,wt,Be,Xe,ft,lt,$e,Zt,te,it,Ge,st,Fe;function Ne(){tt=new yU(Z),tt.init(),Ge=new AT(Z,tt),Mt=new uU(Z,tt,e,Ge),We=new oI(Z,tt),Mt.reversedDepthBuffer&&b&&We.buffers.depth.setReversed(!0),G=new SU(Z),O=new qL,ne=new lI(Z,tt,We,O,Mt,Ge,G),Se=new fU(I),Le=new vU(I),be=new TR(Z),st=new oU(Z,be),ct=new _U(Z,be,G,st),Ze=new MU(Z,ct,be,G),Zt=new bU(Z,Mt,ne),ft=new cU(O),gt=new WL(I,Se,Le,tt,Mt,st,ft),wt=new pI(I,O),Be=new ZL,Xe=new eI(tt),$e=new rU(I,Se,Le,We,Ze,A,m),lt=new sI(I,Ze,Mt),Fe=new mI(Z,G,Mt,We),te=new lU(Z,tt,G),it=new xU(Z,tt,G),G.programs=gt.programs,I.capabilities=Mt,I.extensions=tt,I.properties=O,I.renderLists=Be,I.shadowMap=lt,I.state=We,I.info=G}Ne(),R!==Ka&&(W=new TU(R,t.width,t.height,s,u));const je=new hI(I,Z);this.xr=je,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const V=tt.get("WEBGL_lose_context");V&&V.loseContext()},this.forceContextRestore=function(){const V=tt.get("WEBGL_lose_context");V&&V.restoreContext()},this.getPixelRatio=function(){return Ee},this.setPixelRatio=function(V){V!==void 0&&(Ee=V,this.setSize(X,se,!1))},this.getSize=function(V){return V.set(X,se)},this.setSize=function(V,ie,ye=!0){if(je.isPresenting){rt("WebGLRenderer: Can't change size while VR device is presenting.");return}X=V,se=ie,t.width=Math.floor(V*Ee),t.height=Math.floor(ie*Ee),ye===!0&&(t.style.width=V+"px",t.style.height=ie+"px"),W!==null&&W.setSize(t.width,t.height),this.setViewport(0,0,V,ie)},this.getDrawingBufferSize=function(V){return V.set(X*Ee,se*Ee).floor()},this.setDrawingBufferSize=function(V,ie,ye){X=V,se=ie,Ee=ye,t.width=Math.floor(V*ye),t.height=Math.floor(ie*ye),this.setViewport(0,0,V,ie)},this.setEffects=function(V){if(R===Ka){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(V){for(let ie=0;ie<V.length;ie++)if(V[ie].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}W.setEffects(V||[])},this.getCurrentViewport=function(V){return V.copy(q)},this.getViewport=function(V){return V.copy(fe)},this.setViewport=function(V,ie,ye,me){V.isVector4?fe.set(V.x,V.y,V.z,V.w):fe.set(V,ie,ye,me),We.viewport(q.copy(fe).multiplyScalar(Ee).round())},this.getScissor=function(V){return V.copy(Te)},this.setScissor=function(V,ie,ye,me){V.isVector4?Te.set(V.x,V.y,V.z,V.w):Te.set(V,ie,ye,me),We.scissor(K.copy(Te).multiplyScalar(Ee).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(V){We.setScissorTest(Je=V)},this.setOpaqueSort=function(V){Oe=V},this.setTransparentSort=function(V){nt=V},this.getClearColor=function(V){return V.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor(...arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha(...arguments)},this.clear=function(V=!0,ie=!0,ye=!0){let me=0;if(V){let oe=!1;if($!==null){const qe=$.texture.format;oe=C.has(qe)}if(oe){const qe=$.texture.type,ht=E.has(qe),He=$e.getClearColor(),mt=$e.getClearAlpha(),vt=He.r,At=He.g,_t=He.b;ht?(D[0]=vt,D[1]=At,D[2]=_t,D[3]=mt,Z.clearBufferuiv(Z.COLOR,0,D)):(U[0]=vt,U[1]=At,U[2]=_t,U[3]=mt,Z.clearBufferiv(Z.COLOR,0,U))}else me|=Z.COLOR_BUFFER_BIT}ie&&(me|=Z.DEPTH_BUFFER_BIT),ye&&(me|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(me)},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",Bt,!1),t.removeEventListener("webglcontextrestored",dn,!1),t.removeEventListener("webglcontextcreationerror",gn,!1),$e.dispose(),Be.dispose(),Xe.dispose(),O.dispose(),Se.dispose(),Le.dispose(),Ze.dispose(),st.dispose(),Fe.dispose(),gt.dispose(),je.dispose(),je.removeEventListener("sessionstart",_r),je.removeEventListener("sessionend",ko),Ki.stop()};function Bt(V){V.preventDefault(),um("WebGLRenderer: Context Lost."),z=!0}function dn(){um("WebGLRenderer: Context Restored."),z=!1;const V=G.autoReset,ie=lt.enabled,ye=lt.autoUpdate,me=lt.needsUpdate,oe=lt.type;Ne(),G.autoReset=V,lt.enabled=ie,lt.autoUpdate=ye,lt.needsUpdate=me,lt.type=oe}function gn(V){Tt("WebGLRenderer: A WebGL context could not be created. Reason: ",V.statusMessage)}function Xi(V){const ie=V.target;ie.removeEventListener("dispose",Xi),va(ie)}function va(V){Zr(V),O.remove(V)}function Zr(V){const ie=O.get(V).programs;ie!==void 0&&(ie.forEach(function(ye){gt.releaseProgram(ye)}),V.isShaderMaterial&>.releaseShaderCache(V))}this.renderBufferDirect=function(V,ie,ye,me,oe,qe){ie===null&&(ie=Ve);const ht=oe.isMesh&&oe.matrixWorld.determinant()<0,He=Rs(V,ie,ye,me,oe);We.setMaterial(me,ht);let mt=ye.index,vt=1;if(me.wireframe===!0){if(mt=ct.getWireframeAttribute(ye),mt===void 0)return;vt=2}const At=ye.drawRange,_t=ye.attributes.position;let Ut=At.start*vt,Sn=(At.start+At.count)*vt;qe!==null&&(Ut=Math.max(Ut,qe.start*vt),Sn=Math.min(Sn,(qe.start+qe.count)*vt)),mt!==null?(Ut=Math.max(Ut,0),Sn=Math.min(Sn,mt.count)):_t!=null&&(Ut=Math.max(Ut,0),Sn=Math.min(Sn,_t.count));const zn=Sn-Ut;if(zn<0||zn===1/0)return;st.setup(oe,me,He,ye,mt);let Un,Ht=te;if(mt!==null&&(Un=be.get(mt),Ht=it,Ht.setIndex(Un)),oe.isMesh)me.wireframe===!0?(We.setLineWidth(me.wireframeLinewidth*Ke()),Ht.setMode(Z.LINES)):Ht.setMode(Z.TRIANGLES);else if(oe.isLine){let at=me.linewidth;at===void 0&&(at=1),We.setLineWidth(at*Ke()),oe.isLineSegments?Ht.setMode(Z.LINES):oe.isLineLoop?Ht.setMode(Z.LINE_LOOP):Ht.setMode(Z.LINE_STRIP)}else oe.isPoints?Ht.setMode(Z.POINTS):oe.isSprite&&Ht.setMode(Z.TRIANGLES);if(oe.isBatchedMesh)if(oe._multiDrawInstances!==null)kh("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ht.renderMultiDrawInstances(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount,oe._multiDrawInstances);else if(tt.get("WEBGL_multi_draw"))Ht.renderMultiDraw(oe._multiDrawStarts,oe._multiDrawCounts,oe._multiDrawCount);else{const at=oe._multiDrawStarts,vn=oe._multiDrawCounts,Ot=oe._multiDrawCount,vi=mt?be.get(mt).bytesPerElement:1,Ds=O.get(me).currentProgram.getUniforms();for(let Gn=0;Gn<Ot;Gn++)Ds.setValue(Z,"_gl_DrawID",Gn),Ht.render(at[Gn]/vi,vn[Gn])}else if(oe.isInstancedMesh)Ht.renderInstances(Ut,zn,oe.count);else if(ye.isInstancedBufferGeometry){const at=ye._maxInstanceCount!==void 0?ye._maxInstanceCount:1/0,vn=Math.min(ye.instanceCount,at);Ht.renderInstances(Ut,zn,vn)}else Ht.render(Ut,zn)};function jr(V,ie,ye){V.transparent===!0&&V.side===No&&V.forceSinglePass===!1?(V.side=ts,V.needsUpdate=!0,Fa(V,ie,ye),V.side=Cl,V.needsUpdate=!0,Fa(V,ie,ye),V.side=No):Fa(V,ie,ye)}this.compile=function(V,ie,ye=null){ye===null&&(ye=V),B=Xe.get(ye),B.init(ie),H.push(B),ye.traverseVisible(function(oe){oe.isLight&&oe.layers.test(ie.layers)&&(B.pushLight(oe),oe.castShadow&&B.pushShadow(oe))}),V!==ye&&V.traverseVisible(function(oe){oe.isLight&&oe.layers.test(ie.layers)&&(B.pushLight(oe),oe.castShadow&&B.pushShadow(oe))}),B.setupLights();const me=new Set;return V.traverse(function(oe){if(!(oe.isMesh||oe.isPoints||oe.isLine||oe.isSprite))return;const qe=oe.material;if(qe)if(Array.isArray(qe))for(let ht=0;ht<qe.length;ht++){const He=qe[ht];jr(He,ye,oe),me.add(He)}else jr(qe,ye,oe),me.add(qe)}),B=H.pop(),me},this.compileAsync=function(V,ie,ye=null){const me=this.compile(V,ie,ye);return new Promise(oe=>{function qe(){if(me.forEach(function(ht){O.get(ht).currentProgram.isReady()&&me.delete(ht)}),me.size===0){oe(V);return}setTimeout(qe,10)}tt.get("KHR_parallel_shader_compile")!==null?qe():setTimeout(qe,10)})};let Vo=null;function Qr(V){Vo&&Vo(V)}function _r(){Ki.stop()}function ko(){Ki.start()}const Ki=new ST;Ki.setAnimationLoop(Qr),typeof self<"u"&&Ki.setContext(self),this.setAnimationLoop=function(V){Vo=V,je.setAnimationLoop(V),V===null?Ki.stop():Ki.start()},je.addEventListener("sessionstart",_r),je.addEventListener("sessionend",ko),this.render=function(V,ie){if(ie!==void 0&&ie.isCamera!==!0){Tt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const ye=je.enabled===!0&&je.isPresenting===!0,me=W!==null&&($===null||ye)&&W.begin(I,$);if(V.matrixWorldAutoUpdate===!0&&V.updateMatrixWorld(),ie.parent===null&&ie.matrixWorldAutoUpdate===!0&&ie.updateMatrixWorld(),je.enabled===!0&&je.isPresenting===!0&&(W===null||W.isCompositing()===!1)&&(je.cameraAutoUpdate===!0&&je.updateCamera(ie),ie=je.getCamera()),V.isScene===!0&&V.onBeforeRender(I,V,ie,$),B=Xe.get(V,H.length),B.init(ie),H.push(B),on.multiplyMatrices(ie.projectionMatrix,ie.matrixWorldInverse),et.setFromProjectionMatrix(on,Fs,ie.reversedDepth),Jt=this.localClippingEnabled,ut=ft.init(this.clippingPlanes,Jt),L=Be.get(V,P.length),L.init(),P.push(L),je.enabled===!0&&je.isPresenting===!0){const ht=I.xr.getDepthSensingMesh();ht!==null&&za(ht,ie,-1/0,I.sortObjects)}za(V,ie,0,I.sortObjects),L.finish(),I.sortObjects===!0&&L.sort(Oe,nt),Ue=je.enabled===!1||je.isPresenting===!1||je.hasDepthSensing()===!1,Ue&&$e.addToRenderList(L,V),this.info.render.frame++,ut===!0&&ft.beginShadows();const oe=B.state.shadowsArray;if(lt.render(oe,V,ie),ut===!0&&ft.endShadows(),this.info.autoReset===!0&&this.info.reset(),(me&&W.hasRenderPass())===!1){const ht=L.opaque,He=L.transmissive;if(B.setupLights(),ie.isArrayCamera){const mt=ie.cameras;if(He.length>0)for(let vt=0,At=mt.length;vt<At;vt++){const _t=mt[vt];Ti(ht,He,V,_t)}Ue&&$e.render(V);for(let vt=0,At=mt.length;vt<At;vt++){const _t=mt[vt];Qn(L,V,_t,_t.viewport)}}else He.length>0&&Ti(ht,He,V,ie),Ue&&$e.render(V),Qn(L,V,ie)}$!==null&&ae===0&&(ne.updateMultisampleRenderTarget($),ne.updateRenderTargetMipmap($)),me&&W.end(I),V.isScene===!0&&V.onAfterRender(I,V,ie),st.resetDefaultState(),ue=-1,he=null,H.pop(),H.length>0?(B=H[H.length-1],ut===!0&&ft.setGlobalState(I.clippingPlanes,B.state.camera)):B=null,P.pop(),P.length>0?L=P[P.length-1]:L=null};function za(V,ie,ye,me){if(V.visible===!1)return;if(V.layers.test(ie.layers)){if(V.isGroup)ye=V.renderOrder;else if(V.isLOD)V.autoUpdate===!0&&V.update(ie);else if(V.isLight)B.pushLight(V),V.castShadow&&B.pushShadow(V);else if(V.isSprite){if(!V.frustumCulled||et.intersectsSprite(V)){me&&Re.setFromMatrixPosition(V.matrixWorld).applyMatrix4(on);const ht=Ze.update(V),He=V.material;He.visible&&L.push(V,ht,He,ye,Re.z,null)}}else if((V.isMesh||V.isLine||V.isPoints)&&(!V.frustumCulled||et.intersectsObject(V))){const ht=Ze.update(V),He=V.material;if(me&&(V.boundingSphere!==void 0?(V.boundingSphere===null&&V.computeBoundingSphere(),Re.copy(V.boundingSphere.center)):(ht.boundingSphere===null&&ht.computeBoundingSphere(),Re.copy(ht.boundingSphere.center)),Re.applyMatrix4(V.matrixWorld).applyMatrix4(on)),Array.isArray(He)){const mt=ht.groups;for(let vt=0,At=mt.length;vt<At;vt++){const _t=mt[vt],Ut=He[_t.materialIndex];Ut&&Ut.visible&&L.push(V,ht,Ut,ye,Re.z,_t)}}else He.visible&&L.push(V,ht,He,ye,Re.z,null)}}const qe=V.children;for(let ht=0,He=qe.length;ht<He;ht++)za(qe[ht],ie,ye,me)}function Qn(V,ie,ye,me){const{opaque:oe,transmissive:qe,transparent:ht}=V;B.setupLightsView(ye),ut===!0&&ft.setGlobalState(I.clippingPlanes,ye),me&&We.viewport(q.copy(me)),oe.length>0&&Pa(oe,ie,ye),qe.length>0&&Pa(qe,ie,ye),ht.length>0&&Pa(ht,ie,ye),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function Ti(V,ie,ye,me){if((ye.isScene===!0?ye.overrideMaterial:null)!==null)return;if(B.state.transmissionRenderTarget[me.id]===void 0){const Ut=tt.has("EXT_color_buffer_half_float")||tt.has("EXT_color_buffer_float");B.state.transmissionRenderTarget[me.id]=new ks(1,1,{generateMipmaps:!0,type:Ut?zo:Ka,minFilter:Uo,samples:Mt.samples,stencilBuffer:u,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xn.workingColorSpace})}const qe=B.state.transmissionRenderTarget[me.id],ht=me.viewport||q;qe.setSize(ht.z*I.transmissionResolutionScale,ht.w*I.transmissionResolutionScale);const He=I.getRenderTarget(),mt=I.getActiveCubeFace(),vt=I.getActiveMipmapLevel();I.setRenderTarget(qe),I.getClearColor(Ae),Ce=I.getClearAlpha(),Ce<1&&I.setClearColor(16777215,.5),I.clear(),Ue&&$e.render(ye);const At=I.toneMapping;I.toneMapping=mr;const _t=me.viewport;if(me.viewport!==void 0&&(me.viewport=void 0),B.setupLightsView(me),ut===!0&&ft.setGlobalState(I.clippingPlanes,me),Pa(V,ye,me),ne.updateMultisampleRenderTarget(qe),ne.updateRenderTargetMipmap(qe),tt.has("WEBGL_multisampled_render_to_texture")===!1){let Ut=!1;for(let Sn=0,zn=ie.length;Sn<zn;Sn++){const Un=ie[Sn],{object:Ht,geometry:at,material:vn,group:Ot}=Un;if(vn.side===No&&Ht.layers.test(me.layers)){const vi=vn.side;vn.side=ts,vn.needsUpdate=!0,Ba(Ht,ye,me,at,vn,Ot),vn.side=vi,vn.needsUpdate=!0,Ut=!0}}Ut===!0&&(ne.updateMultisampleRenderTarget(qe),ne.updateRenderTargetMipmap(qe))}I.setRenderTarget(He,mt,vt),I.setClearColor(Ae,Ce),_t!==void 0&&(me.viewport=_t),I.toneMapping=At}function Pa(V,ie,ye){const me=ie.isScene===!0?ie.overrideMaterial:null;for(let oe=0,qe=V.length;oe<qe;oe++){const ht=V[oe],{object:He,geometry:mt,group:vt}=ht;let At=ht.material;At.allowOverride===!0&&me!==null&&(At=me),He.layers.test(ye.layers)&&Ba(He,ie,ye,mt,At,vt)}}function Ba(V,ie,ye,me,oe,qe){V.onBeforeRender(I,ie,ye,me,oe,qe),V.modelViewMatrix.multiplyMatrices(ye.matrixWorldInverse,V.matrixWorld),V.normalMatrix.getNormalMatrix(V.modelViewMatrix),oe.onBeforeRender(I,ie,ye,me,V,qe),oe.transparent===!0&&oe.side===No&&oe.forceSinglePass===!1?(oe.side=ts,oe.needsUpdate=!0,I.renderBufferDirect(ye,ie,me,oe,V,qe),oe.side=Cl,oe.needsUpdate=!0,I.renderBufferDirect(ye,ie,me,oe,V,qe),oe.side=No):I.renderBufferDirect(ye,ie,me,oe,V,qe),V.onAfterRender(I,ie,ye,me,oe,qe)}function Fa(V,ie,ye){ie.isScene!==!0&&(ie=Ve);const me=O.get(V),oe=B.state.lights,qe=B.state.shadowsArray,ht=oe.state.version,He=gt.getParameters(V,oe.state,qe,ie,ye),mt=gt.getProgramCacheKey(He);let vt=me.programs;me.environment=V.isMeshStandardMaterial?ie.environment:null,me.fog=ie.fog,me.envMap=(V.isMeshStandardMaterial?Le:Se).get(V.envMap||me.environment),me.envMapRotation=me.environment!==null&&V.envMap===null?ie.environmentRotation:V.envMapRotation,vt===void 0&&(V.addEventListener("dispose",Xi),vt=new Map,me.programs=vt);let At=vt.get(mt);if(At!==void 0){if(me.currentProgram===At&&me.lightsStateVersion===ht)return Ho(V,He),At}else He.uniforms=gt.getUniforms(V),V.onBeforeCompile(He,I),At=gt.acquireProgram(He,mt),vt.set(mt,At),me.uniforms=He.uniforms;const _t=me.uniforms;return(!V.isShaderMaterial&&!V.isRawShaderMaterial||V.clipping===!0)&&(_t.clippingPlanes=ft.uniform),Ho(V,He),me.needsLights=Sr(V),me.lightsStateVersion=ht,me.needsLights&&(_t.ambientLightColor.value=oe.state.ambient,_t.lightProbe.value=oe.state.probe,_t.directionalLights.value=oe.state.directional,_t.directionalLightShadows.value=oe.state.directionalShadow,_t.spotLights.value=oe.state.spot,_t.spotLightShadows.value=oe.state.spotShadow,_t.rectAreaLights.value=oe.state.rectArea,_t.ltc_1.value=oe.state.rectAreaLTC1,_t.ltc_2.value=oe.state.rectAreaLTC2,_t.pointLights.value=oe.state.point,_t.pointLightShadows.value=oe.state.pointShadow,_t.hemisphereLights.value=oe.state.hemi,_t.directionalShadowMap.value=oe.state.directionalShadowMap,_t.directionalShadowMatrix.value=oe.state.directionalShadowMatrix,_t.spotShadowMap.value=oe.state.spotShadowMap,_t.spotLightMatrix.value=oe.state.spotLightMatrix,_t.spotLightMap.value=oe.state.spotLightMap,_t.pointShadowMap.value=oe.state.pointShadowMap,_t.pointShadowMatrix.value=oe.state.pointShadowMatrix),me.currentProgram=At,me.uniformsList=null,At}function Jr(V){if(V.uniformsList===null){const ie=V.currentProgram.getUniforms();V.uniformsList=rv.seqWithValue(ie.seq,V.uniforms)}return V.uniformsList}function Ho(V,ie){const ye=O.get(V);ye.outputColorSpace=ie.outputColorSpace,ye.batching=ie.batching,ye.batchingColor=ie.batchingColor,ye.instancing=ie.instancing,ye.instancingColor=ie.instancingColor,ye.instancingMorph=ie.instancingMorph,ye.skinning=ie.skinning,ye.morphTargets=ie.morphTargets,ye.morphNormals=ie.morphNormals,ye.morphColors=ie.morphColors,ye.morphTargetsCount=ie.morphTargetsCount,ye.numClippingPlanes=ie.numClippingPlanes,ye.numIntersection=ie.numClipIntersection,ye.vertexAlphas=ie.vertexAlphas,ye.vertexTangents=ie.vertexTangents,ye.toneMapping=ie.toneMapping}function Rs(V,ie,ye,me,oe){ie.isScene!==!0&&(ie=Ve),ne.resetTextureUnits();const qe=ie.fog,ht=me.isMeshStandardMaterial?ie.environment:null,He=$===null?I.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:Lu,mt=(me.isMeshStandardMaterial?Le:Se).get(me.envMap||ht),vt=me.vertexColors===!0&&!!ye.attributes.color&&ye.attributes.color.itemSize===4,At=!!ye.attributes.tangent&&(!!me.normalMap||me.anisotropy>0),_t=!!ye.morphAttributes.position,Ut=!!ye.morphAttributes.normal,Sn=!!ye.morphAttributes.color;let zn=mr;me.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(zn=I.toneMapping);const Un=ye.morphAttributes.position||ye.morphAttributes.normal||ye.morphAttributes.color,Ht=Un!==void 0?Un.length:0,at=O.get(me),vn=B.state.lights;if(ut===!0&&(Jt===!0||V!==he)){const Ii=V===he&&me.id===ue;ft.setState(me,V,Ii)}let Ot=!1;me.version===at.__version?(at.needsLights&&at.lightsStateVersion!==vn.state.version||at.outputColorSpace!==He||oe.isBatchedMesh&&at.batching===!1||!oe.isBatchedMesh&&at.batching===!0||oe.isBatchedMesh&&at.batchingColor===!0&&oe.colorTexture===null||oe.isBatchedMesh&&at.batchingColor===!1&&oe.colorTexture!==null||oe.isInstancedMesh&&at.instancing===!1||!oe.isInstancedMesh&&at.instancing===!0||oe.isSkinnedMesh&&at.skinning===!1||!oe.isSkinnedMesh&&at.skinning===!0||oe.isInstancedMesh&&at.instancingColor===!0&&oe.instanceColor===null||oe.isInstancedMesh&&at.instancingColor===!1&&oe.instanceColor!==null||oe.isInstancedMesh&&at.instancingMorph===!0&&oe.morphTexture===null||oe.isInstancedMesh&&at.instancingMorph===!1&&oe.morphTexture!==null||at.envMap!==mt||me.fog===!0&&at.fog!==qe||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==ft.numPlanes||at.numIntersection!==ft.numIntersection)||at.vertexAlphas!==vt||at.vertexTangents!==At||at.morphTargets!==_t||at.morphNormals!==Ut||at.morphColors!==Sn||at.toneMapping!==zn||at.morphTargetsCount!==Ht)&&(Ot=!0):(Ot=!0,at.__version=me.version);let vi=at.currentProgram;Ot===!0&&(vi=Fa(me,ie,oe));let Ds=!1,Gn=!1,sa=!1;const En=vi.getUniforms(),Ai=at.uniforms;if(We.useProgram(vi.program)&&(Ds=!0,Gn=!0,sa=!0),me.id!==ue&&(ue=me.id,Gn=!0),Ds||he!==V){We.buffers.depth.getReversed()&&V.reversedDepth!==!0&&(V._reversedDepth=!0,V.updateProjectionMatrix()),En.setValue(Z,"projectionMatrix",V.projectionMatrix),En.setValue(Z,"viewMatrix",V.matrixWorldInverse);const Oi=En.map.cameraPosition;Oi!==void 0&&Oi.setValue(Z,Dt.setFromMatrixPosition(V.matrixWorld)),Mt.logarithmicDepthBuffer&&En.setValue(Z,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2)),(me.isMeshPhongMaterial||me.isMeshToonMaterial||me.isMeshLambertMaterial||me.isMeshBasicMaterial||me.isMeshStandardMaterial||me.isShaderMaterial)&&En.setValue(Z,"isOrthographic",V.isOrthographicCamera===!0),he!==V&&(he=V,Gn=!0,sa=!0)}if(at.needsLights&&(vn.state.directionalShadowMap.length>0&&En.setValue(Z,"directionalShadowMap",vn.state.directionalShadowMap,ne),vn.state.spotShadowMap.length>0&&En.setValue(Z,"spotShadowMap",vn.state.spotShadowMap,ne),vn.state.pointShadowMap.length>0&&En.setValue(Z,"pointShadowMap",vn.state.pointShadowMap,ne)),oe.isSkinnedMesh){En.setOptional(Z,oe,"bindMatrix"),En.setOptional(Z,oe,"bindMatrixInverse");const Ii=oe.skeleton;Ii&&(Ii.boneTexture===null&&Ii.computeBoneTexture(),En.setValue(Z,"boneTexture",Ii.boneTexture,ne))}oe.isBatchedMesh&&(En.setOptional(Z,oe,"batchingTexture"),En.setValue(Z,"batchingTexture",oe._matricesTexture,ne),En.setOptional(Z,oe,"batchingIdTexture"),En.setValue(Z,"batchingIdTexture",oe._indirectTexture,ne),En.setOptional(Z,oe,"batchingColorTexture"),oe._colorsTexture!==null&&En.setValue(Z,"batchingColorTexture",oe._colorsTexture,ne));const yi=ye.morphAttributes;if((yi.position!==void 0||yi.normal!==void 0||yi.color!==void 0)&&Zt.update(oe,ye,vi),(Gn||at.receiveShadow!==oe.receiveShadow)&&(at.receiveShadow=oe.receiveShadow,En.setValue(Z,"receiveShadow",oe.receiveShadow)),me.isMeshGouraudMaterial&&me.envMap!==null&&(Ai.envMap.value=mt,Ai.flipEnvMap.value=mt.isCubeTexture&&mt.isRenderTargetTexture===!1?-1:1),me.isMeshStandardMaterial&&me.envMap===null&&ie.environment!==null&&(Ai.envMapIntensity.value=ie.environmentIntensity),Ai.dfgLUT!==void 0&&(Ai.dfgLUT.value=vI()),Gn&&(En.setValue(Z,"toneMappingExposure",I.toneMappingExposure),at.needsLights&&xr(Ai,sa),qe&&me.fog===!0&&wt.refreshFogUniforms(Ai,qe),wt.refreshMaterialUniforms(Ai,me,Ee,se,B.state.transmissionRenderTarget[V.id]),rv.upload(Z,Jr(at),Ai,ne)),me.isShaderMaterial&&me.uniformsNeedUpdate===!0&&(rv.upload(Z,Jr(at),Ai,ne),me.uniformsNeedUpdate=!1),me.isSpriteMaterial&&En.setValue(Z,"center",oe.center),En.setValue(Z,"modelViewMatrix",oe.modelViewMatrix),En.setValue(Z,"normalMatrix",oe.normalMatrix),En.setValue(Z,"modelMatrix",oe.matrixWorld),me.isShaderMaterial||me.isRawShaderMaterial){const Ii=me.uniformsGroups;for(let Oi=0,Go=Ii.length;Oi<Go;Oi++){const is=Ii[Oi];Fe.update(is,vi),Fe.bind(is,vi)}}return vi}function xr(V,ie){V.ambientLightColor.needsUpdate=ie,V.lightProbe.needsUpdate=ie,V.directionalLights.needsUpdate=ie,V.directionalLightShadows.needsUpdate=ie,V.pointLights.needsUpdate=ie,V.pointLightShadows.needsUpdate=ie,V.spotLights.needsUpdate=ie,V.spotLightShadows.needsUpdate=ie,V.rectAreaLights.needsUpdate=ie,V.hemisphereLights.needsUpdate=ie}function Sr(V){return V.isMeshLambertMaterial||V.isMeshToonMaterial||V.isMeshPhongMaterial||V.isMeshStandardMaterial||V.isShadowMaterial||V.isShaderMaterial&&V.lights===!0}this.getActiveCubeFace=function(){return j},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return $},this.setRenderTargetTextures=function(V,ie,ye){const me=O.get(V);me.__autoAllocateDepthBuffer=V.resolveDepthBuffer===!1,me.__autoAllocateDepthBuffer===!1&&(me.__useRenderToTexture=!1),O.get(V.texture).__webglTexture=ie,O.get(V.depthTexture).__webglTexture=me.__autoAllocateDepthBuffer?void 0:ye,me.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(V,ie){const ye=O.get(V);ye.__webglFramebuffer=ie,ye.__useDefaultFramebuffer=ie===void 0};const br=Z.createFramebuffer();this.setRenderTarget=function(V,ie=0,ye=0){$=V,j=ie,ae=ye;let me=null,oe=!1,qe=!1;if(V){const He=O.get(V);if(He.__useDefaultFramebuffer!==void 0){We.bindFramebuffer(Z.FRAMEBUFFER,He.__webglFramebuffer),q.copy(V.viewport),K.copy(V.scissor),ce=V.scissorTest,We.viewport(q),We.scissor(K),We.setScissorTest(ce),ue=-1;return}else if(He.__webglFramebuffer===void 0)ne.setupRenderTarget(V);else if(He.__hasExternalTextures)ne.rebindTextures(V,O.get(V.texture).__webglTexture,O.get(V.depthTexture).__webglTexture);else if(V.depthBuffer){const At=V.depthTexture;if(He.__boundDepthTexture!==At){if(At!==null&&O.has(At)&&(V.width!==At.image.width||V.height!==At.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ne.setupDepthRenderbuffer(V)}}const mt=V.texture;(mt.isData3DTexture||mt.isDataArrayTexture||mt.isCompressedArrayTexture)&&(qe=!0);const vt=O.get(V).__webglFramebuffer;V.isWebGLCubeRenderTarget?(Array.isArray(vt[ie])?me=vt[ie][ye]:me=vt[ie],oe=!0):V.samples>0&&ne.useMultisampledRTT(V)===!1?me=O.get(V).__webglMultisampledFramebuffer:Array.isArray(vt)?me=vt[ye]:me=vt,q.copy(V.viewport),K.copy(V.scissor),ce=V.scissorTest}else q.copy(fe).multiplyScalar(Ee).floor(),K.copy(Te).multiplyScalar(Ee).floor(),ce=Je;if(ye!==0&&(me=br),We.bindFramebuffer(Z.FRAMEBUFFER,me)&&We.drawBuffers(V,me),We.viewport(q),We.scissor(K),We.setScissorTest(ce),oe){const He=O.get(V.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+ie,He.__webglTexture,ye)}else if(qe){const He=ie;for(let mt=0;mt<V.textures.length;mt++){const vt=O.get(V.textures[mt]);Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0+mt,vt.__webglTexture,ye,He)}}else if(V!==null&&ye!==0){const He=O.get(V.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_2D,He.__webglTexture,ye)}ue=-1},this.readRenderTargetPixels=function(V,ie,ye,me,oe,qe,ht,He=0){if(!(V&&V.isWebGLRenderTarget)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let mt=O.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&ht!==void 0&&(mt=mt[ht]),mt){We.bindFramebuffer(Z.FRAMEBUFFER,mt);try{const vt=V.textures[He],At=vt.format,_t=vt.type;if(!Mt.textureFormatReadable(At)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Mt.textureTypeReadable(_t)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ie>=0&&ie<=V.width-me&&ye>=0&&ye<=V.height-oe&&(V.textures.length>1&&Z.readBuffer(Z.COLOR_ATTACHMENT0+He),Z.readPixels(ie,ye,me,oe,Ge.convert(At),Ge.convert(_t),qe))}finally{const vt=$!==null?O.get($).__webglFramebuffer:null;We.bindFramebuffer(Z.FRAMEBUFFER,vt)}}},this.readRenderTargetPixelsAsync=async function(V,ie,ye,me,oe,qe,ht,He=0){if(!(V&&V.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let mt=O.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&ht!==void 0&&(mt=mt[ht]),mt)if(ie>=0&&ie<=V.width-me&&ye>=0&&ye<=V.height-oe){We.bindFramebuffer(Z.FRAMEBUFFER,mt);const vt=V.textures[He],At=vt.format,_t=vt.type;if(!Mt.textureFormatReadable(At))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Mt.textureTypeReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ut=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ut),Z.bufferData(Z.PIXEL_PACK_BUFFER,qe.byteLength,Z.STREAM_READ),V.textures.length>1&&Z.readBuffer(Z.COLOR_ATTACHMENT0+He),Z.readPixels(ie,ye,me,oe,Ge.convert(At),Ge.convert(_t),0);const Sn=$!==null?O.get($).__webglFramebuffer:null;We.bindFramebuffer(Z.FRAMEBUFFER,Sn);const zn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await Aw(Z,zn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ut),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,qe),Z.deleteBuffer(Ut),Z.deleteSync(zn),qe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(V,ie=null,ye=0){const me=Math.pow(2,-ye),oe=Math.floor(V.image.width*me),qe=Math.floor(V.image.height*me),ht=ie!==null?ie.x:0,He=ie!==null?ie.y:0;ne.setTexture2D(V,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,ye,0,0,ht,He,oe,qe),We.unbindTexture()};const Kr=Z.createFramebuffer(),Gs=Z.createFramebuffer();this.copyTextureToTexture=function(V,ie,ye=null,me=null,oe=0,qe=null){qe===null&&(oe!==0?(kh("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),qe=oe,oe=0):qe=0);let ht,He,mt,vt,At,_t,Ut,Sn,zn;const Un=V.isCompressedTexture?V.mipmaps[qe]:V.image;if(ye!==null)ht=ye.max.x-ye.min.x,He=ye.max.y-ye.min.y,mt=ye.isBox3?ye.max.z-ye.min.z:1,vt=ye.min.x,At=ye.min.y,_t=ye.isBox3?ye.min.z:0;else{const yi=Math.pow(2,-oe);ht=Math.floor(Un.width*yi),He=Math.floor(Un.height*yi),V.isDataArrayTexture?mt=Un.depth:V.isData3DTexture?mt=Math.floor(Un.depth*yi):mt=1,vt=0,At=0,_t=0}me!==null?(Ut=me.x,Sn=me.y,zn=me.z):(Ut=0,Sn=0,zn=0);const Ht=Ge.convert(ie.format),at=Ge.convert(ie.type);let vn;ie.isData3DTexture?(ne.setTexture3D(ie,0),vn=Z.TEXTURE_3D):ie.isDataArrayTexture||ie.isCompressedArrayTexture?(ne.setTexture2DArray(ie,0),vn=Z.TEXTURE_2D_ARRAY):(ne.setTexture2D(ie,0),vn=Z.TEXTURE_2D),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,ie.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,ie.unpackAlignment);const Ot=Z.getParameter(Z.UNPACK_ROW_LENGTH),vi=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Ds=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Gn=Z.getParameter(Z.UNPACK_SKIP_ROWS),sa=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Un.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Un.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,vt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,At),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,_t);const En=V.isDataArrayTexture||V.isData3DTexture,Ai=ie.isDataArrayTexture||ie.isData3DTexture;if(V.isDepthTexture){const yi=O.get(V),Ii=O.get(ie),Oi=O.get(yi.__renderTarget),Go=O.get(Ii.__renderTarget);We.bindFramebuffer(Z.READ_FRAMEBUFFER,Oi.__webglFramebuffer),We.bindFramebuffer(Z.DRAW_FRAMEBUFFER,Go.__webglFramebuffer);for(let is=0;is<mt;is++)En&&(Z.framebufferTextureLayer(Z.READ_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,O.get(V).__webglTexture,oe,_t+is),Z.framebufferTextureLayer(Z.DRAW_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,O.get(ie).__webglTexture,qe,zn+is)),Z.blitFramebuffer(vt,At,ht,He,Ut,Sn,ht,He,Z.DEPTH_BUFFER_BIT,Z.NEAREST);We.bindFramebuffer(Z.READ_FRAMEBUFFER,null),We.bindFramebuffer(Z.DRAW_FRAMEBUFFER,null)}else if(oe!==0||V.isRenderTargetTexture||O.has(V)){const yi=O.get(V),Ii=O.get(ie);We.bindFramebuffer(Z.READ_FRAMEBUFFER,Kr),We.bindFramebuffer(Z.DRAW_FRAMEBUFFER,Gs);for(let Oi=0;Oi<mt;Oi++)En?Z.framebufferTextureLayer(Z.READ_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,yi.__webglTexture,oe,_t+Oi):Z.framebufferTexture2D(Z.READ_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_2D,yi.__webglTexture,oe),Ai?Z.framebufferTextureLayer(Z.DRAW_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Ii.__webglTexture,qe,zn+Oi):Z.framebufferTexture2D(Z.DRAW_FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_2D,Ii.__webglTexture,qe),oe!==0?Z.blitFramebuffer(vt,At,ht,He,Ut,Sn,ht,He,Z.COLOR_BUFFER_BIT,Z.NEAREST):Ai?Z.copyTexSubImage3D(vn,qe,Ut,Sn,zn+Oi,vt,At,ht,He):Z.copyTexSubImage2D(vn,qe,Ut,Sn,vt,At,ht,He);We.bindFramebuffer(Z.READ_FRAMEBUFFER,null),We.bindFramebuffer(Z.DRAW_FRAMEBUFFER,null)}else Ai?V.isDataTexture||V.isData3DTexture?Z.texSubImage3D(vn,qe,Ut,Sn,zn,ht,He,mt,Ht,at,Un.data):ie.isCompressedArrayTexture?Z.compressedTexSubImage3D(vn,qe,Ut,Sn,zn,ht,He,mt,Ht,Un.data):Z.texSubImage3D(vn,qe,Ut,Sn,zn,ht,He,mt,Ht,at,Un):V.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,qe,Ut,Sn,ht,He,Ht,at,Un.data):V.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,qe,Ut,Sn,Un.width,Un.height,Ht,Un.data):Z.texSubImage2D(Z.TEXTURE_2D,qe,Ut,Sn,ht,He,Ht,at,Un);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Ot),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,vi),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Ds),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Gn),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,sa),qe===0&&ie.generateMipmaps&&Z.generateMipmap(vn),We.unbindTexture()},this.initRenderTarget=function(V){O.get(V).__webglFramebuffer===void 0&&ne.setupRenderTarget(V)},this.initTexture=function(V){V.isCubeTexture?ne.setTextureCube(V,0):V.isData3DTexture?ne.setTexture3D(V,0):V.isDataArrayTexture||V.isCompressedArrayTexture?ne.setTexture2DArray(V,0):ne.setTexture2D(V,0),We.unbindTexture()},this.resetState=function(){j=0,ae=0,$=null,We.reset(),st.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Fs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=xn._getDrawingBufferColorSpace(e),t.unpackColorSpace=xn._getUnpackColorSpace()}}const yI=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:sy,AddEquation:wu,AddOperation:sE,AdditiveAnimationBlendMode:dS,AdditiveBlending:Rx,AgXToneMapping:aS,AlphaFormat:fS,AlwaysCompare:vE,AlwaysDepth:fv,AlwaysStencilFunc:Lx,AmbientLight:cT,AnimationAction:yT,AnimationClip:mm,AnimationLoader:m3,AnimationMixer:X3,AnimationObjectGroup:H3,AnimationUtils:f3,ArcCurve:BE,ArrayCamera:mT,ArrowHelper:gR,AttachedBindMode:Ux,Audio:gT,AudioAnalyser:U3,AudioContext:kS,AudioListener:R3,AudioLoader:A3,AxesHelper:vR,BackSide:ts,BasicDepthPacking:cE,BasicShadowMap:F1,BatchedMesh:UE,Bone:SS,BooleanKeyframeTrack:ef,Box2:eR,Box3:Ia,Box3Helper:pR,BoxGeometry:$c,BoxHelper:dR,BufferAttribute:Hn,BufferGeometry:Yt,BufferGeometryLoader:pT,ByteType:oS,Cache:Lo,Camera:yy,CameraHelper:hR,CanvasTexture:IC,CapsuleGeometry:Ty,CatmullRomCurve3:FE,CineonToneMapping:nS,CircleGeometry:Ay,ClampToEdgeWrapping:As,Clock:HS,Color:pt,ColorKeyframeTrack:PS,ColorManagement:xn,CompressedArrayTexture:UC,CompressedCubeTexture:LC,CompressedTexture:Ey,CompressedTextureLoader:g3,ConeGeometry:Mm,ConstantAlphaFactor:nE,ConstantColorFactor:eE,Controls:_R,CubeCamera:AE,CubeDepthTexture:zE,CubeReflectionMapping:Oo,CubeRefractionMapping:Uu,CubeTexture:Sm,CubeTextureLoader:v3,CubeUVReflectionMapping:jh,CubicBezierCurve:TS,CubicBezierCurve3:VE,CubicInterpolant:nT,CullFaceBack:Cx,CullFaceFront:B1,CullFaceFrontBack:zA,CullFaceNone:P1,Curve:Yr,CurvePath:HE,CustomBlending:V1,CustomToneMapping:iS,CylinderGeometry:bm,Cylindrical:$3,Data3DTexture:vy,DataArrayTexture:gy,DataTexture:qr,DataTextureLoader:y3,DataUtils:iC,DecrementStencilOp:ew,DecrementWrapStencilOp:nw,DefaultLoadingManager:sT,DepthFormat:Po,DepthStencilFormat:Ru,DepthTexture:qh,DetachedBindMode:rE,DirectionalLight:uT,DirectionalLightHelper:fR,DiscreteInterpolant:iT,DodecahedronGeometry:wy,DoubleSide:No,DstAlphaFactor:j1,DstColorFactor:J1,DynamicCopyUsage:vw,DynamicDrawUsage:fw,DynamicReadUsage:pw,EdgesGeometry:PE,EllipseCurve:Cy,EqualCompare:pE,EqualDepth:dv,EqualStencilFunc:rw,EquirectangularReflectionMapping:em,EquirectangularRefractionMapping:tm,Euler:Hs,EventDispatcher:Bo,ExternalTexture:MS,ExtrudeGeometry:Ry,FileLoader:Rl,Float16BufferAttribute:cC,Float32BufferAttribute:yt,FloatType:es,Fog:xy,FogExp2:_y,FramebufferTexture:NC,FrontSide:Cl,Frustum:Jh,FrustumArray:My,GLBufferAttribute:j3,GLSL1:_w,GLSL3:Ix,GreaterCompare:mE,GreaterDepth:mv,GreaterEqualCompare:my,GreaterEqualDepth:pv,GreaterEqualStencilFunc:cw,GreaterStencilFunc:lw,GridHelper:uR,Group:Oh,HalfFloatType:zo,HemisphereLight:rT,HemisphereLightHelper:lR,IcosahedronGeometry:Dy,ImageBitmapLoader:T3,ImageLoader:gm,ImageUtils:bE,IncrementStencilOp:$A,IncrementWrapStencilOp:tw,InstancedBufferAttribute:Wh,InstancedBufferGeometry:dT,InstancedInterleavedBuffer:Z3,InstancedMesh:NE,Int16BufferAttribute:lC,Int32BufferAttribute:uC,Int8BufferAttribute:sC,IntType:oy,InterleavedBuffer:Sy,InterleavedBufferAttribute:Qc,Interpolant:Am,InterpolateDiscrete:am,InterpolateLinear:jv,InterpolateSmooth:av,InterpolationSamplingMode:bw,InterpolationSamplingType:Sw,InvertStencilOp:iw,KeepStencilOp:Fc,KeyframeTrack:yr,LOD:RE,LatheGeometry:Ny,Layers:Gh,LessCompare:dE,LessDepth:hv,LessEqualCompare:py,LessEqualDepth:Zc,LessEqualStencilFunc:ow,LessStencilFunc:sw,Light:Fu,LightProbe:hT,Line:Ou,Line3:iR,LineBasicMaterial:ns,LineCurve:AS,LineCurve3:kE,LineDashedMaterial:eT,LineLoop:LE,LineSegments:Fo,LinearFilter:ai,LinearInterpolant:zS,LinearMipMapLinearFilter:VA,LinearMipMapNearestFilter:FA,LinearMipmapLinearFilter:Uo,LinearMipmapNearestFilter:Wp,LinearSRGBColorSpace:Lu,LinearToneMapping:eS,LinearTransfer:rm,Loader:Cs,LoaderUtils:Fx,LoadingManager:BS,LoopOnce:oE,LoopPingPong:uE,LoopRepeat:lE,MOUSE:IA,Material:Oa,MaterialLoader:By,MathUtils:SE,Matrix2:qS,Matrix3:Qt,Matrix4:kt,MaxEquation:X1,Mesh:Gi,MeshBasicMaterial:Pu,MeshDepthMaterial:LS,MeshDistanceMaterial:IS,MeshLambertMaterial:KE,MeshMatcapMaterial:$E,MeshNormalMaterial:JE,MeshPhongMaterial:jE,MeshPhysicalMaterial:US,MeshStandardMaterial:NS,MeshToonMaterial:QE,MinEquation:G1,MirroredRepeatWrapping:im,MixOperation:aE,MultiplyBlending:Nx,MultiplyOperation:_m,NearestFilter:Li,NearestMipMapLinearFilter:BA,NearestMipMapNearestFilter:PA,NearestMipmapLinearFilter:Lh,NearestMipmapNearestFilter:rS,NeutralToneMapping:sS,NeverCompare:hE,NeverDepth:cv,NeverStencilFunc:aw,NoBlending:Io,NoColorSpace:Tl,NoNormalPacking:ZA,NoToneMapping:mr,NormalAnimationBlendMode:dy,NormalBlending:Wc,NormalGAPacking:QA,NormalRGPacking:jA,NotEqualCompare:gE,NotEqualDepth:gv,NotEqualStencilFunc:uw,NumberKeyframeTrack:dm,Object3D:An,ObjectLoader:M3,ObjectSpaceNormalMap:fE,OctahedronGeometry:Em,OneFactor:q1,OneMinusConstantAlphaFactor:iE,OneMinusConstantColorFactor:tE,OneMinusDstAlphaFactor:Q1,OneMinusDstColorFactor:K1,OneMinusSrcAlphaFactor:uv,OneMinusSrcColorFactor:Z1,OrthographicCamera:$h,PCFShadowMap:zh,PCFSoftShadowMap:Xp,PMREMGenerator:Hx,Path:$v,PerspectiveCamera:aa,Plane:Au,PlaneGeometry:Kh,PlaneHelper:mR,PointLight:lT,PointLightHelper:rR,Points:IE,PointsMaterial:bS,PolarGridHelper:cR,PolyhedronGeometry:Bu,PositionalAudio:N3,PropertyBinding:Tn,PropertyMixer:vT,QuadraticBezierCurve:wS,QuadraticBezierCurve3:CS,Quaternion:ws,QuaternionKeyframeTrack:wm,QuaternionLinearInterpolant:aT,R11_EAC_Format:Ev,RED_GREEN_RGTC2_Format:Yv,RED_RGTC1_Format:Wv,REVISION:ay,RG11_EAC_Format:Av,RGBADepthPacking:WA,RGBAFormat:La,RGBAIntegerFormat:hy,RGBA_ASTC_10x10_Format:Fv,RGBA_ASTC_10x5_Format:zv,RGBA_ASTC_10x6_Format:Pv,RGBA_ASTC_10x8_Format:Bv,RGBA_ASTC_12x10_Format:Vv,RGBA_ASTC_12x12_Format:kv,RGBA_ASTC_4x4_Format:Cv,RGBA_ASTC_5x4_Format:Rv,RGBA_ASTC_5x5_Format:Dv,RGBA_ASTC_6x5_Format:Nv,RGBA_ASTC_6x6_Format:Uv,RGBA_ASTC_8x5_Format:Lv,RGBA_ASTC_8x6_Format:Iv,RGBA_ASTC_8x8_Format:Ov,RGBA_BPTC_Format:Hv,RGBA_ETC2_EAC_Format:Mv,RGBA_PVRTC_2BPPV1_Format:xv,RGBA_PVRTC_4BPPV1_Format:_v,RGBA_S3TC_DXT1_Format:Yp,RGBA_S3TC_DXT3_Format:Zp,RGBA_S3TC_DXT5_Format:jp,RGBDepthPacking:qA,RGBFormat:hS,RGBIntegerFormat:kA,RGB_BPTC_SIGNED_Format:Gv,RGB_BPTC_UNSIGNED_Format:Xv,RGB_ETC1_Format:Sv,RGB_ETC2_Format:bv,RGB_PVRTC_2BPPV1_Format:yv,RGB_PVRTC_4BPPV1_Format:vv,RGB_S3TC_DXT1_Format:qp,RGDepthPacking:YA,RGFormat:jc,RGIntegerFormat:fy,RawShaderMaterial:DS,Ray:Qh,Raycaster:_T,RectAreaLight:fT,RedFormat:cy,RedIntegerFormat:xm,ReinhardToneMapping:tS,RenderTarget:mS,RenderTarget3D:W3,RepeatWrapping:nm,ReplaceStencilOp:KA,ReverseSubtractEquation:H1,RingGeometry:Uy,SIGNED_R11_EAC_Format:Tv,SIGNED_RED_GREEN_RGTC2_Format:Zv,SIGNED_RED_RGTC1_Format:qv,SIGNED_RG11_EAC_Format:wv,SRGBColorSpace:Ua,SRGBTransfer:On,Scene:_S,ShaderChunk:an,ShaderLib:Xr,ShaderMaterial:vr,ShadowMaterial:ZE,Shape:Yc,ShapeGeometry:Ly,ShapePath:yR,ShapeUtils:Wr,ShortType:lS,Skeleton:by,SkeletonHelper:sR,SkinnedMesh:DE,Source:Du,Sphere:ga,SphereGeometry:Tm,Spherical:K3,SphericalHarmonics3:VS,SplineCurve:RS,SpotLight:oT,SpotLightHelper:aR,Sprite:CE,SpriteMaterial:xS,SrcAlphaFactor:lv,SrcAlphaSaturateFactor:$1,SrcColorFactor:Y1,StaticCopyUsage:gw,StaticDrawUsage:om,StaticReadUsage:dw,StereoCamera:w3,StreamCopyUsage:yw,StreamDrawUsage:hw,StreamReadUsage:mw,StringKeyframeTrack:tf,SubtractEquation:k1,SubtractiveBlending:Dx,TOUCH:OA,TangentSpaceNormalMap:zu,TetrahedronGeometry:Iy,Texture:Ei,TextureLoader:_3,TextureUtils:ER,Timer:Q3,TimestampQuery:xw,TorusGeometry:Oy,TorusKnotGeometry:zy,Triangle:Ts,TriangleFanDrawMode:XA,TriangleStripDrawMode:GA,TrianglesDrawMode:HA,TubeGeometry:Py,UVMapping:ry,Uint16BufferAttribute:gS,Uint32BufferAttribute:vS,Uint8BufferAttribute:rC,Uint8ClampedBufferAttribute:oC,Uniform:WS,UniformsGroup:Y3,UniformsLib:ot,UniformsUtils:TE,UnsignedByteType:Ka,UnsignedInt101111Type:cS,UnsignedInt248Type:Fh,UnsignedInt5999Type:uS,UnsignedIntType:gr,UnsignedShort4444Type:ly,UnsignedShort5551Type:uy,UnsignedShortType:Bh,VSMShadowMap:kc,Vector2:Pe,Vector3:Y,Vector4:Wn,VectorKeyframeTrack:pm,VideoFrameTexture:DC,VideoTexture:OE,WebGL3DRenderTarget:Yw,WebGLArrayRenderTarget:qw,WebGLCoordinateSystem:Fs,WebGLCubeRenderTarget:yS,WebGLRenderTarget:ks,WebGLRenderer:wT,WebGLUtils:AT,WebGPUCoordinateSystem:Vh,WebXRController:sv,WireframeGeometry:YE,WrapAroundEnding:sm,ZeroCurvatureEnding:Hc,ZeroFactor:W1,ZeroSlopeEnding:Gc,ZeroStencilOp:JA,createCanvasElement:xE,error:Tt,getConsoleFunction:Tw,log:um,setConsoleFunction:Ew,warn:rt,warnOnce:kh},Symbol.toStringTag,{value:"Module"}));var vx={exports:{}},yx={},_x={exports:{}},xx={};var v1;function _I(){if(v1)return xx;v1=1;var o=ym();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,i=o.useState,s=o.useEffect,u=o.useLayoutEffect,f=o.useDebugValue;function h(x,b){var M=b(),A=i({inst:{value:M,getSnapshot:b}}),R=A[0].inst,C=A[1];return u(function(){R.value=M,R.getSnapshot=b,m(R)&&C({inst:R})},[x,M,b]),s(function(){return m(R)&&C({inst:R}),x(function(){m(R)&&C({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 xx.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:_,xx}var y1;function xI(){return y1||(y1=1,_x.exports=_I()),_x.exports}var _1;function SI(){if(_1)return yx;_1=1;var o=ym(),e=xI();function t(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}var i=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,u=o.useRef,f=o.useEffect,h=o.useMemo,m=o.useDebugValue;return yx.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(P){if(!D){if(D=!0,U=P,P=b(P),M!==void 0&&R.hasValue){var H=R.value;if(M(H,P))return L=H}return L=P}if(H=L,i(U,P))return H;var W=b(P);return M!==void 0&&M(H,W)?(U=P,H):(U=P,L=W)}var D=!1,U,L,B=x===void 0?null:x;return[function(){return E(_())},B===null?void 0:function(){return E(B())}]},[_,x,b,M]);var C=s(g,A[0],A[1]);return f(function(){R.hasValue=!0,R.value=C},[C]),m(C),C},yx}var x1;function bI(){return x1||(x1=1,vx.exports=SI()),vx.exports}var MI=bI();const EI=$x(MI),S1=o=>{let e;const t=new Set,i=(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:i,getState:s,getInitialState:()=>m,subscribe:g=>(t.add(g),()=>t.delete(g))},m=e=o(i,s,h);return h},TI=(o=>o?S1(o):S1),{useSyncExternalStoreWithSelector:AI}=EI,wI=o=>o;function CI(o,e=wI,t){const i=AI(o.subscribe,o.getState,o.getInitialState,e,t);return O1.useDebugValue(i),i}const b1=(o,e)=>{const t=TI(o),i=(s,u=e)=>CI(t,s,u);return Object.assign(i,t),i},RI=((o,e)=>o?b1(o,e):b1);var Wx=z1();const DI=$x(Wx);function YS(o,e,t){if(!o)return;if(t(o)===!0)return o;let i=e?o.return:o.child;for(;i;){const s=YS(i,e,t);if(s)return s;i=e?null:i.sibling}}function CT(o){try{return Object.defineProperties(o,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return o}}const ZS=CT(It.createContext(null));class RT extends It.Component{render(){return It.createElement(ZS.Provider,{value:this._reactInternals},this.props.children)}}function DT(){const o=It.useContext(ZS);if(o===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=It.useId();return It.useMemo(()=>{for(const t of[o,o?.alternate]){if(!t)continue;const i=YS(t,!1,s=>{let u=s.memoizedState;for(;u;){if(u.memoizedState===e)return!0;u=u.next}});if(i)return i}},[o,e])}const NI=Symbol.for("react.context"),UI=o=>o!==null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===NI;function LI(){const o=DT(),[e]=It.useState(()=>new Map);e.clear();let t=o;for(;t;){const i=t.type;UI(i)&&i!==ZS&&!e.has(i)&&e.set(i,It.use(CT(i))),t=t.return}return e}function II(){const o=LI();return It.useMemo(()=>Array.from(o.keys()).reduce((e,t)=>i=>It.createElement(e,null,It.createElement(t.Provider,{...i,value:o.get(t)})),e=>It.createElement(RT,{...e})),[o])}function NT(o){let e=o.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const UT=o=>o&&o.isOrthographicCamera,OI=o=>o&&o.hasOwnProperty("current"),zI=o=>o!=null&&(typeof o=="string"||typeof o=="number"||o.isColor),Cm=((o,e)=>typeof window<"u"&&(((o=window.document)==null?void 0:o.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?It.useLayoutEffect:It.useEffect;function LT(o){const e=It.useRef(o);return Cm(()=>{e.current=o},[o]),e}function PI(){const o=DT(),e=II();return It.useMemo(()=>({children:t})=>{const s=!!YS(o,!0,u=>u.type===It.StrictMode)?It.StrictMode:It.Fragment;return Bs.jsx(s,{children:Bs.jsx(e,{children:t})})},[o,e])}function BI({set:o}){return Cm(()=>(o(new Promise(()=>null)),()=>o(!1)),[o]),null}const FI=(o=>(o=class extends It.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},o.getDerivedStateFromError=()=>({error:!0}),o))();function IT(o){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(o)?Math.min(Math.max(o[0],t),o[1]):o}function Dh(o){var e;return(e=o.__r3f)==null?void 0:e.root.getState()}const mi={obj:o=>o===Object(o)&&!mi.arr(o)&&typeof o!="function",fun:o=>typeof o=="function",str:o=>typeof o=="string",num:o=>typeof o=="number",boo:o=>typeof o=="boolean",und:o=>o===void 0,nul:o=>o===null,arr:o=>Array.isArray(o),equ(o,e,{arrays:t="shallow",objects:i="reference",strict:s=!0}={}){if(typeof o!=typeof e||!!o!=!!e)return!1;if(mi.str(o)||mi.num(o)||mi.boo(o))return o===e;const u=mi.obj(o);if(u&&i==="reference")return o===e;const f=mi.arr(o);if(f&&t==="reference")return o===e;if((f||u)&&o===e)return!0;let h;for(h in o)if(!(h in e))return!1;if(u&&t==="shallow"&&i==="shallow"){for(h in s?e:o)if(!mi.equ(o[h],e[h],{strict:s,objects:"reference"}))return!1}else for(h in s?e:o)if(o[h]!==e[h])return!1;if(mi.und(h)){if(f&&o.length===0&&e.length===0||u&&Object.keys(o).length===0&&Object.keys(e).length===0)return!0;if(o!==e)return!1}return!0}};function VI(o){o.type!=="Scene"&&(o.dispose==null||o.dispose());for(const e in o){const t=o[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const OT=["children","key","ref"];function kI(o){const e={};for(const t in o)OT.includes(t)||(e[t]=o[t]);return e}function ey(o,e,t,i){const s=o;let u=s?.__r3f;return u||(u={root:e,type:t,parent:null,children:[],props:kI(i),object:s,eventCount:0,handlers:{},isHidden:!1},s&&(s.__r3f=u)),u}function vm(o,e){if(!e.includes("-"))return{root:o,key:e,target:o[e]};if(e in o)return{root:o,key:e,target:o[e]};let t=o;const i=e.split("-");for(const s of i){if(typeof t!="object"||t===null){if(t!==void 0){const u=i.slice(i.indexOf(s)).join("-");return{root:t,key:u,target:void 0}}return{root:o,key:e,target:void 0}}e=s,o=t,t=t[e]}return{root:o,key:e,target:t}}const M1=/-\d+$/;function ty(o,e){if(mi.str(e.props.attach)){if(M1.test(e.props.attach)){const s=e.props.attach.replace(M1,""),{root:u,key:f}=vm(o.object,s);Array.isArray(u[f])||(u[f]=[])}const{root:t,key:i}=vm(o.object,e.props.attach);e.previousAttach=t[i],t[i]=e.object}else mi.fun(e.props.attach)&&(e.previousAttach=e.props.attach(o.object,e.object))}function ny(o,e){if(mi.str(e.props.attach)){const{root:t,key:i}=vm(o.object,e.props.attach),s=e.previousAttach;s===void 0?delete t[i]:t[i]=s}else e.previousAttach==null||e.previousAttach(o.object,e.object);delete e.previousAttach}const qx=[...OT,"args","dispose","attach","object","onUpdate","dispose"],E1=new Map;function HI(o){let e=E1.get(o.constructor);try{e||(e=new o.constructor,E1.set(o.constructor,e))}catch{}return e}function GI(o,e){const t={};for(const i in e)if(!qx.includes(i)&&!mi.equ(e[i],o.props[i])){t[i]=e[i];for(const s in e)s.startsWith(`${i}-`)&&(t[s]=e[s])}for(const i in o.props){if(qx.includes(i)||e.hasOwnProperty(i))continue;const{root:s,key:u}=vm(o.object,i);if(s.constructor&&s.constructor.length===0){const f=HI(s);mi.und(f)||(t[u]=f[u])}else t[u]=0}return t}const XI=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],WI=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Cu(o,e){var t;const i=o.__r3f,s=i&&NT(i).getState(),u=i?.eventCount;for(const h in e){let m=e[h];if(qx.includes(h))continue;if(i&&WI.test(h)){typeof m=="function"?i.handlers[h]=m:delete i.handlers[h],i.eventCount=Object.keys(i.handlers).length;continue}if(m===void 0)continue;let{root:g,key:_,target:x}=vm(o,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 Gh&&m instanceof Gh)x.mask=m.mask;else if(x instanceof pt&&zI(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&&XI.includes(_)&&(f=g[_])!=null&&f.isTexture&&g[_].format===La&&g[_].type===Ka&&(g[_].colorSpace=Ua)}}if(i!=null&&i.parent&&s!=null&&s.internal&&(t=i.object)!=null&&t.isObject3D&&u!==i.eventCount){const h=i.object,m=s.internal.interaction.indexOf(h);m>-1&&s.internal.interaction.splice(m,1),i.eventCount&&h.raycast!==null&&s.internal.interaction.push(h)}return i&&i.props.attach===void 0&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&td(i),o}function td(o){var e;if(!o.parent)return;o.props.onUpdate==null||o.props.onUpdate(o.object);const t=(e=o.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function qI(o,e){o.manual||(UT(o)?(o.left=e.width/-2,o.right=e.width/2,o.top=e.height/2,o.bottom=e.height/-2):o.aspect=e.width/e.height,o.updateProjectionMatrix())}const Es=o=>o?.isObject3D;function nv(o){return(o.eventObject||o.object).uuid+"/"+o.index+o.instanceId}function zT(o,e,t,i){const s=t.get(e);s&&(t.delete(e),t.size===0&&(o.delete(i),s.target.releasePointerCapture(i)))}function YI(o,e){const{internal:t}=o.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,s)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(s)}),t.capturedMap.forEach((i,s)=>{zT(t.capturedMap,e,i,s)})}function ZI(o){function e(m){const{internal:g}=o.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 i(m,g){const _=o.getState(),x=new Set,b=[],M=g?g(_.internal.interaction):_.internal.interaction;for(let E=0;E<M.length;E++){const D=Dh(M[E]);D&&(D.raycaster.camera=void 0)}_.previousRoot||_.events.compute==null||_.events.compute(m,_);function A(E){const D=Dh(E);if(!D||!D.events.enabled||D.raycaster.camera===null)return[];if(D.raycaster.camera===void 0){var U;D.events.compute==null||D.events.compute(m,D,(U=D.previousRoot)==null?void 0:U.getState()),D.raycaster.camera===void 0&&(D.raycaster.camera=null)}return D.raycaster.camera?D.raycaster.intersectObject(E,!0):[]}let R=M.flatMap(A).sort((E,D)=>{const U=Dh(E.object),L=Dh(D.object);return!U||!L?E.distance-D.distance:L.events.priority-U.events.priority||E.distance-D.distance}).filter(E=>{const D=nv(E);return x.has(D)?!1:(x.add(D),!0)});_.events.filter&&(R=_.events.filter(R,_));for(const E of R){let D=E.object;for(;D;){var C;(C=D.__r3f)!=null&&C.eventCount&&b.push({...E,eventObject:D}),D=D.parent}}if("pointerId"in m&&_.internal.capturedMap.has(m.pointerId))for(let E of _.internal.capturedMap.get(m.pointerId).values())x.has(nv(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=Dh(M.object);if(A||M.object.traverseAncestors(R=>{const C=Dh(R);if(C)return A=C,!1}),A){const{raycaster:R,pointer:C,camera:E,internal:D}=A,U=new Y(C.x,C.y,0).unproject(E),L=I=>{var z,j;return(z=(j=D.capturedMap.get(I))==null?void 0:j.has(M.eventObject))!=null?z:!1},B=I=>{const z={intersection:M,target:g.target};D.capturedMap.has(I)?D.capturedMap.get(I).set(M.eventObject,z):D.capturedMap.set(I,new Map([[M.eventObject,z]])),g.target.setPointerCapture(I)},P=I=>{const z=D.capturedMap.get(I);z&&zT(D.capturedMap,M.eventObject,z,I)};let H={};for(let I in g){let z=g[I];typeof z!="function"&&(H[I]=z)}let W={...M,...H,pointer:C,intersections:m,stopped:b.stopped,delta:_,unprojectedPoint:U,ray:R.ray,camera:E,stopPropagation(){const I="pointerId"in g&&D.capturedMap.get(g.pointerId);if((!I||I.has(M.eventObject))&&(W.stopped=b.stopped=!0,D.hovered.size&&Array.from(D.hovered.values()).find(z=>z.eventObject===M.eventObject))){const z=m.slice(0,m.indexOf(M));u([...z,M])}},target:{hasPointerCapture:L,setPointerCapture:B,releasePointerCapture:P},currentTarget:{hasPointerCapture:L,setPointerCapture:B,releasePointerCapture:P},nativeEvent:g};if(x(W),b.stopped===!0)break}}}return m}function u(m){const{internal:g}=o.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(nv(_)),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:_}=o.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}=o.getState();b.lastEvent.current=_;const M=m==="onPointerMove",A=m==="onClick"||m==="onContextMenu"||m==="onDoubleClick",C=i(_,M?t:void 0),E=A?e(_):0;m==="onPointerDown"&&(b.initialClick=[_.offsetX,_.offsetY],b.initialHits=C.map(U=>U.eventObject)),A&&!C.length&&E<=2&&(f(_,b.interaction),x&&x(_)),M&&u(C);function D(U){const L=U.eventObject,B=L.__r3f;if(!(B!=null&&B.eventCount))return;const P=B.handlers;if(M){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const H=nv(U),W=b.hovered.get(H);W?W.stopped&&U.stopPropagation():(b.hovered.set(H,U),P.onPointerOver==null||P.onPointerOver(U),P.onPointerEnter==null||P.onPointerEnter(U))}P.onPointerMove==null||P.onPointerMove(U)}else{const H=P[m];H?(!A||b.initialHits.includes(L))&&(f(_,b.interaction.filter(W=>!b.initialHits.includes(W))),H(U)):A&&b.initialHits.includes(L)&&f(_,b.interaction.filter(W=>!b.initialHits.includes(W)))}}s(C,_,E,D)}}return{handlePointer:h}}const T1=o=>!!(o!=null&&o.render),PT=It.createContext(null),jI=(o,e)=>{const t=RI((h,m)=>{const g=new Y,_=new Y,x=new Y;function b(E=m().camera,D=_,U=m().size){const{width:L,height:B,top:P,left:H}=U,W=L/B;D.isVector3?x.copy(D):x.set(...D);const I=E.getWorldPosition(g).distanceTo(x);if(UT(E))return{width:L/E.zoom,height:B/E.zoom,top:P,left:H,factor:1,distance:I,aspect:W};{const z=E.fov*Math.PI/180,j=2*Math.tan(z/2)*I,ae=j*(L/B);return{width:ae,height:j,top:P,left:H,factor:L/ae,distance:I,aspect:W}}}let M;const A=E=>h(D=>({performance:{...D.performance,current:E}})),R=new Pe;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)=>o(m(),E),advance:(E,D)=>e(E,D,m()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new HS,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(D=>({...D,events:{...D.events,...E}})),setSize:(E,D,U=0,L=0)=>{const B=m().camera,P={width:E,height:D,top:U,left:L};h(H=>({size:P,viewport:{...H.viewport,...b(B,_,P)}}))},setDpr:E=>h(D=>{const U=IT(E);return{viewport:{...D.viewport,dpr:U,initialDpr:D.viewport.initialDpr||U}}}),setFrameloop:(E="always")=>{const D=m().clock;D.stop(),D.elapsedTime=0,E!=="never"&&(D.start(),D.elapsedTime=0),h(()=>({frameloop:E}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:It.createRef(),active:!1,frames:0,priority:0,subscribe:(E,D,U)=>{const L=m().internal;return L.priority=L.priority+(D>0?1:0),L.subscribers.push({ref:E,priority:D,store:U}),L.subscribers=L.subscribers.sort((B,P)=>B.priority-P.priority),()=>{const B=m().internal;B!=null&&B.subscribers&&(B.priority=B.priority-(D>0?1:0),B.subscribers=B.subscribers.filter(P=>P.ref!==E))}}}}}),i=t.getState();let s=i.size,u=i.viewport.dpr,f=i.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,qI(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=>o(h)),t};function QI(){const o=It.useContext(PT);if(!o)throw new Error("R3F: Hooks can only be used within the Canvas component!");return o}function BT(o,e=0){const t=QI(),i=t.getState().internal.subscribe,s=LT(o);return Cm(()=>i(s,e,t),[e,i,t]),null}const JI=1,KI=8,$I=32,eO=2;var tO={version:"9.5.0"};function nO(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var A1={exports:{}},w1={exports:{}},C1;function iO(){return C1||(C1=1,(function(o){o.exports=function(e){function t(r,l,p,v){return new Ad(r,l,p,v)}function i(){}function s(r){var l="https://react.dev/errors/"+r;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 #"+r+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(r){var l=r,p=r;if(r.alternate)for(;l.return;)l=l.return;else{r=l;do l=r,(l.flags&4098)!==0&&(p=l.return),r=l.return;while(r)}return l.tag===3?p:null}function f(r){if(u(r)!==r)throw Error(s(188))}function h(r){var l=r.alternate;if(!l){if(l=u(r),l===null)throw Error(s(188));return l!==r?null:r}for(var p=r,v=l;;){var T=p.return;if(T===null)break;var w=T.alternate;if(w===null){if(v=T.return,v!==null){p=v;continue}break}if(T.child===w.child){for(w=T.child;w;){if(w===p)return f(T),r;if(w===v)return f(T),l;w=w.sibling}throw Error(s(188))}if(p.return!==v.return)p=T,v=w;else{for(var F=!1,J=T.child;J;){if(J===p){F=!0,p=T,v=w;break}if(J===v){F=!0,v=T,p=w;break}J=J.sibling}if(!F){for(J=w.child;J;){if(J===p){F=!0,p=w,v=T;break}if(J===v){F=!0,v=w,p=T;break}J=J.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?r:l}function m(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(l=m(r),l!==null)return l;r=r.sibling}return null}function g(r){var l=r.tag;if(l===5||l===26||l===27||l===6)return r;for(r=r.child;r!==null;){if(r.tag!==4&&(l=g(r),l!==null))return l;r=r.sibling}return null}function _(r){return r===null||typeof r!="object"?null:(r=Nr&&r[Nr]||r["@@iterator"],typeof r=="function"?r:null)}function x(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===fo?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case tl:return"Fragment";case il:return"Profiler";case nl:return"StrictMode";case Nf:return"Suspense";case Dr:return"SuspenseList";case rc:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case el:return"Portal";case cs:return r.displayName||"Context";case sc:return(r._context.displayName||"Context")+".Consumer";case Ql:var l=r.render;return r=r.displayName,r||(r=l.displayName||l.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Uf:return l=r.displayName||null,l!==null?l:x(r.type)||"Memo";case ua:l=r._payload,r=r._init;try{return x(r(l))}catch{}}return null}function b(r){return{current:r}}function M(r){0>ll||(r.current=Wf[ll],Wf[ll]=null,ll--)}function A(r,l){ll++,Wf[ll]=r.current,r.current=l}function R(r){return r>>>=0,r===0?32:31-(qf(r)/Wg|0)|0}function C(r){var l=r&42;if(l!==0)return l;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function E(r,l,p){var v=r.pendingLanes;if(v===0)return 0;var T=0,w=r.suspendedLanes,F=r.pingedLanes;r=r.warmLanes;var J=v&134217727;return J!==0?(v=J&~w,v!==0?T=C(v):(F&=J,F!==0?T=C(F):p||(p=J&~r,p!==0&&(T=C(p))))):(J=v&~w,J!==0?T=C(J):F!==0?T=C(F):p||(p=v&~r,p!==0&&(T=C(p)))),T===0?0:l!==0&&l!==T&&(l&w)===0&&(w=T&-T,p=l&-l,w>=p||w===32&&(p&4194048)!==0)?l:T}function D(r,l){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&l)===0}function U(r,l){switch(r){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 L(){var r=iu;return iu<<=1,(iu&62914560)===0&&(iu=4194304),r}function B(r){for(var l=[],p=0;31>p;p++)l.push(r);return l}function P(r,l){r.pendingLanes|=l,l!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function H(r,l,p,v,T,w){var F=r.pendingLanes;r.pendingLanes=p,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=p,r.entangledLanes&=p,r.errorRecoveryDisabledLanes&=p,r.shellSuspendCounter=0;var J=r.entanglements,xe=r.expirationTimes,ze=r.hiddenUpdates;for(p=F&~p;0<p;){var Qe=31-Ma(p),ke=1<<Qe;J[Qe]=0,xe[Qe]=-1;var dt=ze[Qe];if(dt!==null)for(ze[Qe]=null,Qe=0;Qe<dt.length;Qe++){var Gt=dt[Qe];Gt!==null&&(Gt.lane&=-536870913)}p&=~ke}v!==0&&W(r,v,0),w!==0&&T===0&&r.tag!==0&&(r.suspendedLanes|=w&~(F&~l))}function W(r,l,p){r.pendingLanes|=l,r.suspendedLanes&=~l;var v=31-Ma(l);r.entangledLanes|=l,r.entanglements[v]=r.entanglements[v]|1073741824|p&261930}function I(r,l){var p=r.entangledLanes|=l;for(r=r.entanglements;p;){var v=31-Ma(p),T=1<<v;T&l|r[v]&l&&(r[v]|=l),p&=~T}}function z(r,l){var p=l&-l;return p=(p&42)!==0?1:j(p),(p&(r.suspendedLanes|l))!==0?0:p}function j(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ae(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function $(r){if(typeof fp=="function"&&Zg(r),Ea&&typeof Ea.setStrictMode=="function")try{Ea.setStrictMode(cl,r)}catch{}}function ue(r,l){return r===l&&(r!==0||1/r===1/l)||r!==r&&l!==l}function he(r){if(Kf===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);Kf=l&&l[1]||"",ar=-1<p.stack.indexOf(`
|
|
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
`+Kf+r+ar}function q(r,l){if(!r||mc)return"";mc=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(Gt){var dt=Gt}Reflect.construct(r,[],ke)}else{try{ke.call()}catch(Gt){dt=Gt}r.call(ke.prototype)}}else{try{throw Error()}catch(Gt){dt=Gt}(ke=r())&&typeof ke.catch=="function"&&ke.catch(function(){})}}catch(Gt){if(Gt&&dt&&typeof Gt.stack=="string")return[Gt.stack,dt.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 w=v.DetermineComponentFrameRoot(),F=w[0],J=w[1];if(F&&J){var xe=F.split(`
|
|
`),ze=J.split(`
|
|
`);for(T=v=0;v<xe.length&&!xe[v].includes("DetermineComponentFrameRoot");)v++;for(;T<ze.length&&!ze[T].includes("DetermineComponentFrameRoot");)T++;if(v===xe.length||T===ze.length)for(v=xe.length-1,T=ze.length-1;1<=v&&0<=T&&xe[v]!==ze[T];)T--;for(;1<=v&&0<=T;v--,T--)if(xe[v]!==ze[T]){if(v!==1||T!==1)do if(v--,T--,0>T||xe[v]!==ze[T]){var Qe=`
|
|
`+xe[v].replace(" at new "," at ");return r.displayName&&Qe.includes("<anonymous>")&&(Qe=Qe.replace("<anonymous>",r.displayName)),Qe}while(1<=v&&0<=T);break}}}finally{mc=!1,Error.prepareStackTrace=p}return(p=r?r.displayName||r.name:"")?he(p):""}function K(r,l){switch(r.tag){case 26:case 27:case 5:return he(r.type);case 16:return he("Lazy");case 13:return r.child!==l&&l!==null?he("Suspense Fallback"):he("Suspense");case 19:return he("SuspenseList");case 0:case 15:return q(r.type,!1);case 11:return q(r.type.render,!1);case 1:return q(r.type,!0);case 31:return he("Activity");default:return""}}function ce(r){try{var l="",p=null;do l+=K(r,p),p=r,r=r.return;while(r);return l}catch(v){return`
|
|
Error generating stack: `+v.message+`
|
|
`+v.stack}}function Ae(r,l){if(typeof r=="object"&&r!==null){var p=hp.get(r);return p!==void 0?p:(l={value:r,source:l,stack:ce(l)},hp.set(r,l),l)}return{value:r,source:l,stack:ce(l)}}function Ce(r,l){Ir[sr++]=gc,Ir[sr++]=In,In=r,gc=l}function X(r,l,p){ds[Wa++]=qi,ds[Wa++]=Us,ds[Wa++]=ps,ps=r;var v=qi;r=Us;var T=32-Ma(v)-1;v&=~(1<<T),p+=1;var w=32-Ma(l)+T;if(30<w){var F=T-T%5;w=(v&(1<<F)-1).toString(32),v>>=F,T-=F,qi=1<<32-Ma(l)+T|p<<T|v,Us=w+r}else qi=1<<w|p<<T|v,Us=r}function se(r){r.return!==null&&(Ce(r,1),X(r,1,0))}function Ee(r){for(;r===In;)In=Ir[--sr],Ir[sr]=null,gc=Ir[--sr],Ir[sr]=null;for(;r===ps;)ps=ds[--Wa],ds[Wa]=null,Us=ds[--Wa],ds[Wa]=null,qi=ds[--Wa],ds[Wa]=null}function Oe(r,l){ds[Wa++]=qi,ds[Wa++]=Us,ds[Wa++]=ps,qi=l.id,Us=l.overflow,ps=r}function nt(r,l){A(Yi,l),A(Or,r),A(Fi,null),r=og(l),M(Fi),A(Fi,r)}function fe(){M(Fi),M(Or),M(Yi)}function Te(r){r.memoizedState!==null&&A(vc,r);var l=Fi.current,p=$l(l,r.type);l!==p&&(A(Or,r),A(Fi,p))}function Je(r){Or.current===r&&(M(Fi),M(Or)),vc.current===r&&(M(vc),ui?rl._currentValue=sl:rl._currentValue2=sl)}function et(r){var l=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ve(Ae(l,r)),$f}function ut(r,l){if(!Yn)throw Error(s(175));Lg(r.stateNode,r.type,r.memoizedProps,l,r)||et(r,!0)}function Jt(r){for(Ri=r.return;Ri;)switch(Ri.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:Ri=Ri.return}}function on(r){if(!Yn||r!==Ri)return!1;if(!un)return Jt(r),un=!0,!1;var l=r.tag;if(Ci?l!==3&&l!==27&&(l!==5||nu(r.type)&&!ca(r.type,r.memoizedProps))&&Zn&&et(r):l!==3&&(l!==5||nu(r.type)&&!ca(r.type,r.memoizedProps))&&Zn&&et(r),Jt(r),l===13){if(!Yn)throw Error(s(316));if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Zn=ep(r)}else if(l===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Zn=Og(r)}else Zn=Ci&&l===27?Tg(r.type,Zn):Ri?Eg(r.stateNode):null;return!0}function Dt(){Yn&&(Zn=Ri=null,un=!1)}function Re(){var r=rr;return r!==null&&(wa===null?wa=r:wa.push.apply(wa,r),rr=null),r}function Ve(r){rr===null?rr=[r]:rr.push(r)}function Ue(r,l,p){ui?(A(ms,l._currentValue),l._currentValue=p):(A(ms,l._currentValue2),l._currentValue2=p)}function Ke(r){var l=ms.current;ui?r._currentValue=l:r._currentValue2=l,M(ms)}function Z(r,l,p){for(;r!==null;){var v=r.alternate;if((r.childLanes&l)!==l?(r.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),r===p)break;r=r.return}}function St(r,l,p,v){var T=r.child;for(T!==null&&(T.return=r);T!==null;){var w=T.dependencies;if(w!==null){var F=T.child;w=w.firstContext;e:for(;w!==null;){var J=w;w=T;for(var xe=0;xe<l.length;xe++)if(J.context===l[xe]){w.lanes|=p,J=w.alternate,J!==null&&(J.lanes|=p),Z(w.return,p,r),v||(F=null);break e}w=J.next}}else if(T.tag===18){if(F=T.return,F===null)throw Error(s(341));F.lanes|=p,w=F.alternate,w!==null&&(w.lanes|=p),Z(F,p,r),F=null}else F=T.child;if(F!==null)F.return=T;else for(F=T;F!==null;){if(F===r){F=null;break}if(T=F.sibling,T!==null){T.return=F.return,F=T;break}F=F.return}T=F}}function tt(r,l,p,v){r=null;for(var T=l,w=!1;T!==null;){if(!w){if((T.flags&524288)!==0)w=!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 J=T.type;fi(T.pendingProps.value,F.value)||(r!==null?r.push(J):r=[J])}}else if(T===vc.current){if(F=T.alternate,F===null)throw Error(s(387));F.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(r!==null?r.push(rl):r=[rl])}T=T.return}r!==null&&St(l,r,p,v),l.flags|=262144}function Mt(r){for(r=r.firstContext;r!==null;){var l=r.context;if(!fi(ui?l._currentValue:l._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function We(r){Fn=r,Ls=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function G(r){return ne(Fn,r)}function O(r,l){return Fn===null&&We(r),ne(r,l)}function ne(r,l){var p=ui?l._currentValue:l._currentValue2;if(l={context:l,memoizedValue:p,next:null},Ls===null){if(r===null)throw Error(s(308));Ls=l,r.dependencies={lanes:0,firstContext:l},r.flags|=524288}else Ls=Ls.next=l;return p}function Se(){return{controller:new jg,data:new Map,refCount:0}}function Le(r){r.refCount--,r.refCount===0&&Vi($y,function(){r.controller.abort()})}function be(){}function ct(r){r!==Rn&&r.next===null&&(Rn===null?yc=Rn=r:Rn=Rn.next=r),gs=!0,ta||(ta=!0,lt())}function Ze(r,l){if(!eh&&gs){eh=!0;do for(var p=!1,v=yc;v!==null;){if(r!==0){var T=v.pendingLanes;if(T===0)var w=0;else{var F=v.suspendedLanes,J=v.pingedLanes;w=(1<<31-Ma(42|r)+1)-1,w&=T&~(F&~J),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(p=!0,ft(v,w))}else w=cn,w=E(v,v===en?w:0,v.cancelPendingCommit!==null||v.timeoutHandle!==ba),(w&3)===0||D(v,w)||(p=!0,ft(v,w));v=v.next}while(p);eh=!1}}function gt(){wt()}function wt(){gs=ta=!1;var r=0;vo!==0&&al()&&(r=vo);for(var l=ea(),p=null,v=yc;v!==null;){var T=v.next,w=Be(v,l);w===0?(v.next=null,p===null?yc=T:p.next=T,T===null&&(Rn=p)):(p=v,(r!==0||(w&3)!==0)&&(gs=!0)),v=T}bi!==0&&bi!==5||Ze(r),vo!==0&&(vo=0)}function Be(r,l){for(var p=r.suspendedLanes,v=r.pingedLanes,T=r.expirationTimes,w=r.pendingLanes&-62914561;0<w;){var F=31-Ma(w),J=1<<F,xe=T[F];xe===-1?((J&p)===0||(J&v)!==0)&&(T[F]=U(J,l)):xe<=l&&(r.expiredLanes|=J),w&=~J}if(l=en,p=cn,p=E(r,r===l?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==ba),v=r.callbackNode,p===0||r===l&&(Nn===2||Nn===9)||r.cancelPendingCommit!==null)return v!==null&&v!==null&&Zf(v),r.callbackNode=null,r.callbackPriority=0;if((p&3)===0||D(r,p)){if(l=p&-p,l===r.callbackPriority)return l;switch(v!==null&&Zf(v),ae(p)){case 2:case 8:p=Yg;break;case 32:p=pc;break;case 268435456:p=Qf;break;default:p=pc}return v=Xe.bind(null,r),p=dc(p,v),r.callbackPriority=l,r.callbackNode=p,l}return v!==null&&v!==null&&Zf(v),r.callbackPriority=2,r.callbackNode=null,2}function Xe(r,l){if(bi!==0&&bi!==5)return r.callbackNode=null,r.callbackPriority=0,null;var p=r.callbackNode;if(tr()&&r.callbackNode!==p)return null;var v=cn;return v=E(r,r===en?v:0,r.cancelPendingCommit!==null||r.timeoutHandle!==ba),v===0?null:(Ns(r,v,l),Be(r,ea()),r.callbackNode!=null&&r.callbackNode===p?Xe.bind(null,r):null)}function ft(r,l){if(tr())return null;Ns(r,l,!0)}function lt(){Bd?Fd(function(){(sn&6)!==0?dc(jf,gt):wt()}):dc(jf,gt)}function $e(){if(vo===0){var r=zr;r===0&&(r=Yf,Yf<<=1,(Yf&261888)===0&&(Yf=256)),vo=r}return vo}function Zt(r,l){if(au===null){var p=au=[];dp=0,zr=$e(),Di={status:"pending",value:void 0,then:function(v){p.push(v)}}}return dp++,l.then(te,te),l}function te(){if(--dp===0&&au!==null){Di!==null&&(Di.status="fulfilled");var r=au;au=null,zr=0,Di=null;for(var l=0;l<r.length;l++)(0,r[l])()}}function it(r,l){var p=[],v={status:"pending",value:null,reason:null,then:function(T){p.push(T)}};return r.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 r=yo.current;return r!==null?r:en.pooledCache}function st(r,l){l===null?A(yo,yo.current):A(yo,l.pool)}function Fe(){var r=Ge();return r===null?null:{parent:ui?jn._currentValue:jn._currentValue2,pool:r}}function Ne(r,l){if(fi(r,l))return!0;if(typeof r!="object"||r===null||typeof l!="object"||l===null)return!1;var p=Object.keys(r),v=Object.keys(l);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var T=p[v];if(!Ky.call(l,T)||!fi(r[T],l[T]))return!1}return!0}function je(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Bt(r,l,p){switch(p=r[p],p===void 0?r.push(l):p!==l&&(l.then(be,be),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw r=l.reason,Xi(r),r;default:if(typeof l.status=="string")l.then(be,be);else{if(r=en,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=l,r.status="pending",r.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 r=l.reason,Xi(r),r}throw ha=l,Ni}}function dn(r){try{var l=r._init;return l(r._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(ha=p,Ni):p}}function gn(){if(ha===null)throw Error(s(459));var r=ha;return ha=null,r}function Xi(r){if(r===Ni||r===ys)throw Error(s(483))}function va(r){var l=fl;return fl+=1,_o===null&&(_o=[]),Bt(_o,r,l)}function Zr(r,l){l=l.props.ref,r.ref=l!==void 0?l:null}function jr(r,l){throw l.$$typeof===$o?Error(s(525)):(r=Object.prototype.toString.call(l),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":r)))}function Vo(r){function l(ge,le){if(r){var _e=ge.deletions;_e===null?(ge.deletions=[le],ge.flags|=16):_e.push(le)}}function p(ge,le){if(!r)return null;for(;le!==null;)l(ge,le),le=le.sibling;return null}function v(ge){for(var le=new Map;ge!==null;)ge.key!==null?le.set(ge.key,ge):le.set(ge.index,ge),ge=ge.sibling;return le}function T(ge,le){return ge=Ga(ge,le),ge.index=0,ge.sibling=null,ge}function w(ge,le,_e){return ge.index=_e,r?(_e=ge.alternate,_e!==null?(_e=_e.index,_e<le?(ge.flags|=67108866,le):_e):(ge.flags|=67108866,le)):(ge.flags|=1048576,le)}function F(ge){return r&&ge.alternate===null&&(ge.flags|=67108866),ge}function J(ge,le,_e,Ye){return le===null||le.tag!==6?(le=wd(_e,ge.mode,Ye),le.return=ge,le):(le=T(le,_e),le.return=ge,le)}function xe(ge,le,_e,Ye){var Nt=_e.type;return Nt===tl?Qe(ge,le,_e.props.children,Ye,_e.key):le!==null&&(le.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===ua&&dn(Nt)===le.type)?(le=T(le,_e.props),Zr(le,_e),le.return=ge,le):(le=Rr(_e.type,_e.key,_e.props,null,ge.mode,Ye),Zr(le,_e),le.return=ge,le)}function ze(ge,le,_e,Ye){return le===null||le.tag!==4||le.stateNode.containerInfo!==_e.containerInfo||le.stateNode.implementation!==_e.implementation?(le=Rd(_e,ge.mode,Ye),le.return=ge,le):(le=T(le,_e.children||[]),le.return=ge,le)}function Qe(ge,le,_e,Ye,Nt){return le===null||le.tag!==7?(le=us(_e,ge.mode,Ye,Nt),le.return=ge,le):(le=T(le,_e),le.return=ge,le)}function ke(ge,le,_e){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=wd(""+le,ge.mode,_e),le.return=ge,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case nr:return _e=Rr(le.type,le.key,le.props,null,ge.mode,_e),Zr(_e,le),_e.return=ge,_e;case el:return le=Rd(le,ge.mode,_e),le.return=ge,le;case ua:return le=dn(le),ke(ge,le,_e)}if(ho(le)||_(le))return le=us(le,ge.mode,_e,null),le.return=ge,le;if(typeof le.then=="function")return ke(ge,va(le),_e);if(le.$$typeof===cs)return ke(ge,O(ge,le),_e);jr(ge,le)}return null}function dt(ge,le,_e,Ye){var Nt=le!==null?le.key:null;if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return Nt!==null?null:J(ge,le,""+_e,Ye);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case nr:return _e.key===Nt?xe(ge,le,_e,Ye):null;case el:return _e.key===Nt?ze(ge,le,_e,Ye):null;case ua:return _e=dn(_e),dt(ge,le,_e,Ye)}if(ho(_e)||_(_e))return Nt!==null?null:Qe(ge,le,_e,Ye,null);if(typeof _e.then=="function")return dt(ge,le,va(_e),Ye);if(_e.$$typeof===cs)return dt(ge,le,O(ge,_e),Ye);jr(ge,_e)}return null}function Gt(ge,le,_e,Ye,Nt){if(typeof Ye=="string"&&Ye!==""||typeof Ye=="number"||typeof Ye=="bigint")return ge=ge.get(_e)||null,J(le,ge,""+Ye,Nt);if(typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case nr:return ge=ge.get(Ye.key===null?_e:Ye.key)||null,xe(le,ge,Ye,Nt);case el:return ge=ge.get(Ye.key===null?_e:Ye.key)||null,ze(le,ge,Ye,Nt);case ua:return Ye=dn(Ye),Gt(ge,le,_e,Ye,Nt)}if(ho(Ye)||_(Ye))return ge=ge.get(_e)||null,Qe(le,ge,Ye,Nt,null);if(typeof Ye.then=="function")return Gt(ge,le,_e,va(Ye),Nt);if(Ye.$$typeof===cs)return Gt(ge,le,_e,O(le,Ye),Nt);jr(le,Ye)}return null}function pi(ge,le,_e,Ye){for(var Nt=null,ii=null,Lt=le,yn=le=0,ki=null;Lt!==null&&yn<_e.length;yn++){Lt.index>yn?(ki=Lt,Lt=null):ki=Lt.sibling;var Mn=dt(ge,Lt,_e[yn],Ye);if(Mn===null){Lt===null&&(Lt=ki);break}r&&Lt&&Mn.alternate===null&&l(ge,Lt),le=w(Mn,le,yn),ii===null?Nt=Mn:ii.sibling=Mn,ii=Mn,Lt=ki}if(yn===_e.length)return p(ge,Lt),un&&Ce(ge,yn),Nt;if(Lt===null){for(;yn<_e.length;yn++)Lt=ke(ge,_e[yn],Ye),Lt!==null&&(le=w(Lt,le,yn),ii===null?Nt=Lt:ii.sibling=Lt,ii=Lt);return un&&Ce(ge,yn),Nt}for(Lt=v(Lt);yn<_e.length;yn++)ki=Gt(Lt,ge,yn,_e[yn],Ye),ki!==null&&(r&&ki.alternate!==null&&Lt.delete(ki.key===null?yn:ki.key),le=w(ki,le,yn),ii===null?Nt=ki:ii.sibling=ki,ii=ki);return r&&Lt.forEach(function(Ss){return l(ge,Ss)}),un&&Ce(ge,yn),Nt}function hu(ge,le,_e,Ye){if(_e==null)throw Error(s(151));for(var Nt=null,ii=null,Lt=le,yn=le=0,ki=null,Mn=_e.next();Lt!==null&&!Mn.done;yn++,Mn=_e.next()){Lt.index>yn?(ki=Lt,Lt=null):ki=Lt.sibling;var Ss=dt(ge,Lt,Mn.value,Ye);if(Ss===null){Lt===null&&(Lt=ki);break}r&&Lt&&Ss.alternate===null&&l(ge,Lt),le=w(Ss,le,yn),ii===null?Nt=Ss:ii.sibling=Ss,ii=Ss,Lt=ki}if(Mn.done)return p(ge,Lt),un&&Ce(ge,yn),Nt;if(Lt===null){for(;!Mn.done;yn++,Mn=_e.next())Mn=ke(ge,Mn.value,Ye),Mn!==null&&(le=w(Mn,le,yn),ii===null?Nt=Mn:ii.sibling=Mn,ii=Mn);return un&&Ce(ge,yn),Nt}for(Lt=v(Lt);!Mn.done;yn++,Mn=_e.next())Mn=Gt(Lt,ge,yn,Mn.value,Ye),Mn!==null&&(r&&Mn.alternate!==null&&Lt.delete(Mn.key===null?yn:Mn.key),le=w(Mn,le,yn),ii===null?Nt=Mn:ii.sibling=Mn,ii=Mn);return r&&Lt.forEach(function(e_){return l(ge,e_)}),un&&Ce(ge,yn),Nt}function wo(ge,le,_e,Ye){if(typeof _e=="object"&&_e!==null&&_e.type===tl&&_e.key===null&&(_e=_e.props.children),typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case nr:e:{for(var Nt=_e.key;le!==null;){if(le.key===Nt){if(Nt=_e.type,Nt===tl){if(le.tag===7){p(ge,le.sibling),Ye=T(le,_e.props.children),Ye.return=ge,ge=Ye;break e}}else if(le.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===ua&&dn(Nt)===le.type){p(ge,le.sibling),Ye=T(le,_e.props),Zr(Ye,_e),Ye.return=ge,ge=Ye;break e}p(ge,le);break}else l(ge,le);le=le.sibling}_e.type===tl?(Ye=us(_e.props.children,ge.mode,Ye,_e.key),Ye.return=ge,ge=Ye):(Ye=Rr(_e.type,_e.key,_e.props,null,ge.mode,Ye),Zr(Ye,_e),Ye.return=ge,ge=Ye)}return F(ge);case el:e:{for(Nt=_e.key;le!==null;){if(le.key===Nt)if(le.tag===4&&le.stateNode.containerInfo===_e.containerInfo&&le.stateNode.implementation===_e.implementation){p(ge,le.sibling),Ye=T(le,_e.children||[]),Ye.return=ge,ge=Ye;break e}else{p(ge,le);break}else l(ge,le);le=le.sibling}Ye=Rd(_e,ge.mode,Ye),Ye.return=ge,ge=Ye}return F(ge);case ua:return _e=dn(_e),wo(ge,le,_e,Ye)}if(ho(_e))return pi(ge,le,_e,Ye);if(_(_e)){if(Nt=_(_e),typeof Nt!="function")throw Error(s(150));return _e=Nt.call(_e),hu(ge,le,_e,Ye)}if(typeof _e.then=="function")return wo(ge,le,va(_e),Ye);if(_e.$$typeof===cs)return wo(ge,le,O(ge,_e),Ye);jr(ge,_e)}return typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint"?(_e=""+_e,le!==null&&le.tag===6?(p(ge,le.sibling),Ye=T(le,_e),Ye.return=ge,ge=Ye):(p(ge,le),Ye=wd(_e,ge.mode,Ye),Ye.return=ge,ge=Ye),F(ge)):p(ge,le)}return function(ge,le,_e,Ye){try{fl=0;var Nt=wo(ge,le,_e,Ye);return _o=null,Nt}catch(Lt){if(Lt===Ni||Lt===ys)throw Lt;var ii=t(29,Lt,null,ge.mode);return ii.lanes=Ye,ii.return=ge,ii}}}function Qr(){for(var r=lr,l=hl=lr=0;l<r;){var p=ji[l];ji[l++]=null;var v=ji[l];ji[l++]=null;var T=ji[l];ji[l++]=null;var w=ji[l];if(ji[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}w!==0&&za(p,T,w)}}function _r(r,l,p,v){ji[lr++]=r,ji[lr++]=l,ji[lr++]=p,ji[lr++]=v,hl|=v,r.lanes|=v,r=r.alternate,r!==null&&(r.lanes|=v)}function ko(r,l,p,v){return _r(r,l,p,v),Qn(r)}function Ki(r,l){return _r(r,null,null,l),Qn(r)}function za(r,l,p){r.lanes|=p;var v=r.alternate;v!==null&&(v.lanes|=p);for(var T=!1,w=r.return;w!==null;)w.childLanes|=p,v=w.alternate,v!==null&&(v.childLanes|=p),w.tag===22&&(r=w.stateNode,r===null||r._visibility&1||(T=!0)),r=w,w=w.return;return r.tag===3?(w=r.stateNode,T&&l!==null&&(T=31-Ma(p),r=w.hiddenUpdates,v=r[T],v===null?r[T]=[l]:v.push(l),l.lane=p|536870912),w):null}function Qn(r){if(50<bn)throw bn=0,Ec=null,Error(s(185));for(var l=r.return;l!==null;)r=l,l=r.return;return r.tag===3?r.stateNode:null}function Ti(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pa(r,l){r=r.updateQueue,l.updateQueue===r&&(l.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ba(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Fa(r,l,p){var v=r.updateQueue;if(v===null)return null;if(v=v.shared,(sn&2)!==0){var T=v.pending;return T===null?l.next=l:(l.next=T.next,T.next=l),v.pending=l,l=Qn(r),za(r,null,p),l}return _r(r,v,l,p),Qn(r)}function Jr(r,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var v=l.lanes;v&=r.pendingLanes,p|=v,l.lanes=p,I(r,p)}}function Ho(r,l){var p=r.updateQueue,v=r.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var T=null,w=null;if(p=p.firstBaseUpdate,p!==null){do{var F={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};w===null?T=w=F:w=w.next=F,p=p.next}while(p!==null);w===null?T=w=l:w=w.next=l}else T=w=l;p={baseState:v.baseState,firstBaseUpdate:T,lastBaseUpdate:w,shared:v.shared,callbacks:v.callbacks},r.updateQueue=p;return}r=p.lastBaseUpdate,r===null?p.firstBaseUpdate=l:r.next=l,p.lastBaseUpdate=l}function Rs(){if(nh){var r=Di;if(r!==null)throw r}}function xr(r,l,p,v){nh=!1;var T=r.updateQueue;qa=!1;var w=T.firstBaseUpdate,F=T.lastBaseUpdate,J=T.shared.pending;if(J!==null){T.shared.pending=null;var xe=J,ze=xe.next;xe.next=null,F===null?w=ze:F.next=ze,F=xe;var Qe=r.alternate;Qe!==null&&(Qe=Qe.updateQueue,J=Qe.lastBaseUpdate,J!==F&&(J===null?Qe.firstBaseUpdate=ze:J.next=ze,Qe.lastBaseUpdate=xe))}if(w!==null){var ke=T.baseState;F=0,Qe=ze=xe=null,J=w;do{var dt=J.lane&-536870913,Gt=dt!==J.lane;if(Gt?(cn&dt)===dt:(v&dt)===dt){dt!==0&&dt===zr&&(nh=!0),Qe!==null&&(Qe=Qe.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var pi=r,hu=J;dt=l;var wo=p;switch(hu.tag){case 1:if(pi=hu.payload,typeof pi=="function"){ke=pi.call(wo,ke,dt);break e}ke=pi;break e;case 3:pi.flags=pi.flags&-65537|128;case 0:if(pi=hu.payload,dt=typeof pi=="function"?pi.call(wo,ke,dt):pi,dt==null)break e;ke=Df({},ke,dt);break e;case 2:qa=!0}}dt=J.callback,dt!==null&&(r.flags|=64,Gt&&(r.flags|=8192),Gt=T.callbacks,Gt===null?T.callbacks=[dt]:Gt.push(dt))}else Gt={lane:dt,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Qe===null?(ze=Qe=Gt,xe=ke):Qe=Qe.next=Gt,F|=dt;if(J=J.next,J===null){if(J=T.shared.pending,J===null)break;Gt=J,J=Gt.next,Gt.next=null,T.lastBaseUpdate=Gt,T.shared.pending=null}}while(!0);Qe===null&&(xe=ke),T.baseState=xe,T.firstBaseUpdate=ze,T.lastBaseUpdate=Qe,w===null&&(T.shared.lanes=0),Br|=F,r.lanes=F,r.memoizedState=ke}}function Sr(r,l){if(typeof r!="function")throw Error(s(191,r));r.call(l)}function br(r,l){var p=r.callbacks;if(p!==null)for(r.callbacks=null,r=0;r<p.length;r++)Sr(p[r],l)}function Kr(r,l){r=cr,A(xo,r),A(dl,l),cr=r|l.baseLanes}function Gs(){A(xo,cr),A(dl,dl.current)}function V(){cr=xo.current,M(dl),M(xo)}function ie(r){var l=r.alternate;A(ri,ri.current&1),A(Ta,r),Aa===null&&(l===null||dl.current!==null||l.memoizedState!==null)&&(Aa=r)}function ye(r){A(ri,ri.current),A(Ta,r),Aa===null&&(Aa=r)}function me(r){r.tag===22?(A(ri,ri.current),A(Ta,r),Aa===null&&(Aa=r)):oe()}function oe(){A(ri,ri.current),A(Ta,Ta.current)}function qe(r){M(Ta),Aa===r&&(Aa=null),M(ri)}function ht(r){for(var l=r;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||mo(p)||Bf(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===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function He(){throw Error(s(321))}function mt(r,l){if(l===null)return!1;for(var p=0;p<l.length&&p<r.length;p++)if(!fi(r[p],l[p]))return!1;return!0}function vt(r,l,p,v,T,w){return Pr=w,Wt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ct.H=r===null||r.memoizedState===null?ei:ur,pn=!1,w=p(v,T),pn=!1,jt&&(w=_t(l,p,v,T)),At(r),w}function At(r){Ct.H=Ya;var l=Et!==null&&Et.next!==null;if(Pr=0,Vt=Et=Wt=null,$t=!1,_s=0,Is=null,l)throw Error(s(300));r===null||Xn||(r=r.dependencies,r!==null&&Mt(r)&&(Xn=!0))}function _t(r,l,p,v){Wt=r;var T=0;do{if(jt&&(Is=null),_s=0,jt=!1,25<=T)throw Error(s(301));if(T+=1,Vt=Et=null,r.updateQueue!=null){var w=r.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}Ct.H=So,w=l(p,v)}while(jt);return w}function Ut(){var r=Ct.H,l=r.useState()[0];return l=typeof l.then=="function"?Ot(l):l,r=r.useState()[0],(Et!==null?Et.memoizedState:null)!==r&&(Wt.flags|=1024),l}function Sn(){var r=na!==0;return na=0,r}function zn(r,l,p){l.updateQueue=r.updateQueue,l.flags&=-2053,r.lanes&=~p}function Un(r){if($t){for(r=r.memoizedState;r!==null;){var l=r.queue;l!==null&&(l.pending=null),r=r.next}$t=!1}Pr=0,Vt=Et=Wt=null,jt=!1,_s=na=0,Is=null}function Ht(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Wt.memoizedState=Vt=r:Vt=Vt.next=r,Vt}function at(){if(Et===null){var r=Wt.alternate;r=r!==null?r.memoizedState:null}else r=Et.next;var l=Vt===null?Wt.memoizedState:Vt.next;if(l!==null)Vt=l,Et=r;else{if(r===null)throw Wt.alternate===null?Error(s(467)):Error(s(310));Et=r,r={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},Vt===null?Wt.memoizedState=Vt=r:Vt=Vt.next=r}return Vt}function vn(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ot(r){var l=_s;return _s+=1,Is===null&&(Is=[]),r=Bt(Is,r,l),l=Wt,(Vt===null?l.memoizedState:Vt.next)===null&&(l=l.alternate,Ct.H=l===null||l.memoizedState===null?ei:ur),r}function vi(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Ot(r);if(r.$$typeof===cs)return G(r)}throw Error(s(438,String(r)))}function Ds(r){var l=null,p=Wt.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var v=Wt.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=vn(),Wt.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(r),v=0;v<r;v++)p[v]=Nd;return l.index++,p}function Gn(r,l){return typeof l=="function"?l(r):l}function sa(r){var l=at();return En(l,Et,r)}function En(r,l,p){var v=r.queue;if(v===null)throw Error(s(311));v.lastRenderedReducer=p;var T=r.baseQueue,w=v.pending;if(w!==null){if(T!==null){var F=T.next;T.next=w.next,w.next=F}l.baseQueue=T=w,v.pending=null}if(w=r.baseState,T===null)r.memoizedState=w;else{l=T.next;var J=F=null,xe=null,ze=l,Qe=!1;do{var ke=ze.lane&-536870913;if(ke!==ze.lane?(cn&ke)===ke:(Pr&ke)===ke){var dt=ze.revertLane;if(dt===0)xe!==null&&(xe=xe.next={lane:0,revertLane:0,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),ke===zr&&(Qe=!0);else if((Pr&dt)===dt){ze=ze.next,dt===zr&&(Qe=!0);continue}else ke={lane:0,revertLane:ze.revertLane,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},xe===null?(J=xe=ke,F=w):xe=xe.next=ke,Wt.lanes|=dt,Br|=dt;ke=ze.action,pn&&p(w,ke),w=ze.hasEagerState?ze.eagerState:p(w,ke)}else dt={lane:ke,revertLane:ze.revertLane,gesture:ze.gesture,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},xe===null?(J=xe=dt,F=w):xe=xe.next=dt,Wt.lanes|=ke,Br|=ke;ze=ze.next}while(ze!==null&&ze!==l);if(xe===null?F=w:xe.next=J,!fi(w,r.memoizedState)&&(Xn=!0,Qe&&(p=Di,p!==null)))throw p;r.memoizedState=w,r.baseState=F,r.baseQueue=xe,v.lastRenderedState=w}return T===null&&(v.lanes=0),[r.memoizedState,v.dispatch]}function Ai(r){var l=at(),p=l.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=r;var v=p.dispatch,T=p.pending,w=l.memoizedState;if(T!==null){p.pending=null;var F=T=T.next;do w=r(w,F.action),F=F.next;while(F!==T);fi(w,l.memoizedState)||(Xn=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),p.lastRenderedState=w}return[w,v]}function yi(r,l,p){var v=Wt,T=at(),w=un;if(w){if(p===void 0)throw Error(s(407));p=p()}else p=l();var F=!fi((Et||T).memoizedState,p);if(F&&(T.memoizedState=p,Xn=!0),T=T.queue,Ul(Go.bind(null,v,T,r),[r]),T.getSnapshot!==l||F||Vt!==null&&Vt.memoizedState.tag&1){if(v.flags|=2048,Va(9,{destroy:void 0},Oi.bind(null,v,T,p,l),null),en===null)throw Error(s(349));w||(Pr&127)!==0||Ii(v,l,p)}return p}function Ii(r,l,p){r.flags|=16384,r={getSnapshot:l,value:p},l=Wt.updateQueue,l===null?(l=vn(),Wt.updateQueue=l,l.stores=[r]):(p=l.stores,p===null?l.stores=[r]:p.push(r))}function Oi(r,l,p,v){l.value=p,l.getSnapshot=v,is(l)&&Rm(r)}function Go(r,l,p){return p(function(){is(l)&&Rm(r)})}function is(r){var l=r.getSnapshot;r=r.value;try{var p=l();return!fi(r,p)}catch{return!0}}function Rm(r){var l=Ki(r,2);l!==null&&Kn(l,r,2)}function nd(r){var l=Ht();if(typeof r=="function"){var p=r;if(r=p(),pn){$(!0);try{p()}finally{$(!1)}}}return l.memoizedState=l.baseState=r,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:r},l}function Vu(r,l,p,v){return r.baseState=p,En(r,Et,typeof v=="function"?v:Gn)}function Mr(r,l,p,v,T){if(cf(r))throw Error(s(485));if(r=l.action,r!==null){var w={payload:T,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(F){w.listeners.push(F)}};Ct.T!==null?p(!0):w.isTransition=!1,v(w),p=l.pending,p===null?(w.next=l.pending=w,nf(l,w)):(w.next=p.next,l.pending=p.next=w)}}function nf(r,l){var p=l.action,v=l.payload,T=r.state;if(l.isTransition){var w=Ct.T,F={};Ct.T=F;try{var J=p(T,v),xe=Ct.S;xe!==null&&xe(F,J),af(r,l,J)}catch(ze){$r(r,l,ze)}finally{w!==null&&F.types!==null&&(w.types=F.types),Ct.T=w}}else try{w=p(T,v),af(r,l,w)}catch(ze){$r(r,l,ze)}}function af(r,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(v){Xo(r,l,v)},function(v){return $r(r,l,v)}):Xo(r,l,p)}function Xo(r,l,p){l.status="fulfilled",l.value=p,id(l),r.state=p,l=r.pending,l!==null&&(p=l.next,p===l?r.pending=null:(p=p.next,l.next=p,nf(r,p)))}function $r(r,l,p){var v=r.pending;if(r.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=p,id(l),l=l.next;while(l!==v)}r.action=null}function id(r){r=r.listeners;for(var l=0;l<r.length;l++)(0,r[l])()}function sf(r,l){return l}function ad(r,l){if(un){var p=en.formState;if(p!==null){e:{var v=Wt;if(un){if(Zn){var T=Mg(Zn,fa);if(T){Zn=Eg(T),v=Qd(T);break e}}et(v)}v=!1}v&&(l=p[0])}}p=Ht(),p.memoizedState=p.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sf,lastRenderedState:l},p.queue=v,p=Om.bind(null,Wt,v),v.dispatch=p,v=nd(!1);var w=uf.bind(null,Wt,!1,v.queue);return v=Ht(),T={state:l,dispatch:null,action:r,pending:null},v.queue=T,p=Mr.bind(null,Wt,T,w,p),T.dispatch=p,v.memoizedState=r,[l,p,!1]}function Dl(r){var l=at();return Xs(l,Et,r)}function Xs(r,l,p){if(l=En(r,l,sf)[0],r=sa(Gn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=Ot(l)}catch(F){throw F===Ni?ys:F}else v=l;l=at();var T=l.queue,w=T.dispatch;return p!==l.memoizedState&&(Wt.flags|=2048,Va(9,{destroy:void 0},sd.bind(null,T,p),null)),[v,w,r]}function sd(r,l){r.action=l}function Nl(r){var l=at(),p=Et;if(p!==null)return Xs(l,p,r);at(),l=l.memoizedState,p=at();var v=p.queue.dispatch;return p.memoizedState=r,[l,v,!1]}function Va(r,l,p,v){return r={tag:r,create:p,deps:v,inst:l,next:null},l=Wt.updateQueue,l===null&&(l=vn(),Wt.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=r.next=r:(v=p.next,p.next=r,r.next=v,l.lastEffect=r),r}function rf(){return at().memoizedState}function Wo(r,l,p,v){var T=Ht();Wt.flags|=r,T.memoizedState=Va(1|l,{destroy:void 0},p,v===void 0?null:v)}function ku(r,l,p,v){var T=at();v=v===void 0?null:v;var w=T.memoizedState.inst;Et!==null&&v!==null&&mt(v,Et.memoizedState.deps)?T.memoizedState=Va(l,w,p,v):(Wt.flags|=r,T.memoizedState=Va(1|l,w,p,v))}function Hu(r,l){Wo(8390656,8,r,l)}function Ul(r,l){ku(2048,8,r,l)}function Dm(r){Wt.flags|=4;var l=Wt.updateQueue;if(l===null)l=vn(),Wt.updateQueue=l,l.events=[r];else{var p=l.events;p===null?l.events=[r]:p.push(r)}}function ra(r){var l=at().memoizedState;return Dm({ref:l,nextImpl:r}),function(){if((sn&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}function eo(r,l){return ku(4,2,r,l)}function Gu(r,l){return ku(4,4,r,l)}function Ll(r,l){if(typeof l=="function"){r=r();var p=l(r);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return r=r(),l.current=r,function(){l.current=null}}function Nm(r,l,p){p=p!=null?p.concat([r]):null,ku(4,4,Ll.bind(null,l,r),p)}function Xu(){}function of(r,l){var p=at();l=l===void 0?null:l;var v=p.memoizedState;return l!==null&&mt(l,v[1])?v[0]:(p.memoizedState=[r,l],r)}function Il(r,l){var p=at();l=l===void 0?null:l;var v=p.memoizedState;if(l!==null&&mt(l,v[1]))return v[0];if(v=r(),pn){$(!0);try{r()}finally{$(!1)}}return p.memoizedState=[v,l],v}function Ol(r,l,p){return p===void 0||(Pr&1073741824)!==0&&(cn&261930)===0?r.memoizedState=l:(r.memoizedState=p,r=Ar(),Wt.lanes|=r,Br|=r,p)}function rd(r,l,p,v){return fi(p,l)?p:dl.current!==null?(r=Ol(r,p,v),fi(r,l)||(Xn=!0),r):(Pr&42)===0||(Pr&1073741824)!==0&&(cn&261930)===0?(Xn=!0,r.memoizedState=p):(r=Ar(),Wt.lanes|=r,Br|=r,l)}function Um(r,l,p,v,T){var w=fs();ln(w!==0&&8>w?w:8);var F=Ct.T,J={};Ct.T=J,uf(r,!1,l,p);try{var xe=T(),ze=Ct.S;if(ze!==null&&ze(J,xe),xe!==null&&typeof xe=="object"&&typeof xe.then=="function"){var Qe=it(xe,v);Wu(r,l,Qe,qn(r))}else Wu(r,l,v,qn(r))}catch(ke){Wu(r,l,{then:function(){},status:"rejected",reason:ke},qn())}finally{ln(w),F!==null&&J.types!==null&&(F.types=J.types),Ct.T=F}}function Lm(r){var l=r.memoizedState;if(l!==null)return l;l={memoizedState:sl,baseState:sl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:sl},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:p},next:null},r.memoizedState=l,r=r.alternate,r!==null&&(r.memoizedState=l),l}function od(){return G(rl)}function lf(){return at().memoizedState}function Im(){return at().memoizedState}function Hy(r){for(var l=r.return;l!==null;){switch(l.tag){case 24:case 3:var p=qn();r=Ba(p);var v=Fa(l,r,p);v!==null&&(Kn(v,l,p),Jr(v,l,p)),l={cache:Se()},r.payload=l;return}l=l.return}}function Gy(r,l,p){var v=qn();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},cf(r)?zm(l,p):(p=ko(r,l,p,v),p!==null&&(Kn(p,r,v),Pm(p,l,v)))}function Om(r,l,p){var v=qn();Wu(r,l,p,v)}function Wu(r,l,p,v){var T={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(cf(r))zm(l,T);else{var w=r.alternate;if(r.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var F=l.lastRenderedState,J=w(F,p);if(T.hasEagerState=!0,T.eagerState=J,fi(J,F))return _r(r,l,T,0),en===null&&Qr(),!1}catch{}if(p=ko(r,l,T,v),p!==null)return Kn(p,r,v),Pm(p,l,v),!0}return!1}function uf(r,l,p,v){if(v={lane:2,revertLane:$e(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},cf(r)){if(l)throw Error(s(479))}else l=ko(r,p,v,2),l!==null&&Kn(l,r,2)}function cf(r){var l=r.alternate;return r===Wt||l!==null&&l===Wt}function zm(r,l){jt=$t=!0;var p=r.pending;p===null?l.next=l:(l.next=p.next,p.next=l),r.pending=l}function Pm(r,l,p){if((p&4194048)!==0){var v=l.lanes;v&=r.pendingLanes,p|=v,l.lanes=p,I(r,p)}}function ld(r,l,p,v){l=r.memoizedState,p=p(v,l),p=p==null?l:Df({},l,p),r.memoizedState=p,r.lanes===0&&(r.updateQueue.baseState=p)}function ff(r,l,p,v,T,w,F){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(v,w,F):l.prototype&&l.prototype.isPureReactComponent?!Ne(p,v)||!Ne(T,w):!0}function Bm(r,l,p,v){r=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,v),l.state!==r&&_c.enqueueReplaceState(l,l.state,null)}function qo(r,l){var p=l;if("ref"in l){p={};for(var v in l)v!=="ref"&&(p[v]=l[v])}if(r=r.defaultProps){p===l&&(p=Df({},p));for(var T in r)p[T]===void 0&&(p[T]=r[T])}return p}function hf(r,l){try{var p=r.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function ud(r,l,p){try{var v=r.onCaughtError;v(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function cd(r,l,p){return p=Ba(p),p.tag=3,p.payload={element:null},p.callback=function(){hf(r,l)},p}function Fm(r){return r=Ba(r),r.tag=3,r}function Vm(r,l,p,v){var T=p.type.getDerivedStateFromError;if(typeof T=="function"){var w=v.value;r.payload=function(){return T(w)},r.callback=function(){ud(l,p,v)}}var F=p.stateNode;F!==null&&typeof F.componentDidCatch=="function"&&(r.callback=function(){ud(l,p,v),typeof T!="function"&&(Fr===null?Fr=new Set([this]):Fr.add(this));var J=v.stack;this.componentDidCatch(v.value,{componentStack:J!==null?J:""})})}function Xy(r,l,p,v,T){if(p.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=p.alternate,l!==null&&tt(l,p,T,!0),p=Ta.current,p!==null){switch(p.tag){case 31:case 13:return Aa===null?ql():p.alternate===null&&ni===0&&(ni=3),p.flags&=-257,p.flags|=65536,p.lanes=T,v===or?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([v]):l.add(v),jl(r,v,T)),!1;case 22:return p.flags|=65536,v===or?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)),jl(r,v,T)),!1}throw Error(s(435,p.tag))}return jl(r,v,T),ql(),!1}if(un)return l=Ta.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=T,v!==$f&&(r=Error(s(422),{cause:v}),Ve(Ae(r,p)))):(v!==$f&&(l=Error(s(423),{cause:v}),Ve(Ae(l,p))),r=r.current.alternate,r.flags|=65536,T&=-T,r.lanes|=T,v=Ae(v,p),T=cd(r.stateNode,v,T),Ho(r,T),ni!==4&&(ni=2)),!1;var w=Error(s(520),{cause:v});if(w=Ae(w,p),Sc===null?Sc=[w]:Sc.push(w),ni!==4&&(ni=2),l===null)return!0;v=Ae(v,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,r=T&-T,p.lanes|=r,r=cd(p.stateNode,v,r),Ho(p,r),!1;case 1:if(l=p.type,w=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Fr===null||!Fr.has(w))))return p.flags|=65536,T&=-T,p.lanes|=T,T=Fm(T),Vm(T,r,p,v),Ho(p,T),!1}p=p.return}while(p!==null);return!1}function Wi(r,l,p,v){l.child=r===null?pp(l,null,p,v):Zi(l,r.child,p,v)}function km(r,l,p,v,T){p=p.render;var w=l.ref;if("ref"in v){var F={};for(var J in v)J!=="ref"&&(F[J]=v[J])}else F=v;return We(l),v=vt(r,l,p,F,w,T),J=Sn(),r!==null&&!Xn?(zn(r,l,T),Ws(r,l,T)):(un&&J&&se(l),l.flags|=1,Wi(r,l,v,T),l.child)}function Hm(r,l,p,v,T){if(r===null){var w=p.type;return typeof w=="function"&&!Jo(w)&&w.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=w,Gm(r,l,w,v,T)):(r=Rr(p.type,null,v,l,l.mode,T),r.ref=l.ref,r.return=l,l.child=r)}if(w=r.child,!Yu(r,T)){var F=w.memoizedProps;if(p=p.compare,p=p!==null?p:Ne,p(F,v)&&r.ref===l.ref)return Ws(r,l,T)}return l.flags|=1,r=Ga(w,v),r.ref=l.ref,r.return=l,l.child=r}function Gm(r,l,p,v,T){if(r!==null){var w=r.memoizedProps;if(Ne(w,v)&&r.ref===l.ref)if(Xn=!1,l.pendingProps=v=w,Yu(r,T))(r.flags&131072)!==0&&(Xn=!0);else return l.lanes=r.lanes,Ws(r,l,T)}return pf(r,l,p,v,T)}function Xm(r,l,p,v){var T=v.children,w=r!==null?r.memoizedState:null;if(r===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((l.flags&128)!==0){if(w=w!==null?w.baseLanes|p:p,r!==null){for(v=l.child=r.child,T=0;v!==null;)T=T|v.lanes|v.childLanes,v=v.sibling;v=T&~w}else v=0,l.child=null;return zl(r,l,w,p,v)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},r!==null&&st(l,w!==null?w.cachePool:null),w!==null?Kr(l,w):Gs(),me(l);else return v=l.lanes=536870912,zl(r,l,w!==null?w.baseLanes|p:p,p,v)}else w!==null?(st(l,w.cachePool),Kr(l,w),oe(),l.memoizedState=null):(r!==null&&st(l,null),Gs(),oe());return Wi(r,l,T,p),l.child}function Yo(r,l){return r!==null&&r.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function zl(r,l,p,v,T){var w=Ge();return w=w===null?null:{parent:ui?jn._currentValue:jn._currentValue2,pool:w},l.memoizedState={baseLanes:p,cachePool:w},r!==null&&st(l,null),Gs(),me(l),r!==null&&tt(r,l,v,!0),l.childLanes=T,null}function df(r,l){return l=to({mode:l.mode,children:l.children},r.mode),l.ref=r.ref,r.child=l,l.return=r,l}function fd(r,l,p){return Zi(l,r.child,null,p),r=df(l,l.pendingProps),r.flags|=2,qe(l),l.memoizedState=null,r}function Wm(r,l,p){var v=l.pendingProps,T=(l.flags&128)!==0;if(l.flags&=-129,r===null){if(un){if(v.mode==="hidden")return r=df(l,v),l.lanes=536870912,Yo(null,r);if(ye(l),(r=Zn)?(r=Kd(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:ps!==null?{id:qi,overflow:Us}:null,retryLane:536870912,hydrationErrors:null},p=Cd(r),p.return=l,l.child=p,Ri=l,Zn=null)):r=null,r===null)throw et(l);return l.lanes=536870912,null}return df(l,v)}var w=r.memoizedState;if(w!==null){var F=w.dehydrated;if(ye(l),T)if(l.flags&256)l.flags&=-257,l=fd(r,l,p);else if(l.memoizedState!==null)l.child=r.child,l.flags|=128,l=null;else throw Error(s(558));else if(Xn||tt(r,l,p,!1),T=(p&r.childLanes)!==0,Xn||T){if(v=en,v!==null&&(F=z(v,p),F!==0&&F!==w.retryLane))throw w.retryLane=F,Ki(r,F),Kn(v,r,F),da;ql(),l=fd(r,l,p)}else r=w.treeContext,Yn&&(Zn=Cg(F),Ri=l,un=!0,rr=null,fa=!1,r!==null&&Oe(l,r)),l=df(l,v),l.flags|=4096;return l}return r=Ga(r.child,{mode:v.mode,children:v.children}),r.ref=l.ref,l.child=r,r.return=l,r}function qu(r,l){var p=l.ref;if(p===null)r!==null&&r.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(s(284));(r===null||r.ref!==p)&&(l.flags|=4194816)}}function pf(r,l,p,v,T){return We(l),p=vt(r,l,p,v,void 0,T),v=Sn(),r!==null&&!Xn?(zn(r,l,T),Ws(r,l,T)):(un&&v&&se(l),l.flags|=1,Wi(r,l,p,T),l.child)}function hd(r,l,p,v,T,w){return We(l),l.updateQueue=null,p=_t(l,v,p,T),At(r),v=Sn(),r!==null&&!Xn?(zn(r,l,w),Ws(r,l,w)):(un&&v&&se(l),l.flags|=1,Wi(r,l,p,w),l.child)}function Zo(r,l,p,v,T){if(We(l),l.stateNode===null){var w=ir,F=p.contextType;typeof F=="object"&&F!==null&&(w=G(F)),w=new p(v,w),l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=_c,l.stateNode=w,w._reactInternals=l,w=l.stateNode,w.props=v,w.state=l.memoizedState,w.refs={},Ti(l),F=p.contextType,w.context=typeof F=="object"&&F!==null?G(F):ir,w.state=l.memoizedState,F=p.getDerivedStateFromProps,typeof F=="function"&&(ld(l,p,F,v),w.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(F=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),F!==w.state&&_c.enqueueReplaceState(w,w.state,null),xr(l,v,w,T),Rs(),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(r===null){w=l.stateNode;var J=l.memoizedProps,xe=qo(p,J);w.props=xe;var ze=w.context,Qe=p.contextType;F=ir,typeof Qe=="object"&&Qe!==null&&(F=G(Qe));var ke=p.getDerivedStateFromProps;Qe=typeof ke=="function"||typeof w.getSnapshotBeforeUpdate=="function",J=l.pendingProps!==J,Qe||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(J||ze!==F)&&Bm(l,w,v,F),qa=!1;var dt=l.memoizedState;w.state=dt,xr(l,v,w,T),Rs(),ze=l.memoizedState,J||dt!==ze||qa?(typeof ke=="function"&&(ld(l,p,ke,v),ze=l.memoizedState),(xe=qa||ff(l,p,xe,v,dt,ze,F))?(Qe||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(l.flags|=4194308)):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=ze),w.props=v,w.state=ze,w.context=F,v=xe):(typeof w.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{w=l.stateNode,Pa(r,l),F=l.memoizedProps,Qe=qo(p,F),w.props=Qe,ke=l.pendingProps,dt=w.context,ze=p.contextType,xe=ir,typeof ze=="object"&&ze!==null&&(xe=G(ze)),J=p.getDerivedStateFromProps,(ze=typeof J=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(F!==ke||dt!==xe)&&Bm(l,w,v,xe),qa=!1,dt=l.memoizedState,w.state=dt,xr(l,v,w,T),Rs();var Gt=l.memoizedState;F!==ke||dt!==Gt||qa||r!==null&&r.dependencies!==null&&Mt(r.dependencies)?(typeof J=="function"&&(ld(l,p,J,v),Gt=l.memoizedState),(Qe=qa||ff(l,p,Qe,v,dt,Gt,xe)||r!==null&&r.dependencies!==null&&Mt(r.dependencies))?(ze||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(v,Gt,xe),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(v,Gt,xe)),typeof w.componentDidUpdate=="function"&&(l.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof w.componentDidUpdate!="function"||F===r.memoizedProps&&dt===r.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||F===r.memoizedProps&&dt===r.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=Gt),w.props=v,w.state=Gt,w.context=xe,v=Qe):(typeof w.componentDidUpdate!="function"||F===r.memoizedProps&&dt===r.memoizedState||(l.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||F===r.memoizedProps&&dt===r.memoizedState||(l.flags|=1024),v=!1)}return w=v,qu(r,l),v=(l.flags&128)!==0,w||v?(w=l.stateNode,p=v&&typeof p.getDerivedStateFromError!="function"?null:w.render(),l.flags|=1,r!==null&&v?(l.child=Zi(l,r.child,null,T),l.child=Zi(l,null,p,T)):Wi(r,l,p,T),l.memoizedState=w.state,r=l.child):r=Ws(r,l,T),r}function qm(r,l,p,v){return Dt(),l.flags|=256,Wi(r,l,p,v),l.child}function dd(r){return{baseLanes:r,cachePool:Fe()}}function pd(r,l,p){return r=r!==null?r.childLanes&~p:0,l&&(r|=pa),r}function md(r,l,p){var v=l.pendingProps,T=!1,w=(l.flags&128)!==0,F;if((F=w)||(F=r!==null&&r.memoizedState===null?!1:(ri.current&2)!==0),F&&(T=!0,l.flags&=-129),F=(l.flags&32)!==0,l.flags&=-33,r===null){if(un){if(T?ie(l):oe(),(r=Zn)?(r=Ug(r,fa),r!==null&&(l.memoizedState={dehydrated:r,treeContext:ps!==null?{id:qi,overflow:Us}:null,retryLane:536870912,hydrationErrors:null},p=Cd(r),p.return=l,l.child=p,Ri=l,Zn=null)):r=null,r===null)throw et(l);return Bf(r)?l.lanes=32:l.lanes=536870912,null}var J=v.children;return v=v.fallback,T?(oe(),T=l.mode,J=to({mode:"hidden",children:J},T),v=us(v,T,p,null),J.return=l,v.return=l,J.sibling=v,l.child=J,v=l.child,v.memoizedState=dd(p),v.childLanes=pd(r,F,p),l.memoizedState=pl,Yo(null,v)):(ie(l),mf(l,J))}var xe=r.memoizedState;if(xe!==null&&(J=xe.dehydrated,J!==null)){if(w)l.flags&256?(ie(l),l.flags&=-257,l=jo(r,l,p)):l.memoizedState!==null?(oe(),l.child=r.child,l.flags|=128,l=null):(oe(),J=v.fallback,T=l.mode,v=to({mode:"visible",children:v.children},T),J=us(J,T,p,null),J.flags|=2,v.return=l,J.return=l,v.sibling=J,l.child=v,Zi(l,r.child,null,p),v=l.child,v.memoizedState=dd(p),v.childLanes=pd(r,F,p),l.memoizedState=pl,l=Yo(null,v));else if(ie(l),Bf(J))F=Ff(J).digest,v=Error(s(419)),v.stack="",v.digest=F,Ve({value:v,source:null,stack:null}),l=jo(r,l,p);else if(Xn||tt(r,l,p,!1),F=(p&r.childLanes)!==0,Xn||F){if(F=en,F!==null&&(v=z(F,p),v!==0&&v!==xe.retryLane))throw xe.retryLane=v,Ki(r,v),Kn(F,r,v),da;mo(J)||ql(),l=jo(r,l,p)}else mo(J)?(l.flags|=192,l.child=r.child,l=null):(r=xe.treeContext,Yn&&(Zn=Rg(J),Ri=l,un=!0,rr=null,fa=!1,r!==null&&Oe(l,r)),l=mf(l,v.children),l.flags|=4096);return l}return T?(oe(),J=v.fallback,T=l.mode,xe=r.child,w=xe.sibling,v=Ga(xe,{mode:"hidden",children:v.children}),v.subtreeFlags=xe.subtreeFlags&65011712,w!==null?J=Ga(w,J):(J=us(J,T,p,null),J.flags|=2),J.return=l,v.return=l,v.sibling=J,l.child=v,Yo(null,v),v=l.child,J=r.child.memoizedState,J===null?J=dd(p):(T=J.cachePool,T!==null?(xe=ui?jn._currentValue:jn._currentValue2,T=T.parent!==xe?{parent:xe,pool:xe}:T):T=Fe(),J={baseLanes:J.baseLanes|p,cachePool:T}),v.memoizedState=J,v.childLanes=pd(r,F,p),l.memoizedState=pl,Yo(r.child,v)):(ie(l),p=r.child,r=p.sibling,p=Ga(p,{mode:"visible",children:v.children}),p.return=l,p.sibling=null,r!==null&&(F=l.deletions,F===null?(l.deletions=[r],l.flags|=16):F.push(r)),l.child=p,l.memoizedState=null,p)}function mf(r,l){return l=to({mode:"visible",children:l},r.mode),l.return=r,r.child=l}function to(r,l){return r=t(22,r,null,l),r.lanes=0,r}function jo(r,l,p){return Zi(l,r.child,null,p),r=mf(l,l.pendingProps.children),r.flags|=2,l.memoizedState=null,r}function Ym(r,l,p){r.lanes|=l;var v=r.alternate;v!==null&&(v.lanes|=l),Z(r.return,l,p)}function Pl(r,l,p,v,T,w){var F=r.memoizedState;F===null?r.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:T,treeForkCount:w}:(F.isBackwards=l,F.rendering=null,F.renderingStartTime=0,F.last=v,F.tail=p,F.tailMode=T,F.treeForkCount=w)}function gd(r,l,p){var v=l.pendingProps,T=v.revealOrder,w=v.tail;v=v.children;var F=ri.current,J=(F&2)!==0;if(J?(F=F&1|2,l.flags|=128):F&=1,A(ri,F),Wi(r,l,v,p),v=un?gc:0,!J&&r!==null&&(r.flags&128)!==0)e:for(r=l.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Ym(r,p,l);else if(r.tag===19)Ym(r,p,l);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===l)break e;for(;r.sibling===null;){if(r.return===null||r.return===l)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(T){case"forwards":for(p=l.child,T=null;p!==null;)r=p.alternate,r!==null&&ht(r)===null&&(T=p),p=p.sibling;p=T,p===null?(T=l.child,l.child=null):(T=p.sibling,p.sibling=null),Pl(l,!1,T,p,w,v);break;case"backwards":case"unstable_legacy-backwards":for(p=null,T=l.child,l.child=null;T!==null;){if(r=T.alternate,r!==null&&ht(r)===null){l.child=T;break}r=T.sibling,T.sibling=p,p=T,T=r}Pl(l,!0,p,null,w,v);break;case"together":Pl(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function Ws(r,l,p){if(r!==null&&(l.dependencies=r.dependencies),Br|=l.lanes,(p&l.childLanes)===0)if(r!==null){if(tt(r,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(r!==null&&l.child!==r.child)throw Error(s(153));if(l.child!==null){for(r=l.child,p=Ga(r,r.pendingProps),l.child=p,p.return=l;r.sibling!==null;)r=r.sibling,p=p.sibling=Ga(r,r.pendingProps),p.return=l;p.sibling=null}return l.child}function Yu(r,l){return(r.lanes&l)!==0?!0:(r=r.dependencies,!!(r!==null&&Mt(r)))}function vd(r,l,p){switch(l.tag){case 3:nt(l,l.stateNode.containerInfo),Ue(l,jn,r.memoizedState.cache),Dt();break;case 27:case 5:Te(l);break;case 4:nt(l,l.stateNode.containerInfo);break;case 10:Ue(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,ye(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(ie(l),l.flags|=128,null):(p&l.child.childLanes)!==0?md(r,l,p):(ie(l),r=Ws(r,l,p),r!==null?r.sibling:null);ie(l);break;case 19:var T=(r.flags&128)!==0;if(v=(p&l.childLanes)!==0,v||(tt(r,l,p,!1),v=(p&l.childLanes)!==0),T){if(v)return gd(r,l,p);l.flags|=128}if(T=l.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),A(ri,ri.current),v)break;return null;case 22:return l.lanes=0,Xm(r,l,p,l.pendingProps);case 24:Ue(l,jn,r.memoizedState.cache)}return Ws(r,l,p)}function yd(r,l,p){if(r!==null)if(r.memoizedProps!==l.pendingProps)Xn=!0;else{if(!Yu(r,p)&&(l.flags&128)===0)return Xn=!1,vd(r,l,p);Xn=(r.flags&131072)!==0}else Xn=!1,un&&(l.flags&1048576)!==0&&X(l,gc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(r=dn(l.elementType),l.type=r,typeof r=="function")Jo(r)?(v=qo(r,v),l.tag=1,l=Zo(null,l,r,v,p)):(l.tag=0,l=pf(null,l,r,v,p));else{if(r!=null){var T=r.$$typeof;if(T===Ql){l.tag=11,l=km(null,l,r,v,p);break e}else if(T===Uf){l.tag=14,l=Hm(null,l,r,v,p);break e}}throw l=x(r)||r,Error(s(306,l,""))}}return l;case 0:return pf(r,l,l.type,l.pendingProps,p);case 1:return v=l.type,T=qo(v,l.pendingProps),Zo(r,l,v,T,p);case 3:e:{if(nt(l,l.stateNode.containerInfo),r===null)throw Error(s(387));var w=l.pendingProps;T=l.memoizedState,v=T.element,Pa(r,l),xr(l,w,null,p);var F=l.memoizedState;if(w=F.cache,Ue(l,jn,w),w!==T.cache&&St(l,[jn],p,!0),Rs(),w=F.element,Yn&&T.isDehydrated)if(T={element:w,isDehydrated:!1,cache:F.cache},l.updateQueue.baseState=T,l.memoizedState=T,l.flags&256){l=qm(r,l,w,p);break e}else if(w!==v){v=Ae(Error(s(424)),l),Ve(v),l=qm(r,l,w,p);break e}else for(Yn&&(Zn=wg(l.stateNode.containerInfo),Ri=l,un=!0,rr=null,fa=!0),p=pp(l,null,w,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Dt(),w===v){l=Ws(r,l,p);break e}Wi(r,l,w,p)}l=l.child}return l;case 26:if(hs)return qu(r,l),r===null?(p=ip(l.type,null,l.pendingProps,null))?l.memoizedState=p:un||(l.stateNode=Gf(l.type,l.pendingProps,Yi.current,l)):l.memoizedState=ip(l.type,r.memoizedProps,l.pendingProps,r.memoizedState),null;case 27:if(Ci)return Te(l),r===null&&Ci&&un&&(v=l.stateNode=Xf(l.type,l.pendingProps,Yi.current,Fi.current,!1),Ri=l,fa=!0,Zn=Jd(l.type,v,Zn)),Wi(r,l,l.pendingProps.children,p),qu(r,l),r===null&&(l.flags|=4194304),l.child;case 5:return r===null&&un&&(kg(l.type,l.pendingProps,Fi.current),(T=v=Zn)&&(v=Dg(v,l.type,l.pendingProps,fa),v!==null?(l.stateNode=v,Ri=l,Zn=Ag(v),fa=!1,T=!0):T=!1),T||et(l)),Te(l),T=l.type,w=l.pendingProps,F=r!==null?r.memoizedProps:null,v=w.children,ca(T,w)?v=null:F!==null&&ca(T,F)&&(l.flags|=32),l.memoizedState!==null&&(T=vt(r,l,Ut,null,null,p),ui?rl._currentValue=T:rl._currentValue2=T),qu(r,l),Wi(r,l,v,p),l.child;case 6:return r===null&&un&&(np(l.pendingProps,Fi.current),(r=p=Zn)&&(p=Ng(p,l.pendingProps,fa),p!==null?(l.stateNode=p,Ri=l,Zn=null,r=!0):r=!1),r||et(l)),null;case 13:return md(r,l,p);case 4:return nt(l,l.stateNode.containerInfo),v=l.pendingProps,r===null?l.child=Zi(l,null,v,p):Wi(r,l,v,p),l.child;case 11:return km(r,l,l.type,l.pendingProps,p);case 7:return Wi(r,l,l.pendingProps,p),l.child;case 8:return Wi(r,l,l.pendingProps.children,p),l.child;case 12:return Wi(r,l,l.pendingProps.children,p),l.child;case 10:return v=l.pendingProps,Ue(l,l.type,v.value),Wi(r,l,v.children,p),l.child;case 9:return T=l.type._context,v=l.pendingProps.children,We(l),T=G(T),v=v(T),l.flags|=1,Wi(r,l,v,p),l.child;case 14:return Hm(r,l,l.type,l.pendingProps,p);case 15:return Gm(r,l,l.type,l.pendingProps,p);case 19:return gd(r,l,p);case 31:return Wm(r,l,p);case 22:return Xm(r,l,p,l.pendingProps);case 24:return We(l),v=G(jn),r===null?(T=Ge(),T===null&&(T=en,w=Se(),T.pooledCache=w,w.refCount++,w!==null&&(T.pooledCacheLanes|=p),T=w),l.memoizedState={parent:v,cache:T},Ti(l),Ue(l,jn,T)):((r.lanes&p)!==0&&(Pa(r,l),xr(l,null,null,p),Rs()),T=r.memoizedState,w=l.memoizedState,T.parent!==v?(T={parent:v,cache:v},l.memoizedState=T,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=T),Ue(l,jn,v)):(v=w.cache,Ue(l,jn,v),v!==T.cache&&St(l,[jn],p,!0))),Wi(r,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(s(156,l.tag))}function as(r){r.flags|=4}function Zu(r){Xa&&(r.flags|=8)}function Zm(r,l){if(r!==null&&r.child===l.child)return!1;if((l.flags&16)!==0)return!0;for(r=l.child;r!==null;){if((r.flags&8218)!==0||(r.subtreeFlags&8218)!==0)return!0;r=r.sibling}return!1}function _d(r,l,p,v){if(hn)for(p=l.child;p!==null;){if(p.tag===5||p.tag===6)lc(r,p.stateNode);else if(!(p.tag===4||Ci&&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(Xa)for(var T=l.child;T!==null;){if(T.tag===5){var w=T.stateNode;p&&v&&(w=bg(w,T.type,T.memoizedProps)),lc(r,w)}else if(T.tag===6)w=T.stateNode,p&&v&&(w=jd(w,T.memoizedProps)),lc(r,w);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)w=T.child,w!==null&&(w.return=T),_d(r,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 jm(r,l,p,v){var T=!1;if(Xa)for(var w=l.child;w!==null;){if(w.tag===5){var F=w.stateNode;p&&v&&(F=bg(F,w.type,w.memoizedProps)),Yd(r,F)}else if(w.tag===6)F=w.stateNode,p&&v&&(F=jd(F,w.memoizedProps)),Yd(r,F);else if(w.tag!==4){if(w.tag===22&&w.memoizedState!==null)T=w.child,T!==null&&(T.return=w),jm(r,w,!0,!0),T=!0;else if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===l)break;for(;w.sibling===null;){if(w.return===null||w.return===l)return T;w=w.return}w.sibling.return=w.return,w=w.sibling}return T}function Qm(r,l){if(Xa&&Zm(r,l)){r=l.stateNode;var p=r.containerInfo,v=qd();jm(v,l,!1,!1),r.pendingChildren=v,as(l),Sg(p,v)}}function xd(r,l,p,v){if(hn)r.memoizedProps!==v&&as(l);else if(Xa){var T=r.stateNode,w=r.memoizedProps;if((r=Zm(r,l))||w!==v){var F=Fi.current;w=xg(T,p,w,v,!r,null),w===T?l.stateNode=T:(Zu(l),Sa(w,p,v,F)&&as(l),l.stateNode=w,r&&_d(w,l,!1,!1))}else l.stateNode=T}}function oa(r,l,p,v,T){if((r.mode&32)!==0&&(p===null?uc(l,v):tu(l,p,v))){if(r.flags|=16777216,(T&335544128)===T||Od(l,v))if($n(r.stateNode,l,v))r.flags|=8192;else if(fn())r.flags|=8192;else throw ha=or,th}else r.flags&=-16777217}function Bl(r,l){if(op(l)){if(r.flags|=16777216,!lp(l))if(fn())r.flags|=8192;else throw ha=or,th}else r.flags&=-16777217}function ju(r,l){l!==null&&(r.flags|=4),r.flags&16384&&(l=r.tag!==22?L():536870912,r.lanes|=l,cu|=l)}function Fl(r,l){if(!un)switch(r.tailMode){case"hidden":l=r.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?r.tail=null:p.sibling=null;break;case"collapsed":p=r.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?l||r.tail===null?r.tail=null:r.tail.sibling=null:v.sibling=null}}function Pn(r){var l=r.alternate!==null&&r.alternate.child===r.child,p=0,v=0;if(l)for(var T=r.child;T!==null;)p|=T.lanes|T.childLanes,v|=T.subtreeFlags&65011712,v|=T.flags&65011712,T.return=r,T=T.sibling;else for(T=r.child;T!==null;)p|=T.lanes|T.childLanes,v|=T.subtreeFlags,v|=T.flags,T.return=r,T=T.sibling;return r.subtreeFlags|=v,r.childLanes=p,l}function Jm(r,l,p){var v=l.pendingProps;switch(Ee(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pn(l),null;case 1:return Pn(l),null;case 3:return p=l.stateNode,v=null,r!==null&&(v=r.memoizedState.cache),l.memoizedState.cache!==v&&(l.flags|=2048),Ke(jn),fe(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(r===null||r.child===null)&&(on(l)?as(l):r===null||r.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Re())),Qm(r,l),Pn(l),null;case 26:if(hs){var T=l.type,w=l.memoizedState;return r===null?(as(l),w!==null?(Pn(l),Bl(l,w)):(Pn(l),oa(l,T,null,v,p))):w?w!==r.memoizedState?(as(l),Pn(l),Bl(l,w)):(Pn(l),l.flags&=-16777217):(w=r.memoizedProps,hn?w!==v&&as(l):xd(r,l,T,v),Pn(l),oa(l,T,w,v,p)),null}case 27:if(Ci){if(Je(l),p=Yi.current,T=l.type,r!==null&&l.stateNode!=null)hn?r.memoizedProps!==v&&as(l):xd(r,l,T,v);else{if(!v){if(l.stateNode===null)throw Error(s(166));return Pn(l),null}r=Fi.current,on(l)?ut(l,r):(r=Xf(T,v,p,r,!0),l.stateNode=r,as(l))}return Pn(l),null}case 5:if(Je(l),T=l.type,r!==null&&l.stateNode!=null)xd(r,l,T,v);else{if(!v){if(l.stateNode===null)throw Error(s(166));return Pn(l),null}if(w=Fi.current,on(l))ut(l,w),Bg(l.stateNode,T,v,w)&&(l.flags|=64);else{var F=Ld(T,v,Yi.current,w,l);Zu(l),_d(F,l,!1,!1),l.stateNode=F,Sa(F,T,v,w)&&as(l)}}return Pn(l),oa(l,l.type,r===null?null:r.memoizedProps,l.pendingProps,p),null;case 6:if(r&&l.stateNode!=null)p=r.memoizedProps,hn?p!==v&&as(l):Xa&&(p!==v?(r=Yi.current,p=Fi.current,Zu(l),l.stateNode=Ur(v,r,p,l)):l.stateNode=r.stateNode);else{if(typeof v!="string"&&l.stateNode===null)throw Error(s(166));if(r=Yi.current,p=Fi.current,on(l)){if(!Yn)throw Error(s(176));if(r=l.stateNode,p=l.memoizedProps,v=null,T=Ri,T!==null)switch(T.tag){case 27:case 5:v=T.memoizedProps}jy(r,p,l,v)||et(l,!0)}else Zu(l),l.stateNode=Ur(v,r,p,l)}return Pn(l),null;case 31:if(p=l.memoizedState,r===null||r.memoizedState!==null){if(v=on(l),p!==null){if(r===null){if(!v)throw Error(s(318));if(!Yn)throw Error(s(556));if(r=l.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));$d(r,l)}else Dt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pn(l),r=!1}else p=Re(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=p),r=!0;if(!r)return l.flags&256?(qe(l),l):(qe(l),null);if((l.flags&128)!==0)throw Error(s(558))}return Pn(l),null;case 13:if(v=l.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(T=on(l),v!==null&&v.dehydrated!==null){if(r===null){if(!T)throw Error(s(318));if(!Yn)throw Error(s(344));if(T=l.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(s(317));Ig(T,l)}else Dt(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pn(l),T=!1}else T=Re(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=T),T=!0;if(!T)return l.flags&256?(qe(l),l):(qe(l),null)}return qe(l),(l.flags&128)!==0?(l.lanes=p,l):(p=v!==null,r=r!==null&&r.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),w=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(w=v.memoizedState.cachePool.pool),w!==T&&(v.flags|=2048)),p!==r&&p&&(l.child.flags|=8192),ju(l,l.updateQueue),Pn(l),null);case 4:return fe(),Qm(r,l),r===null&&Ln(l.stateNode.containerInfo),Pn(l),null;case 10:return Ke(l.type),Pn(l),null;case 19:if(M(ri),v=l.memoizedState,v===null)return Pn(l),null;if(T=(l.flags&128)!==0,w=v.rendering,w===null)if(T)Fl(v,!1);else{if(ni!==0||r!==null&&(r.flags&128)!==0)for(r=l.child;r!==null;){if(w=ht(r),w!==null){for(l.flags|=128,Fl(v,!1),r=w.updateQueue,l.updateQueue=r,ju(l,r),l.subtreeFlags=0,r=p,p=l.child;p!==null;)wf(p,r),p=p.sibling;return A(ri,ri.current&1|2),un&&Ce(l,v.treeForkCount),l.child}r=r.sibling}v.tail!==null&&ea()>Ao&&(l.flags|=128,T=!0,Fl(v,!1),l.lanes=4194304)}else{if(!T)if(r=ht(w),r!==null){if(l.flags|=128,T=!0,r=r.updateQueue,l.updateQueue=r,ju(l,r),Fl(v,!0),v.tail===null&&v.tailMode==="hidden"&&!w.alternate&&!un)return Pn(l),null}else 2*ea()-v.renderingStartTime>Ao&&p!==536870912&&(l.flags|=128,T=!0,Fl(v,!1),l.lanes=4194304);v.isBackwards?(w.sibling=l.child,l.child=w):(r=v.last,r!==null?r.sibling=w:l.child=w,v.last=w)}return v.tail!==null?(r=v.tail,v.rendering=r,v.tail=r.sibling,v.renderingStartTime=ea(),r.sibling=null,p=ri.current,A(ri,T?p&1|2:p&1),un&&Ce(l,v.treeForkCount),r):(Pn(l),null);case 22:case 23:return qe(l),V(),v=l.memoizedState!==null,r!==null?r.memoizedState!==null!==v&&(l.flags|=8192):v&&(l.flags|=8192),v?(p&536870912)!==0&&(l.flags&128)===0&&(Pn(l),l.subtreeFlags&6&&(l.flags|=8192)):Pn(l),p=l.updateQueue,p!==null&&ju(l,p.retryQueue),p=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),v=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),v!==p&&(l.flags|=2048),r!==null&&M(yo),null;case 24:return p=null,r!==null&&(p=r.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),Ke(jn),Pn(l),null;case 25:return null;case 30:return null}throw Error(s(156,l.tag))}function Sd(r,l){switch(Ee(l),l.tag){case 1:return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 3:return Ke(jn),fe(),r=l.flags,(r&65536)!==0&&(r&128)===0?(l.flags=r&-65537|128,l):null;case 26:case 27:case 5:return Je(l),null;case 31:if(l.memoizedState!==null){if(qe(l),l.alternate===null)throw Error(s(340));Dt()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 13:if(qe(l),r=l.memoizedState,r!==null&&r.dehydrated!==null){if(l.alternate===null)throw Error(s(340));Dt()}return r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 19:return M(ri),null;case 4:return fe(),null;case 10:return Ke(l.type),null;case 22:case 23:return qe(l),V(),r!==null&&M(yo),r=l.flags,r&65536?(l.flags=r&-65537|128,l):null;case 24:return Ke(jn),null;case 25:return null;default:return null}}function Km(r,l){switch(Ee(l),l.tag){case 3:Ke(jn),fe();break;case 26:case 27:case 5:Je(l);break;case 4:fe();break;case 31:l.memoizedState!==null&&qe(l);break;case 13:qe(l);break;case 19:M(ri);break;case 10:Ke(l.type);break;case 22:case 23:qe(l),V(),r!==null&&M(yo);break;case 24:Ke(jn)}}function qs(r,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&r)===r){v=void 0;var w=p.create,F=p.inst;v=w(),F.destroy=v}p=p.next}while(p!==T)}}catch(J){Pt(l,l.return,J)}}function Ys(r,l,p){try{var v=l.updateQueue,T=v!==null?v.lastEffect:null;if(T!==null){var w=T.next;v=w;do{if((v.tag&r)===r){var F=v.inst,J=F.destroy;if(J!==void 0){F.destroy=void 0,T=l;var xe=p,ze=J;try{ze()}catch(Qe){Pt(T,xe,Qe)}}}v=v.next}while(v!==w)}}catch(Qe){Pt(l,l.return,Qe)}}function Vl(r){var l=r.updateQueue;if(l!==null){var p=r.stateNode;try{br(l,p)}catch(v){Pt(r,r.return,v)}}}function gf(r,l,p){p.props=qo(r.type,r.memoizedProps),p.state=r.memoizedState;try{p.componentWillUnmount()}catch(v){Pt(r,l,v)}}function kl(r,l){try{var p=r.ref;if(p!==null){switch(r.tag){case 26:case 27:case 5:var v=Kl(r.stateNode);break;case 30:v=r.stateNode;break;default:v=r.stateNode}typeof p=="function"?r.refCleanup=p(v):p.current=v}}catch(T){Pt(r,l,T)}}function $i(r,l){var p=r.ref,v=r.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(T){Pt(r,l,T)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(T){Pt(r,l,T)}else p.current=null}function Qo(r){var l=r.type,p=r.memoizedProps,v=r.stateNode;try{hg(v,l,p,r)}catch(T){Pt(r,r.return,T)}}function Qu(r,l,p){try{dg(r.stateNode,r.type,p,l,r)}catch(v){Pt(r,r.return,v)}}function bd(r){return r.tag===5||r.tag===3||(hs?r.tag===26:!1)||(Ci?r.tag===27&&ol(r.type):!1)||r.tag===4}function Er(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||bd(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(Ci&&r.tag===27&&ol(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function vf(r,l,p){var v=r.tag;if(v===5||v===6)r=r.stateNode,l?mg(p,r,l):Hd(p,r);else if(v!==4&&(Ci&&v===27&&ol(r.type)&&(p=r.stateNode,l=null),r=r.child,r!==null))for(vf(r,l,p),r=r.sibling;r!==null;)vf(r,l,p),r=r.sibling}function Ju(r,l,p){var v=r.tag;if(v===5||v===6)r=r.stateNode,l?pg(p,r,l):kd(p,r);else if(v!==4&&(Ci&&v===27&&ol(r.type)&&(p=r.stateNode),r=r.child,r!==null))for(Ju(r,l,p),r=r.sibling;r!==null;)Ju(r,l,p),r=r.sibling}function Md(r,l,p){r=r.containerInfo;try{Zd(r,p)}catch(v){Pt(l,l.return,v)}}function $m(r){var l=r.stateNode,p=r.memoizedProps;try{xi(r.type,p,l,r)}catch(v){Pt(r,r.return,v)}}function Wy(r,l){for(Lf(r.containerInfo),hi=l;hi!==null;)if(r=hi,l=r.child,(r.subtreeFlags&1028)!==0&&l!==null)l.return=r,hi=l;else for(;hi!==null;){r=hi;var p=r.alternate;switch(l=r.flags,r.tag){case 0:if((l&4)!==0&&(l=r.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=r,T=p.memoizedProps,p=p.memoizedState;var w=v.stateNode;try{var F=qo(v.type,T);l=w.getSnapshotBeforeUpdate(F,p),w.__reactInternalSnapshotBeforeUpdate=l}catch(J){Pt(v,v.return,J)}}break;case 3:(l&1024)!==0&&hn&&Wd(r.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=r.sibling,l!==null){l.return=r.return,hi=l;break}hi=r.return}}function eg(r,l,p){var v=p.flags;switch(p.tag){case 0:case 11:case 15:la(r,p),v&4&&qs(5,p);break;case 1:if(la(r,p),v&4)if(r=p.stateNode,l===null)try{r.componentDidMount()}catch(F){Pt(p,p.return,F)}else{var T=qo(p.type,l.memoizedProps);l=l.memoizedState;try{r.componentDidUpdate(T,l,r.__reactInternalSnapshotBeforeUpdate)}catch(F){Pt(p,p.return,F)}}v&64&&Vl(p),v&512&&kl(p,p.return);break;case 3:if(la(r,p),v&64&&(v=p.updateQueue,v!==null)){if(r=null,p.child!==null)switch(p.child.tag){case 27:case 5:r=Kl(p.child.stateNode);break;case 1:r=p.child.stateNode}try{br(v,r)}catch(F){Pt(p,p.return,F)}}break;case 27:Ci&&l===null&&v&4&&$m(p);case 26:case 5:if(la(r,p),l===null){if(v&4)Qo(p);else if(v&64){r=p.type,l=p.memoizedProps,T=p.stateNode;try{zg(T,r,l,p)}catch(F){Pt(p,p.return,F)}}}v&512&&kl(p,p.return);break;case 12:la(r,p);break;case 31:la(r,p),v&4&&rs(r,p);break;case 13:la(r,p),v&4&&$u(r,p),v&64&&(v=p.memoizedState,v!==null&&(v=v.dehydrated,v!==null&&(p=qy.bind(null,p),Vf(v,p))));break;case 22:if(v=p.memoizedState!==null||oi,!v){l=l!==null&&l.memoizedState!==null||li,T=oi;var w=li;oi=v,(li=l)&&!w?ls(r,p,(p.subtreeFlags&8772)!==0):la(r,p),oi=T,li=w}break;case 30:break;default:la(r,p)}}function Ed(r){var l=r.alternate;l!==null&&(r.alternate=null,Ed(l)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(l=r.stateNode,l!==null&&If(l)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function ss(r,l,p){for(p=p.child;p!==null;)Ku(r,l,p),p=p.sibling}function Ku(r,l,p){if(Ea&&typeof Ea.onCommitFiberUnmount=="function")try{Ea.onCommitFiberUnmount(cl,p)}catch{}switch(p.tag){case 26:if(hs){li||$i(p,l),ss(r,l,p),p.memoizedState?go(p.memoizedState):p.stateNode&&rp(p.stateNode);break}case 27:if(Ci){li||$i(p,l);var v=ti,T=di;ol(p.type)&&(ti=p.stateNode,di=!1),ss(r,l,p),Bi(p.stateNode),ti=v,di=T;break}case 5:li||$i(p,l);case 6:if(hn){if(v=ti,T=di,ti=null,ss(r,l,p),ti=v,di=T,ti!==null)if(di)try{Gd(ti,p.stateNode)}catch(w){Pt(p,l,w)}else try{gg(ti,p.stateNode)}catch(w){Pt(p,l,w)}}else ss(r,l,p);break;case 18:hn&&ti!==null&&(di?kf(ti,p.stateNode):tp(ti,p.stateNode));break;case 4:hn?(v=ti,T=di,ti=p.stateNode.containerInfo,di=!0,ss(r,l,p),ti=v,di=T):(Xa&&Md(p.stateNode,p,qd()),ss(r,l,p));break;case 0:case 11:case 14:case 15:Ys(2,p,l),li||Ys(4,p,l),ss(r,l,p);break;case 1:li||($i(p,l),v=p.stateNode,typeof v.componentWillUnmount=="function"&&gf(p,l,v)),ss(r,l,p);break;case 21:ss(r,l,p);break;case 22:li=(v=li)||p.memoizedState!==null,ss(r,l,p),li=v;break;default:ss(r,l,p)}}function rs(r,l){if(Yn&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Qy(r)}catch(p){Pt(l,l.return,p)}}}function $u(r,l){if(Yn&&l.memoizedState===null&&(r=l.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Jy(r)}catch(p){Pt(l,l.return,p)}}function os(r){switch(r.tag){case 31:case 13:case 19:var l=r.stateNode;return l===null&&(l=r.stateNode=new gp),l;case 22:return r=r.stateNode,l=r._retryCache,l===null&&(l=r._retryCache=new gp),l;default:throw Error(s(435,r.tag))}}function Tr(r,l){var p=os(r);l.forEach(function(v){if(!p.has(v)){p.add(v);var T=Yy.bind(null,r,v);v.then(T,T)}})}function zi(r,l){var p=l.deletions;if(p!==null)for(var v=0;v<p.length;v++){var T=p[v],w=r,F=l;if(hn){var J=F;e:for(;J!==null;){switch(J.tag){case 27:if(Ci){if(ol(J.type)){ti=J.stateNode,di=!1;break e}break}case 5:ti=J.stateNode,di=!1;break e;case 3:case 4:ti=J.stateNode.containerInfo,di=!0;break e}J=J.return}if(ti===null)throw Error(s(160));Ku(w,F,T),ti=null,di=!1}else Ku(w,F,T);w=T.alternate,w!==null&&(w.return=null),T.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)ec(l,r),l=l.sibling}function ec(r,l){var p=r.alternate,v=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:zi(l,r),Pi(r),v&4&&(Ys(3,r,r.return),qs(3,r),Ys(5,r,r.return));break;case 1:zi(l,r),Pi(r),v&512&&(li||p===null||$i(p,p.return)),v&64&&oi&&(r=r.updateQueue,r!==null&&(v=r.callbacks,v!==null&&(p=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=p===null?v:p.concat(v))));break;case 26:if(hs){var T=Dn;if(zi(l,r),Pi(r),v&512&&(li||p===null||$i(p,p.return)),v&4){v=p!==null?p.memoizedState:null;var w=r.memoizedState;p===null?w===null?r.stateNode===null?r.stateNode=Hg(T,r.type,r.memoizedProps,r):sp(T,r.type,r.stateNode):r.stateNode=ap(T,w,r.memoizedProps):v!==w?(v===null?p.stateNode!==null&&rp(p.stateNode):go(v),w===null?sp(T,r.type,r.stateNode):ap(T,w,r.memoizedProps)):w===null&&r.stateNode!==null&&Qu(r,r.memoizedProps,p.memoizedProps)}break}case 27:if(Ci){zi(l,r),Pi(r),v&512&&(li||p===null||$i(p,p.return)),p!==null&&v&4&&Qu(r,r.memoizedProps,p.memoizedProps);break}case 5:if(zi(l,r),Pi(r),v&512&&(li||p===null||$i(p,p.return)),hn){if(r.flags&32){T=r.stateNode;try{Xd(T)}catch(ke){Pt(r,r.return,ke)}}v&4&&r.stateNode!=null&&(T=r.memoizedProps,Qu(r,T,p!==null?p.memoizedProps:T)),v&1024&&(su=!0)}else Xa&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(zi(l,r),Pi(r),v&4&&hn){if(r.stateNode===null)throw Error(s(162));v=r.memoizedProps,p=p!==null?p.memoizedProps:v,T=r.stateNode;try{fg(T,p,v)}catch(ke){Pt(r,r.return,ke)}}break;case 3:if(hs?(Gg(),T=Dn,Dn=hc(l.containerInfo),zi(l,r),Dn=T):zi(l,r),Pi(r),v&4){if(hn&&Yn&&p!==null&&p.memoizedState.isDehydrated)try{Pg(l.containerInfo)}catch(ke){Pt(r,r.return,ke)}if(Xa){v=l.containerInfo,p=l.pendingChildren;try{Zd(v,p)}catch(ke){Pt(r,r.return,ke)}}}su&&(su=!1,yf(r));break;case 4:hs?(p=Dn,Dn=hc(r.stateNode.containerInfo),zi(l,r),Pi(r),Dn=p):(zi(l,r),Pi(r)),v&4&&Xa&&Md(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:zi(l,r),Pi(r);break;case 31:zi(l,r),Pi(r),v&4&&(v=r.updateQueue,v!==null&&(r.updateQueue=null,Tr(r,v)));break;case 13:zi(l,r),Pi(r),r.child.flags&8192&&r.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(bc=ea()),v&4&&(v=r.updateQueue,v!==null&&(r.updateQueue=null,Tr(r,v)));break;case 22:T=r.memoizedState!==null;var F=p!==null&&p.memoizedState!==null,J=oi,xe=li;if(oi=J||T,li=xe||F,zi(l,r),li=xe,oi=J,Pi(r),v&8192&&(l=r.stateNode,l._visibility=T?l._visibility&-2:l._visibility|1,T&&(p===null||F||oi||li||no(r)),hn)){e:if(p=null,hn)for(l=r;;){if(l.tag===5||hs&&l.tag===26){if(p===null){F=p=l;try{w=F.stateNode,T?Zy(w):yg(F.stateNode,F.memoizedProps)}catch(ke){Pt(F,F.return,ke)}}}else if(l.tag===6){if(p===null){F=l;try{var ze=F.stateNode;T?vg(ze):_g(ze,F.memoizedProps)}catch(ke){Pt(F,F.return,ke)}}}else if(l.tag===18){if(p===null){F=l;try{var Qe=F.stateNode;T?Fg(Qe):Vg(F.stateNode)}catch(ke){Pt(F,F.return,ke)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===r)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break e;for(;l.sibling===null;){if(l.return===null||l.return===r)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}}v&4&&(v=r.updateQueue,v!==null&&(p=v.retryQueue,p!==null&&(v.retryQueue=null,Tr(r,p))));break;case 19:zi(l,r),Pi(r),v&4&&(v=r.updateQueue,v!==null&&(r.updateQueue=null,Tr(r,v)));break;case 30:break;case 21:break;default:zi(l,r),Pi(r)}}function Pi(r){var l=r.flags;if(l&2){try{for(var p,v=r.return;v!==null;){if(bd(v)){p=v;break}v=v.return}if(hn){if(p==null)throw Error(s(160));switch(p.tag){case 27:if(Ci){var T=p.stateNode,w=Er(r);Ju(r,w,T);break}case 5:var F=p.stateNode;p.flags&32&&(Xd(F),p.flags&=-33);var J=Er(r);Ju(r,J,F);break;case 3:case 4:var xe=p.stateNode.containerInfo,ze=Er(r);vf(r,ze,xe);break;default:throw Error(s(161))}}}catch(Qe){Pt(r,r.return,Qe)}r.flags&=-3}l&4096&&(r.flags&=-4097)}function yf(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var l=r;yf(l),l.tag===5&&l.flags&1024&&Pd(l.stateNode),r=r.sibling}}function la(r,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)eg(r,l.alternate,l),l=l.sibling}function no(r){for(r=r.child;r!==null;){var l=r;switch(l.tag){case 0:case 11:case 14:case 15:Ys(4,l,l.return),no(l);break;case 1:$i(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&gf(l,l.return,p),no(l);break;case 27:Ci&&Bi(l.stateNode);case 26:case 5:$i(l,l.return),no(l);break;case 22:l.memoizedState===null&&no(l);break;case 30:no(l);break;default:no(l)}r=r.sibling}}function ls(r,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,T=r,w=l,F=w.flags;switch(w.tag){case 0:case 11:case 15:ls(T,w,p),qs(4,w);break;case 1:if(ls(T,w,p),v=w,T=v.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(ze){Pt(v,v.return,ze)}if(v=w,T=v.updateQueue,T!==null){var J=v.stateNode;try{var xe=T.shared.hiddenCallbacks;if(xe!==null)for(T.shared.hiddenCallbacks=null,T=0;T<xe.length;T++)Sr(xe[T],J)}catch(ze){Pt(v,v.return,ze)}}p&&F&64&&Vl(w),kl(w,w.return);break;case 27:Ci&&$m(w);case 26:case 5:ls(T,w,p),p&&v===null&&F&4&&Qo(w),kl(w,w.return);break;case 12:ls(T,w,p);break;case 31:ls(T,w,p),p&&F&4&&rs(T,w);break;case 13:ls(T,w,p),p&&F&4&&$u(T,w);break;case 22:w.memoizedState===null&&ls(T,w,p),kl(w,w.return);break;case 30:break;default:ls(T,w,p)}l=l.sibling}}function io(r,l){var p=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==p&&(r!=null&&r.refCount++,p!=null&&Le(p))}function Td(r,l){r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&Le(r))}function Jn(r,l,p,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)_f(r,l,p,v),l=l.sibling}function _f(r,l,p,v){var T=l.flags;switch(l.tag){case 0:case 11:case 15:Jn(r,l,p,v),T&2048&&qs(9,l);break;case 1:Jn(r,l,p,v);break;case 3:Jn(r,l,p,v),T&2048&&(r=null,l.alternate!==null&&(r=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==r&&(l.refCount++,r!=null&&Le(r)));break;case 12:if(T&2048){Jn(r,l,p,v),r=l.stateNode;try{var w=l.memoizedProps,F=w.id,J=w.onPostCommit;typeof J=="function"&&J(F,l.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(xe){Pt(l,l.return,xe)}}else Jn(r,l,p,v);break;case 31:Jn(r,l,p,v);break;case 13:Jn(r,l,p,v);break;case 23:break;case 22:w=l.stateNode,F=l.alternate,l.memoizedState!==null?w._visibility&2?Jn(r,l,p,v):Hl(r,l):w._visibility&2?Jn(r,l,p,v):(w._visibility|=2,ya(r,l,p,v,(l.subtreeFlags&10256)!==0||!1)),T&2048&&io(F,l);break;case 24:Jn(r,l,p,v),T&2048&&Td(l.alternate,l);break;default:Jn(r,l,p,v)}}function ya(r,l,p,v,T){for(T=T&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var w=r,F=l,J=p,xe=v,ze=F.flags;switch(F.tag){case 0:case 11:case 15:ya(w,F,J,xe,T),qs(8,F);break;case 23:break;case 22:var Qe=F.stateNode;F.memoizedState!==null?Qe._visibility&2?ya(w,F,J,xe,T):Hl(w,F):(Qe._visibility|=2,ya(w,F,J,xe,T)),T&&ze&2048&&io(F.alternate,F);break;case 24:ya(w,F,J,xe,T),T&&ze&2048&&Td(F.alternate,F);break;default:ya(w,F,J,xe,T)}l=l.sibling}}function Hl(r,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=r,v=l,T=v.flags;switch(v.tag){case 22:Hl(p,v),T&2048&&io(v.alternate,v);break;case 24:Hl(p,v),T&2048&&Td(v.alternate,v);break;default:Hl(p,v)}l=l.sibling}}function Zs(r,l,p){if(r.subtreeFlags&Za)for(r=r.child;r!==null;)ao(r,l,p),r=r.sibling}function ao(r,l,p){switch(r.tag){case 26:if(Zs(r,l,p),r.flags&Za)if(r.memoizedState!==null)Xg(p,Dn,r.memoizedState,r.memoizedProps);else{var v=r.stateNode,T=r.type;r=r.memoizedProps,((l&335544128)===l||Od(T,r))&&Of(p,v,T,r)}break;case 5:Zs(r,l,p),r.flags&Za&&(v=r.stateNode,T=r.type,r=r.memoizedProps,((l&335544128)===l||Od(T,r))&&Of(p,v,T,r));break;case 3:case 4:hs?(v=Dn,Dn=hc(r.stateNode.containerInfo),Zs(r,l,p),Dn=v):Zs(r,l,p);break;case 22:r.memoizedState===null&&(v=r.alternate,v!==null&&v.memoizedState!==null?(v=Za,Za=16777216,Zs(r,l,p),Za=v):Zs(r,l,p));break;default:Zs(r,l,p)}}function xf(r){var l=r.alternate;if(l!==null&&(r=l.child,r!==null)){l.child=null;do l=r.sibling,r.sibling=null,r=l;while(r!==null)}}function Gl(r){var l=r.deletions;if((r.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var v=l[p];hi=v,ka(v,r)}xf(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Sf(r),r=r.sibling}function Sf(r){switch(r.tag){case 0:case 11:case 15:Gl(r),r.flags&2048&&Ys(9,r,r.return);break;case 3:Gl(r);break;case 12:Gl(r);break;case 22:var l=r.stateNode;r.memoizedState!==null&&l._visibility&2&&(r.return===null||r.return.tag!==13)?(l._visibility&=-3,tc(r)):Gl(r);break;default:Gl(r)}}function tc(r){var l=r.deletions;if((r.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var v=l[p];hi=v,ka(v,r)}xf(r)}for(r=r.child;r!==null;){switch(l=r,l.tag){case 0:case 11:case 15:Ys(8,l,l.return),tc(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,tc(l));break;default:tc(l)}r=r.sibling}}function ka(r,l){for(;hi!==null;){var p=hi;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:Le(p.memoizedState.cache)}if(v=p.child,v!==null)v.return=p,hi=v;else e:for(p=r;hi!==null;){v=hi;var T=v.sibling,w=v.return;if(Ed(v),v===p){hi=null;break e}if(T!==null){T.return=w,hi=T;break e}hi=w}}}function so(r){var l=Xt(r);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(s(364));return l}if(r=ci(r),r===null)throw Error(s(362));return r.stateNode.current}function ro(r,l){var p=r.tag;switch(l.$$typeof){case xs:if(r.type===l.value)return!0;break;case ou:e:{for(l=l.value,r=[r,0],p=0;p<r.length;){var v=r[p++],T=v.tag,w=r[p++],F=l[w];if(T!==5&&T!==26&&T!==27||!po(v)){for(;F!=null&&ro(v,F);)w++,F=l[w];if(w===l.length){l=!0;break e}else for(v=v.child;v!==null;)r.push(v,w),v=v.sibling}}l=!1}return l;case lu:if((p===5||p===26||p===27)&&Vd(r.stateNode,l.value))return!0;break;case bo:if((p===5||p===6||p===26||p===27)&&(r=cc(r),r!==null&&0<=r.indexOf(l.value)))return!0;break;case xc:if((p===5||p===26||p===27)&&(r=r.memoizedProps["data-testname"],typeof r=="string"&&r.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(s(365))}return!1}function Xl(r){switch(r.$$typeof){case xs:return"<"+(x(r.value)||"Unknown")+">";case ou:return":has("+(Xl(r)||"")+")";case lu:return'[role="'+r.value+'"]';case bo:return'"'+r.value+'"';case xc:return'[data-testname="'+r.value+'"]';default:throw Error(s(365))}}function Wl(r,l){var p=[];r=[r,0];for(var v=0;v<r.length;){var T=r[v++],w=T.tag,F=r[v++],J=l[F];if(w!==5&&w!==26&&w!==27||!po(T)){for(;J!=null&&ro(T,J);)F++,J=l[F];if(F===l.length)p.push(T);else for(T=T.child;T!==null;)r.push(T,F),T=T.sibling}}return p}function _a(r,l){if(!wi)throw Error(s(363));r=so(r),r=Wl(r,l),l=[],r=Array.from(r);for(var p=0;p<r.length;){var v=r[p++],T=v.tag;if(T===5||T===26||T===27)po(v)||l.push(v.stateNode);else for(v=v.child;v!==null;)r.push(v),v=v.sibling}return l}function qn(){return(sn&2)!==0&&cn!==0?cn&-cn:Ct.T!==null?$e():eu()}function Ar(){if(pa===0)if((cn&536870912)===0||un){var r=ul;ul<<=1,(ul&3932160)===0&&(ul=262144),pa=r}else pa=536870912;return r=Ta.current,r!==null&&(r.flags|=32),pa}function Kn(r,l,p){(r===en&&(Nn===2||Nn===9)||r.cancelPendingCommit!==null)&&(si(r,0),Qs(r,cn,pa,!1)),P(r,p),((sn&2)===0||r!==en)&&(r===en&&((sn&2)===0&&(To|=p),ni===4&&Qs(r,cn,pa,!1)),ct(r))}function Ns(r,l,p){if((sn&6)!==0)throw Error(s(327));var v=!p&&(l&127)===0&&(l&r.expiredLanes)===0||D(r,l),T=v?ig(r,l):Js(r,l,!0),w=v;do{if(T===0){Mo&&!v&&Qs(r,l,0,!1);break}else{if(p=r.current.alternate,w&&!tg(p)){T=Js(r,l,!1),w=!1;continue}if(T===2){if(w=l,r.errorRecoveryDisabledLanes&w)var F=0;else F=r.pendingLanes&-536870913,F=F!==0?F:F&536870912?536870912:0;if(F!==0){l=F;e:{var J=r;T=Sc;var xe=Yn&&J.current.memoizedState.isDehydrated;if(xe&&(si(J,F).flags|=256),F=Js(J,F,!1),F!==2){if(Eo&&!xe){J.errorRecoveryDisabledLanes|=w,To|=w,T=4;break e}w=wa,wa=T,w!==null&&(wa===null?wa=w:wa.push.apply(wa,w))}T=F}if(w=!1,T!==2)continue}}if(T===1){si(r,0),Qs(r,l,0,!0);break}e:{switch(v=r,w=T,w){case 0:case 1:throw Error(s(345));case 4:if((l&4194048)!==l)break;case 6:Qs(v,l,pa,!Os);break e;case 2:wa=null;break;case 3:case 5:break;default:throw Error(s(329))}if((l&62914560)===l&&(T=bc+300-ea(),10<T)){if(Qs(v,l,pa,!Os),E(v,0,!0)!==0)break e;fr=l,v.timeoutHandle=Id(js.bind(null,v,p,wa,Mc,ih,l,pa,To,cu,Os,w,"Throttled",-0,0),T);break e}js(v,p,wa,Mc,ih,l,pa,To,cu,Os,w,null,-0,0)}}break}while(!0);ct(r)}function js(r,l,p,v,T,w,F,J,xe,ze,Qe,ke,dt,Gt){if(r.timeoutHandle=ba,ke=l.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke=zd(),ao(l,w,ke);var pi=(w&62914560)===w?bc-ea():(w&4194048)===w?gl-ea():0;if(pi=cg(ke,pi),pi!==null){fr=w,r.cancelPendingCommit=pi($s.bind(null,r,l,w,p,v,T,F,J,xe,Qe,ke,null,dt,Gt)),Qs(r,w,F,!ze);return}}$s(r,l,w,p,v,T,F,J,xe)}function tg(r){for(var l=r;;){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],w=T.getSnapshot;T=T.value;try{if(!fi(w(),T))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Qs(r,l,p,v){l&=~uu,l&=~To,r.suspendedLanes|=l,r.pingedLanes&=~l,v&&(r.warmLanes|=l),v=r.expirationTimes;for(var T=l;0<T;){var w=31-Ma(T),F=1<<w;v[w]=-1,T&=~F}p!==0&&W(r,p,l)}function bf(){return(sn&6)===0?(Ze(0),!1):!0}function Mf(){if(rn!==null){if(Nn===0)var r=rn.return;else r=rn,Ls=Fn=null,Un(r),_o=null,fl=0,r=rn;for(;r!==null;)Km(r.alternate,r),r=r.return;rn=null}}function si(r,l){var p=r.timeoutHandle;p!==ba&&(r.timeoutHandle=ba,ug(p)),p=r.cancelPendingCommit,p!==null&&(r.cancelPendingCommit=null,p()),fr=0,Mf(),en=r,rn=p=Ga(r.current,null),cn=l,Nn=0,Si=null,Os=!1,Mo=D(r,l),Eo=!1,cu=pa=uu=To=Br=ni=0,wa=Sc=null,ih=!1,(l&8)!==0&&(l|=l&32);var v=r.entangledLanes;if(v!==0)for(r=r.entanglements,v&=l;0<v;){var T=31-Ma(v),w=1<<T;l|=r[T],v&=~w}return cr=l,Qr(),p}function Bn(r,l){Wt=null,Ct.H=Ya,l===Ni||l===ys?(l=gn(),Nn=3):l===th?(l=gn(),Nn=4):Nn=l===da?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Si=l,rn===null&&(ni=1,hf(r,Ae(l,r.current)))}function fn(){var r=Ta.current;return r===null?!0:(cn&4194048)===cn?Aa===null:(cn&62914560)===cn||(cn&536870912)!==0?r===Aa:!1}function wr(){var r=Ct.H;return Ct.H=Ya,r===null?Ya:r}function Ha(){var r=Ct.A;return Ct.A=ru,r}function ql(){ni=4,Os||(cn&4194048)!==cn&&Ta.current!==null||(Mo=!0),(Br&134217727)===0&&(To&134217727)===0||en===null||Qs(en,cn,pa,!1)}function Js(r,l,p){var v=sn;sn|=2;var T=wr(),w=Ha();(en!==r||cn!==l)&&(Mc=null,si(r,l)),l=!1;var F=ni;e:do try{if(Nn!==0&&rn!==null){var J=rn,xe=Si;switch(Nn){case 8:Mf(),F=6;break e;case 3:case 2:case 9:case 6:Ta.current===null&&(l=!0);var ze=Nn;if(Nn=0,Si=null,Ks(r,J,xe,ze),p&&Mo){F=0;break e}break;default:ze=Nn,Nn=0,Si=null,Ks(r,J,xe,ze)}}ng(),F=ni;break}catch(Qe){Bn(r,Qe)}while(!0);return l&&r.shellSuspendCounter++,Ls=Fn=null,sn=v,Ct.H=T,Ct.A=w,rn===null&&(en=null,cn=0,Qr()),F}function ng(){for(;rn!==null;)oo(rn)}function ig(r,l){var p=sn;sn|=2;var v=wr(),T=Ha();en!==r||cn!==l?(Mc=null,Ao=ea()+500,si(r,l)):Mo=D(r,l);e:do try{if(Nn!==0&&rn!==null){l=rn;var w=Si;t:switch(Nn){case 1:Nn=0,Si=null,Ks(r,l,w,1);break;case 2:case 9:if(je(w)){Nn=0,Si=null,Ef(l);break}l=function(){Nn!==2&&Nn!==9||en!==r||(Nn=7),ct(r)},w.then(l,l);break e;case 3:Nn=7;break e;case 4:Nn=5;break e;case 7:je(w)?(Nn=0,Si=null,Ef(l)):(Nn=0,Si=null,Ks(r,l,w,7));break;case 5:var F=null;switch(rn.tag){case 26:F=rn.memoizedState;case 5:case 27:var J=rn,xe=J.type,ze=J.pendingProps;if(F?lp(F):$n(J.stateNode,xe,ze)){Nn=0,Si=null;var Qe=J.sibling;if(Qe!==null)rn=Qe;else{var ke=J.return;ke!==null?(rn=ke,Zl(ke)):rn=null}break t}}Nn=0,Si=null,Ks(r,l,w,5);break;case 6:Nn=0,Si=null,Ks(r,l,w,6);break;case 8:Mf(),ni=6;break e;default:throw Error(s(462))}}Yl();break}catch(dt){Bn(r,dt)}while(!0);return Ls=Fn=null,Ct.H=v,Ct.A=T,sn=p,rn!==null?0:(en=null,cn=0,Qr(),ni)}function Yl(){for(;rn!==null&&!qg();)oo(rn)}function oo(r){var l=yd(r.alternate,r,cr);r.memoizedProps=r.pendingProps,l===null?Zl(r):rn=l}function Ef(r){var l=r,p=l.alternate;switch(l.tag){case 15:case 0:l=hd(p,l,l.pendingProps,l.type,void 0,cn);break;case 11:l=hd(p,l,l.pendingProps,l.type.render,l.ref,cn);break;case 5:Un(l);default:Km(p,l),l=rn=wf(l,cr),l=yd(p,l,cr)}r.memoizedProps=r.pendingProps,l===null?Zl(r):rn=l}function Ks(r,l,p,v){Ls=Fn=null,Un(l),_o=null,fl=0;var T=l.return;try{if(Xy(r,T,l,p,cn)){ni=1,hf(r,Ae(p,r.current)),rn=null;return}}catch(w){if(T!==null)throw rn=T,w;ni=1,hf(r,Ae(p,r.current)),rn=null;return}l.flags&32768?(un||v===1?r=!0:Mo||(cn&536870912)!==0?r=!1:(Os=r=!0,(v===2||v===9||v===3||v===6)&&(v=Ta.current,v!==null&&v.tag===13&&(v.flags|=16384))),lo(l,r)):Zl(l)}function Zl(r){var l=r;do{if((l.flags&32768)!==0){lo(l,Os);return}r=l.return;var p=Jm(l.alternate,l,cr);if(p!==null){rn=p;return}if(l=l.sibling,l!==null){rn=l;return}rn=l=r}while(l!==null);ni===0&&(ni=5)}function lo(r,l){do{var p=Sd(r.alternate,r);if(p!==null){p.flags&=32767,rn=p;return}if(p=r.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(r=r.sibling,r!==null)){rn=r;return}rn=r=p}while(r!==null);ni=6,rn=null}function $s(r,l,p,v,T,w,F,J,xe){r.cancelPendingCommit=null;do tr();while(bi!==0);if((sn&6)!==0)throw Error(s(327));if(l!==null){if(l===r.current)throw Error(s(177));if(w=l.lanes|l.childLanes,w|=hl,H(r,p,w,F,J,xe),r===en&&(rn=en=null,cn=0),vl=l,Vr=r,fr=p,fu=w,ah=T,vp=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,_i(pc,function(){return nc(),null})):(r.callbackNode=null,r.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=Ct.T,Ct.T=null,T=fs(),ln(2),F=sn,sn|=4;try{Wy(r,l,p)}finally{sn=F,ln(T),Ct.T=v}}bi=1,Cr(),er(),Tf()}}function Cr(){if(bi===1){bi=0;var r=Vr,l=vl,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=Ct.T,Ct.T=null;var v=fs();ln(2);var T=sn;sn|=4;try{ec(l,r),lg(r.containerInfo)}finally{sn=T,ln(v),Ct.T=p}}r.current=l,bi=2}}function er(){if(bi===2){bi=0;var r=Vr,l=vl,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=Ct.T,Ct.T=null;var v=fs();ln(2);var T=sn;sn|=4;try{eg(r,l.alternate,l)}finally{sn=T,ln(v),Ct.T=p}}bi=3}}function Tf(){if(bi===4||bi===3){bi=0,cp();var r=Vr,l=vl,p=fr,v=vp;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?bi=5:(bi=0,vl=Vr=null,Af(r,r.pendingLanes));var T=r.pendingLanes;if(T===0&&(Fr=null),ae(p),l=l.stateNode,Ea&&typeof Ea.onCommitFiberRoot=="function")try{Ea.onCommitFiberRoot(cl,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=Ct.T,T=fs(),ln(2),Ct.T=null;try{for(var w=r.onRecoverableError,F=0;F<v.length;F++){var J=v[F];w(J.value,{componentStack:J.stack})}}finally{Ct.T=l,ln(T)}}(fr&3)!==0&&tr(),ct(r),T=r.pendingLanes,(p&261930)!==0&&(T&42)!==0?r===Ec?bn++:(bn=0,Ec=r):bn=0,Yn&&fc(),Ze(0)}}function Af(r,l){(r.pooledCacheLanes&=l)===0&&(l=r.pooledCache,l!=null&&(r.pooledCache=null,Le(l)))}function tr(){return Cr(),er(),Tf(),nc()}function nc(){if(bi!==5)return!1;var r=Vr,l=fu;fu=0;var p=ae(fr),v=32>p?32:p;p=Ct.T;var T=fs();try{ln(v),Ct.T=null,v=ah,ah=null;var w=Vr,F=fr;if(bi=0,vl=Vr=null,fr=0,(sn&6)!==0)throw Error(s(331));var J=sn;if(sn|=4,Sf(w.current),_f(w,w.current,F,v),sn=J,Ze(0,!1),Ea&&typeof Ea.onPostCommitFiberRoot=="function")try{Ea.onPostCommitFiberRoot(cl,w)}catch{}return!0}finally{ln(T),Ct.T=p,Af(r,l)}}function uo(r,l,p){l=Ae(p,l),l=cd(r.stateNode,l,2),r=Fa(r,l,2),r!==null&&(P(r,2),ct(r))}function Pt(r,l,p){if(r.tag===3)uo(r,r,p);else for(;l!==null;){if(l.tag===3){uo(l,r,p);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Fr===null||!Fr.has(v))){r=Ae(p,r),p=Fm(2),v=Fa(l,p,2),v!==null&&(Vm(p,v,l,r),P(v,2),ct(v));break}}l=l.return}}function jl(r,l,p){var v=r.pingCache;if(v===null){v=r.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)||(Eo=!0,T.add(p),r=ag.bind(null,r,l,p),l.then(r,r))}function ag(r,l,p){var v=r.pingCache;v!==null&&v.delete(l),r.pingedLanes|=r.suspendedLanes&p,r.warmLanes&=~p,en===r&&(cn&p)===p&&(ni===4||ni===3&&(cn&62914560)===cn&&300>ea()-bc?(sn&2)===0&&si(r,0):uu|=p,cu===cn&&(cu=0)),ct(r)}function sg(r,l){l===0&&(l=L()),r=Ki(r,l),r!==null&&(P(r,l),ct(r))}function qy(r){var l=r.memoizedState,p=0;l!==null&&(p=l.retryLane),sg(r,p)}function Yy(r,l){var p=0;switch(r.tag){case 31:case 13:var v=r.stateNode,T=r.memoizedState;T!==null&&(p=T.retryLane);break;case 19:v=r.stateNode;break;case 22:v=r.stateNode._retryCache;break;default:throw Error(s(314))}v!==null&&v.delete(l),sg(r,p)}function _i(r,l){return dc(r,l)}function Ad(r,l,p,v){this.tag=r,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 Jo(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ga(r,l){var p=r.alternate;return p===null?(p=t(r.tag,l,r.key,r.mode),p.elementType=r.elementType,p.type=r.type,p.stateNode=r.stateNode,p.alternate=r,r.alternate=p):(p.pendingProps=l,p.type=r.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=r.flags&65011712,p.childLanes=r.childLanes,p.lanes=r.lanes,p.child=r.child,p.memoizedProps=r.memoizedProps,p.memoizedState=r.memoizedState,p.updateQueue=r.updateQueue,l=r.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=r.sibling,p.index=r.index,p.ref=r.ref,p.refCleanup=r.refCleanup,p}function wf(r,l){r.flags&=65011714;var p=r.alternate;return p===null?(r.childLanes=0,r.lanes=l,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=p.childLanes,r.lanes=p.lanes,r.child=p.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=p.memoizedProps,r.memoizedState=p.memoizedState,r.updateQueue=p.updateQueue,r.type=p.type,l=p.dependencies,r.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),r}function Rr(r,l,p,v,T,w){var F=0;if(v=r,typeof r=="function")Jo(r)&&(F=1);else if(typeof r=="string")F=hs&&Ci?Hf(r,p,Fi.current)?26:up(r)?27:5:hs?Hf(r,p,Fi.current)?26:5:Ci&&up(r)?27:5;else e:switch(r){case rc:return r=t(31,p,l,T),r.elementType=rc,r.lanes=w,r;case tl:return us(p.children,T,w,l);case nl:F=8,T|=24;break;case il:return r=t(12,p,l,T|2),r.elementType=il,r.lanes=w,r;case Nf:return r=t(13,p,l,T),r.elementType=Nf,r.lanes=w,r;case Dr:return r=t(19,p,l,T),r.elementType=Dr,r.lanes=w,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case cs:F=10;break e;case sc:F=9;break e;case Ql:F=11;break e;case Uf:F=14;break e;case ua:F=16,v=null;break e}F=29,p=Error(s(130,r===null?"null":typeof r,"")),v=null}return l=t(F,p,l,T),l.elementType=r,l.type=v,l.lanes=w,l}function us(r,l,p,v){return r=t(7,r,v,l),r.lanes=p,r}function wd(r,l,p){return r=t(6,r,null,l),r.lanes=p,r}function Cd(r){var l=t(18,null,null,0);return l.stateNode=r,l}function Rd(r,l,p){return l=t(4,r.children!==null?r.children:[],r.key,l),l.lanes=p,l.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},l}function rg(r,l,p,v,T,w,F,J,xe){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ba,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=w,this.onRecoverableError=F,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=xe,this.incompleteTransitions=new Map}function co(r,l,p,v,T,w,F,J,xe,ze,Qe,ke){return r=new rg(r,l,p,F,xe,ze,Qe,ke,J),l=1,w===!0&&(l|=24),w=t(3,null,null,l),r.current=w,w.stateNode=r,l=Se(),l.refCount++,r.pooledCache=l,l.refCount++,w.memoizedState={element:v,isDehydrated:p,cache:l},Ti(w),r}function Cf(r){return r?(r=ir,r):ir}function ic(r){var l=r._reactInternals;if(l===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=h(l),r=r!==null?m(r):null,r===null?null:Kl(r.stateNode)}function Dd(r,l,p,v,T,w){T=Cf(T),v.context===null?v.context=T:v.pendingContext=T,v=Ba(l),v.payload={element:p},w=w===void 0?null:w,w!==null&&(v.callback=w),p=Fa(r,v,l),p!==null&&(Kn(p,r,l),Jr(p,r,l))}function Ko(r,l){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var p=r.retryLane;r.retryLane=p!==0&&p<l?p:l}}function ac(r,l){Ko(r,l),(r=r.alternate)&&Ko(r,l)}var Kt={},Rf=O1,xa=DI,Df=Object.assign,$o=Symbol.for("react.element"),nr=Symbol.for("react.transitional.element"),el=Symbol.for("react.portal"),tl=Symbol.for("react.fragment"),nl=Symbol.for("react.strict_mode"),il=Symbol.for("react.profiler"),sc=Symbol.for("react.consumer"),cs=Symbol.for("react.context"),Ql=Symbol.for("react.forward_ref"),Nf=Symbol.for("react.suspense"),Dr=Symbol.for("react.suspense_list"),Uf=Symbol.for("react.memo"),ua=Symbol.for("react.lazy"),rc=Symbol.for("react.activity"),Nd=Symbol.for("react.memo_cache_sentinel"),Nr=Symbol.iterator,fo=Symbol.for("react.client.reference"),ho=Array.isArray,Ct=Rf.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ud=e.rendererVersion,oc=e.rendererPackageName,Jl=e.extraDevToolsConfig,Kl=e.getPublicInstance,og=e.getRootHostContext,$l=e.getChildHostContext,Lf=e.prepareForCommit,lg=e.resetAfterCommit,Ld=e.createInstance;e.cloneMutableInstance;var lc=e.appendInitialChild,Sa=e.finalizeInitialChildren,ca=e.shouldSetTextContent,Ur=e.createTextInstance;e.cloneMutableTextInstance;var Id=e.scheduleTimeout,ug=e.cancelTimeout,ba=e.noTimeout,ui=e.isPrimaryRenderer;e.warnsIfNotActing;var hn=e.supportsMutation,Xa=e.supportsPersistence,Yn=e.supportsHydration,Xt=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Ln=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var ln=e.setCurrentUpdatePriority,fs=e.getCurrentUpdatePriority,eu=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var al=e.shouldAttemptEagerTransition,If=e.detachDeletedInstance;e.requestPostPaintCallback;var uc=e.maySuspendCommit,tu=e.maySuspendCommitOnUpdate,Od=e.maySuspendCommitInSyncRender,$n=e.preloadInstance,zd=e.startSuspendingCommit,Of=e.suspendInstance;e.suspendOnActiveViewTransition;var cg=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var sl=e.NotPendingTransition,rl=e.HostTransitionContext,Pd=e.resetFormInstance;e.bindToConsole;var Bd=e.supportsMicrotasks,Fd=e.scheduleMicrotask,wi=e.supportsTestSelectors,ci=e.findFiberRoot,zf=e.getBoundingRect,cc=e.getTextContent,po=e.isHiddenSubtree,Vd=e.matchAccessibilityRole,Lr=e.setFocusIfFocusable,Pf=e.setupIntersectionObserver,kd=e.appendChild,Hd=e.appendChildToContainer,fg=e.commitTextUpdate,hg=e.commitMount,dg=e.commitUpdate,pg=e.insertBefore,mg=e.insertInContainerBefore,gg=e.removeChild,Gd=e.removeChildFromContainer,Xd=e.resetTextContent,Zy=e.hideInstance,vg=e.hideTextInstance,yg=e.unhideInstance,_g=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 Wd=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var xg=e.cloneInstance,qd=e.createContainerChildSet,Yd=e.appendChildToContainerChildSet,Sg=e.finalizeContainerChildren,Zd=e.replaceContainerChildren,bg=e.cloneHiddenInstance,jd=e.cloneHiddenTextInstance,mo=e.isSuspenseInstancePending,Bf=e.isSuspenseInstanceFallback,Ff=e.getSuspenseInstanceFallbackErrorDetails,Vf=e.registerSuspenseInstanceRetry,Mg=e.canHydrateFormStateMarker,Qd=e.isFormStateMarkerMatching,Eg=e.getNextHydratableSibling,Tg=e.getNextHydratableSiblingAfterSingleton,Ag=e.getFirstHydratableChild,wg=e.getFirstHydratableChildWithinContainer,Cg=e.getFirstHydratableChildWithinActivityInstance,Rg=e.getFirstHydratableChildWithinSuspenseInstance,Jd=e.getFirstHydratableChildWithinSingleton,Dg=e.canHydrateInstance,Ng=e.canHydrateTextInstance,Kd=e.canHydrateActivityInstance,Ug=e.canHydrateSuspenseInstance,Lg=e.hydrateInstance,jy=e.hydrateTextInstance,$d=e.hydrateActivityInstance,Ig=e.hydrateSuspenseInstance,Og=e.getNextHydratableInstanceAfterActivityInstance,ep=e.getNextHydratableInstanceAfterSuspenseInstance,zg=e.commitHydratedInstance,Pg=e.commitHydratedContainer,Qy=e.commitHydratedActivityInstance,Jy=e.commitHydratedSuspenseInstance,Bg=e.finalizeHydratedChildren,fc=e.flushHydrationEvents;e.clearActivityBoundary;var tp=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var kf=e.clearSuspenseBoundaryFromContainer,Fg=e.hideDehydratedBoundary,Vg=e.unhideDehydratedBoundary,nu=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var kg=e.validateHydratableInstance,np=e.validateHydratableTextInstance,hs=e.supportsResources,Hf=e.isHostHoistableType,hc=e.getHoistableRoot,ip=e.getResource,ap=e.acquireResource,go=e.releaseResource,Hg=e.hydrateHoistable,sp=e.mountHoistable,rp=e.unmountHoistable,Gf=e.createHoistableInstance,Gg=e.prepareToCommitHoistables,op=e.mayResourceSuspendCommit,lp=e.preloadResource,Xg=e.suspendResource,Ci=e.supportsSingletons,Xf=e.resolveSingletonInstance,xi=e.acquireSingletonInstance,Bi=e.releaseSingletonInstance,up=e.isHostSingletonType,ol=e.isSingletonScope,Wf=[],ll=-1,ir={},Ma=Math.clz32?Math.clz32:R,qf=Math.log,Wg=Math.LN2,Yf=256,ul=262144,iu=4194304,dc=xa.unstable_scheduleCallback,Zf=xa.unstable_cancelCallback,qg=xa.unstable_shouldYield,cp=xa.unstable_requestPaint,ea=xa.unstable_now,jf=xa.unstable_ImmediatePriority,Yg=xa.unstable_UserBlockingPriority,pc=xa.unstable_NormalPriority,Qf=xa.unstable_IdlePriority,fp=xa.log,Zg=xa.unstable_setDisableYieldValue,cl=null,Ea=null,fi=typeof Object.is=="function"?Object.is:ue,Jf=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Ky=Object.prototype.hasOwnProperty,Kf,ar,mc=!1,hp=new WeakMap,Ir=[],sr=0,In=null,gc=0,ds=[],Wa=0,ps=null,qi=1,Us="",Fi=b(null),Or=b(null),Yi=b(null),vc=b(null),Ri=null,Zn=null,un=!1,rr=null,fa=!1,$f=Error(s(519)),ms=b(null),Fn=null,Ls=null,jg=typeof AbortController<"u"?AbortController:function(){var r=[],l=this.signal={aborted:!1,addEventListener:function(p,v){r.push(v)}};this.abort=function(){l.aborted=!0,r.forEach(function(p){return p()})}},Vi=xa.unstable_scheduleCallback,$y=xa.unstable_NormalPriority,jn={$$typeof:cs,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},yc=null,Rn=null,ta=!1,gs=!1,eh=!1,vo=0,au=null,dp=0,zr=0,Di=null,vs=Ct.S;Ct.S=function(r,l){gl=ea(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Zt(r,l),vs!==null&&vs(r,l)};var yo=b(null),Ni=Error(s(460)),th=Error(s(474)),ys=Error(s(542)),or={then:function(){}},ha=null,_o=null,fl=0,Zi=Vo(!0),pp=Vo(!1),ji=[],lr=0,hl=0,qa=!1,nh=!1,dl=b(null),xo=b(0),Ta=b(null),Aa=null,ri=b(0),Pr=0,Wt=null,Et=null,Vt=null,$t=!1,jt=!1,pn=!1,na=0,_s=0,Is=null,mp=0,Ya={readContext:G,use:vi,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useLayoutEffect:He,useInsertionEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useSyncExternalStore:He,useId:He,useHostTransitionStatus:He,useFormState:He,useActionState:He,useOptimistic:He,useMemoCache:He,useCacheRefresh:He};Ya.useEffectEvent=He;var ei={readContext:G,use:vi,useCallback:function(r,l){return Ht().memoizedState=[r,l===void 0?null:l],r},useContext:G,useEffect:Hu,useImperativeHandle:function(r,l,p){p=p!=null?p.concat([r]):null,Wo(4194308,4,Ll.bind(null,l,r),p)},useLayoutEffect:function(r,l){return Wo(4194308,4,r,l)},useInsertionEffect:function(r,l){Wo(4,2,r,l)},useMemo:function(r,l){var p=Ht();l=l===void 0?null:l;var v=r();if(pn){$(!0);try{r()}finally{$(!1)}}return p.memoizedState=[v,l],v},useReducer:function(r,l,p){var v=Ht();if(p!==void 0){var T=p(l);if(pn){$(!0);try{p(l)}finally{$(!1)}}}else T=l;return v.memoizedState=v.baseState=T,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:T},v.queue=r,r=r.dispatch=Gy.bind(null,Wt,r),[v.memoizedState,r]},useRef:function(r){var l=Ht();return r={current:r},l.memoizedState=r},useState:function(r){r=nd(r);var l=r.queue,p=Om.bind(null,Wt,l);return l.dispatch=p,[r.memoizedState,p]},useDebugValue:Xu,useDeferredValue:function(r,l){var p=Ht();return Ol(p,r,l)},useTransition:function(){var r=nd(!1);return r=Um.bind(null,Wt,r.queue,!0,!1),Ht().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,l,p){var v=Wt,T=Ht();if(un){if(p===void 0)throw Error(s(407));p=p()}else{if(p=l(),en===null)throw Error(s(349));(cn&127)!==0||Ii(v,l,p)}T.memoizedState=p;var w={value:p,getSnapshot:l};return T.queue=w,Hu(Go.bind(null,v,w,r),[r]),v.flags|=2048,Va(9,{destroy:void 0},Oi.bind(null,v,w,p,l),null),p},useId:function(){var r=Ht(),l=en.identifierPrefix;if(un){var p=Us,v=qi;p=(v&~(1<<32-Ma(v)-1)).toString(32)+p,l="_"+l+"R_"+p,p=na++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=mp++,l="_"+l+"r_"+p.toString(32)+"_";return r.memoizedState=l},useHostTransitionStatus:od,useFormState:ad,useActionState:ad,useOptimistic:function(r){var l=Ht();l.memoizedState=l.baseState=r;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=uf.bind(null,Wt,!0,p),p.dispatch=l,[r,l]},useMemoCache:Ds,useCacheRefresh:function(){return Ht().memoizedState=Hy.bind(null,Wt)},useEffectEvent:function(r){var l=Ht(),p={impl:r};return l.memoizedState=p,function(){if((sn&2)!==0)throw Error(s(440));return p.impl.apply(void 0,arguments)}}},ur={readContext:G,use:vi,useCallback:of,useContext:G,useEffect:Ul,useImperativeHandle:Nm,useInsertionEffect:eo,useLayoutEffect:Gu,useMemo:Il,useReducer:sa,useRef:rf,useState:function(){return sa(Gn)},useDebugValue:Xu,useDeferredValue:function(r,l){var p=at();return rd(p,Et.memoizedState,r,l)},useTransition:function(){var r=sa(Gn)[0],l=at().memoizedState;return[typeof r=="boolean"?r:Ot(r),l]},useSyncExternalStore:yi,useId:lf,useHostTransitionStatus:od,useFormState:Dl,useActionState:Dl,useOptimistic:function(r,l){var p=at();return Vu(p,Et,r,l)},useMemoCache:Ds,useCacheRefresh:Im};ur.useEffectEvent=ra;var So={readContext:G,use:vi,useCallback:of,useContext:G,useEffect:Ul,useImperativeHandle:Nm,useInsertionEffect:eo,useLayoutEffect:Gu,useMemo:Il,useReducer:Ai,useRef:rf,useState:function(){return Ai(Gn)},useDebugValue:Xu,useDeferredValue:function(r,l){var p=at();return Et===null?Ol(p,r,l):rd(p,Et.memoizedState,r,l)},useTransition:function(){var r=Ai(Gn)[0],l=at().memoizedState;return[typeof r=="boolean"?r:Ot(r),l]},useSyncExternalStore:yi,useId:lf,useHostTransitionStatus:od,useFormState:Nl,useActionState:Nl,useOptimistic:function(r,l){var p=at();return Et!==null?Vu(p,Et,r,l):(p.baseState=r,[r,p.queue.dispatch])},useMemoCache:Ds,useCacheRefresh:Im};So.useEffectEvent=ra;var _c={enqueueSetState:function(r,l,p){r=r._reactInternals;var v=qn(),T=Ba(v);T.payload=l,p!=null&&(T.callback=p),l=Fa(r,T,v),l!==null&&(Kn(l,r,v),Jr(l,r,v))},enqueueReplaceState:function(r,l,p){r=r._reactInternals;var v=qn(),T=Ba(v);T.tag=1,T.payload=l,p!=null&&(T.callback=p),l=Fa(r,T,v),l!==null&&(Kn(l,r,v),Jr(l,r,v))},enqueueForceUpdate:function(r,l){r=r._reactInternals;var p=qn(),v=Ba(p);v.tag=2,l!=null&&(v.callback=l),l=Fa(r,v,p),l!==null&&(Kn(l,r,p),Jr(l,r,p))}},da=Error(s(461)),Xn=!1,pl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},oi=!1,li=!1,su=!1,gp=typeof WeakSet=="function"?WeakSet:Set,hi=null,ti=null,di=!1,Dn=null,Za=8192,ru={getCacheForType:function(r){var l=G(jn),p=l.data.get(r);return p===void 0&&(p=r(),l.data.set(r,p)),p},cacheSignal:function(){return G(jn).controller.signal}},xs=0,ou=1,lu=2,xc=3,bo=4;if(typeof Symbol=="function"&&Symbol.for){var ml=Symbol.for;xs=ml("selector.component"),ou=ml("selector.has_pseudo_class"),lu=ml("selector.role"),xc=ml("selector.test_id"),bo=ml("selector.text")}var ja=typeof WeakMap=="function"?WeakMap:Map,sn=0,en=null,rn=null,cn=0,Nn=0,Si=null,Os=!1,Mo=!1,Eo=!1,cr=0,ni=0,Br=0,To=0,uu=0,pa=0,cu=0,Sc=null,wa=null,ih=!1,bc=0,gl=0,Ao=1/0,Mc=null,Fr=null,bi=0,Vr=null,vl=null,fr=0,fu=0,ah=null,vp=null,bn=0,Ec=null;return Kt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var l=Ki(r,67108864);l!==null&&Kn(l,r,67108864),ac(r,67108864)}},Kt.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var l=qn();l=j(l);var p=Ki(r,l);p!==null&&Kn(p,r,l),ac(r,l)}},Kt.attemptSynchronousHydration=function(r){switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var l=C(r.pendingLanes);if(l!==0){for(r.pendingLanes|=2,r.entangledLanes|=2;l;){var p=1<<31-Ma(l);r.entanglements[1]|=p,l&=~p}ct(r),(sn&6)===0&&(Ao=ea()+500,Ze(0))}}break;case 31:case 13:l=Ki(r,2),l!==null&&Kn(l,r,2),bf(),ac(r,2)}},Kt.batchedUpdates=function(r,l){return r(l)},Kt.createComponentSelector=function(r){return{$$typeof:xs,value:r}},Kt.createContainer=function(r,l,p,v,T,w,F,J,xe,ze){return co(r,l,!1,null,p,v,w,null,F,J,xe,ze)},Kt.createHasPseudoClassSelector=function(r){return{$$typeof:ou,value:r}},Kt.createHydrationContainer=function(r,l,p,v,T,w,F,J,xe,ze,Qe,ke,dt,Gt){var pi;return r=co(p,v,!0,r,T,w,J,Gt,xe,ze,Qe,ke),r.context=Cf(null),p=r.current,v=qn(),v=j(v),T=Ba(v),T.callback=(pi=l)!=null?pi:null,Fa(p,T,v),l=v,r.current.lanes=l,P(r,l),ct(r),r},Kt.createPortal=function(r,l,p){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:el,key:v==null?null:""+v,children:r,containerInfo:l,implementation:p}},Kt.createRoleSelector=function(r){return{$$typeof:lu,value:r}},Kt.createTestNameSelector=function(r){return{$$typeof:xc,value:r}},Kt.createTextSelector=function(r){return{$$typeof:bo,value:r}},Kt.defaultOnCaughtError=function(r){console.error(r)},Kt.defaultOnRecoverableError=function(r){Jf(r)},Kt.defaultOnUncaughtError=function(r){Jf(r)},Kt.deferredUpdates=function(r){var l=Ct.T,p=fs();try{return ln(32),Ct.T=null,r()}finally{ln(p),Ct.T=l}},Kt.discreteUpdates=function(r,l,p,v,T){var w=Ct.T,F=fs();try{return ln(2),Ct.T=null,r(l,p,v,T)}finally{ln(F),Ct.T=w,sn===0&&(Ao=ea()+500)}},Kt.findAllNodes=_a,Kt.findBoundingRects=function(r,l){if(!wi)throw Error(s(363));l=_a(r,l),r=[];for(var p=0;p<l.length;p++)r.push(zf(l[p]));for(l=r.length-1;0<l;l--){p=r[l];for(var v=p.x,T=v+p.width,w=p.y,F=w+p.height,J=l-1;0<=J;J--)if(l!==J){var xe=r[J],ze=xe.x,Qe=ze+xe.width,ke=xe.y,dt=ke+xe.height;if(v>=ze&&w>=ke&&T<=Qe&&F<=dt){r.splice(l,1);break}else if(v!==ze||p.width!==xe.width||dt<w||ke>F){if(!(w!==ke||p.height!==xe.height||Qe<v||ze>T)){ze>v&&(xe.width+=ze-v,xe.x=v),Qe<T&&(xe.width=T-ze),r.splice(l,1);break}}else{ke>w&&(xe.height+=ke-w,xe.y=w),dt<F&&(xe.height=F-ke),r.splice(l,1);break}}}return r},Kt.findHostInstance=ic,Kt.findHostInstanceWithNoPortals=function(r){return r=h(r),r=r!==null?g(r):null,r===null?null:Kl(r.stateNode)},Kt.findHostInstanceWithWarning=function(r){return ic(r)},Kt.flushPassiveEffects=tr,Kt.flushSyncFromReconciler=function(r){var l=sn;sn|=1;var p=Ct.T,v=fs();try{if(ln(2),Ct.T=null,r)return r()}finally{ln(v),Ct.T=p,sn=l,(sn&6)===0&&Ze(0)}},Kt.flushSyncWork=bf,Kt.focusWithin=function(r,l){if(!wi)throw Error(s(363));for(r=so(r),l=Wl(r,l),l=Array.from(l),r=0;r<l.length;){var p=l[r++],v=p.tag;if(!po(p)){if((v===5||v===26||v===27)&&Lr(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},Kt.getFindAllNodesFailureDescription=function(r,l){if(!wi)throw Error(s(363));var p=0,v=[];r=[so(r),0];for(var T=0;T<r.length;){var w=r[T++],F=w.tag,J=r[T++],xe=l[J];if((F!==5&&F!==26&&F!==27||!po(w))&&(ro(w,xe)&&(v.push(Xl(xe)),J++,J>p&&(p=J)),J<l.length))for(w=w.child;w!==null;)r.push(w,J),w=w.sibling}if(p<l.length){for(r=[];p<l.length;p++)r.push(Xl(l[p]));return`findAllNodes was able to match part of the selector:
|
|
`+(v.join(" > ")+`
|
|
|
|
No matching component was found for:
|
|
`)+r.join(" > ")}return null},Kt.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return Kl(r.child.stateNode);default:return r.child.stateNode}},Kt.injectIntoDevTools=function(){var r={bundleType:0,version:Ud,rendererPackageName:oc,currentDispatcherRef:Ct,reconcilerVersion:"19.2.0"};if(Jl!==null&&(r.rendererConfig=Jl),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)r=!0;else{try{cl=l.inject(r),Ea=l}catch{}r=!!l.checkDCE}}return r},Kt.isAlreadyRendering=function(){return(sn&6)!==0},Kt.observeVisibleRects=function(r,l,p,v){if(!wi)throw Error(s(363));r=_a(r,l);var T=Pf(r,p,v).disconnect;return{disconnect:function(){T()}}},Kt.shouldError=function(){return null},Kt.shouldSuspend=function(){return!1},Kt.startHostTransition=function(r,l,p,v){if(r.tag!==5)throw Error(s(476));var T=Lm(r).queue;Um(r,T,l,sl,p===null?i:function(){var w=Lm(r);return w.next===null&&(w=r.alternate.memoizedState),Wu(r,w.next.queue,{},qn()),p(v)})},Kt.updateContainer=function(r,l,p,v){var T=l.current,w=qn();return Dd(T,w,r,l,p,v),w},Kt.updateContainerSync=function(r,l,p,v){return Dd(l.current,2,r,l,p,v),2},Kt},o.exports.default=o.exports,Object.defineProperty(o.exports,"__esModule",{value:!0})})(w1)),w1.exports}var R1;function aO(){return R1||(R1=1,A1.exports=iO()),A1.exports}var sO=aO();const rO=nO(sO);function oO(o){const e=rO(o);return e.injectIntoDevTools(),e}const FT=0,Zh={},lO=/^three(?=[A-Z])/,ky=o=>`${o[0].toUpperCase()}${o.slice(1)}`;let uO=0;const cO=o=>typeof o=="function";function fO(o){if(cO(o)){const e=`${uO++}`;return Zh[e]=o,e}else Object.assign(Zh,o)}function VT(o,e){const t=ky(o),i=Zh[t];if(o!=="primitive"&&!i)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(o==="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 hO(o,e,t){var i;return o=ky(o)in Zh?o:o.replace(lO,""),VT(o,e),o==="primitive"&&(i=e.object)!=null&&i.__r3f&&delete e.object.__r3f,ey(e.object,t,o,e)}function dO(o){if(!o.isHidden){var e;o.props.attach&&(e=o.parent)!=null&&e.object?ny(o.parent,o):Es(o.object)&&(o.object.visible=!1),o.isHidden=!0,td(o)}}function kT(o){if(o.isHidden){var e;o.props.attach&&(e=o.parent)!=null&&e.object?ty(o.parent,o):Es(o.object)&&o.props.visible!==!1&&(o.object.visible=!0),o.isHidden=!1,td(o)}}function jS(o,e,t){const i=e.root.getState();if(!(!o.parent&&o.object!==i.scene)){if(!e.object){var s,u;const f=Zh[ky(e.type)];e.object=(s=e.props.object)!=null?s:new f(...(u=e.props.args)!=null?u:[]),e.object.__r3f=e}if(Cu(e.object,e.props),e.props.attach)ty(o,e);else if(Es(e.object)&&Es(o.object)){const f=o.object.children.indexOf(t?.object);if(t&&f!==-1){const h=o.object.children.indexOf(e.object);if(h!==-1){o.object.children.splice(h,1);const m=h<f?f-1:f;o.object.children.splice(m,0,e.object)}else e.object.parent=o.object,o.object.children.splice(f,0,e.object),e.object.dispatchEvent({type:"added"}),o.object.dispatchEvent({type:"childadded",child:e.object})}else o.object.add(e.object)}for(const f of e.children)jS(e,f);td(e)}}function Sx(o,e){e&&(e.parent=o,o.children.push(e),jS(o,e))}function D1(o,e,t){if(!e||!t)return;e.parent=o;const i=o.children.indexOf(t);i!==-1?o.children.splice(i,0,e):o.children.push(e),jS(o,e,t)}function HT(o){if(typeof o.dispose=="function"){const e=()=>{try{o.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Wx.unstable_scheduleCallback(Wx.unstable_IdlePriority,e)}}function Yx(o,e,t){if(!e)return;e.parent=null;const i=o.children.indexOf(e);i!==-1&&o.children.splice(i,1),e.props.attach?ny(o,e):Es(e.object)&&Es(o.object)&&(o.object.remove(e.object),YI(NT(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];Yx(e,f,s)}e.children.length=0,delete e.object.__r3f,s&&e.type!=="primitive"&&e.object.type!=="Scene"&&HT(e.object),t===void 0&&td(e)}function pO(o,e){for(const t of[o,o.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const i=t.ref(e);typeof i=="function"&&(t.refCleanup=i)}else t.ref&&(t.ref.current=e)}const ov=[];function mO(){for(const[t]of ov){const i=t.parent;if(i){t.props.attach?ny(i,t):Es(t.object)&&Es(i.object)&&i.object.remove(t.object);for(const s of t.children)s.props.attach?ny(t,s):Es(s.object)&&Es(t.object)&&t.object.remove(s.object)}t.isHidden&&kT(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&HT(t.object)}for(const[t,i,s]of ov){t.props=i;const u=t.parent;if(u){var o,e;const f=Zh[ky(t.type)];t.object=(o=t.props.object)!=null?o:new f(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,pO(s,t.object),Cu(t.object,t.props),t.props.attach?ty(u,t):Es(t.object)&&Es(u.object)&&u.object.add(t.object);for(const h of t.children)h.props.attach?ty(t,h):Es(h.object)&&Es(t.object)&&t.object.add(h.object);td(t)}}ov.length=0}const bx=()=>{},N1={};let iv=FT;const gO=0,vO=4,Zx=oO({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:hO,removeChild:Yx,appendChild:Sx,appendInitialChild:Sx,insertBefore:D1,appendChildToContainer(o,e){const t=o.getState().scene.__r3f;!e||!t||Sx(t,e)},removeChildFromContainer(o,e){const t=o.getState().scene.__r3f;!e||!t||Yx(t,e)},insertInContainerBefore(o,e,t){const i=o.getState().scene.__r3f;!e||!t||!i||D1(i,e,t)},getRootHostContext:()=>N1,getChildHostContext:()=>N1,commitUpdate(o,e,t,i,s){var u,f,h;VT(e,i);let m=!1;if((o.type==="primitive"&&t.object!==i.object||((u=i.args)==null?void 0:u.length)!==((f=t.args)==null?void 0:f.length)||(h=i.args)!=null&&h.some((_,x)=>{var b;return _!==((b=t.args)==null?void 0:b[x])}))&&(m=!0),m)ov.push([o,{...i},s]);else{const _=GI(o,i);Object.keys(_).length&&(Object.assign(o.props,_),Cu(o.object,_))}(s.sibling===null||(s.flags&vO)===gO)&&mO()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:o=>o?.object,prepareForCommit:()=>null,preparePortalMount:o=>ey(o.getState().scene,o,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:dO,unhideInstance:kT,createTextInstance:bx,hideTextInstance:bx,unhideTextInstance:bx,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:It.createContext(null),setCurrentUpdatePriority(o){iv=o},getCurrentUpdatePriority(){return iv},resolveUpdatePriority(){var o;if(iv!==FT)return iv;switch(typeof window<"u"&&((o=window.event)==null?void 0:o.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return eO;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return KI;default:return $I}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tO.version,applyViewTransitionName(o,e,t){},restoreViewTransitionName(o,e){},cancelViewTransitionName(o,e,t){},cancelRootViewTransitionName(o){},restoreRootViewTransitionName(o){},InstanceMeasurement:null,measureInstance:o=>null,wasInstanceInViewport:o=>!0,hasInstanceChanged:(o,e)=>!1,hasInstanceAffectedParent:(o,e)=>!1,suspendOnActiveViewTransition(o,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(o){},createViewTransitionInstance:o=>null,getCurrentGestureOffset(o){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(o,e){return o},cloneMutableTextInstance(o){return o},cloneRootViewTransitionContainer(o){throw new Error("Not implemented.")},removeRootViewTransitionClone(o,e){throw new Error("Not implemented.")},createFragmentInstance:o=>null,updateFragmentInstanceFiber(o,e){},commitNewChildToFragmentInstance(o,e){},deleteChildFromFragmentInstance(o,e){},measureClonedInstance:o=>null,maySuspendCommitOnUpdate:(o,e,t)=>!1,maySuspendCommitInSyncRender:(o,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(o,e)=>null}),Kc=new Map,Nh={objects:"shallow",strict:!1};function yO(o,e){if(!e&&typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement&&o.parentElement){const{width:t,height:i,top:s,left:u}=o.parentElement.getBoundingClientRect();return{width:t,height:i,top:s,left:u}}else if(!e&&typeof OffscreenCanvas<"u"&&o instanceof OffscreenCanvas)return{width:o.width,height:o.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function _O(o){const e=Kc.get(o),t=e?.fiber,i=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const s=typeof reportError=="function"?reportError:console.error,u=i||jI(Jx,L1),f=t||Zx.createContainer(u,JI,null,!1,null,"",s,s,s,null);e||Kc.set(o,{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:C,onCreated:E,shadows:D=!1,linear:U=!1,flat:L=!1,legacy:B=!1,orthographic:P=!1,frameloop:H="always",dpr:W=[1,2],performance:I,raycaster:z,camera:j,onPointerMissed:ae}=x,$=u.getState(),ue=$.gl;if(!$.gl){const X={canvas:o,powerPreference:"high-performance",antialias:!0,alpha:!0},se=typeof M=="function"?await M(X):M;T1(se)?ue=se:ue=new wT({...X,...M}),$.set({gl:ue})}let he=$.raycaster;he||$.set({raycaster:he=new _T});const{params:q,...K}=z||{};if(mi.equ(K,he,Nh)||Cu(he,{...K}),mi.equ(q,he.params,Nh)||Cu(he,{params:{...he.params,...q}}),!$.camera||$.camera===m&&!mi.equ(m,j,Nh)){m=j;const X=j?.isCamera,se=X?j:P?new $h(0,0,0,0,.1,1e3):new aa(75,0,.1,1e3);X||(se.position.z=5,j&&(Cu(se,j),se.manual||("aspect"in j||"left"in j||"right"in j||"bottom"in j||"top"in j)&&(se.manual=!0,se.updateProjectionMatrix())),!$.camera&&!(j!=null&&j.rotation)&&se.lookAt(0,0,0)),$.set({camera:se}),he.camera=se}if(!$.scene){let X;R!=null&&R.isScene?(X=R,ey(X,u,"",{})):(X=new _S,ey(X,u,"",{}),R&&Cu(X,R)),$.set({scene:X})}C&&!$.events.handlers&&$.set({events:C(u)});const ce=yO(o,A);if(mi.equ(ce,$.size,Nh)||$.setSize(ce.width,ce.height,ce.top,ce.left),W&&$.viewport.dpr!==IT(W)&&$.setDpr(W),$.frameloop!==H&&$.setFrameloop(H),$.onPointerMissed||$.set({onPointerMissed:ae}),I&&!mi.equ(I,$.performance,Nh)&&$.set(X=>({performance:{...X.performance,...I}})),!$.xr){var Ae;const X=(Oe,nt)=>{const fe=u.getState();fe.frameloop!=="never"&&L1(Oe,!0,fe,nt)},se=()=>{const Oe=u.getState();Oe.gl.xr.enabled=Oe.gl.xr.isPresenting,Oe.gl.xr.setAnimationLoop(Oe.gl.xr.isPresenting?X:null),Oe.gl.xr.isPresenting||Jx(Oe)},Ee={connect(){const Oe=u.getState().gl;Oe.xr.addEventListener("sessionstart",se),Oe.xr.addEventListener("sessionend",se)},disconnect(){const Oe=u.getState().gl;Oe.xr.removeEventListener("sessionstart",se),Oe.xr.removeEventListener("sessionend",se)}};typeof((Ae=ue.xr)==null?void 0:Ae.addEventListener)=="function"&&Ee.connect(),$.set({xr:Ee})}if(ue.shadowMap){const X=ue.shadowMap.enabled,se=ue.shadowMap.type;if(ue.shadowMap.enabled=!!D,mi.boo(D))ue.shadowMap.type=Xp;else if(mi.str(D)){var Ce;const Ee={basic:F1,percentage:zh,soft:Xp,variance:kc};ue.shadowMap.type=(Ce=Ee[D])!=null?Ce:Xp}else mi.obj(D)&&Object.assign(ue.shadowMap,D);(X!==ue.shadowMap.enabled||se!==ue.shadowMap.type)&&(ue.shadowMap.needsUpdate=!0)}return xn.enabled=!B,g||(ue.outputColorSpace=U?Lu:Ua,ue.toneMapping=L?mr:sy),$.legacy!==B&&$.set(()=>({legacy:B})),$.linear!==U&&$.set(()=>({linear:U})),$.flat!==L&&$.set(()=>({flat:L})),M&&!mi.fun(M)&&!T1(M)&&!mi.equ(M,ue,Nh)&&Cu(ue,M),h=E,g=!0,b(),this},render(x){return!g&&!_&&this.configure(),_.then(()=>{Zx.updateContainer(Bs.jsx(xO,{store:u,children:x,onCreated:h,rootElement:o}),f,null,()=>{})}),u},unmount(){GT(o)}}}function xO({store:o,children:e,onCreated:t,rootElement:i}){return Cm(()=>{const s=o.getState();s.set(u=>({internal:{...u.internal,active:!0}})),t&&t(s),o.getState().events.connected||s.events.connect==null||s.events.connect(i)},[]),Bs.jsx(PT.Provider,{value:o,children:e})}function GT(o,e){const t=Kc.get(o),i=t?.fiber;if(i){const s=t?.store.getState();s&&(s.internal.active=!1),Zx.updateContainer(null,i,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(),VI(s.scene),Kc.delete(o)}catch{}},500)})}}const SO=new Set,bO=new Set,MO=new Set;function Mx(o,e){if(o.size)for(const{callback:t}of o.values())t(e)}function $p(o,e){switch(o){case"before":return Mx(SO,e);case"after":return Mx(bO,e);case"tail":return Mx(MO,e)}}let Ex,Tx;function jx(o,e,t){let i=e.clock.getDelta();e.frameloop==="never"&&typeof o=="number"&&(i=o-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=o),Ex=e.internal.subscribers;for(let s=0;s<Ex.length;s++)Tx=Ex[s],Tx.ref.current(Tx.store.getState(),i,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 iy=!1,Qx=!1,Ax,U1,Uh;function XT(o){U1=requestAnimationFrame(XT),iy=!0,Ax=0,$p("before",o),Qx=!0;for(const t of Kc.values()){var e;Uh=t.store.getState(),Uh.internal.active&&(Uh.frameloop==="always"||Uh.internal.frames>0)&&!((e=Uh.gl.xr)!=null&&e.isPresenting)&&(Ax+=jx(o,Uh))}if(Qx=!1,$p("after",o),Ax===0)return $p("tail",o),iy=!1,cancelAnimationFrame(U1)}function Jx(o,e=1){var t;if(!o)return Kc.forEach(i=>Jx(i.store.getState(),e));(t=o.gl.xr)!=null&&t.isPresenting||!o.internal.active||o.frameloop==="never"||(e>1?o.internal.frames=Math.min(60,o.internal.frames+e):Qx?o.internal.frames=2:o.internal.frames=1,iy||(iy=!0,requestAnimationFrame(XT)))}function L1(o,e=!0,t,i){if(e&&$p("before",o),t)jx(o,t,i);else for(const s of Kc.values())jx(o,s.store.getState());e&&$p("after",o)}const wx={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 EO(o){const{handlePointer:e}=ZI(o);return{priority:1,enabled:!0,compute(t,i,s){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(wx).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:s}=o.getState();(t=s.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(s.lastEvent.current)},connect:t=>{const{set:i,events:s}=o.getState();if(s.disconnect==null||s.disconnect(),i(u=>({events:{...u.events,connected:t}})),s.handlers)for(const u in s.handlers){const f=s.handlers[u],[h,m]=wx[u];t.addEventListener(h,f,{passive:m})}},disconnect:()=>{const{set:t,events:i}=o.getState();if(i.connected){if(i.handlers)for(const s in i.handlers){const u=i.handlers[s],[f]=wx[s];i.connected.removeEventListener(f,u)}t(s=>({events:{...s.events,connected:void 0}}))}}}}function I1(o,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>o(...i),e)}}function TO({debounce:o,scroll:e,polyfill:t,offsetSize:i}={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]=It.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=It.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u,orientationHandler:null}),m=o?typeof o=="number"?o:o.scroll:null,g=o?typeof o=="number"?o:o.resize:null,_=It.useRef(!1);It.useEffect(()=>(_.current=!0,()=>{_.current=!1}));const[x,b,M]=It.useMemo(()=>{const E=()=>{if(!h.current.element)return;const{left:D,top:U,width:L,height:B,bottom:P,right:H,x:W,y:I}=h.current.element.getBoundingClientRect(),z={left:D,top:U,width:L,height:B,bottom:P,right:H,x:W,y:I};h.current.element instanceof HTMLElement&&i&&(z.height=h.current.element.offsetHeight,z.width=h.current.element.offsetWidth),Object.freeze(z),_.current&&!RO(h.current.lastBounds,z)&&f(h.current.lastBounds=z)};return[E,g?I1(E,g):E,m?I1(E,m):E]},[f,i,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 C=E=>{!E||E===h.current.element||(A(),h.current.element=E,h.current.scrollContainers=WT(E),R())};return wO(M,!!e),AO(b),It.useEffect(()=>{A(),R()},[e,M,b]),It.useEffect(()=>A,[]),[C,u,x]}function AO(o){It.useEffect(()=>{const e=o;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[o])}function wO(o,e){It.useEffect(()=>{if(e){const t=o;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[o,e])}function WT(o){const e=[];if(!o||o===document.body)return e;const{overflow:t,overflowX:i,overflowY:s}=window.getComputedStyle(o);return[t,i,s].some(u=>u==="auto"||u==="scroll")&&e.push(o),[...e,...WT(o.parentElement)]}const CO=["x","y","top","bottom","left","right","width","height"],RO=(o,e)=>CO.every(t=>o[t]===e[t]);function DO({ref:o,children:e,fallback:t,resize:i,style:s,gl:u,events:f=EO,eventSource:h,eventPrefix:m,shadows:g,linear:_,flat:x,legacy:b,orthographic:M,frameloop:A,dpr:R,performance:C,raycaster:E,camera:D,scene:U,onPointerMissed:L,onCreated:B,...P}){It.useMemo(()=>fO(yI),[]);const H=PI(),[W,I]=TO({scroll:!0,debounce:{scroll:50,resize:0},...i}),z=It.useRef(null),j=It.useRef(null);It.useImperativeHandle(o,()=>z.current);const ae=LT(L),[$,ue]=It.useState(!1),[he,q]=It.useState(!1);if($)throw $;if(he)throw he;const K=It.useRef(null);Cm(()=>{const Ae=z.current;if(I.width>0&&I.height>0&&Ae){K.current||(K.current=_O(Ae));async function Ce(){await K.current.configure({gl:u,scene:U,events:f,shadows:g,linear:_,flat:x,legacy:b,orthographic:M,frameloop:A,dpr:R,performance:C,raycaster:E,camera:D,size:I,onPointerMissed:(...X)=>ae.current==null?void 0:ae.current(...X),onCreated:X=>{X.events.connect==null||X.events.connect(h?OI(h)?h.current:h:j.current),m&&X.setEvents({compute:(se,Ee)=>{const Oe=se[m+"X"],nt=se[m+"Y"];Ee.pointer.set(Oe/Ee.size.width*2-1,-(nt/Ee.size.height)*2+1),Ee.raycaster.setFromCamera(Ee.pointer,Ee.camera)}}),B?.(X)}}),K.current.render(Bs.jsx(H,{children:Bs.jsx(FI,{set:q,children:Bs.jsx(It.Suspense,{fallback:Bs.jsx(BI,{set:ue}),children:e??null})})}))}Ce()}}),It.useEffect(()=>{const Ae=z.current;if(Ae)return()=>GT(Ae)},[]);const ce=h?"none":"auto";return Bs.jsx("div",{ref:j,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ce,...s},...P,children:Bs.jsx("div",{ref:W,style:{width:"100%",height:"100%"},children:Bs.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}function OO(o){return Bs.jsx(RT,{children:Bs.jsx(DO,{...o})})}function Kx(){return Kx=Object.assign?Object.assign.bind():function(o){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(o[i]=t[i])}return o},Kx.apply(null,arguments)}var NO=`#define GLSLIFY 1
|
|
vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}`;class UO extends US{constructor(e={}){super(e),this.setValues(e),this._time={value:0},this._distort={value:.4},this._radius={value:1}}onBeforeCompile(e){e.uniforms.time=this._time,e.uniforms.radius=this._radius,e.uniforms.distort=this._distort,e.vertexShader=`
|
|
uniform float time;
|
|
uniform float radius;
|
|
uniform float distort;
|
|
${NO}
|
|
${e.vertexShader}
|
|
`,e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`
|
|
float updateTime = time / 50.0;
|
|
float noise = snoise(vec3(position / 2.0 + updateTime * 5.0));
|
|
vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius));
|
|
`)}get time(){return this._time.value}set time(e){this._time.value=e}get distort(){return this._distort.value}set distort(e){this._distort.value=e}get radius(){return this._radius.value}set radius(e){this._radius.value=e}}const zO=It.forwardRef(({speed:o=1,...e},t)=>{const[i]=It.useState(()=>new UO);return BT(s=>i&&(i.time=s.clock.elapsedTime*o)),It.createElement("primitive",Kx({object:i,ref:t,attach:"material"},e))}),PO=It.forwardRef(({children:o,enabled:e=!0,speed:t=1,rotationIntensity:i=1,floatIntensity:s=1,floatingRange:u=[-.1,.1],autoInvalidate:f=!1,...h},m)=>{const g=It.useRef(null);It.useImperativeHandle(m,()=>g.current,[]);const _=It.useRef(Math.random()*1e4);return BT(x=>{var b,M;if(!e||t===0)return;f&&x.invalidate();const A=_.current+x.clock.elapsedTime;g.current.rotation.x=Math.cos(A/4*t)/8*i,g.current.rotation.y=Math.sin(A/4*t)/8*i,g.current.rotation.z=Math.sin(A/4*t)/20*i;let R=Math.sin(A/4*t)/10;R=SE.mapLinear(R,-.1,.1,(b=u?.[0])!==null&&b!==void 0?b:-.1,(M=u?.[1])!==null&&M!==void 0?M:.1),g.current.position.y=R*s,g.current.updateMatrix()}),It.createElement("group",h,It.createElement("group",{ref:g,matrixAutoUpdate:!1},o))});export{OO as C,PO as F,zO as M,O1 as R,LO as c,Bs as j,It as r,BT as u};
|