@axion-engine/core 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
- "use strict";(()=>{var vA=Object.create;var b0=Object.defineProperty;var xA=Object.getOwnPropertyDescriptor;var yA=Object.getOwnPropertyNames;var SA=Object.getPrototypeOf,MA=Object.prototype.hasOwnProperty;var pi=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),bA=(i,t)=>{for(var e in t)b0(i,e,{get:t[e],enumerable:!0})},EA=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of yA(t))!MA.call(i,s)&&s!==e&&b0(i,s,{get:()=>t[s],enumerable:!(n=xA(t,s))||n.enumerable});return i};var zn=(i,t,e)=>(e=i!=null?vA(SA(i)):{},EA(t||!i||!i.__esModule?b0(e,"default",{value:i,enumerable:!0}):e,i));var a1=pi(me=>{"use strict";var Cv=Symbol.for("react.transitional.element"),iD=Symbol.for("react.portal"),sD=Symbol.for("react.fragment"),aD=Symbol.for("react.strict_mode"),rD=Symbol.for("react.profiler"),oD=Symbol.for("react.consumer"),lD=Symbol.for("react.context"),cD=Symbol.for("react.forward_ref"),uD=Symbol.for("react.suspense"),hD=Symbol.for("react.memo"),$b=Symbol.for("react.lazy"),fD=Symbol.for("react.activity"),jb=Symbol.iterator;function dD(i){return i===null||typeof i!="object"?null:(i=jb&&i[jb]||i["@@iterator"],typeof i=="function"?i:null)}var t1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},e1=Object.assign,n1={};function xc(i,t,e){this.props=i,this.context=t,this.refs=n1,this.updater=e||t1}xc.prototype.isReactComponent={};xc.prototype.setState=function(i,t){if(typeof i!="object"&&typeof i!="function"&&i!=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,i,t,"setState")};xc.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function i1(){}i1.prototype=xc.prototype;function Rv(i,t,e){this.props=i,this.context=t,this.refs=n1,this.updater=e||t1}var wv=Rv.prototype=new i1;wv.constructor=Rv;e1(wv,xc.prototype);wv.isPureReactComponent=!0;var Jb=Array.isArray;function Av(){}var en={H:null,A:null,T:null,S:null},s1=Object.prototype.hasOwnProperty;function Nv(i,t,e){var n=e.ref;return{$$typeof:Cv,type:i,key:t,ref:n!==void 0?n:null,props:e}}function pD(i,t){return Nv(i.type,t,i.props)}function Dv(i){return typeof i=="object"&&i!==null&&i.$$typeof===Cv}function mD(i){var t={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(e){return t[e]})}var Kb=/\/+/g;function Tv(i,t){return typeof i=="object"&&i!==null&&i.key!=null?mD(""+i.key):t.toString(36)}function gD(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(Av,Av):(i.status="pending",i.then(function(t){i.status==="pending"&&(i.status="fulfilled",i.value=t)},function(t){i.status==="pending"&&(i.status="rejected",i.reason=t)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function vc(i,t,e,n,s){var r=typeof i;(r==="undefined"||r==="boolean")&&(i=null);var l=!1;if(i===null)l=!0;else switch(r){case"bigint":case"string":case"number":l=!0;break;case"object":switch(i.$$typeof){case Cv:case iD:l=!0;break;case $b:return l=i._init,vc(l(i._payload),t,e,n,s)}}if(l)return s=s(i),l=n===""?"."+Tv(i,0):n,Jb(s)?(e="",l!=null&&(e=l.replace(Kb,"$&/")+"/"),vc(s,t,e,"",function(f){return f})):s!=null&&(Dv(s)&&(s=pD(s,e+(s.key==null||i&&i.key===s.key?"":(""+s.key).replace(Kb,"$&/")+"/")+l)),t.push(s)),1;l=0;var c=n===""?".":n+":";if(Jb(i))for(var h=0;h<i.length;h++)n=i[h],r=c+Tv(n,h),l+=vc(n,t,e,r,s);else if(h=dD(i),typeof h=="function")for(i=h.call(i),h=0;!(n=i.next()).done;)n=n.value,r=c+Tv(n,h++),l+=vc(n,t,e,r,s);else if(r==="object"){if(typeof i.then=="function")return vc(gD(i),t,e,n,s);throw t=String(i),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function Om(i,t,e){if(i==null)return i;var n=[],s=0;return vc(i,n,"","",function(r){return t.call(e,r,s++)}),n}function _D(i){if(i._status===-1){var t=i._result;t=t(),t.then(function(e){(i._status===0||i._status===-1)&&(i._status=1,i._result=e)},function(e){(i._status===0||i._status===-1)&&(i._status=2,i._result=e)}),i._status===-1&&(i._status=0,i._result=t)}if(i._status===1)return i._result.default;throw i._result}var Qb=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},vD={map:Om,forEach:function(i,t,e){Om(i,function(){t.apply(this,arguments)},e)},count:function(i){var t=0;return Om(i,function(){t++}),t},toArray:function(i){return Om(i,function(t){return t})||[]},only:function(i){if(!Dv(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};me.Activity=fD;me.Children=vD;me.Component=xc;me.Fragment=sD;me.Profiler=rD;me.PureComponent=Rv;me.StrictMode=aD;me.Suspense=uD;me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=en;me.__COMPILER_RUNTIME={__proto__:null,c:function(i){return en.H.useMemoCache(i)}};me.cache=function(i){return function(){return i.apply(null,arguments)}};me.cacheSignal=function(){return null};me.cloneElement=function(i,t,e){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var n=e1({},i.props),s=i.key;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)!s1.call(t,r)||r==="key"||r==="__self"||r==="__source"||r==="ref"&&t.ref===void 0||(n[r]=t[r]);var r=arguments.length-2;if(r===1)n.children=e;else if(1<r){for(var l=Array(r),c=0;c<r;c++)l[c]=arguments[c+2];n.children=l}return Nv(i.type,s,n)};me.createContext=function(i){return i={$$typeof:lD,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:oD,_context:i},i};me.createElement=function(i,t,e){var n,s={},r=null;if(t!=null)for(n in t.key!==void 0&&(r=""+t.key),t)s1.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=e;else if(1<l){for(var c=Array(l),h=0;h<l;h++)c[h]=arguments[h+2];s.children=c}if(i&&i.defaultProps)for(n in l=i.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return Nv(i,r,s)};me.createRef=function(){return{current:null}};me.forwardRef=function(i){return{$$typeof:cD,render:i}};me.isValidElement=Dv;me.lazy=function(i){return{$$typeof:$b,_payload:{_status:-1,_result:i},_init:_D}};me.memo=function(i,t){return{$$typeof:hD,type:i,compare:t===void 0?null:t}};me.startTransition=function(i){var t=en.T,e={};en.T=e;try{var n=i(),s=en.S;s!==null&&s(e,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(Av,Qb)}catch(r){Qb(r)}finally{t!==null&&e.types!==null&&(t.types=e.types),en.T=t}};me.unstable_useCacheRefresh=function(){return en.H.useCacheRefresh()};me.use=function(i){return en.H.use(i)};me.useActionState=function(i,t,e){return en.H.useActionState(i,t,e)};me.useCallback=function(i,t){return en.H.useCallback(i,t)};me.useContext=function(i){return en.H.useContext(i)};me.useDebugValue=function(){};me.useDeferredValue=function(i,t){return en.H.useDeferredValue(i,t)};me.useEffect=function(i,t){return en.H.useEffect(i,t)};me.useEffectEvent=function(i){return en.H.useEffectEvent(i)};me.useId=function(){return en.H.useId()};me.useImperativeHandle=function(i,t,e){return en.H.useImperativeHandle(i,t,e)};me.useInsertionEffect=function(i,t){return en.H.useInsertionEffect(i,t)};me.useLayoutEffect=function(i,t){return en.H.useLayoutEffect(i,t)};me.useMemo=function(i,t){return en.H.useMemo(i,t)};me.useOptimistic=function(i,t){return en.H.useOptimistic(i,t)};me.useReducer=function(i,t,e){return en.H.useReducer(i,t,e)};me.useRef=function(i){return en.H.useRef(i)};me.useState=function(i){return en.H.useState(i)};me.useSyncExternalStore=function(i,t,e){return en.H.useSyncExternalStore(i,t,e)};me.useTransition=function(){return en.H.useTransition()};me.version="19.2.3"});var or=pi((bU,r1)=>{"use strict";r1.exports=a1()});var o1=pi(lr=>{"use strict";lr.ConcurrentRoot=1;lr.ContinuousEventPriority=8;lr.DefaultEventPriority=32;lr.DiscreteEventPriority=2;lr.IdleEventPriority=268435456;lr.LegacyRoot=0;lr.NoEventPriority=0});var Uv=pi((TU,l1)=>{"use strict";l1.exports=o1()});var u1=pi(c1=>{"use strict";var yc=or();function xD(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var yD=typeof Object.is=="function"?Object.is:xD,SD=yc.useState,MD=yc.useEffect,bD=yc.useLayoutEffect,ED=yc.useDebugValue;function TD(i,t){var e=t(),n=SD({inst:{value:e,getSnapshot:t}}),s=n[0].inst,r=n[1];return bD(function(){s.value=e,s.getSnapshot=t,Pv(s)&&r({inst:s})},[i,e,t]),MD(function(){return Pv(s)&&r({inst:s}),i(function(){Pv(s)&&r({inst:s})})},[i]),ED(e),e}function Pv(i){var t=i.getSnapshot;i=i.value;try{var e=t();return!yD(i,e)}catch{return!0}}function AD(i,t){return t()}var CD=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?AD:TD;c1.useSyncExternalStore=yc.useSyncExternalStore!==void 0?yc.useSyncExternalStore:CD});var f1=pi((CU,h1)=>{"use strict";h1.exports=u1()});var p1=pi(d1=>{"use strict";var Bm=or(),RD=f1();function wD(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var ND=typeof Object.is=="function"?Object.is:wD,DD=RD.useSyncExternalStore,UD=Bm.useRef,PD=Bm.useEffect,ID=Bm.useMemo,LD=Bm.useDebugValue;d1.useSyncExternalStoreWithSelector=function(i,t,e,n,s){var r=UD(null);if(r.current===null){var l={hasValue:!1,value:null};r.current=l}else l=r.current;r=ID(function(){function h(v){if(!f){if(f=!0,p=v,v=n(v),s!==void 0&&l.hasValue){var y=l.value;if(s(y,v))return m=y}return m=v}if(y=m,ND(p,v))return y;var b=n(v);return s!==void 0&&s(y,b)?(p=v,y):(p=v,m=b)}var f=!1,p,m,g=e===void 0?null:e;return[function(){return h(t())},g===null?void 0:function(){return h(g())}]},[t,e,n,s]);var c=DD(i,r[0],r[1]);return PD(function(){l.hasValue=!0,l.value=c},[c]),LD(c),c}});var g1=pi((wU,m1)=>{"use strict";m1.exports=p1()});var B1=pi(Ye=>{"use strict";function Bv(i,t){var e=i.length;i.push(t);t:for(;0<e;){var n=e-1>>>1,s=i[n];if(0<Fm(s,t))i[n]=t,i[e]=s,e=n;else break t}}function bs(i){return i.length===0?null:i[0]}function Vm(i){if(i.length===0)return null;var t=i[0],e=i.pop();if(e!==t){i[0]=e;t:for(var n=0,s=i.length,r=s>>>1;n<r;){var l=2*(n+1)-1,c=i[l],h=l+1,f=i[h];if(0>Fm(c,e))h<s&&0>Fm(f,c)?(i[n]=f,i[h]=e,n=h):(i[n]=c,i[l]=e,n=l);else if(h<s&&0>Fm(f,e))i[n]=f,i[h]=e,n=h;else break t}}return t}function Fm(i,t){var e=i.sortIndex-t.sortIndex;return e!==0?e:i.id-t.id}Ye.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(R1=performance,Ye.unstable_now=function(){return R1.now()}):(Iv=Date,w1=Iv.now(),Ye.unstable_now=function(){return Iv.now()-w1});var R1,Iv,w1,Vs=[],cr=[],VD=1,ts=null,ni=3,Hm=!1,yo=!1,Df=!1,U1=typeof setTimeout=="function"?setTimeout:null,P1=typeof clearTimeout=="function"?clearTimeout:null,N1=typeof setImmediate<"u"?setImmediate:null;function zm(i){for(var t=bs(cr);t!==null;){if(t.callback===null)Vm(cr);else if(t.startTime<=i)Vm(cr),t.sortIndex=t.expirationTime,Bv(Vs,t);else break;t=bs(cr)}}function Fv(i){if(Df=!1,zm(i),!yo)if(bs(Vs)!==null)yo=!0,zv();else{var t=bs(cr);t!==null&&Vv(Fv,t.startTime-i)}}var Gm=!1,Uf=-1,I1=5,L1=-1;function O1(){return!(Ye.unstable_now()-L1<I1)}function Lv(){if(Gm){var i=Ye.unstable_now();L1=i;var t=!0;try{t:{yo=!1,Df&&(Df=!1,P1(Uf),Uf=-1),Hm=!0;var e=ni;try{e:{for(zm(i),ts=bs(Vs);ts!==null&&!(ts.expirationTime>i&&O1());){var n=ts.callback;if(typeof n=="function"){ts.callback=null,ni=ts.priorityLevel;var s=n(ts.expirationTime<=i);if(i=Ye.unstable_now(),typeof s=="function"){ts.callback=s,zm(i),t=!0;break e}ts===bs(Vs)&&Vm(Vs),zm(i)}else Vm(Vs);ts=bs(Vs)}if(ts!==null)t=!0;else{var r=bs(cr);r!==null&&Vv(Fv,r.startTime-i),t=!1}}break t}finally{ts=null,ni=e,Hm=!1}t=void 0}}finally{t?Nf():Gm=!1}}}var Nf;typeof N1=="function"?Nf=function(){N1(Lv)}:typeof MessageChannel<"u"?(Ov=new MessageChannel,D1=Ov.port2,Ov.port1.onmessage=Lv,Nf=function(){D1.postMessage(null)}):Nf=function(){U1(Lv,0)};var Ov,D1;function zv(){Gm||(Gm=!0,Nf())}function Vv(i,t){Uf=U1(function(){i(Ye.unstable_now())},t)}Ye.unstable_IdlePriority=5;Ye.unstable_ImmediatePriority=1;Ye.unstable_LowPriority=4;Ye.unstable_NormalPriority=3;Ye.unstable_Profiling=null;Ye.unstable_UserBlockingPriority=2;Ye.unstable_cancelCallback=function(i){i.callback=null};Ye.unstable_continueExecution=function(){yo||Hm||(yo=!0,zv())};Ye.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I1=0<i?Math.floor(1e3/i):5};Ye.unstable_getCurrentPriorityLevel=function(){return ni};Ye.unstable_getFirstCallbackNode=function(){return bs(Vs)};Ye.unstable_next=function(i){switch(ni){case 1:case 2:case 3:var t=3;break;default:t=ni}var e=ni;ni=t;try{return i()}finally{ni=e}};Ye.unstable_pauseExecution=function(){};Ye.unstable_requestPaint=function(){};Ye.unstable_runWithPriority=function(i,t){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var e=ni;ni=i;try{return t()}finally{ni=e}};Ye.unstable_scheduleCallback=function(i,t,e){var n=Ye.unstable_now();switch(typeof e=="object"&&e!==null?(e=e.delay,e=typeof e=="number"&&0<e?n+e:n):e=n,i){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=e+s,i={id:VD++,callback:t,priorityLevel:i,startTime:e,expirationTime:s,sortIndex:-1},e>n?(i.sortIndex=e,Bv(cr,i),bs(Vs)===null&&i===bs(cr)&&(Df?(P1(Uf),Uf=-1):Df=!0,Vv(Fv,e-n))):(i.sortIndex=s,Bv(Vs,i),yo||Hm||(yo=!0,zv())),i};Ye.unstable_shouldYield=O1;Ye.unstable_wrapCallback=function(i){var t=ni;return function(){var e=ni;ni=t;try{return i.apply(this,arguments)}finally{ni=e}}}});var km=pi((LU,F1)=>{"use strict";F1.exports=B1()});var z1=pi((OU,Pf)=>{"use strict";Pf.exports=function(i){function t(a,o,u,d){return new LE(a,o,u,d)}function e(){}function n(a){var o="https://react.dev/errors/"+a;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+a+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return a===null||typeof a!="object"?null:(a=Py&&a[Py]||a["@@iterator"],typeof a=="function"?a:null)}function r(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===HE?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case Lo:return"Fragment";case Io:return"Portal";case Wg:return"Profiler";case Ny:return"StrictMode";case qg:return"Suspense";case Yg:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case Aa:return(a.displayName||"Context")+".Provider";case Dy:return(a._context.displayName||"Context")+".Consumer";case Xg:var o=a.render;return a=a.displayName,a||(a=o.displayName||o.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Zg:return o=a.displayName||null,o!==null?o:r(a.type)||"Memo";case Ca:o=a._payload,a=a._init;try{return r(a(o))}catch{}}return null}function l(a){if(jg===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);jg=o&&o[1]||"",Iy=-1<u.stack.indexOf(`
1
+ "use strict";(()=>{var xA=Object.create;var b0=Object.defineProperty;var yA=Object.getOwnPropertyDescriptor;var SA=Object.getOwnPropertyNames;var MA=Object.getPrototypeOf,bA=Object.prototype.hasOwnProperty;var pi=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),EA=(i,t)=>{for(var e in t)b0(i,e,{get:t[e],enumerable:!0})},TA=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of SA(t))!bA.call(i,s)&&s!==e&&b0(i,s,{get:()=>t[s],enumerable:!(n=yA(t,s))||n.enumerable});return i};var zn=(i,t,e)=>(e=i!=null?xA(MA(i)):{},TA(t||!i||!i.__esModule?b0(e,"default",{value:i,enumerable:!0}):e,i));var a1=pi(me=>{"use strict";var Cv=Symbol.for("react.transitional.element"),sD=Symbol.for("react.portal"),aD=Symbol.for("react.fragment"),rD=Symbol.for("react.strict_mode"),oD=Symbol.for("react.profiler"),lD=Symbol.for("react.consumer"),cD=Symbol.for("react.context"),uD=Symbol.for("react.forward_ref"),hD=Symbol.for("react.suspense"),fD=Symbol.for("react.memo"),$b=Symbol.for("react.lazy"),dD=Symbol.for("react.activity"),jb=Symbol.iterator;function pD(i){return i===null||typeof i!="object"?null:(i=jb&&i[jb]||i["@@iterator"],typeof i=="function"?i:null)}var t1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},e1=Object.assign,n1={};function xc(i,t,e){this.props=i,this.context=t,this.refs=n1,this.updater=e||t1}xc.prototype.isReactComponent={};xc.prototype.setState=function(i,t){if(typeof i!="object"&&typeof i!="function"&&i!=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,i,t,"setState")};xc.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function i1(){}i1.prototype=xc.prototype;function Rv(i,t,e){this.props=i,this.context=t,this.refs=n1,this.updater=e||t1}var wv=Rv.prototype=new i1;wv.constructor=Rv;e1(wv,xc.prototype);wv.isPureReactComponent=!0;var Jb=Array.isArray;function Av(){}var en={H:null,A:null,T:null,S:null},s1=Object.prototype.hasOwnProperty;function Nv(i,t,e){var n=e.ref;return{$$typeof:Cv,type:i,key:t,ref:n!==void 0?n:null,props:e}}function mD(i,t){return Nv(i.type,t,i.props)}function Dv(i){return typeof i=="object"&&i!==null&&i.$$typeof===Cv}function gD(i){var t={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(e){return t[e]})}var Kb=/\/+/g;function Tv(i,t){return typeof i=="object"&&i!==null&&i.key!=null?gD(""+i.key):t.toString(36)}function _D(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(Av,Av):(i.status="pending",i.then(function(t){i.status==="pending"&&(i.status="fulfilled",i.value=t)},function(t){i.status==="pending"&&(i.status="rejected",i.reason=t)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function vc(i,t,e,n,s){var r=typeof i;(r==="undefined"||r==="boolean")&&(i=null);var l=!1;if(i===null)l=!0;else switch(r){case"bigint":case"string":case"number":l=!0;break;case"object":switch(i.$$typeof){case Cv:case sD:l=!0;break;case $b:return l=i._init,vc(l(i._payload),t,e,n,s)}}if(l)return s=s(i),l=n===""?"."+Tv(i,0):n,Jb(s)?(e="",l!=null&&(e=l.replace(Kb,"$&/")+"/"),vc(s,t,e,"",function(f){return f})):s!=null&&(Dv(s)&&(s=mD(s,e+(s.key==null||i&&i.key===s.key?"":(""+s.key).replace(Kb,"$&/")+"/")+l)),t.push(s)),1;l=0;var c=n===""?".":n+":";if(Jb(i))for(var h=0;h<i.length;h++)n=i[h],r=c+Tv(n,h),l+=vc(n,t,e,r,s);else if(h=pD(i),typeof h=="function")for(i=h.call(i),h=0;!(n=i.next()).done;)n=n.value,r=c+Tv(n,h++),l+=vc(n,t,e,r,s);else if(r==="object"){if(typeof i.then=="function")return vc(_D(i),t,e,n,s);throw t=String(i),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function Om(i,t,e){if(i==null)return i;var n=[],s=0;return vc(i,n,"","",function(r){return t.call(e,r,s++)}),n}function vD(i){if(i._status===-1){var t=i._result;t=t(),t.then(function(e){(i._status===0||i._status===-1)&&(i._status=1,i._result=e)},function(e){(i._status===0||i._status===-1)&&(i._status=2,i._result=e)}),i._status===-1&&(i._status=0,i._result=t)}if(i._status===1)return i._result.default;throw i._result}var Qb=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},xD={map:Om,forEach:function(i,t,e){Om(i,function(){t.apply(this,arguments)},e)},count:function(i){var t=0;return Om(i,function(){t++}),t},toArray:function(i){return Om(i,function(t){return t})||[]},only:function(i){if(!Dv(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};me.Activity=dD;me.Children=xD;me.Component=xc;me.Fragment=aD;me.Profiler=oD;me.PureComponent=Rv;me.StrictMode=rD;me.Suspense=hD;me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=en;me.__COMPILER_RUNTIME={__proto__:null,c:function(i){return en.H.useMemoCache(i)}};me.cache=function(i){return function(){return i.apply(null,arguments)}};me.cacheSignal=function(){return null};me.cloneElement=function(i,t,e){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var n=e1({},i.props),s=i.key;if(t!=null)for(r in t.key!==void 0&&(s=""+t.key),t)!s1.call(t,r)||r==="key"||r==="__self"||r==="__source"||r==="ref"&&t.ref===void 0||(n[r]=t[r]);var r=arguments.length-2;if(r===1)n.children=e;else if(1<r){for(var l=Array(r),c=0;c<r;c++)l[c]=arguments[c+2];n.children=l}return Nv(i.type,s,n)};me.createContext=function(i){return i={$$typeof:cD,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:lD,_context:i},i};me.createElement=function(i,t,e){var n,s={},r=null;if(t!=null)for(n in t.key!==void 0&&(r=""+t.key),t)s1.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=e;else if(1<l){for(var c=Array(l),h=0;h<l;h++)c[h]=arguments[h+2];s.children=c}if(i&&i.defaultProps)for(n in l=i.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return Nv(i,r,s)};me.createRef=function(){return{current:null}};me.forwardRef=function(i){return{$$typeof:uD,render:i}};me.isValidElement=Dv;me.lazy=function(i){return{$$typeof:$b,_payload:{_status:-1,_result:i},_init:vD}};me.memo=function(i,t){return{$$typeof:fD,type:i,compare:t===void 0?null:t}};me.startTransition=function(i){var t=en.T,e={};en.T=e;try{var n=i(),s=en.S;s!==null&&s(e,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(Av,Qb)}catch(r){Qb(r)}finally{t!==null&&e.types!==null&&(t.types=e.types),en.T=t}};me.unstable_useCacheRefresh=function(){return en.H.useCacheRefresh()};me.use=function(i){return en.H.use(i)};me.useActionState=function(i,t,e){return en.H.useActionState(i,t,e)};me.useCallback=function(i,t){return en.H.useCallback(i,t)};me.useContext=function(i){return en.H.useContext(i)};me.useDebugValue=function(){};me.useDeferredValue=function(i,t){return en.H.useDeferredValue(i,t)};me.useEffect=function(i,t){return en.H.useEffect(i,t)};me.useEffectEvent=function(i){return en.H.useEffectEvent(i)};me.useId=function(){return en.H.useId()};me.useImperativeHandle=function(i,t,e){return en.H.useImperativeHandle(i,t,e)};me.useInsertionEffect=function(i,t){return en.H.useInsertionEffect(i,t)};me.useLayoutEffect=function(i,t){return en.H.useLayoutEffect(i,t)};me.useMemo=function(i,t){return en.H.useMemo(i,t)};me.useOptimistic=function(i,t){return en.H.useOptimistic(i,t)};me.useReducer=function(i,t,e){return en.H.useReducer(i,t,e)};me.useRef=function(i){return en.H.useRef(i)};me.useState=function(i){return en.H.useState(i)};me.useSyncExternalStore=function(i,t,e){return en.H.useSyncExternalStore(i,t,e)};me.useTransition=function(){return en.H.useTransition()};me.version="19.2.3"});var lr=pi((EU,r1)=>{"use strict";r1.exports=a1()});var o1=pi(cr=>{"use strict";cr.ConcurrentRoot=1;cr.ContinuousEventPriority=8;cr.DefaultEventPriority=32;cr.DiscreteEventPriority=2;cr.IdleEventPriority=268435456;cr.LegacyRoot=0;cr.NoEventPriority=0});var Uv=pi((AU,l1)=>{"use strict";l1.exports=o1()});var u1=pi(c1=>{"use strict";var yc=lr();function yD(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var SD=typeof Object.is=="function"?Object.is:yD,MD=yc.useState,bD=yc.useEffect,ED=yc.useLayoutEffect,TD=yc.useDebugValue;function AD(i,t){var e=t(),n=MD({inst:{value:e,getSnapshot:t}}),s=n[0].inst,r=n[1];return ED(function(){s.value=e,s.getSnapshot=t,Pv(s)&&r({inst:s})},[i,e,t]),bD(function(){return Pv(s)&&r({inst:s}),i(function(){Pv(s)&&r({inst:s})})},[i]),TD(e),e}function Pv(i){var t=i.getSnapshot;i=i.value;try{var e=t();return!SD(i,e)}catch{return!0}}function CD(i,t){return t()}var RD=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?CD:AD;c1.useSyncExternalStore=yc.useSyncExternalStore!==void 0?yc.useSyncExternalStore:RD});var f1=pi((RU,h1)=>{"use strict";h1.exports=u1()});var p1=pi(d1=>{"use strict";var Bm=lr(),wD=f1();function ND(i,t){return i===t&&(i!==0||1/i===1/t)||i!==i&&t!==t}var DD=typeof Object.is=="function"?Object.is:ND,UD=wD.useSyncExternalStore,PD=Bm.useRef,ID=Bm.useEffect,LD=Bm.useMemo,OD=Bm.useDebugValue;d1.useSyncExternalStoreWithSelector=function(i,t,e,n,s){var r=PD(null);if(r.current===null){var l={hasValue:!1,value:null};r.current=l}else l=r.current;r=LD(function(){function h(v){if(!f){if(f=!0,p=v,v=n(v),s!==void 0&&l.hasValue){var y=l.value;if(s(y,v))return m=y}return m=v}if(y=m,DD(p,v))return y;var b=n(v);return s!==void 0&&s(y,b)?(p=v,y):(p=v,m=b)}var f=!1,p,m,g=e===void 0?null:e;return[function(){return h(t())},g===null?void 0:function(){return h(g())}]},[t,e,n,s]);var c=UD(i,r[0],r[1]);return ID(function(){l.hasValue=!0,l.value=c},[c]),OD(c),c}});var g1=pi((NU,m1)=>{"use strict";m1.exports=p1()});var B1=pi(Ye=>{"use strict";function Bv(i,t){var e=i.length;i.push(t);t:for(;0<e;){var n=e-1>>>1,s=i[n];if(0<Fm(s,t))i[n]=t,i[e]=s,e=n;else break t}}function bs(i){return i.length===0?null:i[0]}function Vm(i){if(i.length===0)return null;var t=i[0],e=i.pop();if(e!==t){i[0]=e;t:for(var n=0,s=i.length,r=s>>>1;n<r;){var l=2*(n+1)-1,c=i[l],h=l+1,f=i[h];if(0>Fm(c,e))h<s&&0>Fm(f,c)?(i[n]=f,i[h]=e,n=h):(i[n]=c,i[l]=e,n=l);else if(h<s&&0>Fm(f,e))i[n]=f,i[h]=e,n=h;else break t}}return t}function Fm(i,t){var e=i.sortIndex-t.sortIndex;return e!==0?e:i.id-t.id}Ye.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(R1=performance,Ye.unstable_now=function(){return R1.now()}):(Iv=Date,w1=Iv.now(),Ye.unstable_now=function(){return Iv.now()-w1});var R1,Iv,w1,Vs=[],ur=[],HD=1,ts=null,ni=3,Hm=!1,yo=!1,Df=!1,U1=typeof setTimeout=="function"?setTimeout:null,P1=typeof clearTimeout=="function"?clearTimeout:null,N1=typeof setImmediate<"u"?setImmediate:null;function zm(i){for(var t=bs(ur);t!==null;){if(t.callback===null)Vm(ur);else if(t.startTime<=i)Vm(ur),t.sortIndex=t.expirationTime,Bv(Vs,t);else break;t=bs(ur)}}function Fv(i){if(Df=!1,zm(i),!yo)if(bs(Vs)!==null)yo=!0,zv();else{var t=bs(ur);t!==null&&Vv(Fv,t.startTime-i)}}var Gm=!1,Uf=-1,I1=5,L1=-1;function O1(){return!(Ye.unstable_now()-L1<I1)}function Lv(){if(Gm){var i=Ye.unstable_now();L1=i;var t=!0;try{t:{yo=!1,Df&&(Df=!1,P1(Uf),Uf=-1),Hm=!0;var e=ni;try{e:{for(zm(i),ts=bs(Vs);ts!==null&&!(ts.expirationTime>i&&O1());){var n=ts.callback;if(typeof n=="function"){ts.callback=null,ni=ts.priorityLevel;var s=n(ts.expirationTime<=i);if(i=Ye.unstable_now(),typeof s=="function"){ts.callback=s,zm(i),t=!0;break e}ts===bs(Vs)&&Vm(Vs),zm(i)}else Vm(Vs);ts=bs(Vs)}if(ts!==null)t=!0;else{var r=bs(ur);r!==null&&Vv(Fv,r.startTime-i),t=!1}}break t}finally{ts=null,ni=e,Hm=!1}t=void 0}}finally{t?Nf():Gm=!1}}}var Nf;typeof N1=="function"?Nf=function(){N1(Lv)}:typeof MessageChannel<"u"?(Ov=new MessageChannel,D1=Ov.port2,Ov.port1.onmessage=Lv,Nf=function(){D1.postMessage(null)}):Nf=function(){U1(Lv,0)};var Ov,D1;function zv(){Gm||(Gm=!0,Nf())}function Vv(i,t){Uf=U1(function(){i(Ye.unstable_now())},t)}Ye.unstable_IdlePriority=5;Ye.unstable_ImmediatePriority=1;Ye.unstable_LowPriority=4;Ye.unstable_NormalPriority=3;Ye.unstable_Profiling=null;Ye.unstable_UserBlockingPriority=2;Ye.unstable_cancelCallback=function(i){i.callback=null};Ye.unstable_continueExecution=function(){yo||Hm||(yo=!0,zv())};Ye.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I1=0<i?Math.floor(1e3/i):5};Ye.unstable_getCurrentPriorityLevel=function(){return ni};Ye.unstable_getFirstCallbackNode=function(){return bs(Vs)};Ye.unstable_next=function(i){switch(ni){case 1:case 2:case 3:var t=3;break;default:t=ni}var e=ni;ni=t;try{return i()}finally{ni=e}};Ye.unstable_pauseExecution=function(){};Ye.unstable_requestPaint=function(){};Ye.unstable_runWithPriority=function(i,t){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var e=ni;ni=i;try{return t()}finally{ni=e}};Ye.unstable_scheduleCallback=function(i,t,e){var n=Ye.unstable_now();switch(typeof e=="object"&&e!==null?(e=e.delay,e=typeof e=="number"&&0<e?n+e:n):e=n,i){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=e+s,i={id:HD++,callback:t,priorityLevel:i,startTime:e,expirationTime:s,sortIndex:-1},e>n?(i.sortIndex=e,Bv(ur,i),bs(Vs)===null&&i===bs(ur)&&(Df?(P1(Uf),Uf=-1):Df=!0,Vv(Fv,e-n))):(i.sortIndex=s,Bv(Vs,i),yo||Hm||(yo=!0,zv())),i};Ye.unstable_shouldYield=O1;Ye.unstable_wrapCallback=function(i){var t=ni;return function(){var e=ni;ni=t;try{return i.apply(this,arguments)}finally{ni=e}}}});var km=pi((OU,F1)=>{"use strict";F1.exports=B1()});var z1=pi((BU,Pf)=>{"use strict";Pf.exports=function(i){function t(a,o,u,d){return new OE(a,o,u,d)}function e(){}function n(a){var o="https://react.dev/errors/"+a;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+a+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return a===null||typeof a!="object"?null:(a=Py&&a[Py]||a["@@iterator"],typeof a=="function"?a:null)}function r(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===GE?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case Lo:return"Fragment";case Io:return"Portal";case Wg:return"Profiler";case Ny:return"StrictMode";case qg:return"Suspense";case Yg:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case Ca:return(a.displayName||"Context")+".Provider";case Dy:return(a._context.displayName||"Context")+".Consumer";case Xg:var o=a.render;return a=a.displayName,a||(a=o.displayName||o.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Zg:return o=a.displayName||null,o!==null?o:r(a.type)||"Memo";case Ra:o=a._payload,a=a._init;try{return r(a(o))}catch{}}return null}function l(a){if(jg===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);jg=o&&o[1]||"",Iy=-1<u.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+jg+a+Iy}function c(a,o){if(!a||Jg)return"";Jg=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var Bt=function(){throw Error()};if(Object.defineProperty(Bt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Bt,[])}catch(_e){var zt=_e}Reflect.construct(a,[],Bt)}else{try{Bt.call()}catch(_e){zt=_e}a.call(Bt.prototype)}}else{try{throw Error()}catch(_e){zt=_e}(Bt=a())&&typeof Bt.catch=="function"&&Bt.catch(function(){})}}catch(_e){if(_e&&zt&&typeof _e.stack=="string")return[_e.stack,zt.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var M=d.DetermineComponentFrameRoot(),P=M[0],V=M[1];if(P&&V){var q=P.split(`
4
4
  `),ot=V.split(`
5
5
  `);for(_=d=0;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;for(;_<ot.length&&!ot[_].includes("DetermineComponentFrameRoot");)_++;if(d===q.length||_===ot.length)for(d=q.length-1,_=ot.length-1;1<=d&&0<=_&&q[d]!==ot[_];)_--;for(;1<=d&&0<=_;d--,_--)if(q[d]!==ot[_]){if(d!==1||_!==1)do if(d--,_--,0>_||q[d]!==ot[_]){var yt=`
6
6
  `+q[d].replace(" at new "," at ");return a.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",a.displayName)),yt}while(1<=d&&0<=_);break}}}finally{Jg=!1,Error.prepareStackTrace=u}return(u=a?a.displayName||a.name:"")?l(u):""}function h(a){switch(a.tag){case 26:case 27:case 5:return l(a.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("SuspenseList");case 0:case 15:return a=c(a.type,!1),a;case 11:return a=c(a.type.render,!1),a;case 1:return a=c(a.type,!0),a;default:return""}}function f(a){try{var o="";do o+=h(a),a=a.return;while(a);return o}catch(u){return`
7
7
  Error generating stack: `+u.message+`
8
- `+u.stack}}function p(a){var o=a,u=a;if(a.alternate)for(;o.return;)o=o.return;else{a=o;do o=a,(o.flags&4098)!==0&&(u=o.return),a=o.return;while(a)}return o.tag===3?u:null}function m(a){if(p(a)!==a)throw Error(n(188))}function g(a){var o=a.alternate;if(!o){if(o=p(a),o===null)throw Error(n(188));return o!==a?null:a}for(var u=a,d=o;;){var _=u.return;if(_===null)break;var M=_.alternate;if(M===null){if(d=_.return,d!==null){u=d;continue}break}if(_.child===M.child){for(M=_.child;M;){if(M===u)return m(_),a;if(M===d)return m(_),o;M=M.sibling}throw Error(n(188))}if(u.return!==d.return)u=_,d=M;else{for(var P=!1,V=_.child;V;){if(V===u){P=!0,u=_,d=M;break}if(V===d){P=!0,d=_,u=M;break}V=V.sibling}if(!P){for(V=M.child;V;){if(V===u){P=!0,u=M,d=_;break}if(V===d){P=!0,d=M,u=_;break}V=V.sibling}if(!P)throw Error(n(189))}}if(u.alternate!==d)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?a:o}function v(a){var o=a.tag;if(o===5||o===26||o===27||o===6)return a;for(a=a.child;a!==null;){if(o=v(a),o!==null)return o;a=a.sibling}return null}function y(a){var o=a.tag;if(o===5||o===26||o===27||o===6)return a;for(a=a.child;a!==null;){if(a.tag!==4&&(o=y(a),o!==null))return o;a=a.sibling}return null}function b(a){return{current:a}}function S(a){0>Bo||(a.current=n0[Bo],n0[Bo]=null,Bo--)}function x(a,o){Bo++,n0[Bo]=a.current,a.current=o}function E(a){return a>>>=0,a===0?32:31-(nA(a)/iA|0)|0}function T(a){var o=a&42;if(o!==0)return o;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function A(a,o){var u=a.pendingLanes;if(u===0)return 0;var d=0,_=a.suspendedLanes,M=a.pingedLanes,P=a.warmLanes;a=a.finishedLanes!==0;var V=u&134217727;return V!==0?(u=V&~_,u!==0?d=T(u):(M&=V,M!==0?d=T(M):a||(P=V&~P,P!==0&&(d=T(P))))):(V=u&~_,V!==0?d=T(V):M!==0?d=T(M):a||(P=u&~P,P!==0&&(d=T(P)))),d===0?0:o!==0&&o!==d&&(o&_)===0&&(_=d&-d,P=o&-o,_>=P||_===32&&(P&4194176)!==0)?o:d}function N(a,o){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&o)===0}function D(a,o){switch(a){case 1:case 2:case 4:case 8:return o+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+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 a=jf;return jf<<=1,(jf&4194176)===0&&(jf=128),a}function F(){var a=Jf;return Jf<<=1,(Jf&62914560)===0&&(Jf=4194304),a}function C(a){for(var o=[],u=0;31>u;u++)o.push(a);return o}function w(a,o){a.pendingLanes|=o,o!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function z(a,o,u,d,_,M){var P=a.pendingLanes;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=u,a.entangledLanes&=u,a.errorRecoveryDisabledLanes&=u,a.shellSuspendCounter=0;var V=a.entanglements,q=a.expirationTimes,ot=a.hiddenUpdates;for(u=P&~u;0<u;){var yt=31-Ri(u),Bt=1<<yt;V[yt]=0,q[yt]=-1;var zt=ot[yt];if(zt!==null)for(ot[yt]=null,yt=0;yt<zt.length;yt++){var _e=zt[yt];_e!==null&&(_e.lane&=-536870913)}u&=~Bt}d!==0&&Y(a,d,0),M!==0&&_===0&&a.tag!==0&&(a.suspendedLanes|=M&~(P&~o))}function Y(a,o,u){a.pendingLanes|=o,a.suspendedLanes&=~o;var d=31-Ri(o);a.entangledLanes|=o,a.entanglements[d]=a.entanglements[d]|1073741824|u&4194218}function G(a,o){var u=a.entangledLanes|=o;for(a=a.entanglements;u;){var d=31-Ri(u),_=1<<d;_&o|a[d]&o&&(a[d]|=o),u&=~_}}function j(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function nt(a){if(wi&&typeof wi.onCommitFiberRoot=="function")try{wi.onCommitFiberRoot(kc,a,void 0,(a.current.flags&128)===128)}catch{}}function J(a){if(typeof lA=="function"&&cA(a),wi&&typeof wi.setStrictMode=="function")try{wi.setStrictMode(kc,a)}catch{}}function et(a,o){return a===o&&(a!==0||1/a===1/o)||a!==a&&o!==o}function rt(a,o){if(typeof a=="object"&&a!==null){var u=rS.get(a);return u!==void 0?u:(o={value:a,source:o,stack:f(o)},rS.set(a,o),o)}return{value:a,source:o,stack:f(o)}}function St(a,o){zo[Vo++]=$f,zo[Vo++]=Qf,Qf=a,$f=o}function bt(a,o,u){Xi[qi++]=Zs,Xi[qi++]=js,Xi[qi++]=br,br=a;var d=Zs;a=js;var _=32-Ri(d)-1;d&=~(1<<_),u+=1;var M=32-Ri(o)+_;if(30<M){var P=_-_%5;M=(d&(1<<P)-1).toString(32),d>>=P,_-=P,Zs=1<<32-Ri(o)+_|u<<_|d,js=M+a}else Zs=1<<M|u<<_|d,js=a}function mt(a){a.return!==null&&(St(a,1),bt(a,1,0))}function kt(a){for(;a===Qf;)Qf=zo[--Vo],zo[Vo]=null,$f=zo[--Vo],zo[Vo]=null;for(;a===br;)br=Xi[--qi],Xi[qi]=null,js=Xi[--qi],Xi[qi]=null,Zs=Xi[--qi],Xi[qi]=null}function $t(a,o){x(wa,o),x(Wc,a),x(Fn,null),a=WE(o),S(Fn),x(Fn,a)}function re(){S(Fn),S(Wc),S(wa)}function Ce(a){a.memoizedState!==null&&x(td,a);var o=Fn.current,u=XE(o,a.type);o!==u&&(x(Wc,a),x(Fn,u))}function at(a){Wc.current===a&&(S(Fn),S(Wc)),td.current===a&&(S(td),Ys?Mr._currentValue=Oo:Mr._currentValue2=Oo)}function dt(a){var o=Error(n(418,""));throw Re(rt(o,a)),a0}function Vt(a,o){if(!ki)throw Error(n(175));FT(a.stateNode,a.type,a.memoizedProps,o,a)||dt(a)}function ie(a){for(ai=a.return;ai;)switch(ai.tag){case 3:case 27:Ts=!0;return;case 5:case 13:Ts=!1;return;default:ai=ai.return}}function Ft(a){if(!ki||a!==ai)return!1;if(!Pe)return ie(a),Pe=!0,!1;var o=!1;if(Yn?a.tag!==3&&a.tag!==27&&(a.tag!==5||jy(a.type)&&!Zf(a.type,a.memoizedProps))&&(o=!0):a.tag!==3&&(a.tag!==5||jy(a.type)&&!Zf(a.type,a.memoizedProps))&&(o=!0),o&&Zn&&dt(a),ie(a),a.tag===13){if(!ki)throw Error(n(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));Zn=HT(a)}else Zn=ai?Yy(a.stateNode):null;return!0}function ye(){ki&&(Zn=ai=null,Pe=!1)}function Re(a){ss===null?ss=[a]:ss.push(a)}function ce(){for(var a=Ho,o=r0=Ho=0;o<a;){var u=Yi[o];Yi[o++]=null;var d=Yi[o];Yi[o++]=null;var _=Yi[o];Yi[o++]=null;var M=Yi[o];if(Yi[o++]=null,d!==null&&_!==null){var P=d.pending;P===null?_.next=_:(_.next=P.next,P.next=_),d.pending=_}M!==0&&Nt(u,_,M)}}function ct(a,o,u,d){Yi[Ho++]=a,Yi[Ho++]=o,Yi[Ho++]=u,Yi[Ho++]=d,r0|=d,a.lanes|=d,a=a.alternate,a!==null&&(a.lanes|=d)}function gt(a,o,u,d){return ct(a,o,u,d),B(a)}function lt(a,o){return ct(a,null,null,o),B(a)}function Nt(a,o,u){a.lanes|=u;var d=a.alternate;d!==null&&(d.lanes|=u);for(var _=!1,M=a.return;M!==null;)M.childLanes|=u,d=M.alternate,d!==null&&(d.childLanes|=u),M.tag===22&&(a=M.stateNode,a===null||a._visibility&1||(_=!0)),a=M,M=M.return;_&&o!==null&&a.tag===3&&(M=a.stateNode,_=31-Ri(u),M=M.hiddenUpdates,a=M[_],a===null?M[_]=[o]:a.push(o),o.lane=u|536870912)}function B(a){if(50<$c)throw $c=0,M0=null,Error(n(185));for(var o=a.return;o!==null;)a=o,o=a.return;return a.tag===3?a.stateNode:null}function Zt(a){a!==Go&&a.next===null&&(Go===null?ed=Go=a:Go=Go.next=a),nd=!0,o0||(o0=!0,k(se))}function Dt(a,o){if(!l0&&nd){l0=!0;do for(var u=!1,d=ed;d!==null;){if(!o)if(a!==0){var _=d.pendingLanes;if(_===0)var M=0;else{var P=d.suspendedLanes,V=d.pingedLanes;M=(1<<31-Ri(42|a)+1)-1,M&=_&~(P&~V),M=M&201326677?M&201326677|1:M?M|2:0}M!==0&&(u=!0,R(d,M))}else M=we,M=A(d,d===Ze?M:0),(M&3)===0||N(d,M)||(u=!0,R(d,M));d=d.next}while(u);l0=!1}}function se(){nd=o0=!1;var a=0;ko!==0&&($E()&&(a=ko),ko=0);for(var o=is(),u=null,d=ed;d!==null;){var _=d.next,M=Mt(d,o);M===0?(d.next=null,u===null?ed=_:u.next=_,_===null&&(Go=u)):(u=d,(a!==0||(M&3)!==0)&&(nd=!0)),d=_}Dt(a,!1)}function Mt(a,o){for(var u=a.suspendedLanes,d=a.pingedLanes,_=a.expirationTimes,M=a.pendingLanes&-62914561;0<M;){var P=31-Ri(M),V=1<<P,q=_[P];q===-1?((V&u)===0||(V&d)!==0)&&(_[P]=D(V,o)):q<=o&&(a.expiredLanes|=V),M&=~V}if(o=Ze,u=we,u=A(a,a===o?u:0),d=a.callbackNode,u===0||a===o&&je===2||a.cancelPendingCommit!==null)return d!==null&&d!==null&&i0(d),a.callbackNode=null,a.callbackPriority=0;if((u&3)===0||N(a,u)){if(o=u&-u,o===a.callbackPriority)return o;switch(d!==null&&i0(d),j(u)){case 2:case 8:u=rA;break;case 32:u=s0;break;case 268435456:u=oA;break;default:u=s0}return d=I.bind(null,a),u=Kf(u,d),a.callbackPriority=o,a.callbackNode=u,o}return d!==null&&d!==null&&i0(d),a.callbackPriority=2,a.callbackNode=null,2}function I(a,o){var u=a.callbackNode;if(xr()&&a.callbackNode!==u)return null;var d=we;return d=A(a,a===Ze?d:0),d===0?null:(cy(a,d,o),Mt(a,is()),a.callbackNode!=null&&a.callbackNode===u?I.bind(null,a):null)}function R(a,o){if(xr())return null;cy(a,o,!0)}function k(a){aT?rT(function(){(Xe&6)!==0?Kf(aS,a):a()}):Kf(aS,a)}function it(){return ko===0&&(ko=L()),ko}function ht(a,o){if(Xc===null){var u=Xc=[];c0=0,Wo=it(),Xo={status:"pending",value:void 0,then:function(d){u.push(d)}}}return c0++,o.then(st,st),o}function st(){if(--c0===0&&Xc!==null){Xo!==null&&(Xo.status="fulfilled");var a=Xc;Xc=null,Wo=0,Xo=null;for(var o=0;o<a.length;o++)(0,a[o])()}}function jt(a,o){var u=[],d={status:"pending",value:null,reason:null,then:function(_){u.push(_)}};return a.then(function(){d.status="fulfilled",d.value=o;for(var _=0;_<u.length;_++)(0,u[_])(o)},function(_){for(d.status="rejected",d.reason=_,_=0;_<u.length;_++)(0,u[_])(void 0)}),d}function Et(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wt(a,o){a=a.updateQueue,o.updateQueue===a&&(o.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Kt(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function pt(a,o,u){var d=a.updateQueue;if(d===null)return null;if(d=d.shared,(Xe&2)!==0){var _=d.pending;return _===null?o.next=o:(o.next=_.next,_.next=o),d.pending=o,o=B(a),Nt(a,null,u),o}return ct(a,d,o,u),B(a)}function Ct(a,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194176)!==0)){var d=o.lanes;d&=a.pendingLanes,u|=d,o.lanes=u,G(a,u)}}function Xt(a,o){var u=a.updateQueue,d=a.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var _=null,M=null;if(u=u.firstBaseUpdate,u!==null){do{var P={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};M===null?_=M=P:M=M.next=P,u=u.next}while(u!==null);M===null?_=M=o:M=M.next=o}else _=M=o;u={baseState:d.baseState,firstBaseUpdate:_,lastBaseUpdate:M,shared:d.shared,callbacks:d.callbacks},a.updateQueue=u;return}a=u.lastBaseUpdate,a===null?u.firstBaseUpdate=o:a.next=o,u.lastBaseUpdate=o}function Yt(){if(u0){var a=Xo;if(a!==null)throw a}}function Tt(a,o,u,d){u0=!1;var _=a.updateQueue;Na=!1;var M=_.firstBaseUpdate,P=_.lastBaseUpdate,V=_.shared.pending;if(V!==null){_.shared.pending=null;var q=V,ot=q.next;q.next=null,P===null?M=ot:P.next=ot,P=q;var yt=a.alternate;yt!==null&&(yt=yt.updateQueue,V=yt.lastBaseUpdate,V!==P&&(V===null?yt.firstBaseUpdate=ot:V.next=ot,yt.lastBaseUpdate=q))}if(M!==null){var Bt=_.baseState;P=0,yt=ot=q=null,V=M;do{var zt=V.lane&-536870913,_e=zt!==V.lane;if(_e?(we&zt)===zt:(d&zt)===zt){zt!==0&&zt===Wo&&(u0=!0),yt!==null&&(yt=yt.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var Ji=a,tu=V;zt=o;var Ur=u;switch(tu.tag){case 1:if(Ji=tu.payload,typeof Ji=="function"){Bt=Ji.call(Ur,Bt,zt);break t}Bt=Ji;break t;case 3:Ji.flags=Ji.flags&-65537|128;case 0:if(Ji=tu.payload,zt=typeof Ji=="function"?Ji.call(Ur,Bt,zt):Ji,zt==null)break t;Bt=kg({},Bt,zt);break t;case 2:Na=!0}}zt=V.callback,zt!==null&&(a.flags|=64,_e&&(a.flags|=8192),_e=_.callbacks,_e===null?_.callbacks=[zt]:_e.push(zt))}else _e={lane:zt,tag:V.tag,payload:V.payload,callback:V.callback,next:null},yt===null?(ot=yt=_e,q=Bt):yt=yt.next=_e,P|=zt;if(V=V.next,V===null){if(V=_.shared.pending,V===null)break;_e=V,V=_e.next,_e.next=null,_.lastBaseUpdate=_e,_.shared.pending=null}}while(!0);yt===null&&(q=Bt),_.baseState=q,_.firstBaseUpdate=ot,_.lastBaseUpdate=yt,M===null&&(_.shared.lanes=0),Pa|=P,a.lanes=P,a.memoizedState=Bt}}function ge(a,o){if(typeof a!="function")throw Error(n(191,a));a.call(o)}function H(a,o){var u=a.callbacks;if(u!==null)for(a.callbacks=null,a=0;a<u.length;a++)ge(u[a],o)}function Ut(a,o){if(Ni(a,o))return!0;if(typeof a!="object"||a===null||typeof o!="object"||o===null)return!1;var u=Object.keys(a),d=Object.keys(o);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var _=u[d];if(!uA.call(o,_)||!Ni(a[_],o[_]))return!1}return!0}function xt(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Ot(){}function _t(a,o,u){switch(u=a[u],u===void 0?a.push(o):u!==o&&(o.then(Ot,Ot),o=u),o.status){case"fulfilled":return o.value;case"rejected":throw a=o.reason,a===qc?Error(n(483)):a;default:if(typeof o.status=="string")o.then(Ot,Ot);else{if(a=Ze,a!==null&&100<a.shellSuspendCounter)throw Error(n(482));a=o,a.status="pending",a.then(function(d){if(o.status==="pending"){var _=o;_.status="fulfilled",_.value=d}},function(d){if(o.status==="pending"){var _=o;_.status="rejected",_.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw a=o.reason,a===qc?Error(n(483)):a}throw qo=o,qc}}function ut(){if(qo===null)throw Error(n(459));var a=qo;return qo=null,a}function At(a){var o=Yc;return Yc+=1,Yo===null&&(Yo=[]),_t(Yo,a,o)}function oe(a,o){o=o.props.ref,a.ref=o!==void 0?o:null}function Be(a,o){throw o.$$typeof===FE?Error(n(525)):(a=Object.prototype.toString.call(o),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":a)))}function De(a){var o=a._init;return o(a._payload)}function Mi(a){function o(K,X){if(a){var tt=K.deletions;tt===null?(K.deletions=[X],K.flags|=16):tt.push(X)}}function u(K,X){if(!a)return null;for(;X!==null;)o(K,X),X=X.sibling;return null}function d(K){for(var X=new Map;K!==null;)K.key!==null?X.set(K.key,K):X.set(K.index,K),K=K.sibling;return X}function _(K,X){return K=Ta(K,X),K.index=0,K.sibling=null,K}function M(K,X,tt){return K.index=tt,a?(tt=K.alternate,tt!==null?(tt=tt.index,tt<X?(K.flags|=33554434,X):tt):(K.flags|=33554434,X)):(K.flags|=1048576,X)}function P(K){return a&&K.alternate===null&&(K.flags|=33554434),K}function V(K,X,tt,vt){return X===null||X.tag!==6?(X=Vg(tt,K.mode,vt),X.return=K,X):(X=_(X,tt),X.return=K,X)}function q(K,X,tt,vt){var ne=tt.type;return ne===Lo?yt(K,X,tt.props.children,vt,tt.key):X!==null&&(X.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===Ca&&De(ne)===X.type)?(X=_(X,tt.props),oe(X,tt),X.return=K,X):(X=Xf(tt.type,tt.key,tt.props,null,K.mode,vt),oe(X,tt),X.return=K,X)}function ot(K,X,tt,vt){return X===null||X.tag!==4||X.stateNode.containerInfo!==tt.containerInfo||X.stateNode.implementation!==tt.implementation?(X=Hg(tt,K.mode,vt),X.return=K,X):(X=_(X,tt.children||[]),X.return=K,X)}function yt(K,X,tt,vt,ne){return X===null||X.tag!==7?(X=yr(tt,K.mode,vt,ne),X.return=K,X):(X=_(X,tt),X.return=K,X)}function Bt(K,X,tt){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Vg(""+X,K.mode,tt),X.return=K,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case qf:return tt=Xf(X.type,X.key,X.props,null,K.mode,tt),oe(tt,X),tt.return=K,tt;case Io:return X=Hg(X,K.mode,tt),X.return=K,X;case Ca:var vt=X._init;return X=vt(X._payload),Bt(K,X,tt)}if(Yf(X)||s(X))return X=yr(X,K.mode,tt,null),X.return=K,X;if(typeof X.then=="function")return Bt(K,At(X),tt);if(X.$$typeof===Aa)return Bt(K,zf(K,X),tt);Be(K,X)}return null}function zt(K,X,tt,vt){var ne=X!==null?X.key:null;if(typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint")return ne!==null?null:V(K,X,""+tt,vt);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case qf:return tt.key===ne?q(K,X,tt,vt):null;case Io:return tt.key===ne?ot(K,X,tt,vt):null;case Ca:return ne=tt._init,tt=ne(tt._payload),zt(K,X,tt,vt)}if(Yf(tt)||s(tt))return ne!==null?null:yt(K,X,tt,vt,null);if(typeof tt.then=="function")return zt(K,X,At(tt),vt);if(tt.$$typeof===Aa)return zt(K,X,zf(K,tt),vt);Be(K,tt)}return null}function _e(K,X,tt,vt,ne){if(typeof vt=="string"&&vt!==""||typeof vt=="number"||typeof vt=="bigint")return K=K.get(tt)||null,V(X,K,""+vt,ne);if(typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case qf:return K=K.get(vt.key===null?tt:vt.key)||null,q(X,K,vt,ne);case Io:return K=K.get(vt.key===null?tt:vt.key)||null,ot(X,K,vt,ne);case Ca:var tn=vt._init;return vt=tn(vt._payload),_e(K,X,tt,vt,ne)}if(Yf(vt)||s(vt))return K=K.get(tt)||null,yt(X,K,vt,ne,null);if(typeof vt.then=="function")return _e(K,X,tt,At(vt),ne);if(vt.$$typeof===Aa)return _e(K,X,tt,zf(X,vt),ne);Be(X,vt)}return null}function Ji(K,X,tt,vt){for(var ne=null,tn=null,he=X,Ie=X=0,wn=null;he!==null&&Ie<tt.length;Ie++){he.index>Ie?(wn=he,he=null):wn=he.sibling;var Le=zt(K,he,tt[Ie],vt);if(Le===null){he===null&&(he=wn);break}a&&he&&Le.alternate===null&&o(K,he),X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le,he=wn}if(Ie===tt.length)return u(K,he),Pe&&St(K,Ie),ne;if(he===null){for(;Ie<tt.length;Ie++)he=Bt(K,tt[Ie],vt),he!==null&&(X=M(he,X,Ie),tn===null?ne=he:tn.sibling=he,tn=he);return Pe&&St(K,Ie),ne}for(he=d(he);Ie<tt.length;Ie++)wn=_e(he,K,Ie,tt[Ie],vt),wn!==null&&(a&&wn.alternate!==null&&he.delete(wn.key===null?Ie:wn.key),X=M(wn,X,Ie),tn===null?ne=wn:tn.sibling=wn,tn=wn);return a&&he.forEach(function(La){return o(K,La)}),Pe&&St(K,Ie),ne}function tu(K,X,tt,vt){if(tt==null)throw Error(n(151));for(var ne=null,tn=null,he=X,Ie=X=0,wn=null,Le=tt.next();he!==null&&!Le.done;Ie++,Le=tt.next()){he.index>Ie?(wn=he,he=null):wn=he.sibling;var La=zt(K,he,Le.value,vt);if(La===null){he===null&&(he=wn);break}a&&he&&La.alternate===null&&o(K,he),X=M(La,X,Ie),tn===null?ne=La:tn.sibling=La,tn=La,he=wn}if(Le.done)return u(K,he),Pe&&St(K,Ie),ne;if(he===null){for(;!Le.done;Ie++,Le=tt.next())Le=Bt(K,Le.value,vt),Le!==null&&(X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le);return Pe&&St(K,Ie),ne}for(he=d(he);!Le.done;Ie++,Le=tt.next())Le=_e(he,K,Ie,Le.value,vt),Le!==null&&(a&&Le.alternate!==null&&he.delete(Le.key===null?Ie:Le.key),X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le);return a&&he.forEach(function(_A){return o(K,_A)}),Pe&&St(K,Ie),ne}function Ur(K,X,tt,vt){if(typeof tt=="object"&&tt!==null&&tt.type===Lo&&tt.key===null&&(tt=tt.props.children),typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case qf:t:{for(var ne=tt.key;X!==null;){if(X.key===ne){if(ne=tt.type,ne===Lo){if(X.tag===7){u(K,X.sibling),vt=_(X,tt.props.children),vt.return=K,K=vt;break t}}else if(X.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===Ca&&De(ne)===X.type){u(K,X.sibling),vt=_(X,tt.props),oe(vt,tt),vt.return=K,K=vt;break t}u(K,X);break}else o(K,X);X=X.sibling}tt.type===Lo?(vt=yr(tt.props.children,K.mode,vt,tt.key),vt.return=K,K=vt):(vt=Xf(tt.type,tt.key,tt.props,null,K.mode,vt),oe(vt,tt),vt.return=K,K=vt)}return P(K);case Io:t:{for(ne=tt.key;X!==null;){if(X.key===ne)if(X.tag===4&&X.stateNode.containerInfo===tt.containerInfo&&X.stateNode.implementation===tt.implementation){u(K,X.sibling),vt=_(X,tt.children||[]),vt.return=K,K=vt;break t}else{u(K,X);break}else o(K,X);X=X.sibling}vt=Hg(tt,K.mode,vt),vt.return=K,K=vt}return P(K);case Ca:return ne=tt._init,tt=ne(tt._payload),Ur(K,X,tt,vt)}if(Yf(tt))return Ji(K,X,tt,vt);if(s(tt)){if(ne=s(tt),typeof ne!="function")throw Error(n(150));return tt=ne.call(tt),tu(K,X,tt,vt)}if(typeof tt.then=="function")return Ur(K,X,At(tt),vt);if(tt.$$typeof===Aa)return Ur(K,X,zf(K,tt),vt);Be(K,tt)}return typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint"?(tt=""+tt,X!==null&&X.tag===6?(u(K,X.sibling),vt=_(X,tt),vt.return=K,K=vt):(u(K,X),vt=Vg(tt,K.mode,vt),vt.return=K,K=vt),P(K)):u(K,X)}return function(K,X,tt,vt){try{Yc=0;var ne=Ur(K,X,tt,vt);return Yo=null,ne}catch(he){if(he===qc)throw he;var tn=t(29,he,null,K.mode);return tn.lanes=vt,tn.return=K,tn}}}function zi(a,o){a=$s,x(sd,a),x(Zo,o),$s=a|o.baseLanes}function Rc(){x(sd,$s),x(Zo,Zo.current)}function bo(){$s=sd.current,S(Zo),S(sd)}function Vi(a){var o=a.alternate;x(Mn,Mn.current&1),x(Zi,a),As===null&&(o===null||Zo.current!==null||o.memoizedState!==null)&&(As=a)}function Lf(a){if(a.tag===22){if(x(Mn,Mn.current),x(Zi,a),As===null){var o=a.alternate;o!==null&&o.memoizedState!==null&&(As=a)}}else es(a)}function es(){x(Mn,Mn.current),x(Zi,Zi.current)}function Hi(a){S(Zi),As===a&&(As=null),S(Mn)}function Gi(a){for(var o=a;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||$g(u)||t0(u)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}function Ke(){throw Error(n(321))}function Eo(a,o){if(o===null)return!1;for(var u=0;u<o.length&&u<a.length;u++)if(!Ni(a[u],o[u]))return!1;return!0}function To(a,o,u,d,_,M){return Da=M,Me=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,fe.H=a===null||a.memoizedState===null?Ar:Ua,Tr=!1,M=u(d,_),Tr=!1,jo&&(M=wc(o,u,d,_)),fr(a),M}function fr(a){fe.H=Cs;var o=We!==null&&We.next!==null;if(Da=0,_n=We=Me=null,ad=!1,Zc=0,Jo=null,o)throw Error(n(300));a===null||Cn||(a=a.dependencies,a!==null&&Ff(a)&&(Cn=!0))}function wc(a,o,u,d){Me=a;var _=0;do{if(jo&&(Jo=null),Zc=0,jo=!1,25<=_)throw Error(n(301));if(_+=1,_n=We=null,a.updateQueue!=null){var M=a.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}fe.H=Cr,M=o(u,d)}while(jo);return M}function Ao(){var a=fe.H,o=a.useState()[0];return o=typeof o.then=="function"?dr(o):o,a=a.useState()[0],(We!==null?We.memoizedState:null)!==a&&(Me.flags|=1024),o}function Co(){var a=rd!==0;return rd=0,a}function Ro(a,o,u){o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~u}function Nc(a){if(ad){for(a=a.memoizedState;a!==null;){var o=a.queue;o!==null&&(o.pending=null),a=a.next}ad=!1}Da=0,_n=We=Me=null,jo=!1,Zc=rd=0,Jo=null}function kn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?Me.memoizedState=_n=a:_n=_n.next=a,_n}function on(){if(We===null){var a=Me.alternate;a=a!==null?a.memoizedState:null}else a=We.next;var o=_n===null?Me.memoizedState:_n.next;if(o!==null)_n=o,We=a;else{if(a===null)throw Me.alternate===null?Error(n(467)):Error(n(310));We=a,a={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},_n===null?Me.memoizedState=_n=a:_n=_n.next=a}return _n}function dr(a){var o=Zc;return Zc+=1,Jo===null&&(Jo=[]),a=_t(Jo,a,o),o=Me,(_n===null?o.memoizedState:_n.next)===null&&(o=o.alternate,fe.H=o===null||o.memoizedState===null?Ar:Ua),a}function wo(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return dr(a);if(a.$$typeof===Aa)return Xn(a)}throw Error(n(438,String(a)))}function Dc(a){var o=null,u=Me.updateQueue;if(u!==null&&(o=u.memoCache),o==null){var d=Me.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(_){return _.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),u===null&&(u=f0(),Me.updateQueue=u),u.memoCache=o,u=o.data[o.index],u===void 0)for(u=o.data[o.index]=Array(a),d=0;d<a;d++)u[d]=VE;return o.index++,u}function U(a,o){return typeof o=="function"?o(a):o}function W(a){var o=on();return $(o,We,a)}function $(a,o,u){var d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=u;var _=a.baseQueue,M=d.pending;if(M!==null){if(_!==null){var P=_.next;_.next=M.next,M.next=P}o.baseQueue=_=M,d.pending=null}if(M=a.baseState,_===null)a.memoizedState=M;else{o=_.next;var V=P=null,q=null,ot=o,yt=!1;do{var Bt=ot.lane&-536870913;if(Bt!==ot.lane?(we&Bt)===Bt:(Da&Bt)===Bt){var zt=ot.revertLane;if(zt===0)q!==null&&(q=q.next={lane:0,revertLane:0,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null}),Bt===Wo&&(yt=!0);else if((Da&zt)===zt){ot=ot.next,zt===Wo&&(yt=!0);continue}else Bt={lane:0,revertLane:ot.revertLane,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null},q===null?(V=q=Bt,P=M):q=q.next=Bt,Me.lanes|=zt,Pa|=zt;Bt=ot.action,Tr&&u(M,Bt),M=ot.hasEagerState?ot.eagerState:u(M,Bt)}else zt={lane:Bt,revertLane:ot.revertLane,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null},q===null?(V=q=zt,P=M):q=q.next=zt,Me.lanes|=Bt,Pa|=Bt;ot=ot.next}while(ot!==null&&ot!==o);if(q===null?P=M:q.next=V,!Ni(M,a.memoizedState)&&(Cn=!0,yt&&(u=Xo,u!==null)))throw u;a.memoizedState=M,a.baseState=P,a.baseQueue=q,d.lastRenderedState=M}return _===null&&(d.lanes=0),[a.memoizedState,d.dispatch]}function Q(a){var o=on(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=a;var d=u.dispatch,_=u.pending,M=o.memoizedState;if(_!==null){u.pending=null;var P=_=_.next;do M=a(M,P.action),P=P.next;while(P!==_);Ni(M,o.memoizedState)||(Cn=!0),o.memoizedState=M,o.baseQueue===null&&(o.baseState=M),u.lastRenderedState=M}return[M,d]}function Z(a,o,u){var d=Me,_=on(),M=Pe;if(M){if(u===void 0)throw Error(n(407));u=u()}else u=o();var P=!Ni((We||_).memoizedState,u);if(P&&(_.memoizedState=u,Cn=!0),_=_.queue,pr(Pt.bind(null,d,_,a),[a]),_.getSnapshot!==o||P||_n!==null&&_n.memoizedState.tag&1){if(d.flags|=2048,Ne(9,Ht.bind(null,d,_,u,o),{destroy:void 0},null),Ze===null)throw Error(n(349));M||(Da&60)!==0||Rt(d,o,u)}return u}function Rt(a,o,u){a.flags|=16384,a={getSnapshot:o,value:u},o=Me.updateQueue,o===null?(o=f0(),Me.updateQueue=o,o.stores=[a]):(u=o.stores,u===null?o.stores=[a]:u.push(a))}function Ht(a,o,u,d){o.value=u,o.getSnapshot=d,qt(o)&&Jt(a)}function Pt(a,o,u){return u(function(){qt(o)&&Jt(a)})}function qt(a){var o=a.getSnapshot;a=a.value;try{var u=o();return!Ni(a,u)}catch{return!0}}function Jt(a){var o=lt(a,2);o!==null&&si(o,a,2)}function ae(a){var o=kn();if(typeof a=="function"){var u=a;if(a=u(),Tr){J(!0);try{u()}finally{J(!1)}}}return o.memoizedState=o.baseState=a,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:a},o}function te(a,o,u,d){return a.baseState=u,$(a,We,typeof d=="function"?d:U)}function Se(a,o,u,d,_){if(Of(a))throw Error(n(485));if(a=o.action,a!==null){var M={payload:_,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){M.listeners.push(P)}};fe.T!==null?u(!0):M.isTransition=!1,d(M),u=o.pending,u===null?(M.next=o.pending=M,Fe(o,M)):(M.next=u.next,o.pending=u.next=M)}}function Fe(a,o){var u=o.action,d=o.payload,_=a.state;if(o.isTransition){var M=fe.T,P={};fe.T=P;try{var V=u(_,d),q=fe.S;q!==null&&q(P,V),Qe(a,o,V)}catch(ot){ze(a,o,ot)}finally{fe.T=M}}else try{M=u(_,d),Qe(a,o,M)}catch(ot){ze(a,o,ot)}}function Qe(a,o,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){$e(a,o,d)},function(d){return ze(a,o,d)}):$e(a,o,u)}function $e(a,o,u){o.status="fulfilled",o.value=u,ee(o),a.state=u,o=a.pending,o!==null&&(u=o.next,u===o?a.pending=null:(u=u.next,o.next=u,Fe(a,u)))}function ze(a,o,u){var d=a.pending;if(a.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=u,ee(o),o=o.next;while(o!==d)}a.action=null}function ee(a){a=a.listeners;for(var o=0;o<a.length;o++)(0,a[o])()}function Ue(a,o){return o}function Ae(a,o){if(Pe){var u=Ze.formState;if(u!==null){t:{var d=Me;if(Pe){if(Zn){var _=DT(Zn,Ts);if(_){Zn=Yy(_),d=UT(_);break t}}dt(d)}d=!1}d&&(o=u[0])}}u=kn(),u.memoizedState=u.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ue,lastRenderedState:o},u.queue=d,u=vx.bind(null,Me,d),d.dispatch=u,d=ae(!1);var M=rg.bind(null,Me,!1,d.queue);return d=kn(),_={state:o,dispatch:null,action:a,pending:null},d.queue=_,u=Se.bind(null,Me,_,M,u),_.dispatch=u,d.memoizedState=a,[o,u,!1]}function Wn(a){var o=on();return Gs(o,We,a)}function Gs(a,o,u){o=$(a,o,Ue)[0],a=W(U)[0],o=typeof o=="object"&&o!==null&&typeof o.then=="function"?dr(o):o;var d=on(),_=d.queue,M=_.dispatch;return u!==d.memoizedState&&(Me.flags|=2048,Ne(9,ii.bind(null,_,u),{destroy:void 0},null)),[o,M,a]}function ii(a,o){a.action=o}function ya(a){var o=on(),u=We;if(u!==null)return Gs(o,u,a);on(),o=o.memoizedState,u=on();var d=u.queue.dispatch;return u.memoizedState=a,[o,d,!1]}function Ne(a,o,u,d){return a={tag:a,create:o,inst:u,deps:d,next:null},o=Me.updateQueue,o===null&&(o=f0(),Me.updateQueue=o),u=o.lastEffect,u===null?o.lastEffect=a.next=a:(d=u.next,u.next=a,a.next=d,o.lastEffect=a),a}function In(){return on().memoizedState}function Ln(a,o,u,d){var _=kn();Me.flags|=a,_.memoizedState=Ne(1|o,u,{destroy:void 0},d===void 0?null:d)}function gn(a,o,u,d){var _=on();d=d===void 0?null:d;var M=_.memoizedState.inst;We!==null&&d!==null&&Eo(d,We.memoizedState.deps)?_.memoizedState=Ne(o,u,M,d):(Me.flags|=a,_.memoizedState=Ne(1|o,u,M,d))}function On(a,o){Ln(8390656,8,a,o)}function pr(a,o){gn(2048,8,a,o)}function Es(a,o){return gn(4,2,a,o)}function lx(a,o){return gn(4,4,a,o)}function cx(a,o){if(typeof o=="function"){a=a();var u=o(a);return function(){typeof u=="function"?u():o(null)}}if(o!=null)return a=a(),o.current=a,function(){o.current=null}}function ux(a,o,u){u=u!=null?u.concat([a]):null,gn(4,4,cx.bind(null,o,a),u)}function ig(){}function hx(a,o){var u=on();o=o===void 0?null:o;var d=u.memoizedState;return o!==null&&Eo(o,d[1])?d[0]:(u.memoizedState=[a,o],a)}function fx(a,o){var u=on();o=o===void 0?null:o;var d=u.memoizedState;if(o!==null&&Eo(o,d[1]))return d[0];if(d=a(),Tr){J(!0);try{a()}finally{J(!1)}}return u.memoizedState=[d,o],d}function sg(a,o,u){return u===void 0||(Da&1073741824)!==0?a.memoizedState=o:(a.memoizedState=u,a=ly(),Me.lanes|=a,Pa|=a,u)}function dx(a,o,u,d){return Ni(u,o)?u:Zo.current!==null?(a=sg(a,u,d),Ni(a,o)||(Cn=!0),a):(Da&42)===0?(Cn=!0,a.memoizedState=u):(a=ly(),Me.lanes|=a,Pa|=a,o)}function px(a,o,u,d,_){var M=Sr();di(M!==0&&8>M?M:8);var P=fe.T,V={};fe.T=V,rg(a,!1,o,u);try{var q=_(),ot=fe.S;if(ot!==null&&ot(V,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var yt=jt(q,d);Uc(a,o,yt,Ai(a))}else Uc(a,o,d,Ai(a))}catch(Bt){Uc(a,o,{then:function(){},status:"rejected",reason:Bt},Ai())}finally{di(M),fe.T=P}}function mx(a){var o=a.memoizedState;if(o!==null)return o;o={memoizedState:Oo,baseState:Oo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:Oo},next:null};var u={};return o.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:u},next:null},a.memoizedState=o,a=a.alternate,a!==null&&(a.memoizedState=o),o}function ag(){return Xn(Mr)}function gx(){return on().memoizedState}function _x(){return on().memoizedState}function vE(a){for(var o=a.return;o!==null;){switch(o.tag){case 24:case 3:var u=Ai();a=Kt(u);var d=pt(o,a,u);d!==null&&(si(d,o,u),Ct(d,o,u)),o={cache:xg()},a.payload=o;return}o=o.return}}function xE(a,o,u){var d=Ai();u={lane:d,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null},Of(a)?xx(o,u):(u=gt(a,o,u,d),u!==null&&(si(u,a,d),yx(u,o,d)))}function vx(a,o,u){var d=Ai();Uc(a,o,u,d)}function Uc(a,o,u,d){var _={lane:d,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null};if(Of(a))xx(o,_);else{var M=a.alternate;if(a.lanes===0&&(M===null||M.lanes===0)&&(M=o.lastRenderedReducer,M!==null))try{var P=o.lastRenderedState,V=M(P,u);if(_.hasEagerState=!0,_.eagerState=V,Ni(V,P))return ct(a,o,_,0),Ze===null&&ce(),!1}catch{}if(u=gt(a,o,_,d),u!==null)return si(u,a,d),yx(u,o,d),!0}return!1}function rg(a,o,u,d){if(d={lane:2,revertLane:it(),action:d,hasEagerState:!1,eagerState:null,next:null},Of(a)){if(o)throw Error(n(479))}else o=gt(a,u,d,2),o!==null&&si(o,a,2)}function Of(a){var o=a.alternate;return a===Me||o!==null&&o===Me}function xx(a,o){jo=ad=!0;var u=a.pending;u===null?o.next=o:(o.next=u.next,u.next=o),a.pending=o}function yx(a,o,u){if((u&4194176)!==0){var d=o.lanes;d&=a.pendingLanes,u|=d,o.lanes=u,G(a,u)}}function og(a,o,u,d){o=a.memoizedState,u=u(d,o),u=u==null?o:kg({},o,u),a.memoizedState=u,a.lanes===0&&(a.updateQueue.baseState=u)}function Sx(a,o,u,d,_,M,P){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(d,M,P):o.prototype&&o.prototype.isPureReactComponent?!Ut(u,d)||!Ut(_,M):!0}function Mx(a,o,u,d){a=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,d),o.state!==a&&d0.enqueueReplaceState(o,o.state,null)}function mr(a,o){var u=o;if("ref"in o){u={};for(var d in o)d!=="ref"&&(u[d]=o[d])}if(a=a.defaultProps){u===o&&(u=kg({},u));for(var _ in a)u[_]===void 0&&(u[_]=a[_])}return u}function Bf(a,o){try{var u=a.onUncaughtError;u(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function bx(a,o,u){try{var d=a.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function lg(a,o,u){return u=Kt(u),u.tag=3,u.payload={element:null},u.callback=function(){Bf(a,o)},u}function Ex(a){return a=Kt(a),a.tag=3,a}function Tx(a,o,u,d){var _=u.type.getDerivedStateFromError;if(typeof _=="function"){var M=d.value;a.payload=function(){return _(M)},a.callback=function(){bx(o,u,d)}}var P=u.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(a.callback=function(){bx(o,u,d),typeof _!="function"&&(Ia===null?Ia=new Set([this]):Ia.add(this));var V=d.stack;this.componentDidCatch(d.value,{componentStack:V!==null?V:""})})}function yE(a,o,u,d,_){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=u.alternate,o!==null&&Ic(o,u,_,!0),u=Zi.current,u!==null){switch(u.tag){case 13:return As===null?Og():u.alternate===null&&un===0&&(un=3),u.flags&=-257,u.flags|=65536,u.lanes=_,d===id?u.flags|=16384:(o=u.updateQueue,o===null?u.updateQueue=new Set([d]):o.add(d),Fg(a,d,_)),!1;case 22:return u.flags|=65536,d===id?u.flags|=16384:(o=u.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=o):(u=o.retryQueue,u===null?o.retryQueue=new Set([d]):u.add(d)),Fg(a,d,_)),!1}throw Error(n(435,u.tag))}return Fg(a,d,_),Og(),!1}if(Pe)return o=Zi.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=_,d!==a0&&(a=Error(n(422),{cause:d}),Re(rt(a,u)))):(d!==a0&&(o=Error(n(423),{cause:d}),Re(rt(o,u))),a=a.current.alternate,a.flags|=65536,_&=-_,a.lanes|=_,d=rt(d,u),_=lg(a.stateNode,d,_),Xt(a,_),un!==4&&(un=2)),!1;var M=Error(n(520),{cause:d});if(M=rt(M,u),Jc===null?Jc=[M]:Jc.push(M),un!==4&&(un=2),o===null)return!0;d=rt(d,u),u=o;do{switch(u.tag){case 3:return u.flags|=65536,a=_&-_,u.lanes|=a,a=lg(u.stateNode,d,a),Xt(u,a),!1;case 1:if(o=u.type,M=u.stateNode,(u.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(Ia===null||!Ia.has(M))))return u.flags|=65536,_&=-_,u.lanes|=_,_=Ex(_),Tx(_,a,u,d),Xt(u,_),!1}u=u.return}while(u!==null);return!1}function Bn(a,o,u,d){o.child=a===null?oS(o,null,u,d):Er(o,a.child,u,d)}function Ax(a,o,u,d,_){u=u.render;var M=o.ref;if("ref"in d){var P={};for(var V in d)V!=="ref"&&(P[V]=d[V])}else P=d;return gr(o),d=To(a,o,u,P,M,_),V=Co(),a!==null&&!Cn?(Ro(a,o,_),ks(a,o,_)):(Pe&&V&&mt(o),o.flags|=1,Bn(a,o,d,_),o.child)}function Cx(a,o,u,d,_){if(a===null){var M=u.type;return typeof M=="function"&&!zg(M)&&M.defaultProps===void 0&&u.compare===null?(o.tag=15,o.type=M,Rx(a,o,M,d,_)):(a=Xf(u.type,null,d,o,o.mode,_),a.ref=o.ref,a.return=o,o.child=a)}if(M=a.child,!gg(a,_)){var P=M.memoizedProps;if(u=u.compare,u=u!==null?u:Ut,u(P,d)&&a.ref===o.ref)return ks(a,o,_)}return o.flags|=1,a=Ta(M,d),a.ref=o.ref,a.return=o,o.child=a}function Rx(a,o,u,d,_){if(a!==null){var M=a.memoizedProps;if(Ut(M,d)&&a.ref===o.ref)if(Cn=!1,o.pendingProps=d=M,gg(a,_))(a.flags&131072)!==0&&(Cn=!0);else return o.lanes=a.lanes,ks(a,o,_)}return cg(a,o,u,d,_)}function wx(a,o,u){var d=o.pendingProps,_=d.children,M=(o.stateNode._pendingVisibility&2)!==0,P=a!==null?a.memoizedState:null;if(Pc(a,o),d.mode==="hidden"||M){if((o.flags&128)!==0){if(d=P!==null?P.baseLanes|u:u,a!==null){for(_=o.child=a.child,M=0;_!==null;)M=M|_.lanes|_.childLanes,_=_.sibling;o.childLanes=M&~d}else o.childLanes=0,o.child=null;return Nx(a,o,d,u)}if((u&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},a!==null&&Vf(o,P!==null?P.cachePool:null),P!==null?zi(o,P):Rc(),Lf(o);else return o.lanes=o.childLanes=536870912,Nx(a,o,P!==null?P.baseLanes|u:u,u)}else P!==null?(Vf(o,P.cachePool),zi(o,P),es(o),o.memoizedState=null):(a!==null&&Vf(o,null),Rc(),es(o));return Bn(a,o,_,u),o.child}function Nx(a,o,u,d){var _=yg();return _=_===null?null:{parent:Ys?ln._currentValue:ln._currentValue2,pool:_},o.memoizedState={baseLanes:u,cachePool:_},a!==null&&Vf(o,null),Rc(),Lf(o),a!==null&&Ic(a,o,d,!0),null}function Pc(a,o){var u=o.ref;if(u===null)a!==null&&a.ref!==null&&(o.flags|=2097664);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(a===null||a.ref!==u)&&(o.flags|=2097664)}}function cg(a,o,u,d,_){return gr(o),u=To(a,o,u,d,void 0,_),d=Co(),a!==null&&!Cn?(Ro(a,o,_),ks(a,o,_)):(Pe&&d&&mt(o),o.flags|=1,Bn(a,o,u,_),o.child)}function Dx(a,o,u,d,_,M){return gr(o),o.updateQueue=null,u=wc(o,d,u,_),fr(a),d=Co(),a!==null&&!Cn?(Ro(a,o,M),ks(a,o,M)):(Pe&&d&&mt(o),o.flags|=1,Bn(a,o,u,M),o.child)}function Ux(a,o,u,d,_){if(gr(o),o.stateNode===null){var M=Fo,P=u.contextType;typeof P=="object"&&P!==null&&(M=Xn(P)),M=new u(d,M),o.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=d0,o.stateNode=M,M._reactInternals=o,M=o.stateNode,M.props=d,M.state=o.memoizedState,M.refs={},Et(o),P=u.contextType,M.context=typeof P=="object"&&P!==null?Xn(P):Fo,M.state=o.memoizedState,P=u.getDerivedStateFromProps,typeof P=="function"&&(og(o,u,P,d),M.state=o.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(P=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),P!==M.state&&d0.enqueueReplaceState(M,M.state,null),Tt(o,d,M,_),Yt(),M.state=o.memoizedState),typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(a===null){M=o.stateNode;var V=o.memoizedProps,q=mr(u,V);M.props=q;var ot=M.context,yt=u.contextType;P=Fo,typeof yt=="object"&&yt!==null&&(P=Xn(yt));var Bt=u.getDerivedStateFromProps;yt=typeof Bt=="function"||typeof M.getSnapshotBeforeUpdate=="function",V=o.pendingProps!==V,yt||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(V||ot!==P)&&Mx(o,M,d,P),Na=!1;var zt=o.memoizedState;M.state=zt,Tt(o,d,M,_),Yt(),ot=o.memoizedState,V||zt!==ot||Na?(typeof Bt=="function"&&(og(o,u,Bt,d),ot=o.memoizedState),(q=Na||Sx(o,u,q,d,zt,ot,P))?(yt||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=ot),M.props=d,M.state=ot,M.context=P,d=q):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{M=o.stateNode,Wt(a,o),P=o.memoizedProps,yt=mr(u,P),M.props=yt,Bt=o.pendingProps,zt=M.context,ot=u.contextType,q=Fo,typeof ot=="object"&&ot!==null&&(q=Xn(ot)),V=u.getDerivedStateFromProps,(ot=typeof V=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(P!==Bt||zt!==q)&&Mx(o,M,d,q),Na=!1,zt=o.memoizedState,M.state=zt,Tt(o,d,M,_),Yt();var _e=o.memoizedState;P!==Bt||zt!==_e||Na||a!==null&&a.dependencies!==null&&Ff(a.dependencies)?(typeof V=="function"&&(og(o,u,V,d),_e=o.memoizedState),(yt=Na||Sx(o,u,yt,d,zt,_e,q)||a!==null&&a.dependencies!==null&&Ff(a.dependencies))?(ot||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(d,_e,q),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(d,_e,q)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=_e),M.props=d,M.state=_e,M.context=q,d=yt):(typeof M.componentDidUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=1024),d=!1)}return M=d,Pc(a,o),d=(o.flags&128)!==0,M||d?(M=o.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:M.render(),o.flags|=1,a!==null&&d?(o.child=Er(o,a.child,null,_),o.child=Er(o,null,u,_)):Bn(a,o,u,_),o.memoizedState=M.state,a=o.child):a=ks(a,o,_),a}function Px(a,o,u,d){return ye(),o.flags|=256,Bn(a,o,u,d),o.child}function ug(a){return{baseLanes:a,cachePool:zx()}}function hg(a,o,u){return a=a!==null?a.childLanes&~u:0,o&&(a|=ji),a}function Ix(a,o,u){var d=o.pendingProps,_=!1,M=(o.flags&128)!==0,P;if((P=M)||(P=a!==null&&a.memoizedState===null?!1:(Mn.current&2)!==0),P&&(_=!0,o.flags&=-129),P=(o.flags&32)!==0,o.flags&=-33,a===null){if(Pe){if(_?Vi(o):es(o),Pe){var V=Zn,q;(q=V)&&(V=BT(V,Ts),V!==null?(o.memoizedState={dehydrated:V,treeContext:br!==null?{id:Zs,overflow:js}:null,retryLane:536870912},q=t(18,null,null,0),q.stateNode=V,q.return=o,o.child=q,ai=o,Zn=null,q=!0):q=!1),q||dt(o)}if(V=o.memoizedState,V!==null&&(V=V.dehydrated,V!==null))return t0(V)?o.lanes=16:o.lanes=536870912,null;Hi(o)}return V=d.children,d=d.fallback,_?(es(o),_=o.mode,V=dg({mode:"hidden",children:V},_),d=yr(d,_,u,null),V.return=o,d.return=o,V.sibling=d,o.child=V,_=o.child,_.memoizedState=ug(u),_.childLanes=hg(a,P,u),o.memoizedState=p0,d):(Vi(o),fg(o,V))}if(q=a.memoizedState,q!==null&&(V=q.dehydrated,V!==null)){if(M)o.flags&256?(Vi(o),o.flags&=-257,o=pg(a,o,u)):o.memoizedState!==null?(es(o),o.child=a.child,o.flags|=128,o=null):(es(o),_=d.fallback,V=o.mode,d=dg({mode:"visible",children:d.children},V),_=yr(_,V,u,null),_.flags|=2,d.return=o,_.return=o,d.sibling=_,o.child=d,Er(o,a.child,null,u),d=o.child,d.memoizedState=ug(u),d.childLanes=hg(a,P,u),o.memoizedState=p0,o=_);else if(Vi(o),t0(V))P=wT(V).digest,d=Error(n(419)),d.stack="",d.digest=P,Re({value:d,source:null,stack:null}),o=pg(a,o,u);else if(Cn||Ic(a,o,u,!1),P=(u&a.childLanes)!==0,Cn||P){if(P=Ze,P!==null){if(d=u&-u,(d&42)!==0)d=1;else switch(d){case 2:d=1;break;case 8:d=4;break;case 32:d=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:d=64;break;case 268435456:d=134217728;break;default:d=0}if(d=(d&(P.suspendedLanes|u))!==0?0:d,d!==0&&d!==q.retryLane)throw q.retryLane=d,lt(a,d),si(P,a,d),cS}$g(V)||Og(),o=pg(a,o,u)}else $g(V)?(o.flags|=128,o.child=a.child,o=UE.bind(null,a),NT(V,o),o=null):(a=q.treeContext,ki&&(Zn=IT(V),ai=o,Pe=!0,ss=null,Ts=!1,a!==null&&(Xi[qi++]=Zs,Xi[qi++]=js,Xi[qi++]=br,Zs=a.id,js=a.overflow,br=o)),o=fg(o,d.children),o.flags|=4096);return o}return _?(es(o),_=d.fallback,V=o.mode,q=a.child,M=q.sibling,d=Ta(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&31457280,M!==null?_=Ta(M,_):(_=yr(_,V,u,null),_.flags|=2),_.return=o,d.return=o,d.sibling=_,o.child=d,d=_,_=o.child,V=a.child.memoizedState,V===null?V=ug(u):(q=V.cachePool,q!==null?(M=Ys?ln._currentValue:ln._currentValue2,q=q.parent!==M?{parent:M,pool:M}:q):q=zx(),V={baseLanes:V.baseLanes|u,cachePool:q}),_.memoizedState=V,_.childLanes=hg(a,P,u),o.memoizedState=p0,d):(Vi(o),u=a.child,a=u.sibling,u=Ta(u,{mode:"visible",children:d.children}),u.return=o,u.sibling=null,a!==null&&(P=o.deletions,P===null?(o.deletions=[a],o.flags|=16):P.push(a)),o.child=u,o.memoizedState=null,u)}function fg(a,o){return o=dg({mode:"visible",children:o},a.mode),o.return=a,a.child=o}function dg(a,o){return Ey(a,o,0,null)}function pg(a,o,u){return Er(o,a.child,null,u),a=fg(o,o.pendingProps.children),a.flags|=2,o.memoizedState=null,a}function Lx(a,o,u){a.lanes|=o;var d=a.alternate;d!==null&&(d.lanes|=o),_g(a.return,o,u)}function mg(a,o,u,d,_){var M=a.memoizedState;M===null?a.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:_}:(M.isBackwards=o,M.rendering=null,M.renderingStartTime=0,M.last=d,M.tail=u,M.tailMode=_)}function Ox(a,o,u){var d=o.pendingProps,_=d.revealOrder,M=d.tail;if(Bn(a,o,d.children,u),d=Mn.current,(d&2)!==0)d=d&1|2,o.flags|=128;else{if(a!==null&&(a.flags&128)!==0)t:for(a=o.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Lx(a,u,o);else if(a.tag===19)Lx(a,u,o);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break t;for(;a.sibling===null;){if(a.return===null||a.return===o)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}d&=1}switch(x(Mn,d),_){case"forwards":for(u=o.child,_=null;u!==null;)a=u.alternate,a!==null&&Gi(a)===null&&(_=u),u=u.sibling;u=_,u===null?(_=o.child,o.child=null):(_=u.sibling,u.sibling=null),mg(o,!1,_,u,M);break;case"backwards":for(u=null,_=o.child,o.child=null;_!==null;){if(a=_.alternate,a!==null&&Gi(a)===null){o.child=_;break}a=_.sibling,_.sibling=u,u=_,_=a}mg(o,!0,u,null,M);break;case"together":mg(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function ks(a,o,u){if(a!==null&&(o.dependencies=a.dependencies),Pa|=o.lanes,(u&o.childLanes)===0)if(a!==null){if(Ic(a,o,u,!1),(u&o.childLanes)===0)return null}else return null;if(a!==null&&o.child!==a.child)throw Error(n(153));if(o.child!==null){for(a=o.child,u=Ta(a,a.pendingProps),o.child=u,u.return=o;a.sibling!==null;)a=a.sibling,u=u.sibling=Ta(a,a.pendingProps),u.return=o;u.sibling=null}return o.child}function gg(a,o){return(a.lanes&o)!==0?!0:(a=a.dependencies,!!(a!==null&&Ff(a)))}function SE(a,o,u){switch(o.tag){case 3:$t(o,o.stateNode.containerInfo),Sa(o,ln,a.memoizedState.cache),ye();break;case 27:case 5:Ce(o);break;case 4:$t(o,o.stateNode.containerInfo);break;case 10:Sa(o,o.type,o.memoizedProps.value);break;case 13:var d=o.memoizedState;if(d!==null)return d.dehydrated!==null?(Vi(o),o.flags|=128,null):(u&o.child.childLanes)!==0?Ix(a,o,u):(Vi(o),a=ks(a,o,u),a!==null?a.sibling:null);Vi(o);break;case 19:var _=(a.flags&128)!==0;if(d=(u&o.childLanes)!==0,d||(Ic(a,o,u,!1),d=(u&o.childLanes)!==0),_){if(d)return Ox(a,o,u);o.flags|=128}if(_=o.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),x(Mn,Mn.current),d)break;return null;case 22:case 23:return o.lanes=0,wx(a,o,u);case 24:Sa(o,ln,a.memoizedState.cache)}return ks(a,o,u)}function Bx(a,o,u){if(a!==null)if(a.memoizedProps!==o.pendingProps)Cn=!0;else{if(!gg(a,u)&&(o.flags&128)===0)return Cn=!1,SE(a,o,u);Cn=(a.flags&131072)!==0}else Cn=!1,Pe&&(o.flags&1048576)!==0&&bt(o,$f,o.index);switch(o.lanes=0,o.tag){case 16:t:{a=o.pendingProps;var d=o.elementType,_=d._init;if(d=_(d._payload),o.type=d,typeof d=="function")zg(d)?(a=mr(d,a),o.tag=1,o=Ux(null,o,d,a,u)):(o.tag=0,o=cg(null,o,d,a,u));else{if(d!=null){if(_=d.$$typeof,_===Xg){o.tag=11,o=Ax(null,o,d,a,u);break t}else if(_===Zg){o.tag=14,o=Cx(null,o,d,a,u);break t}}throw o=r(d)||d,Error(n(306,o,""))}}return o;case 0:return cg(a,o,o.type,o.pendingProps,u);case 1:return d=o.type,_=mr(d,o.pendingProps),Ux(a,o,d,_,u);case 3:t:{if($t(o,o.stateNode.containerInfo),a===null)throw Error(n(387));var M=o.pendingProps;_=o.memoizedState,d=_.element,Wt(a,o),Tt(o,M,null,u);var P=o.memoizedState;if(M=P.cache,Sa(o,ln,M),M!==_.cache&&vg(o,[ln],u,!0),Yt(),M=P.element,ki&&_.isDehydrated)if(_={element:M,isDehydrated:!1,cache:P.cache},o.updateQueue.baseState=_,o.memoizedState=_,o.flags&256){o=Px(a,o,M,u);break t}else if(M!==d){d=rt(Error(n(424)),o),Re(d),o=Px(a,o,M,u);break t}else for(ki&&(Zn=PT(o.stateNode.containerInfo),ai=o,Pe=!0,ss=null,Ts=!0),u=oS(o,null,M,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ye(),M===d){o=ks(a,o,u);break t}Bn(a,o,M,u)}o=o.child}return o;case 26:if(Wi)return Pc(a,o),a===null?(u=Ky(o.type,null,o.pendingProps,null))?o.memoizedState=u:Pe||(o.stateNode=jT(o.type,o.pendingProps,wa.current,o)):o.memoizedState=Ky(o.type,a.memoizedProps,o.pendingProps,a.memoizedState),null;case 27:if(Yn)return Ce(o),a===null&&Yn&&Pe&&(d=o.stateNode=iS(o.type,o.pendingProps,wa.current,Fn.current,!1),ai=o,Ts=!0,Zn=Zy(d)),d=o.pendingProps.children,a!==null||Pe?Bn(a,o,d,u):o.child=Er(o,null,d,u),Pc(a,o),o.child;case 5:return a===null&&Pe&&(qT(o.type,o.pendingProps,Fn.current),(_=d=Zn)&&(d=LT(d,o.type,o.pendingProps,Ts),d!==null?(o.stateNode=d,ai=o,Zn=Zy(d),Ts=!1,_=!0):_=!1),_||dt(o)),Ce(o),_=o.type,M=o.pendingProps,P=a!==null?a.memoizedProps:null,d=M.children,Zf(_,M)?d=null:P!==null&&Zf(_,P)&&(o.flags|=32),o.memoizedState!==null&&(_=To(a,o,Ao,null,null,u),Ys?Mr._currentValue=_:Mr._currentValue2=_),Pc(a,o),Bn(a,o,d,u),o.child;case 6:return a===null&&Pe&&(YT(o.pendingProps,Fn.current),(a=u=Zn)&&(u=OT(u,o.pendingProps,Ts),u!==null?(o.stateNode=u,ai=o,Zn=null,a=!0):a=!1),a||dt(o)),null;case 13:return Ix(a,o,u);case 4:return $t(o,o.stateNode.containerInfo),d=o.pendingProps,a===null?o.child=Er(o,null,d,u):Bn(a,o,d,u),o.child;case 11:return Ax(a,o,o.type,o.pendingProps,u);case 7:return Bn(a,o,o.pendingProps,u),o.child;case 8:return Bn(a,o,o.pendingProps.children,u),o.child;case 12:return Bn(a,o,o.pendingProps.children,u),o.child;case 10:return d=o.pendingProps,Sa(o,o.type,d.value),Bn(a,o,d.children,u),o.child;case 9:return _=o.type._context,d=o.pendingProps.children,gr(o),_=Xn(_),d=d(_),o.flags|=1,Bn(a,o,d,u),o.child;case 14:return Cx(a,o,o.type,o.pendingProps,u);case 15:return Rx(a,o,o.type,o.pendingProps,u);case 19:return Ox(a,o,u);case 22:return wx(a,o,u);case 24:return gr(o),d=Xn(ln),a===null?(_=yg(),_===null&&(_=Ze,M=xg(),_.pooledCache=M,M.refCount++,M!==null&&(_.pooledCacheLanes|=u),_=M),o.memoizedState={parent:d,cache:_},Et(o),Sa(o,ln,_)):((a.lanes&u)!==0&&(Wt(a,o),Tt(o,null,null,u),Yt()),_=a.memoizedState,M=o.memoizedState,_.parent!==d?(_={parent:d,cache:d},o.memoizedState=_,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=_),Sa(o,ln,d)):(d=M.cache,Sa(o,ln,d),d!==_.cache&&vg(o,[ln],u,!0))),Bn(a,o,o.pendingProps.children,u),o.child;case 29:throw o.pendingProps}throw Error(n(156,o.tag))}function Sa(a,o,u){Ys?(x(od,o._currentValue),o._currentValue=u):(x(od,o._currentValue2),o._currentValue2=u)}function Ws(a){var o=od.current;Ys?a._currentValue=o:a._currentValue2=o,S(od)}function _g(a,o,u){for(;a!==null;){var d=a.alternate;if((a.childLanes&o)!==o?(a.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),a===u)break;a=a.return}}function vg(a,o,u,d){var _=a.child;for(_!==null&&(_.return=a);_!==null;){var M=_.dependencies;if(M!==null){var P=_.child;M=M.firstContext;t:for(;M!==null;){var V=M;M=_;for(var q=0;q<o.length;q++)if(V.context===o[q]){M.lanes|=u,V=M.alternate,V!==null&&(V.lanes|=u),_g(M.return,u,a),d||(P=null);break t}M=V.next}}else if(_.tag===18){if(P=_.return,P===null)throw Error(n(341));P.lanes|=u,M=P.alternate,M!==null&&(M.lanes|=u),_g(P,u,a),P=null}else P=_.child;if(P!==null)P.return=_;else for(P=_;P!==null;){if(P===a){P=null;break}if(_=P.sibling,_!==null){_.return=P.return,P=_;break}P=P.return}_=P}}function Ic(a,o,u,d){a=null;for(var _=o,M=!1;_!==null;){if(!M){if((_.flags&524288)!==0)M=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var P=_.alternate;if(P===null)throw Error(n(387));if(P=P.memoizedProps,P!==null){var V=_.type;Ni(_.pendingProps.value,P.value)||(a!==null?a.push(V):a=[V])}}else if(_===td.current){if(P=_.alternate,P===null)throw Error(n(387));P.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(a!==null?a.push(Mr):a=[Mr])}_=_.return}a!==null&&vg(o,a,u,d),o.flags|=262144}function Ff(a){for(a=a.firstContext;a!==null;){var o=a.context;if(!Ni(Ys?o._currentValue:o._currentValue2,a.memoizedValue))return!0;a=a.next}return!1}function gr(a){Rr=a,Js=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function Xn(a){return Fx(Rr,a)}function zf(a,o){return Rr===null&&gr(a),Fx(a,o)}function Fx(a,o){var u=Ys?o._currentValue:o._currentValue2;if(o={context:o,memoizedValue:u,next:null},Js===null){if(a===null)throw Error(n(308));Js=o,a.dependencies={lanes:0,firstContext:o},a.flags|=524288}else Js=Js.next=o;return u}function xg(){return{controller:new fA,data:new Map,refCount:0}}function Lc(a){a.refCount--,a.refCount===0&&dA(pA,function(){a.controller.abort()})}function yg(){var a=wr.current;return a!==null?a:Ze.pooledCache}function Vf(a,o){o===null?x(wr,wr.current):x(wr,o.pool)}function zx(){var a=yg();return a===null?null:{parent:Ys?ln._currentValue:ln._currentValue2,pool:a}}function bi(a){a.flags|=4}function Vx(a,o){if(a!==null&&a.child===o.child)return!1;if((o.flags&16)!==0)return!0;for(a=o.child;a!==null;){if((a.flags&13878)!==0||(a.subtreeFlags&13878)!==0)return!0;a=a.sibling}return!1}function Sg(a,o,u,d){if(qn)for(u=o.child;u!==null;){if(u.tag===5||u.tag===6)Kg(a,u.stateNode);else if(!(u.tag===4||Yn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(Ra)for(var _=o.child;_!==null;){if(_.tag===5){var M=_.stateNode;u&&d&&(M=Xy(M,_.type,_.memoizedProps)),Kg(a,M)}else if(_.tag===6)M=_.stateNode,u&&d&&(M=qy(M,_.memoizedProps)),Kg(a,M);else if(_.tag!==4){if(_.tag===22&&_.memoizedState!==null)M=_.child,M!==null&&(M.return=_),Sg(a,_,!0,!0);else if(_.child!==null){_.child.return=_,_=_.child;continue}}if(_===o)break;for(;_.sibling===null;){if(_.return===null||_.return===o)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function Hx(a,o,u,d){if(Ra)for(var _=o.child;_!==null;){if(_.tag===5){var M=_.stateNode;u&&d&&(M=Xy(M,_.type,_.memoizedProps)),ky(a,M)}else if(_.tag===6)M=_.stateNode,u&&d&&(M=qy(M,_.memoizedProps)),ky(a,M);else if(_.tag!==4){if(_.tag===22&&_.memoizedState!==null)M=_.child,M!==null&&(M.return=_),Hx(a,_,!(_.memoizedProps!==null&&_.memoizedProps.mode==="manual"),!0);else if(_.child!==null){_.child.return=_,_=_.child;continue}}if(_===o)break;for(;_.sibling===null;){if(_.return===null||_.return===o)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function Gx(a,o){if(Ra&&Vx(a,o)){a=o.stateNode;var u=a.containerInfo,d=Gy();Hx(d,o,!1,!1),a.pendingChildren=d,bi(o),RT(u,d)}}function Mg(a,o,u,d){if(qn)a.memoizedProps!==d&&bi(o);else if(Ra){var _=a.stateNode,M=a.memoizedProps;if((a=Vx(a,o))||M!==d){var P=Fn.current;M=CT(_,u,M,d,!a,null),M===_?o.stateNode=_:(Oy(M,u,d,P)&&bi(o),o.stateNode=M,a?Sg(M,o,!1,!1):bi(o))}else o.stateNode=_}}function bg(a,o,u){if(eT(o,u)){if(a.flags|=16777216,!zy(o,u))if(dy())a.flags|=8192;else throw qo=id,h0}else a.flags&=-16777217}function kx(a,o){if(KT(o)){if(a.flags|=16777216,!nS(o))if(dy())a.flags|=8192;else throw qo=id,h0}else a.flags&=-16777217}function Hf(a,o){o!==null&&(a.flags|=4),a.flags&16384&&(o=a.tag!==22?F():536870912,a.lanes|=o,$o|=o)}function Oc(a,o){if(!Pe)switch(a.tailMode){case"hidden":o=a.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a.tail=null:u.sibling=null;break;case"collapsed":u=a.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?o||a.tail===null?a.tail=null:a.tail.sibling=null:d.sibling=null}}function sn(a){var o=a.alternate!==null&&a.alternate.child===a.child,u=0,d=0;if(o)for(var _=a.child;_!==null;)u|=_.lanes|_.childLanes,d|=_.subtreeFlags&31457280,d|=_.flags&31457280,_.return=a,_=_.sibling;else for(_=a.child;_!==null;)u|=_.lanes|_.childLanes,d|=_.subtreeFlags,d|=_.flags,_.return=a,_=_.sibling;return a.subtreeFlags|=d,a.childLanes=u,o}function ME(a,o,u){var d=o.pendingProps;switch(kt(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(o),null;case 1:return sn(o),null;case 3:return u=o.stateNode,d=null,a!==null&&(d=a.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),Ws(ln),re(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(a===null||a.child===null)&&(Ft(o)?bi(o):a===null||a.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ss!==null&&(Ig(ss),ss=null))),Gx(a,o),sn(o),null;case 26:if(Wi){u=o.type;var _=o.memoizedState;return a===null?(bi(o),_!==null?(sn(o),kx(o,_)):(sn(o),bg(o,u,d))):_?_!==a.memoizedState?(bi(o),sn(o),kx(o,_)):(sn(o),o.flags&=-16777217):(qn?a.memoizedProps!==d&&bi(o):Mg(a,o,u,d),sn(o),bg(o,u,d)),null}case 27:if(Yn){if(at(o),u=wa.current,_=o.type,a!==null&&o.stateNode!=null)qn?a.memoizedProps!==d&&bi(o):Mg(a,o,_,d);else{if(!d){if(o.stateNode===null)throw Error(n(166));return sn(o),null}a=Fn.current,Ft(o)?Vt(o,a):(a=iS(_,d,u,a,!0),o.stateNode=a,bi(o))}return sn(o),null}case 5:if(at(o),u=o.type,a!==null&&o.stateNode!=null)Mg(a,o,u,d);else{if(!d){if(o.stateNode===null)throw Error(n(166));return sn(o),null}a=Fn.current,Ft(o)?Vt(o,a):(_=ZE(u,d,wa.current,a,o),Sg(_,o,!1,!1),o.stateNode=_,Oy(_,u,d,a)&&bi(o))}return sn(o),bg(o,o.type,o.pendingProps),null;case 6:if(a&&o.stateNode!=null)u=a.memoizedProps,qn?u!==d&&bi(o):Ra&&(u!==d?(o.stateNode=By(d,wa.current,Fn.current,o),bi(o)):o.stateNode=a.stateNode);else{if(typeof d!="string"&&o.stateNode===null)throw Error(n(166));if(a=wa.current,u=Fn.current,Ft(o)){if(!ki)throw Error(n(176));if(a=o.stateNode,u=o.memoizedProps,d=null,_=ai,_!==null)switch(_.tag){case 27:case 5:d=_.memoizedProps}zT(a,u,o,d)||dt(o)}else o.stateNode=By(d,a,u,o)}return sn(o),null;case 13:if(d=o.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(_=Ft(o),d!==null&&d.dehydrated!==null){if(a===null){if(!_)throw Error(n(318));if(!ki)throw Error(n(344));if(_=o.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));VT(_,o)}else ye(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;sn(o),_=!1}else ss!==null&&(Ig(ss),ss=null),_=!0;if(!_)return o.flags&256?(Hi(o),o):(Hi(o),null)}if(Hi(o),(o.flags&128)!==0)return o.lanes=u,o;if(u=d!==null,a=a!==null&&a.memoizedState!==null,u){d=o.child,_=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(_=d.alternate.memoizedState.cachePool.pool);var M=null;d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(M=d.memoizedState.cachePool.pool),M!==_&&(d.flags|=2048)}return u!==a&&u&&(o.child.flags|=8192),Hf(o,o.updateQueue),sn(o),null;case 4:return re(),Gx(a,o),a===null&&KE(o.stateNode.containerInfo),sn(o),null;case 10:return Ws(o.type),sn(o),null;case 19:if(S(Mn),_=o.memoizedState,_===null)return sn(o),null;if(d=(o.flags&128)!==0,M=_.rendering,M===null)if(d)Oc(_,!1);else{if(un!==0||a!==null&&(a.flags&128)!==0)for(a=o.child;a!==null;){if(M=Gi(a),M!==null){for(o.flags|=128,Oc(_,!1),a=M.updateQueue,o.updateQueue=a,Hf(o,a),o.subtreeFlags=0,a=u,u=o.child;u!==null;)by(u,a),u=u.sibling;return x(Mn,Mn.current&1|2),o.child}a=a.sibling}_.tail!==null&&is()>Kc&&(o.flags|=128,d=!0,Oc(_,!1),o.lanes=4194304)}else{if(!d)if(a=Gi(M),a!==null){if(o.flags|=128,d=!0,a=a.updateQueue,o.updateQueue=a,Hf(o,a),Oc(_,!0),_.tail===null&&_.tailMode==="hidden"&&!M.alternate&&!Pe)return sn(o),null}else 2*is()-_.renderingStartTime>Kc&&u!==536870912&&(o.flags|=128,d=!0,Oc(_,!1),o.lanes=4194304);_.isBackwards?(M.sibling=o.child,o.child=M):(a=_.last,a!==null?a.sibling=M:o.child=M,_.last=M)}return _.tail!==null?(o=_.tail,_.rendering=o,_.tail=o.sibling,_.renderingStartTime=is(),o.sibling=null,a=Mn.current,x(Mn,d?a&1|2:a&1),o):(sn(o),null);case 22:case 23:return Hi(o),bo(),d=o.memoizedState!==null,a!==null?a.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(u&536870912)!==0&&(o.flags&128)===0&&(sn(o),o.subtreeFlags&6&&(o.flags|=8192)):sn(o),u=o.updateQueue,u!==null&&Hf(o,u.retryQueue),u=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048),a!==null&&S(wr),null;case 24:return u=null,a!==null&&(u=a.memoizedState.cache),o.memoizedState.cache!==u&&(o.flags|=2048),Ws(ln),sn(o),null;case 25:return null}throw Error(n(156,o.tag))}function bE(a,o){switch(kt(o),o.tag){case 1:return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 3:return Ws(ln),re(),a=o.flags,(a&65536)!==0&&(a&128)===0?(o.flags=a&-65537|128,o):null;case 26:case 27:case 5:return at(o),null;case 13:if(Hi(o),a=o.memoizedState,a!==null&&a.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ye()}return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 19:return S(Mn),null;case 4:return re(),null;case 10:return Ws(o.type),null;case 22:case 23:return Hi(o),bo(),a!==null&&S(wr),a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 24:return Ws(ln),null;case 25:return null;default:return null}}function Wx(a,o){switch(kt(o),o.tag){case 3:Ws(ln),re();break;case 26:case 27:case 5:at(o);break;case 4:re();break;case 13:Hi(o);break;case 19:S(Mn);break;case 10:Ws(o.type);break;case 22:case 23:Hi(o),bo(),a!==null&&S(wr);break;case 24:Ws(ln)}}function Bc(a,o){try{var u=o.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var _=d.next;u=_;do{if((u.tag&a)===a){d=void 0;var M=u.create,P=u.inst;d=M(),P.destroy=d}u=u.next}while(u!==_)}}catch(V){ke(o,o.return,V)}}function Ma(a,o,u){try{var d=o.updateQueue,_=d!==null?d.lastEffect:null;if(_!==null){var M=_.next;d=M;do{if((d.tag&a)===a){var P=d.inst,V=P.destroy;if(V!==void 0){P.destroy=void 0,_=o;var q=u;try{V()}catch(ot){ke(_,q,ot)}}}d=d.next}while(d!==M)}}catch(ot){ke(o,o.return,ot)}}function Xx(a){var o=a.updateQueue;if(o!==null){var u=a.stateNode;try{H(o,u)}catch(d){ke(a,a.return,d)}}}function qx(a,o,u){u.props=mr(a.type,a.memoizedProps),u.state=a.memoizedState;try{u.componentWillUnmount()}catch(d){ke(a,o,d)}}function _r(a,o){try{var u=a.ref;if(u!==null){var d=a.stateNode;switch(a.tag){case 26:case 27:case 5:var _=Vc(d);break;default:_=d}typeof u=="function"?a.refCleanup=u(_):u.current=_}}catch(M){ke(a,o,M)}}function Ei(a,o){var u=a.ref,d=a.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(_){ke(a,o,_)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(_){ke(a,o,_)}else u.current=null}function Yx(a){var o=a.type,u=a.memoizedProps,d=a.stateNode;try{gT(d,o,u,a)}catch(_){ke(a,a.return,_)}}function Zx(a,o,u){try{_T(a.stateNode,a.type,u,o,a)}catch(d){ke(a,a.return,d)}}function jx(a){return a.tag===5||a.tag===3||(Wi?a.tag===26:!1)||(Yn?a.tag===27:!1)||a.tag===4}function Eg(a){t:for(;;){for(;a.sibling===null;){if(a.return===null||jx(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&(!Yn||a.tag!==27)&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue t;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Tg(a,o,u){var d=a.tag;if(d===5||d===6)a=a.stateNode,o?xT(u,a,o):pT(u,a);else if(!(d===4||Yn&&d===27)&&(a=a.child,a!==null))for(Tg(a,o,u),a=a.sibling;a!==null;)Tg(a,o,u),a=a.sibling}function Gf(a,o,u){var d=a.tag;if(d===5||d===6)a=a.stateNode,o?vT(u,a,o):dT(u,a);else if(!(d===4||Yn&&d===27)&&(a=a.child,a!==null))for(Gf(a,o,u),a=a.sibling;a!==null;)Gf(a,o,u),a=a.sibling}function Jx(a,o,u){a=a.containerInfo;try{Wy(a,u)}catch(d){ke(o,o.return,d)}}function EE(a,o){for(qE(a.containerInfo),Rn=o;Rn!==null;)if(a=Rn,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Rn=o;else for(;Rn!==null;){a=Rn;var u=a.alternate;switch(o=a.flags,a.tag){case 0:break;case 11:case 15:break;case 1:if((o&1024)!==0&&u!==null){o=void 0;var d=a,_=u.memoizedProps;u=u.memoizedState;var M=d.stateNode;try{var P=mr(d.type,_,d.elementType===d.type);o=M.getSnapshotBeforeUpdate(P,u),M.__reactInternalSnapshotBeforeUpdate=o}catch(V){ke(d,d.return,V)}}break;case 3:(o&1024)!==0&&qn&&AT(a.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(n(163))}if(o=a.sibling,o!==null){o.return=a.return,Rn=o;break}Rn=a.return}return P=fS,fS=!1,P}function Kx(a,o,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Xs(a,u),d&4&&Bc(5,u);break;case 1:if(Xs(a,u),d&4)if(a=u.stateNode,o===null)try{a.componentDidMount()}catch(V){ke(u,u.return,V)}else{var _=mr(u.type,o.memoizedProps);o=o.memoizedState;try{a.componentDidUpdate(_,o,a.__reactInternalSnapshotBeforeUpdate)}catch(V){ke(u,u.return,V)}}d&64&&Xx(u),d&512&&_r(u,u.return);break;case 3:if(Xs(a,u),d&64&&(d=u.updateQueue,d!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=Vc(u.child.stateNode);break;case 1:a=u.child.stateNode}try{H(d,a)}catch(V){ke(u,u.return,V)}}break;case 26:if(Wi){Xs(a,u),d&512&&_r(u,u.return);break}case 27:case 5:Xs(a,u),o===null&&d&4&&Yx(u),d&512&&_r(u,u.return);break;case 12:Xs(a,u);break;case 13:Xs(a,u),d&4&&$x(a,u);break;case 22:if(_=u.memoizedState!==null||Ks,!_){o=o!==null&&o.memoizedState!==null||cn;var M=Ks,P=cn;Ks=_,(cn=o)&&!P?ba(a,u,(u.subtreeFlags&8772)!==0):Xs(a,u),Ks=M,cn=P}d&512&&(u.memoizedProps.mode==="manual"?_r(u,u.return):Ei(u,u.return));break;default:Xs(a,u)}}function Qx(a){var o=a.alternate;o!==null&&(a.alternate=null,Qx(o)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(o=a.stateNode,o!==null&&tT(o)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function ns(a,o,u){for(u=u.child;u!==null;)Ag(a,o,u),u=u.sibling}function Ag(a,o,u){if(wi&&typeof wi.onCommitFiberUnmount=="function")try{wi.onCommitFiberUnmount(kc,u)}catch{}switch(u.tag){case 26:if(Wi){cn||Ei(u,o),ns(a,o,u),u.memoizedState?$y(u.memoizedState):u.stateNode&&eS(u.stateNode);break}case 27:if(Yn){cn||Ei(u,o);var d=vn,_=Di;vn=u.stateNode,ns(a,o,u),eA(u.stateNode),vn=d,Di=_;break}case 5:cn||Ei(u,o);case 6:if(qn){if(d=vn,_=Di,vn=null,ns(a,o,u),vn=d,Di=_,vn!==null)if(Di)try{ST(vn,u.stateNode)}catch(M){ke(u,o,M)}else try{yT(vn,u.stateNode)}catch(M){ke(u,o,M)}}else ns(a,o,u);break;case 18:qn&&vn!==null&&(Di?XT(vn,u.stateNode):WT(vn,u.stateNode));break;case 4:qn?(d=vn,_=Di,vn=u.stateNode.containerInfo,Di=!0,ns(a,o,u),vn=d,Di=_):(Ra&&Jx(u.stateNode,u,Gy()),ns(a,o,u));break;case 0:case 11:case 14:case 15:cn||Ma(2,u,o),cn||Ma(4,u,o),ns(a,o,u);break;case 1:cn||(Ei(u,o),d=u.stateNode,typeof d.componentWillUnmount=="function"&&qx(u,o,d)),ns(a,o,u);break;case 21:ns(a,o,u);break;case 22:cn||Ei(u,o),cn=(d=cn)||u.memoizedState!==null,ns(a,o,u),cn=d;break;default:ns(a,o,u)}}function $x(a,o){if(ki&&o.memoizedState===null&&(a=o.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{kT(a)}catch(u){ke(o,o.return,u)}}function TE(a){switch(a.tag){case 13:case 19:var o=a.stateNode;return o===null&&(o=a.stateNode=new hS),o;case 22:return a=a.stateNode,o=a._retryCache,o===null&&(o=a._retryCache=new hS),o;default:throw Error(n(435,a.tag))}}function Cg(a,o){var u=TE(a);o.forEach(function(d){var _=PE.bind(null,a,d);u.has(d)||(u.add(d),d.then(_,_))})}function fi(a,o){var u=o.deletions;if(u!==null)for(var d=0;d<u.length;d++){var _=u[d],M=a,P=o;if(qn){var V=P;t:for(;V!==null;){switch(V.tag){case 27:case 5:vn=V.stateNode,Di=!1;break t;case 3:vn=V.stateNode.containerInfo,Di=!0;break t;case 4:vn=V.stateNode.containerInfo,Di=!0;break t}V=V.return}if(vn===null)throw Error(n(160));Ag(M,P,_),vn=null,Di=!1}else Ag(M,P,_);M=_.alternate,M!==null&&(M.return=null),_.return=null}if(o.subtreeFlags&13878)for(o=o.child;o!==null;)ty(o,a),o=o.sibling}function ty(a,o){var u=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:fi(o,a),Ti(a),d&4&&(Ma(3,a,a.return),Bc(3,a),Ma(5,a,a.return));break;case 1:fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),d&64&&Ks&&(a=a.updateQueue,a!==null&&(d=a.callbacks,d!==null&&(u=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:if(Wi){var _=as;fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),d&4&&(d=u!==null?u.memoizedState:null,o=a.memoizedState,u===null?o===null?a.stateNode===null?a.stateNode=ZT(_,a.type,a.memoizedProps,a):tS(_,a.type,a.stateNode):a.stateNode=Qy(_,o,a.memoizedProps):d!==o?(d===null?u.stateNode!==null&&eS(u.stateNode):$y(d),o===null?tS(_,a.type,a.stateNode):Qy(_,o,a.memoizedProps)):o===null&&a.stateNode!==null&&Zx(a,a.memoizedProps,u.memoizedProps));break}case 27:if(Yn&&d&4&&a.alternate===null){_=a.stateNode;var M=a.memoizedProps;try{$T(_),tA(a.type,M,_,a)}catch(yt){ke(a,a.return,yt)}}case 5:if(fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),qn){if(a.flags&32){o=a.stateNode;try{Hy(o)}catch(yt){ke(a,a.return,yt)}}d&4&&a.stateNode!=null&&(o=a.memoizedProps,Zx(a,o,u!==null?u.memoizedProps:o)),d&1024&&(m0=!0)}break;case 6:if(fi(o,a),Ti(a),d&4&&qn){if(a.stateNode===null)throw Error(n(162));d=a.memoizedProps,u=u!==null?u.memoizedProps:d,o=a.stateNode;try{mT(o,u,d)}catch(yt){ke(a,a.return,yt)}}break;case 3:if(Wi?(JT(),_=as,as=e0(o.containerInfo),fi(o,a),as=_):fi(o,a),Ti(a),d&4){if(qn&&ki&&u!==null&&u.memoizedState.isDehydrated)try{GT(o.containerInfo)}catch(yt){ke(a,a.return,yt)}if(Ra){d=o.containerInfo,u=o.pendingChildren;try{Wy(d,u)}catch(yt){ke(a,a.return,yt)}}}m0&&(m0=!1,ey(a));break;case 4:Wi?(u=as,as=e0(a.stateNode.containerInfo),fi(o,a),Ti(a),as=u):(fi(o,a),Ti(a)),d&4&&Ra&&Jx(a.stateNode,a,a.stateNode.pendingChildren);break;case 12:fi(o,a),Ti(a);break;case 13:fi(o,a),Ti(a),a.child.flags&8192&&a.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(x0=is()),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,Cg(a,d)));break;case 22:d&512&&(cn||u===null||Ei(u,u.return)),_=a.memoizedState!==null;var P=u!==null&&u.memoizedState!==null,V=Ks,q=cn;if(Ks=V||_,cn=q||P,fi(o,a),cn=q,Ks=V,Ti(a),o=a.stateNode,o._current=a,o._visibility&=-3,o._visibility|=o._pendingVisibility&2,d&8192&&(o._visibility=_?o._visibility&-2:o._visibility|1,_&&(o=Ks||cn,u===null||P||o||No(a)),qn&&(a.memoizedProps===null||a.memoizedProps.mode!=="manual"))){t:if(u=null,qn)for(o=a;;){if(o.tag===5||Wi&&o.tag===26||Yn&&o.tag===27){if(u===null){P=u=o;try{M=P.stateNode,_?MT(M):ET(P.stateNode,P.memoizedProps)}catch(yt){ke(P,P.return,yt)}}}else if(o.tag===6){if(u===null){P=o;try{var ot=P.stateNode;_?bT(ot):TT(ot,P.memoizedProps)}catch(yt){ke(P,P.return,yt)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===a)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break t;for(;o.sibling===null;){if(o.return===null||o.return===a)break t;u===o&&(u=null),o=o.return}u===o&&(u=null),o.sibling.return=o.return,o=o.sibling}}d&4&&(d=a.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Cg(a,u))));break;case 19:fi(o,a),Ti(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,Cg(a,d)));break;case 21:break;default:fi(o,a),Ti(a)}}function Ti(a){var o=a.flags;if(o&2){try{if(qn&&(!Yn||a.tag!==27)){t:{for(var u=a.return;u!==null;){if(jx(u)){var d=u;break t}u=u.return}throw Error(n(160))}switch(d.tag){case 27:if(Yn){var _=d.stateNode,M=Eg(a);Gf(a,M,_);break}case 5:var P=d.stateNode;d.flags&32&&(Hy(P),d.flags&=-33);var V=Eg(a);Gf(a,V,P);break;case 3:case 4:var q=d.stateNode.containerInfo,ot=Eg(a);Tg(a,ot,q);break;default:throw Error(n(161))}}}catch(yt){ke(a,a.return,yt)}a.flags&=-3}o&4096&&(a.flags&=-4097)}function ey(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var o=a;ey(o),o.tag===5&&o.flags&1024&&sT(o.stateNode),a=a.sibling}}function Xs(a,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)Kx(a,o.alternate,o),o=o.sibling}function No(a){for(a=a.child;a!==null;){var o=a;switch(o.tag){case 0:case 11:case 14:case 15:Ma(4,o,o.return),No(o);break;case 1:Ei(o,o.return);var u=o.stateNode;typeof u.componentWillUnmount=="function"&&qx(o,o.return,u),No(o);break;case 26:case 27:case 5:Ei(o,o.return),No(o);break;case 22:Ei(o,o.return),o.memoizedState===null&&No(o);break;default:No(o)}a=a.sibling}}function ba(a,o,u){for(u=u&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var d=o.alternate,_=a,M=o,P=M.flags;switch(M.tag){case 0:case 11:case 15:ba(_,M,u),Bc(4,M);break;case 1:if(ba(_,M,u),d=M,_=d.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ot){ke(d,d.return,ot)}if(d=M,_=d.updateQueue,_!==null){var V=d.stateNode;try{var q=_.shared.hiddenCallbacks;if(q!==null)for(_.shared.hiddenCallbacks=null,_=0;_<q.length;_++)ge(q[_],V)}catch(ot){ke(d,d.return,ot)}}u&&P&64&&Xx(M),_r(M,M.return);break;case 26:case 27:case 5:ba(_,M,u),u&&d===null&&P&4&&Yx(M),_r(M,M.return);break;case 12:ba(_,M,u);break;case 13:ba(_,M,u),u&&P&4&&$x(_,M);break;case 22:M.memoizedState===null&&ba(_,M,u),_r(M,M.return);break;default:ba(_,M,u)}o=o.sibling}}function Rg(a,o){var u=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),a=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(a=o.memoizedState.cachePool.pool),a!==u&&(a!=null&&a.refCount++,u!=null&&Lc(u))}function wg(a,o){a=null,o.alternate!==null&&(a=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==a&&(o.refCount++,a!=null&&Lc(a))}function Ea(a,o,u,d){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)ny(a,o,u,d),o=o.sibling}function ny(a,o,u,d){var _=o.flags;switch(o.tag){case 0:case 11:case 15:Ea(a,o,u,d),_&2048&&Bc(9,o);break;case 3:Ea(a,o,u,d),_&2048&&(a=null,o.alternate!==null&&(a=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==a&&(o.refCount++,a!=null&&Lc(a)));break;case 12:if(_&2048){Ea(a,o,u,d),a=o.stateNode;try{var M=o.memoizedProps,P=M.id,V=M.onPostCommit;typeof V=="function"&&V(P,o.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(q){ke(o,o.return,q)}}else Ea(a,o,u,d);break;case 23:break;case 22:M=o.stateNode,o.memoizedState!==null?M._visibility&4?Ea(a,o,u,d):Fc(a,o):M._visibility&4?Ea(a,o,u,d):(M._visibility|=4,Do(a,o,u,d,(o.subtreeFlags&10256)!==0)),_&2048&&Rg(o.alternate,o);break;case 24:Ea(a,o,u,d),_&2048&&wg(o.alternate,o);break;default:Ea(a,o,u,d)}}function Do(a,o,u,d,_){for(_=_&&(o.subtreeFlags&10256)!==0,o=o.child;o!==null;){var M=a,P=o,V=u,q=d,ot=P.flags;switch(P.tag){case 0:case 11:case 15:Do(M,P,V,q,_),Bc(8,P);break;case 23:break;case 22:var yt=P.stateNode;P.memoizedState!==null?yt._visibility&4?Do(M,P,V,q,_):Fc(M,P):(yt._visibility|=4,Do(M,P,V,q,_)),_&&ot&2048&&Rg(P.alternate,P);break;case 24:Do(M,P,V,q,_),_&&ot&2048&&wg(P.alternate,P);break;default:Do(M,P,V,q,_)}o=o.sibling}}function Fc(a,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var u=a,d=o,_=d.flags;switch(d.tag){case 22:Fc(u,d),_&2048&&Rg(d.alternate,d);break;case 24:Fc(u,d),_&2048&&wg(d.alternate,d);break;default:Fc(u,d)}o=o.sibling}}function vr(a){if(a.subtreeFlags&Ko)for(a=a.child;a!==null;)iy(a),a=a.sibling}function iy(a){switch(a.tag){case 26:vr(a),a.flags&Ko&&(a.memoizedState!==null?QT(as,a.memoizedState,a.memoizedProps):Vy(a.type,a.memoizedProps));break;case 5:vr(a),a.flags&Ko&&Vy(a.type,a.memoizedProps);break;case 3:case 4:if(Wi){var o=as;as=e0(a.stateNode.containerInfo),vr(a),as=o}else vr(a);break;case 22:a.memoizedState===null&&(o=a.alternate,o!==null&&o.memoizedState!==null?(o=Ko,Ko=16777216,vr(a),Ko=o):vr(a));break;default:vr(a)}}function sy(a){var o=a.alternate;if(o!==null&&(a=o.child,a!==null)){o.child=null;do o=a.sibling,a.sibling=null,a=o;while(a!==null)}}function zc(a){var o=a.deletions;if((a.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var d=o[u];Rn=d,ry(d,a)}sy(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)ay(a),a=a.sibling}function ay(a){switch(a.tag){case 0:case 11:case 15:zc(a),a.flags&2048&&Ma(9,a,a.return);break;case 3:zc(a);break;case 12:zc(a);break;case 22:var o=a.stateNode;a.memoizedState!==null&&o._visibility&4&&(a.return===null||a.return.tag!==13)?(o._visibility&=-5,kf(a)):zc(a);break;default:zc(a)}}function kf(a){var o=a.deletions;if((a.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var d=o[u];Rn=d,ry(d,a)}sy(a)}for(a=a.child;a!==null;){switch(o=a,o.tag){case 0:case 11:case 15:Ma(8,o,o.return),kf(o);break;case 22:u=o.stateNode,u._visibility&4&&(u._visibility&=-5,kf(o));break;default:kf(o)}a=a.sibling}}function ry(a,o){for(;Rn!==null;){var u=Rn;switch(u.tag){case 0:case 11:case 15:Ma(8,u,o);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Lc(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,Rn=d;else t:for(u=a;Rn!==null;){d=Rn;var _=d.sibling,M=d.return;if(Qx(d),d===u){Rn=null;break t}if(_!==null){_.return=M,Rn=_;break t}Rn=M}}}function Ng(a){var o=Fy(a);if(o!=null){if(typeof o.memoizedProps["data-testname"]!="string")throw Error(n(364));return o}if(a=oT(a),a===null)throw Error(n(362));return a.stateNode.current}function Dg(a,o){var u=a.tag;switch(o.$$typeof){case ld:if(a.type===o.value)return!0;break;case cd:t:{for(o=o.value,a=[a,0],u=0;u<a.length;){var d=a[u++],_=d.tag,M=a[u++],P=o[M];if(_!==5&&_!==26&&_!==27||!Gc(d)){for(;P!=null&&Dg(d,P);)M++,P=o[M];if(M===o.length){o=!0;break t}else for(d=d.child;d!==null;)a.push(d,M),d=d.sibling}}o=!1}return o;case ud:if((u===5||u===26||u===27)&&uT(a.stateNode,o.value))return!0;break;case fd:if((u===5||u===6||u===26||u===27)&&(a=cT(a),a!==null&&0<=a.indexOf(o.value)))return!0;break;case hd:if((u===5||u===26||u===27)&&(a=a.memoizedProps["data-testname"],typeof a=="string"&&a.toLowerCase()===o.value.toLowerCase()))return!0;break;default:throw Error(n(365))}return!1}function Ug(a){switch(a.$$typeof){case ld:return"<"+(r(a.value)||"Unknown")+">";case cd:return":has("+(Ug(a)||"")+")";case ud:return'[role="'+a.value+'"]';case fd:return'"'+a.value+'"';case hd:return'[data-testname="'+a.value+'"]';default:throw Error(n(365))}}function oy(a,o){var u=[];a=[a,0];for(var d=0;d<a.length;){var _=a[d++],M=_.tag,P=a[d++],V=o[P];if(M!==5&&M!==26&&M!==27||!Gc(_)){for(;V!=null&&Dg(_,V);)P++,V=o[P];if(P===o.length)u.push(_);else for(_=_.child;_!==null;)a.push(_,P),_=_.sibling}}return u}function Pg(a,o){if(!Hc)throw Error(n(363));a=Ng(a),a=oy(a,o),o=[],a=Array.from(a);for(var u=0;u<a.length;){var d=a[u++],_=d.tag;if(_===5||_===26||_===27)Gc(d)||o.push(d.stateNode);else for(d=d.child;d!==null;)a.push(d),d=d.sibling}return o}function Ai(){if((Xe&2)!==0&&we!==0)return we&-we;if(fe.T!==null){var a=Wo;return a!==0?a:it()}return QE()}function ly(){ji===0&&(ji=(we&536870912)===0||Pe?L():536870912);var a=Zi.current;return a!==null&&(a.flags|=32),ji}function si(a,o,u){(a===Ze&&je===2||a.cancelPendingCommit!==null)&&(Uo(a,0),qs(a,we,ji,!1)),w(a,u),((Xe&2)===0||a!==Ze)&&(a===Ze&&((Xe&2)===0&&(Nr|=u),un===4&&qs(a,we,ji,!1)),Zt(a))}function cy(a,o,u){if((Xe&6)!==0)throw Error(n(327));var d=!u&&(o&60)===0&&(o&a.expiredLanes)===0||N(a,o),_=d?RE(a,o):Bg(a,o,!0),M=d;do{if(_===0){Qo&&!d&&qs(a,o,0,!1);break}else if(_===6)qs(a,o,0,!Qs);else{if(u=a.current.alternate,M&&!AE(u)){_=Bg(a,o,!1),M=!1;continue}if(_===2){if(M=o,a.errorRecoveryDisabledLanes&M)var P=0;else P=a.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){o=P;t:{var V=a;_=Jc;var q=ki&&V.current.memoizedState.isDehydrated;if(q&&(Uo(V,P).flags|=256),P=Bg(V,P,!1),P!==2){if(g0&&!q){V.errorRecoveryDisabledLanes|=M,Nr|=M,_=4;break t}M=Rs,Rs=_,M!==null&&Ig(M)}_=P}if(M=!1,_!==2)continue}}if(_===1){Uo(a,0),qs(a,o,0,!0);break}t:{switch(d=a,_){case 0:case 1:throw Error(n(345));case 4:if((o&4194176)===o){qs(d,o,ji,!Qs);break t}break;case 2:Rs=null;break;case 3:case 5:break;default:throw Error(n(329))}if(d.finishedWork=u,d.finishedLanes=o,(o&62914560)===o&&(M=x0+300-is(),10<M)){if(qs(d,o,ji,!Qs),A(d,0)!==0)break t;d.timeoutHandle=jE(uy.bind(null,d,u,Rs,dd,v0,o,ji,Nr,$o,Qs,2,-0,0),M);break t}uy(d,u,Rs,dd,v0,o,ji,Nr,$o,Qs,0,-0,0)}}break}while(!0);Zt(a)}function Ig(a){Rs===null?Rs=a:Rs.push.apply(Rs,a)}function uy(a,o,u,d,_,M,P,V,q,ot,yt,Bt,zt){var _e=o.subtreeFlags;if((_e&8192||(_e&16785408)===16785408)&&(nT(),iy(o),o=iT(),o!==null)){a.cancelPendingCommit=o(xy.bind(null,a,u,d,_,P,V,q,1,Bt,zt)),qs(a,M,P,!ot);return}xy(a,u,d,_,P,V,q,yt,Bt,zt)}function AE(a){for(var o=a;;){var u=o.tag;if((u===0||u===11||u===15)&&o.flags&16384&&(u=o.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var _=u[d],M=_.getSnapshot;_=_.value;try{if(!Ni(M(),_))return!1}catch{return!1}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function qs(a,o,u,d){o&=~_0,o&=~Nr,a.suspendedLanes|=o,a.pingedLanes&=~o,d&&(a.warmLanes|=o),d=a.expirationTimes;for(var _=o;0<_;){var M=31-Ri(_),P=1<<M;d[M]=-1,_&=~P}u!==0&&Y(a,u,o)}function hy(){return(Xe&6)===0?(Dt(0,!1),!1):!0}function Lg(){if(Te!==null){if(je===0)var a=Te.return;else a=Te,Js=Rr=null,Nc(a),Yo=null,Yc=0,a=Te;for(;a!==null;)Wx(a.alternate,a),a=a.return;Te=null}}function Uo(a,o){a.finishedWork=null,a.finishedLanes=0;var u=a.timeoutHandle;u!==Qg&&(a.timeoutHandle=Qg,JE(u)),u=a.cancelPendingCommit,u!==null&&(a.cancelPendingCommit=null,u()),Lg(),Ze=a,Te=u=Ta(a.current,null),we=o,je=0,Ui=null,Qs=!1,Qo=N(a,o),g0=!1,$o=ji=_0=Nr=Pa=un=0,Rs=Jc=null,v0=!1,(o&8)!==0&&(o|=o&32);var d=a.entangledLanes;if(d!==0)for(a=a.entanglements,d&=o;0<d;){var _=31-Ri(d),M=1<<_;o|=a[_],d&=~M}return $s=o,ce(),u}function fy(a,o){Me=null,fe.H=Cs,o===qc?(o=ut(),je=3):o===h0?(o=ut(),je=4):je=o===cS?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Ui=o,Te===null&&(un=1,Bf(a,rt(o,a.current)))}function dy(){var a=Zi.current;return a===null?!0:(we&4194176)===we?As===null:(we&62914560)===we||(we&536870912)!==0?a===As:!1}function py(){var a=fe.H;return fe.H=Cs,a===null?Cs:a}function my(){var a=fe.A;return fe.A=mA,a}function Og(){un=4,Qs||(we&4194176)!==we&&Zi.current!==null||(Qo=!0),(Pa&134217727)===0&&(Nr&134217727)===0||Ze===null||qs(Ze,we,ji,!1)}function Bg(a,o,u){var d=Xe;Xe|=2;var _=py(),M=my();(Ze!==a||we!==o)&&(dd=null,Uo(a,o)),o=!1;var P=un;t:do try{if(je!==0&&Te!==null){var V=Te,q=Ui;switch(je){case 8:Lg(),P=6;break t;case 3:case 2:case 6:Zi.current===null&&(o=!0);var ot=je;if(je=0,Ui=null,Po(a,V,q,ot),u&&Qo){P=0;break t}break;default:ot=je,je=0,Ui=null,Po(a,V,q,ot)}}CE(),P=un;break}catch(yt){fy(a,yt)}while(!0);return o&&a.shellSuspendCounter++,Js=Rr=null,Xe=d,fe.H=_,fe.A=M,Te===null&&(Ze=null,we=0,ce()),P}function CE(){for(;Te!==null;)gy(Te)}function RE(a,o){var u=Xe;Xe|=2;var d=py(),_=my();Ze!==a||we!==o?(dd=null,Kc=is()+500,Uo(a,o)):Qo=N(a,o);t:do try{if(je!==0&&Te!==null){o=Te;var M=Ui;e:switch(je){case 1:je=0,Ui=null,Po(a,o,M,1);break;case 2:if(xt(M)){je=0,Ui=null,_y(o);break}o=function(){je===2&&Ze===a&&(je=7),Zt(a)},M.then(o,o);break t;case 3:je=7;break t;case 4:je=5;break t;case 7:xt(M)?(je=0,Ui=null,_y(o)):(je=0,Ui=null,Po(a,o,M,7));break;case 5:var P=null;switch(Te.tag){case 26:P=Te.memoizedState;case 5:case 27:var V=Te,q=V.type,ot=V.pendingProps;if(P?nS(P):zy(q,ot)){je=0,Ui=null;var yt=V.sibling;if(yt!==null)Te=yt;else{var Bt=V.return;Bt!==null?(Te=Bt,Wf(Bt)):Te=null}break e}}je=0,Ui=null,Po(a,o,M,5);break;case 6:je=0,Ui=null,Po(a,o,M,6);break;case 8:Lg(),un=6;break t;default:throw Error(n(462))}}wE();break}catch(zt){fy(a,zt)}while(!0);return Js=Rr=null,fe.H=d,fe.A=_,Xe=u,Te!==null?0:(Ze=null,we=0,ce(),un)}function wE(){for(;Te!==null&&!sA();)gy(Te)}function gy(a){var o=Bx(a.alternate,a,$s);a.memoizedProps=a.pendingProps,o===null?Wf(a):Te=o}function _y(a){var o=a,u=o.alternate;switch(o.tag){case 15:case 0:o=Dx(u,o,o.pendingProps,o.type,void 0,we);break;case 11:o=Dx(u,o,o.pendingProps,o.type.render,o.ref,we);break;case 5:Nc(o);default:Wx(u,o),o=Te=by(o,$s),o=Bx(u,o,$s)}a.memoizedProps=a.pendingProps,o===null?Wf(a):Te=o}function Po(a,o,u,d){Js=Rr=null,Nc(o),Yo=null,Yc=0;var _=o.return;try{if(yE(a,_,o,u,we)){un=1,Bf(a,rt(u,a.current)),Te=null;return}}catch(M){if(_!==null)throw Te=_,M;un=1,Bf(a,rt(u,a.current)),Te=null;return}o.flags&32768?(Pe||d===1?a=!0:Qo||(we&536870912)!==0?a=!1:(Qs=a=!0,(d===2||d===3||d===6)&&(d=Zi.current,d!==null&&d.tag===13&&(d.flags|=16384))),vy(o,a)):Wf(o)}function Wf(a){var o=a;do{if((o.flags&32768)!==0){vy(o,Qs);return}a=o.return;var u=ME(o.alternate,o,$s);if(u!==null){Te=u;return}if(o=o.sibling,o!==null){Te=o;return}Te=o=a}while(o!==null);un===0&&(un=5)}function vy(a,o){do{var u=bE(a.alternate,a);if(u!==null){u.flags&=32767,Te=u;return}if(u=a.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!o&&(a=a.sibling,a!==null)){Te=a;return}Te=a=u}while(a!==null);un=6,Te=null}function xy(a,o,u,d,_,M,P,V,q,ot){var yt=fe.T,Bt=Sr();try{di(2),fe.T=null,NE(a,o,u,d,Bt,_,M,P,V,q,ot)}finally{fe.T=yt,di(Bt)}}function NE(a,o,u,d,_,M,P,V){do xr();while(Dr!==null);if((Xe&6)!==0)throw Error(n(327));var q=a.finishedWork;if(d=a.finishedLanes,q===null)return null;if(a.finishedWork=null,a.finishedLanes=0,q===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0,a.cancelPendingCommit=null;var ot=q.lanes|q.childLanes;if(ot|=r0,z(a,d,ot,M,P,V),a===Ze&&(Te=Ze=null,we=0),(q.subtreeFlags&10256)===0&&(q.flags&10256)===0||pd||(pd=!0,y0=ot,S0=u,IE(s0,function(){return xr(!0),null})),u=(q.flags&15990)!==0,(q.subtreeFlags&15990)!==0||u?(u=fe.T,fe.T=null,M=Sr(),di(2),P=Xe,Xe|=4,EE(a,q),ty(q,a),YE(a.containerInfo),a.current=q,Kx(a,q.alternate,q),aA(),Xe=P,di(M),fe.T=u):a.current=q,pd?(pd=!1,Dr=a,Qc=d):yy(a,ot),ot=a.pendingLanes,ot===0&&(Ia=null),nt(q.stateNode,_),Zt(a),o!==null)for(_=a.onRecoverableError,q=0;q<o.length;q++)ot=o[q],_(ot.value,{componentStack:ot.stack});return(Qc&3)!==0&&xr(),ot=a.pendingLanes,(d&4194218)!==0&&(ot&42)!==0?a===M0?$c++:($c=0,M0=a):$c=0,Dt(0,!1),null}function yy(a,o){(a.pooledCacheLanes&=o)===0&&(o=a.pooledCache,o!=null&&(a.pooledCache=null,Lc(o)))}function xr(){if(Dr!==null){var a=Dr,o=y0;y0=0;var u=j(Qc),d=32>u?32:u;u=fe.T;var _=Sr();try{if(di(d),fe.T=null,Dr===null)var M=!1;else{d=S0,S0=null;var P=Dr,V=Qc;if(Dr=null,Qc=0,(Xe&6)!==0)throw Error(n(331));var q=Xe;if(Xe|=4,ay(P.current),ny(P,P.current,V,d),Xe=q,Dt(0,!1),wi&&typeof wi.onPostCommitFiberRoot=="function")try{wi.onPostCommitFiberRoot(kc,P)}catch{}M=!0}return M}finally{di(_),fe.T=u,yy(a,o)}}return!1}function Sy(a,o,u){o=rt(u,o),o=lg(a.stateNode,o,2),a=pt(a,o,2),a!==null&&(w(a,2),Zt(a))}function ke(a,o,u){if(a.tag===3)Sy(a,a,u);else for(;o!==null;){if(o.tag===3){Sy(o,a,u);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ia===null||!Ia.has(d))){a=rt(u,a),u=Ex(2),d=pt(o,u,2),d!==null&&(Tx(u,d,o,a),w(d,2),Zt(d));break}}o=o.return}}function Fg(a,o,u){var d=a.pingCache;if(d===null){d=a.pingCache=new gA;var _=new Set;d.set(o,_)}else _=d.get(o),_===void 0&&(_=new Set,d.set(o,_));_.has(u)||(g0=!0,_.add(u),a=DE.bind(null,a,o,u),o.then(a,a))}function DE(a,o,u){var d=a.pingCache;d!==null&&d.delete(o),a.pingedLanes|=a.suspendedLanes&u,a.warmLanes&=~u,Ze===a&&(we&u)===u&&(un===4||un===3&&(we&62914560)===we&&300>is()-x0?(Xe&2)===0&&Uo(a,0):_0|=u,$o===we&&($o=0)),Zt(a)}function My(a,o){o===0&&(o=F()),a=lt(a,o),a!==null&&(w(a,o),Zt(a))}function UE(a){var o=a.memoizedState,u=0;o!==null&&(u=o.retryLane),My(a,u)}function PE(a,o){var u=0;switch(a.tag){case 13:var d=a.stateNode,_=a.memoizedState;_!==null&&(u=_.retryLane);break;case 19:d=a.stateNode;break;case 22:d=a.stateNode._retryCache;break;default:throw Error(n(314))}d!==null&&d.delete(o),My(a,u)}function IE(a,o){return Kf(a,o)}function LE(a,o,u,d){this.tag=a,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,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 zg(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Ta(a,o){var u=a.alternate;return u===null?(u=t(a.tag,o,a.key,a.mode),u.elementType=a.elementType,u.type=a.type,u.stateNode=a.stateNode,u.alternate=a,a.alternate=u):(u.pendingProps=o,u.type=a.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=a.flags&31457280,u.childLanes=a.childLanes,u.lanes=a.lanes,u.child=a.child,u.memoizedProps=a.memoizedProps,u.memoizedState=a.memoizedState,u.updateQueue=a.updateQueue,o=a.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=a.sibling,u.index=a.index,u.ref=a.ref,u.refCleanup=a.refCleanup,u}function by(a,o){a.flags&=31457282;var u=a.alternate;return u===null?(a.childLanes=0,a.lanes=o,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=u.childLanes,a.lanes=u.lanes,a.child=u.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=u.memoizedProps,a.memoizedState=u.memoizedState,a.updateQueue=u.updateQueue,a.type=u.type,o=u.dependencies,a.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),a}function Xf(a,o,u,d,_,M){var P=0;if(d=a,typeof a=="function")zg(a)&&(P=1);else if(typeof a=="string")P=Wi&&Yn?Jy(a,u,Fn.current)?26:sS(a)?27:5:Wi?Jy(a,u,Fn.current)?26:5:Yn&&sS(a)?27:5;else t:switch(a){case Lo:return yr(u.children,_,M,o);case Ny:P=8,_|=24;break;case Wg:return a=t(12,u,o,_|2),a.elementType=Wg,a.lanes=M,a;case qg:return a=t(13,u,o,_),a.elementType=qg,a.lanes=M,a;case Yg:return a=t(19,u,o,_),a.elementType=Yg,a.lanes=M,a;case Uy:return Ey(u,_,M,o);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case zE:case Aa:P=10;break t;case Dy:P=9;break t;case Xg:P=11;break t;case Zg:P=14;break t;case Ca:P=16,d=null;break t}P=29,u=Error(n(130,a===null?"null":typeof a,"")),d=null}return o=t(P,u,o,_),o.elementType=a,o.type=d,o.lanes=M,o}function yr(a,o,u,d){return a=t(7,a,d,o),a.lanes=u,a}function Ey(a,o,u,d){a=t(22,a,d,o),a.elementType=Uy,a.lanes=u;var _={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var M=_._current;if(M===null)throw Error(n(456));if((_._pendingVisibility&2)===0){var P=lt(M,2);P!==null&&(_._pendingVisibility|=2,si(P,M,2))}},attach:function(){var M=_._current;if(M===null)throw Error(n(456));if((_._pendingVisibility&2)!==0){var P=lt(M,2);P!==null&&(_._pendingVisibility&=-3,si(P,M,2))}}};return a.stateNode=_,a}function Vg(a,o,u){return a=t(6,a,null,o),a.lanes=u,a}function Hg(a,o,u){return o=t(4,a.children!==null?a.children:[],a.key,o),o.lanes=u,o.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},o}function OE(a,o,u,d,_,M,P,V){this.tag=1,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Qg,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=C(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=C(0),this.hiddenUpdates=C(null),this.identifierPrefix=d,this.onUncaughtError=_,this.onCaughtError=M,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Ty(a,o,u,d,_,M,P,V,q,ot,yt,Bt){return a=new OE(a,o,u,P,V,q,ot,Bt),o=1,M===!0&&(o|=24),M=t(3,null,null,o),a.current=M,M.stateNode=a,o=xg(),o.refCount++,a.pooledCache=o,o.refCount++,M.memoizedState={element:d,isDehydrated:u,cache:o},Et(M),a}function Ay(a){return a?(a=Fo,a):Fo}function Cy(a){var o=a._reactInternals;if(o===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=g(o),a=a!==null?v(a):null,a===null?null:Vc(a.stateNode)}function Ry(a,o,u,d,_,M){_=Ay(_),d.context===null?d.context=_:d.pendingContext=_,d=Kt(o),d.payload={element:u},M=M===void 0?null:M,M!==null&&(d.callback=M),u=pt(a,d,o),u!==null&&(si(u,a,o),Ct(u,a,o))}function wy(a,o){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var u=a.retryLane;a.retryLane=u!==0&&u<o?u:o}}function Gg(a,o){wy(a,o),(a=a.alternate)&&wy(a,o)}var Ee={},BE=or(),Ci=km(),kg=Object.assign,FE=Symbol.for("react.element"),qf=Symbol.for("react.transitional.element"),Io=Symbol.for("react.portal"),Lo=Symbol.for("react.fragment"),Ny=Symbol.for("react.strict_mode"),Wg=Symbol.for("react.profiler"),zE=Symbol.for("react.provider"),Dy=Symbol.for("react.consumer"),Aa=Symbol.for("react.context"),Xg=Symbol.for("react.forward_ref"),qg=Symbol.for("react.suspense"),Yg=Symbol.for("react.suspense_list"),Zg=Symbol.for("react.memo"),Ca=Symbol.for("react.lazy"),Uy=Symbol.for("react.offscreen"),VE=Symbol.for("react.memo_cache_sentinel"),Py=Symbol.iterator,HE=Symbol.for("react.client.reference"),fe=BE.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,jg,Iy,Jg=!1,Yf=Array.isArray,GE=i.rendererVersion,kE=i.rendererPackageName,Ly=i.extraDevToolsConfig,Vc=i.getPublicInstance,WE=i.getRootHostContext,XE=i.getChildHostContext,qE=i.prepareForCommit,YE=i.resetAfterCommit,ZE=i.createInstance,Kg=i.appendInitialChild,Oy=i.finalizeInitialChildren,Zf=i.shouldSetTextContent,By=i.createTextInstance,jE=i.scheduleTimeout,JE=i.cancelTimeout,Qg=i.noTimeout,Ys=i.isPrimaryRenderer;i.warnsIfNotActing;var qn=i.supportsMutation,Ra=i.supportsPersistence,ki=i.supportsHydration,Fy=i.getInstanceFromNode;i.beforeActiveInstanceBlur,i.afterActiveInstanceBlur;var KE=i.preparePortalMount;i.prepareScopeUpdate,i.getInstanceFromScope;var di=i.setCurrentUpdatePriority,Sr=i.getCurrentUpdatePriority,QE=i.resolveUpdatePriority;i.resolveEventType,i.resolveEventTimeStamp;var $E=i.shouldAttemptEagerTransition,tT=i.detachDeletedInstance;i.requestPostPaintCallback;var eT=i.maySuspendCommit,zy=i.preloadInstance,nT=i.startSuspendingCommit,Vy=i.suspendInstance,iT=i.waitForCommitToBeReady,Oo=i.NotPendingTransition,Mr=i.HostTransitionContext,sT=i.resetFormInstance;i.bindToConsole;var aT=i.supportsMicrotasks,rT=i.scheduleMicrotask,Hc=i.supportsTestSelectors,oT=i.findFiberRoot,lT=i.getBoundingRect,cT=i.getTextContent,Gc=i.isHiddenSubtree,uT=i.matchAccessibilityRole,hT=i.setFocusIfFocusable,fT=i.setupIntersectionObserver,dT=i.appendChild,pT=i.appendChildToContainer,mT=i.commitTextUpdate,gT=i.commitMount,_T=i.commitUpdate,vT=i.insertBefore,xT=i.insertInContainerBefore,yT=i.removeChild,ST=i.removeChildFromContainer,Hy=i.resetTextContent,MT=i.hideInstance,bT=i.hideTextInstance,ET=i.unhideInstance,TT=i.unhideTextInstance,AT=i.clearContainer,CT=i.cloneInstance,Gy=i.createContainerChildSet,ky=i.appendChildToContainerChildSet,RT=i.finalizeContainerChildren,Wy=i.replaceContainerChildren,Xy=i.cloneHiddenInstance,qy=i.cloneHiddenTextInstance,$g=i.isSuspenseInstancePending,t0=i.isSuspenseInstanceFallback,wT=i.getSuspenseInstanceFallbackErrorDetails,NT=i.registerSuspenseInstanceRetry,DT=i.canHydrateFormStateMarker,UT=i.isFormStateMarkerMatching,Yy=i.getNextHydratableSibling,Zy=i.getFirstHydratableChild,PT=i.getFirstHydratableChildWithinContainer,IT=i.getFirstHydratableChildWithinSuspenseInstance,LT=i.canHydrateInstance,OT=i.canHydrateTextInstance,BT=i.canHydrateSuspenseInstance,FT=i.hydrateInstance,zT=i.hydrateTextInstance,VT=i.hydrateSuspenseInstance,HT=i.getNextHydratableInstanceAfterSuspenseInstance,GT=i.commitHydratedContainer,kT=i.commitHydratedSuspenseInstance,WT=i.clearSuspenseBoundary,XT=i.clearSuspenseBoundaryFromContainer,jy=i.shouldDeleteUnhydratedTailInstances;i.diffHydratedPropsForDevWarnings,i.diffHydratedTextForDevWarnings,i.describeHydratableInstanceForDevWarnings;var qT=i.validateHydratableInstance,YT=i.validateHydratableTextInstance,Wi=i.supportsResources,Jy=i.isHostHoistableType,e0=i.getHoistableRoot,Ky=i.getResource,Qy=i.acquireResource,$y=i.releaseResource,ZT=i.hydrateHoistable,tS=i.mountHoistable,eS=i.unmountHoistable,jT=i.createHoistableInstance,JT=i.prepareToCommitHoistables,KT=i.mayResourceSuspendCommit,nS=i.preloadResource,QT=i.suspendResource,Yn=i.supportsSingletons,iS=i.resolveSingletonInstance,$T=i.clearSingleton,tA=i.acquireSingletonInstance,eA=i.releaseSingletonInstance,sS=i.isHostSingletonType,n0=[],Bo=-1,Fo={},Ri=Math.clz32?Math.clz32:E,nA=Math.log,iA=Math.LN2,jf=128,Jf=4194304,Kf=Ci.unstable_scheduleCallback,i0=Ci.unstable_cancelCallback,sA=Ci.unstable_shouldYield,aA=Ci.unstable_requestPaint,is=Ci.unstable_now,aS=Ci.unstable_ImmediatePriority,rA=Ci.unstable_UserBlockingPriority,s0=Ci.unstable_NormalPriority,oA=Ci.unstable_IdlePriority,lA=Ci.log,cA=Ci.unstable_setDisableYieldValue,kc=null,wi=null,Ni=typeof Object.is=="function"?Object.is:et,rS=new WeakMap,zo=[],Vo=0,Qf=null,$f=0,Xi=[],qi=0,br=null,Zs=1,js="",Fn=b(null),Wc=b(null),wa=b(null),td=b(null),ai=null,Zn=null,Pe=!1,ss=null,Ts=!1,a0=Error(n(519)),Yi=[],Ho=0,r0=0,ed=null,Go=null,o0=!1,nd=!1,l0=!1,ko=0,Xc=null,c0=0,Wo=0,Xo=null,Na=!1,u0=!1,uA=Object.prototype.hasOwnProperty,qc=Error(n(460)),h0=Error(n(474)),id={then:function(){}},qo=null,Yo=null,Yc=0,Er=Mi(!0),oS=Mi(!1),Zo=b(null),sd=b(0),Zi=b(null),As=null,Mn=b(0),Da=0,Me=null,We=null,_n=null,ad=!1,jo=!1,Tr=!1,rd=0,Zc=0,Jo=null,hA=0,f0=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},Cs={readContext:Xn,use:wo,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useLayoutEffect:Ke,useInsertionEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useSyncExternalStore:Ke,useId:Ke};Cs.useCacheRefresh=Ke,Cs.useMemoCache=Ke,Cs.useHostTransitionStatus=Ke,Cs.useFormState=Ke,Cs.useActionState=Ke,Cs.useOptimistic=Ke;var Ar={readContext:Xn,use:wo,useCallback:function(a,o){return kn().memoizedState=[a,o===void 0?null:o],a},useContext:Xn,useEffect:On,useImperativeHandle:function(a,o,u){u=u!=null?u.concat([a]):null,Ln(4194308,4,cx.bind(null,o,a),u)},useLayoutEffect:function(a,o){return Ln(4194308,4,a,o)},useInsertionEffect:function(a,o){Ln(4,2,a,o)},useMemo:function(a,o){var u=kn();o=o===void 0?null:o;var d=a();if(Tr){J(!0);try{a()}finally{J(!1)}}return u.memoizedState=[d,o],d},useReducer:function(a,o,u){var d=kn();if(u!==void 0){var _=u(o);if(Tr){J(!0);try{u(o)}finally{J(!1)}}}else _=o;return d.memoizedState=d.baseState=_,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:_},d.queue=a,a=a.dispatch=xE.bind(null,Me,a),[d.memoizedState,a]},useRef:function(a){var o=kn();return a={current:a},o.memoizedState=a},useState:function(a){a=ae(a);var o=a.queue,u=vx.bind(null,Me,o);return o.dispatch=u,[a.memoizedState,u]},useDebugValue:ig,useDeferredValue:function(a,o){var u=kn();return sg(u,a,o)},useTransition:function(){var a=ae(!1);return a=px.bind(null,Me,a.queue,!0,!1),kn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,o,u){var d=Me,_=kn();if(Pe){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Ze===null)throw Error(n(349));(we&60)!==0||Rt(d,o,u)}_.memoizedState=u;var M={value:u,getSnapshot:o};return _.queue=M,On(Pt.bind(null,d,M,a),[a]),d.flags|=2048,Ne(9,Ht.bind(null,d,M,u,o),{destroy:void 0},null),u},useId:function(){var a=kn(),o=Ze.identifierPrefix;if(Pe){var u=js,d=Zs;u=(d&~(1<<32-Ri(d)-1)).toString(32)+u,o=":"+o+"R"+u,u=rd++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=hA++,o=":"+o+"r"+u.toString(32)+":";return a.memoizedState=o},useCacheRefresh:function(){return kn().memoizedState=vE.bind(null,Me)}};Ar.useMemoCache=Dc,Ar.useHostTransitionStatus=ag,Ar.useFormState=Ae,Ar.useActionState=Ae,Ar.useOptimistic=function(a){var o=kn();o.memoizedState=o.baseState=a;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=u,o=rg.bind(null,Me,!0,u),u.dispatch=o,[a,o]};var Ua={readContext:Xn,use:wo,useCallback:hx,useContext:Xn,useEffect:pr,useImperativeHandle:ux,useInsertionEffect:Es,useLayoutEffect:lx,useMemo:fx,useReducer:W,useRef:In,useState:function(){return W(U)},useDebugValue:ig,useDeferredValue:function(a,o){var u=on();return dx(u,We.memoizedState,a,o)},useTransition:function(){var a=W(U)[0],o=on().memoizedState;return[typeof a=="boolean"?a:dr(a),o]},useSyncExternalStore:Z,useId:gx};Ua.useCacheRefresh=_x,Ua.useMemoCache=Dc,Ua.useHostTransitionStatus=ag,Ua.useFormState=Wn,Ua.useActionState=Wn,Ua.useOptimistic=function(a,o){var u=on();return te(u,We,a,o)};var Cr={readContext:Xn,use:wo,useCallback:hx,useContext:Xn,useEffect:pr,useImperativeHandle:ux,useInsertionEffect:Es,useLayoutEffect:lx,useMemo:fx,useReducer:Q,useRef:In,useState:function(){return Q(U)},useDebugValue:ig,useDeferredValue:function(a,o){var u=on();return We===null?sg(u,a,o):dx(u,We.memoizedState,a,o)},useTransition:function(){var a=Q(U)[0],o=on().memoizedState;return[typeof a=="boolean"?a:dr(a),o]},useSyncExternalStore:Z,useId:gx};Cr.useCacheRefresh=_x,Cr.useMemoCache=Dc,Cr.useHostTransitionStatus=ag,Cr.useFormState=ya,Cr.useActionState=ya,Cr.useOptimistic=function(a,o){var u=on();return We!==null?te(u,We,a,o):(u.baseState=a,[a,u.queue.dispatch])};var d0={isMounted:function(a){return(a=a._reactInternals)?p(a)===a:!1},enqueueSetState:function(a,o,u){a=a._reactInternals;var d=Ai(),_=Kt(d);_.payload=o,u!=null&&(_.callback=u),o=pt(a,_,d),o!==null&&(si(o,a,d),Ct(o,a,d))},enqueueReplaceState:function(a,o,u){a=a._reactInternals;var d=Ai(),_=Kt(d);_.tag=1,_.payload=o,u!=null&&(_.callback=u),o=pt(a,_,d),o!==null&&(si(o,a,d),Ct(o,a,d))},enqueueForceUpdate:function(a,o){a=a._reactInternals;var u=Ai(),d=Kt(u);d.tag=2,o!=null&&(d.callback=o),o=pt(a,d,u),o!==null&&(si(o,a,u),Ct(o,a,u))}},lS=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},cS=Error(n(461)),Cn=!1,p0={dehydrated:null,treeContext:null,retryLane:0},od=b(null),Rr=null,Js=null,fA=typeof AbortController<"u"?AbortController:function(){var a=[],o=this.signal={aborted:!1,addEventListener:function(u,d){a.push(d)}};this.abort=function(){o.aborted=!0,a.forEach(function(u){return u()})}},dA=Ci.unstable_scheduleCallback,pA=Ci.unstable_NormalPriority,ln={$$typeof:Aa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},uS=fe.S;fe.S=function(a,o){typeof o=="object"&&o!==null&&typeof o.then=="function"&&ht(a,o),uS!==null&&uS(a,o)};var wr=b(null),Ks=!1,cn=!1,m0=!1,hS=typeof WeakSet=="function"?WeakSet:Set,Rn=null,fS=!1,vn=null,Di=!1,as=null,Ko=8192,mA={getCacheForType:function(a){var o=Xn(ln),u=o.data.get(a);return u===void 0&&(u=a(),o.data.set(a,u)),u}},ld=0,cd=1,ud=2,hd=3,fd=4;if(typeof Symbol=="function"&&Symbol.for){var jc=Symbol.for;ld=jc("selector.component"),cd=jc("selector.has_pseudo_class"),ud=jc("selector.role"),hd=jc("selector.test_id"),fd=jc("selector.text")}var gA=typeof WeakMap=="function"?WeakMap:Map,Xe=0,Ze=null,Te=null,we=0,je=0,Ui=null,Qs=!1,Qo=!1,g0=!1,$s=0,un=0,Pa=0,Nr=0,_0=0,ji=0,$o=0,Jc=null,Rs=null,v0=!1,x0=0,Kc=1/0,dd=null,Ia=null,pd=!1,Dr=null,Qc=0,y0=0,S0=null,$c=0,M0=null;return Ee.attemptContinuousHydration=function(a){if(a.tag===13){var o=lt(a,67108864);o!==null&&si(o,a,67108864),Gg(a,67108864)}},Ee.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var o=Ai(),u=lt(a,o);u!==null&&si(u,a,o),Gg(a,o)}},Ee.attemptSynchronousHydration=function(a){switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=T(a.pendingLanes);if(o!==0){for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var u=1<<31-Ri(o);a.entanglements[1]|=u,o&=~u}Zt(a),(Xe&6)===0&&(Kc=is()+500,Dt(0,!1))}}break;case 13:o=lt(a,2),o!==null&&si(o,a,2),hy(),Gg(a,2)}},Ee.batchedUpdates=function(a,o){return a(o)},Ee.createComponentSelector=function(a){return{$$typeof:ld,value:a}},Ee.createContainer=function(a,o,u,d,_,M,P,V,q,ot){return Ty(a,o,!1,null,u,d,M,P,V,q,ot,null)},Ee.createHasPseudoClassSelector=function(a){return{$$typeof:cd,value:a}},Ee.createHydrationContainer=function(a,o,u,d,_,M,P,V,q,ot,yt,Bt,zt){return a=Ty(u,d,!0,a,_,M,V,q,ot,yt,Bt,zt),a.context=Ay(null),u=a.current,d=Ai(),_=Kt(d),_.callback=o??null,pt(u,_,d),a.current.lanes=d,w(a,d),Zt(a),a},Ee.createPortal=function(a,o,u){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Io,key:d==null?null:""+d,children:a,containerInfo:o,implementation:u}},Ee.createRoleSelector=function(a){return{$$typeof:ud,value:a}},Ee.createTestNameSelector=function(a){return{$$typeof:hd,value:a}},Ee.createTextSelector=function(a){return{$$typeof:fd,value:a}},Ee.defaultOnCaughtError=function(a){console.error(a)},Ee.defaultOnRecoverableError=function(a){lS(a)},Ee.defaultOnUncaughtError=function(a){lS(a)},Ee.deferredUpdates=function(a){var o=fe.T,u=Sr();try{return di(32),fe.T=null,a()}finally{di(u),fe.T=o}},Ee.discreteUpdates=function(a,o,u,d,_){var M=fe.T,P=Sr();try{return di(2),fe.T=null,a(o,u,d,_)}finally{di(P),fe.T=M,Xe===0&&(Kc=is()+500)}},Ee.findAllNodes=Pg,Ee.findBoundingRects=function(a,o){if(!Hc)throw Error(n(363));o=Pg(a,o),a=[];for(var u=0;u<o.length;u++)a.push(lT(o[u]));for(o=a.length-1;0<o;o--){u=a[o];for(var d=u.x,_=d+u.width,M=u.y,P=M+u.height,V=o-1;0<=V;V--)if(o!==V){var q=a[V],ot=q.x,yt=ot+q.width,Bt=q.y,zt=Bt+q.height;if(d>=ot&&M>=Bt&&_<=yt&&P<=zt){a.splice(o,1);break}else if(d!==ot||u.width!==q.width||zt<M||Bt>P){if(!(M!==Bt||u.height!==q.height||yt<d||ot>_)){ot>d&&(q.width+=ot-d,q.x=d),yt<_&&(q.width=_-ot),a.splice(o,1);break}}else{Bt>M&&(q.height+=Bt-M,q.y=M),zt<P&&(q.height=P-Bt),a.splice(o,1);break}}}return a},Ee.findHostInstance=Cy,Ee.findHostInstanceWithNoPortals=function(a){return a=g(a),a=a!==null?y(a):null,a===null?null:Vc(a.stateNode)},Ee.findHostInstanceWithWarning=function(a){return Cy(a)},Ee.flushPassiveEffects=xr,Ee.flushSyncFromReconciler=function(a){var o=Xe;Xe|=1;var u=fe.T,d=Sr();try{if(di(2),fe.T=null,a)return a()}finally{di(d),fe.T=u,Xe=o,(Xe&6)===0&&Dt(0,!1)}},Ee.flushSyncWork=hy,Ee.focusWithin=function(a,o){if(!Hc)throw Error(n(363));for(a=Ng(a),o=oy(a,o),o=Array.from(o),a=0;a<o.length;){var u=o[a++],d=u.tag;if(!Gc(u)){if((d===5||d===26||d===27)&&hT(u.stateNode))return!0;for(u=u.child;u!==null;)o.push(u),u=u.sibling}}return!1},Ee.getFindAllNodesFailureDescription=function(a,o){if(!Hc)throw Error(n(363));var u=0,d=[];a=[Ng(a),0];for(var _=0;_<a.length;){var M=a[_++],P=M.tag,V=a[_++],q=o[V];if((P!==5&&P!==26&&P!==27||!Gc(M))&&(Dg(M,q)&&(d.push(Ug(q)),V++,V>u&&(u=V)),V<o.length))for(M=M.child;M!==null;)a.push(M,V),M=M.sibling}if(u<o.length){for(a=[];u<o.length;u++)a.push(Ug(o[u]));return`findAllNodes was able to match part of the selector:
8
+ `+u.stack}}function p(a){var o=a,u=a;if(a.alternate)for(;o.return;)o=o.return;else{a=o;do o=a,(o.flags&4098)!==0&&(u=o.return),a=o.return;while(a)}return o.tag===3?u:null}function m(a){if(p(a)!==a)throw Error(n(188))}function g(a){var o=a.alternate;if(!o){if(o=p(a),o===null)throw Error(n(188));return o!==a?null:a}for(var u=a,d=o;;){var _=u.return;if(_===null)break;var M=_.alternate;if(M===null){if(d=_.return,d!==null){u=d;continue}break}if(_.child===M.child){for(M=_.child;M;){if(M===u)return m(_),a;if(M===d)return m(_),o;M=M.sibling}throw Error(n(188))}if(u.return!==d.return)u=_,d=M;else{for(var P=!1,V=_.child;V;){if(V===u){P=!0,u=_,d=M;break}if(V===d){P=!0,d=_,u=M;break}V=V.sibling}if(!P){for(V=M.child;V;){if(V===u){P=!0,u=M,d=_;break}if(V===d){P=!0,d=M,u=_;break}V=V.sibling}if(!P)throw Error(n(189))}}if(u.alternate!==d)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?a:o}function v(a){var o=a.tag;if(o===5||o===26||o===27||o===6)return a;for(a=a.child;a!==null;){if(o=v(a),o!==null)return o;a=a.sibling}return null}function y(a){var o=a.tag;if(o===5||o===26||o===27||o===6)return a;for(a=a.child;a!==null;){if(a.tag!==4&&(o=y(a),o!==null))return o;a=a.sibling}return null}function b(a){return{current:a}}function S(a){0>Bo||(a.current=n0[Bo],n0[Bo]=null,Bo--)}function x(a,o){Bo++,n0[Bo]=a.current,a.current=o}function E(a){return a>>>=0,a===0?32:31-(iA(a)/sA|0)|0}function T(a){var o=a&42;if(o!==0)return o;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function A(a,o){var u=a.pendingLanes;if(u===0)return 0;var d=0,_=a.suspendedLanes,M=a.pingedLanes,P=a.warmLanes;a=a.finishedLanes!==0;var V=u&134217727;return V!==0?(u=V&~_,u!==0?d=T(u):(M&=V,M!==0?d=T(M):a||(P=V&~P,P!==0&&(d=T(P))))):(V=u&~_,V!==0?d=T(V):M!==0?d=T(M):a||(P=u&~P,P!==0&&(d=T(P)))),d===0?0:o!==0&&o!==d&&(o&_)===0&&(_=d&-d,P=o&-o,_>=P||_===32&&(P&4194176)!==0)?o:d}function N(a,o){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&o)===0}function D(a,o){switch(a){case 1:case 2:case 4:case 8:return o+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+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 a=jf;return jf<<=1,(jf&4194176)===0&&(jf=128),a}function F(){var a=Jf;return Jf<<=1,(Jf&62914560)===0&&(Jf=4194304),a}function C(a){for(var o=[],u=0;31>u;u++)o.push(a);return o}function w(a,o){a.pendingLanes|=o,o!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function z(a,o,u,d,_,M){var P=a.pendingLanes;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=u,a.entangledLanes&=u,a.errorRecoveryDisabledLanes&=u,a.shellSuspendCounter=0;var V=a.entanglements,q=a.expirationTimes,ot=a.hiddenUpdates;for(u=P&~u;0<u;){var yt=31-Ri(u),Bt=1<<yt;V[yt]=0,q[yt]=-1;var zt=ot[yt];if(zt!==null)for(ot[yt]=null,yt=0;yt<zt.length;yt++){var _e=zt[yt];_e!==null&&(_e.lane&=-536870913)}u&=~Bt}d!==0&&Y(a,d,0),M!==0&&_===0&&a.tag!==0&&(a.suspendedLanes|=M&~(P&~o))}function Y(a,o,u){a.pendingLanes|=o,a.suspendedLanes&=~o;var d=31-Ri(o);a.entangledLanes|=o,a.entanglements[d]=a.entanglements[d]|1073741824|u&4194218}function G(a,o){var u=a.entangledLanes|=o;for(a=a.entanglements;u;){var d=31-Ri(u),_=1<<d;_&o|a[d]&o&&(a[d]|=o),u&=~_}}function j(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function nt(a){if(wi&&typeof wi.onCommitFiberRoot=="function")try{wi.onCommitFiberRoot(kc,a,void 0,(a.current.flags&128)===128)}catch{}}function J(a){if(typeof cA=="function"&&uA(a),wi&&typeof wi.setStrictMode=="function")try{wi.setStrictMode(kc,a)}catch{}}function et(a,o){return a===o&&(a!==0||1/a===1/o)||a!==a&&o!==o}function rt(a,o){if(typeof a=="object"&&a!==null){var u=rS.get(a);return u!==void 0?u:(o={value:a,source:o,stack:f(o)},rS.set(a,o),o)}return{value:a,source:o,stack:f(o)}}function St(a,o){zo[Vo++]=$f,zo[Vo++]=Qf,Qf=a,$f=o}function bt(a,o,u){Xi[qi++]=Zs,Xi[qi++]=js,Xi[qi++]=Er,Er=a;var d=Zs;a=js;var _=32-Ri(d)-1;d&=~(1<<_),u+=1;var M=32-Ri(o)+_;if(30<M){var P=_-_%5;M=(d&(1<<P)-1).toString(32),d>>=P,_-=P,Zs=1<<32-Ri(o)+_|u<<_|d,js=M+a}else Zs=1<<M|u<<_|d,js=a}function mt(a){a.return!==null&&(St(a,1),bt(a,1,0))}function kt(a){for(;a===Qf;)Qf=zo[--Vo],zo[Vo]=null,$f=zo[--Vo],zo[Vo]=null;for(;a===Er;)Er=Xi[--qi],Xi[qi]=null,js=Xi[--qi],Xi[qi]=null,Zs=Xi[--qi],Xi[qi]=null}function $t(a,o){x(Na,o),x(Wc,a),x(Fn,null),a=XE(o),S(Fn),x(Fn,a)}function re(){S(Fn),S(Wc),S(Na)}function Ce(a){a.memoizedState!==null&&x(td,a);var o=Fn.current,u=qE(o,a.type);o!==u&&(x(Wc,a),x(Fn,u))}function at(a){Wc.current===a&&(S(Fn),S(Wc)),td.current===a&&(S(td),Ys?br._currentValue=Oo:br._currentValue2=Oo)}function dt(a){var o=Error(n(418,""));throw Re(rt(o,a)),a0}function Vt(a,o){if(!ki)throw Error(n(175));zT(a.stateNode,a.type,a.memoizedProps,o,a)||dt(a)}function ie(a){for(ai=a.return;ai;)switch(ai.tag){case 3:case 27:Ts=!0;return;case 5:case 13:Ts=!1;return;default:ai=ai.return}}function Ft(a){if(!ki||a!==ai)return!1;if(!Pe)return ie(a),Pe=!0,!1;var o=!1;if(Yn?a.tag!==3&&a.tag!==27&&(a.tag!==5||jy(a.type)&&!Zf(a.type,a.memoizedProps))&&(o=!0):a.tag!==3&&(a.tag!==5||jy(a.type)&&!Zf(a.type,a.memoizedProps))&&(o=!0),o&&Zn&&dt(a),ie(a),a.tag===13){if(!ki)throw Error(n(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));Zn=GT(a)}else Zn=ai?Yy(a.stateNode):null;return!0}function ye(){ki&&(Zn=ai=null,Pe=!1)}function Re(a){ss===null?ss=[a]:ss.push(a)}function ce(){for(var a=Ho,o=r0=Ho=0;o<a;){var u=Yi[o];Yi[o++]=null;var d=Yi[o];Yi[o++]=null;var _=Yi[o];Yi[o++]=null;var M=Yi[o];if(Yi[o++]=null,d!==null&&_!==null){var P=d.pending;P===null?_.next=_:(_.next=P.next,P.next=_),d.pending=_}M!==0&&Nt(u,_,M)}}function ct(a,o,u,d){Yi[Ho++]=a,Yi[Ho++]=o,Yi[Ho++]=u,Yi[Ho++]=d,r0|=d,a.lanes|=d,a=a.alternate,a!==null&&(a.lanes|=d)}function gt(a,o,u,d){return ct(a,o,u,d),B(a)}function lt(a,o){return ct(a,null,null,o),B(a)}function Nt(a,o,u){a.lanes|=u;var d=a.alternate;d!==null&&(d.lanes|=u);for(var _=!1,M=a.return;M!==null;)M.childLanes|=u,d=M.alternate,d!==null&&(d.childLanes|=u),M.tag===22&&(a=M.stateNode,a===null||a._visibility&1||(_=!0)),a=M,M=M.return;_&&o!==null&&a.tag===3&&(M=a.stateNode,_=31-Ri(u),M=M.hiddenUpdates,a=M[_],a===null?M[_]=[o]:a.push(o),o.lane=u|536870912)}function B(a){if(50<$c)throw $c=0,M0=null,Error(n(185));for(var o=a.return;o!==null;)a=o,o=a.return;return a.tag===3?a.stateNode:null}function Zt(a){a!==Go&&a.next===null&&(Go===null?ed=Go=a:Go=Go.next=a),nd=!0,o0||(o0=!0,k(se))}function Dt(a,o){if(!l0&&nd){l0=!0;do for(var u=!1,d=ed;d!==null;){if(!o)if(a!==0){var _=d.pendingLanes;if(_===0)var M=0;else{var P=d.suspendedLanes,V=d.pingedLanes;M=(1<<31-Ri(42|a)+1)-1,M&=_&~(P&~V),M=M&201326677?M&201326677|1:M?M|2:0}M!==0&&(u=!0,R(d,M))}else M=we,M=A(d,d===Ze?M:0),(M&3)===0||N(d,M)||(u=!0,R(d,M));d=d.next}while(u);l0=!1}}function se(){nd=o0=!1;var a=0;ko!==0&&(tT()&&(a=ko),ko=0);for(var o=is(),u=null,d=ed;d!==null;){var _=d.next,M=Mt(d,o);M===0?(d.next=null,u===null?ed=_:u.next=_,_===null&&(Go=u)):(u=d,(a!==0||(M&3)!==0)&&(nd=!0)),d=_}Dt(a,!1)}function Mt(a,o){for(var u=a.suspendedLanes,d=a.pingedLanes,_=a.expirationTimes,M=a.pendingLanes&-62914561;0<M;){var P=31-Ri(M),V=1<<P,q=_[P];q===-1?((V&u)===0||(V&d)!==0)&&(_[P]=D(V,o)):q<=o&&(a.expiredLanes|=V),M&=~V}if(o=Ze,u=we,u=A(a,a===o?u:0),d=a.callbackNode,u===0||a===o&&je===2||a.cancelPendingCommit!==null)return d!==null&&d!==null&&i0(d),a.callbackNode=null,a.callbackPriority=0;if((u&3)===0||N(a,u)){if(o=u&-u,o===a.callbackPriority)return o;switch(d!==null&&i0(d),j(u)){case 2:case 8:u=oA;break;case 32:u=s0;break;case 268435456:u=lA;break;default:u=s0}return d=I.bind(null,a),u=Kf(u,d),a.callbackPriority=o,a.callbackNode=u,o}return d!==null&&d!==null&&i0(d),a.callbackPriority=2,a.callbackNode=null,2}function I(a,o){var u=a.callbackNode;if(yr()&&a.callbackNode!==u)return null;var d=we;return d=A(a,a===Ze?d:0),d===0?null:(cy(a,d,o),Mt(a,is()),a.callbackNode!=null&&a.callbackNode===u?I.bind(null,a):null)}function R(a,o){if(yr())return null;cy(a,o,!0)}function k(a){rT?oT(function(){(Xe&6)!==0?Kf(aS,a):a()}):Kf(aS,a)}function it(){return ko===0&&(ko=L()),ko}function ht(a,o){if(Xc===null){var u=Xc=[];c0=0,Wo=it(),Xo={status:"pending",value:void 0,then:function(d){u.push(d)}}}return c0++,o.then(st,st),o}function st(){if(--c0===0&&Xc!==null){Xo!==null&&(Xo.status="fulfilled");var a=Xc;Xc=null,Wo=0,Xo=null;for(var o=0;o<a.length;o++)(0,a[o])()}}function jt(a,o){var u=[],d={status:"pending",value:null,reason:null,then:function(_){u.push(_)}};return a.then(function(){d.status="fulfilled",d.value=o;for(var _=0;_<u.length;_++)(0,u[_])(o)},function(_){for(d.status="rejected",d.reason=_,_=0;_<u.length;_++)(0,u[_])(void 0)}),d}function Et(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wt(a,o){a=a.updateQueue,o.updateQueue===a&&(o.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Kt(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function pt(a,o,u){var d=a.updateQueue;if(d===null)return null;if(d=d.shared,(Xe&2)!==0){var _=d.pending;return _===null?o.next=o:(o.next=_.next,_.next=o),d.pending=o,o=B(a),Nt(a,null,u),o}return ct(a,d,o,u),B(a)}function Ct(a,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194176)!==0)){var d=o.lanes;d&=a.pendingLanes,u|=d,o.lanes=u,G(a,u)}}function Xt(a,o){var u=a.updateQueue,d=a.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var _=null,M=null;if(u=u.firstBaseUpdate,u!==null){do{var P={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};M===null?_=M=P:M=M.next=P,u=u.next}while(u!==null);M===null?_=M=o:M=M.next=o}else _=M=o;u={baseState:d.baseState,firstBaseUpdate:_,lastBaseUpdate:M,shared:d.shared,callbacks:d.callbacks},a.updateQueue=u;return}a=u.lastBaseUpdate,a===null?u.firstBaseUpdate=o:a.next=o,u.lastBaseUpdate=o}function Yt(){if(u0){var a=Xo;if(a!==null)throw a}}function Tt(a,o,u,d){u0=!1;var _=a.updateQueue;Da=!1;var M=_.firstBaseUpdate,P=_.lastBaseUpdate,V=_.shared.pending;if(V!==null){_.shared.pending=null;var q=V,ot=q.next;q.next=null,P===null?M=ot:P.next=ot,P=q;var yt=a.alternate;yt!==null&&(yt=yt.updateQueue,V=yt.lastBaseUpdate,V!==P&&(V===null?yt.firstBaseUpdate=ot:V.next=ot,yt.lastBaseUpdate=q))}if(M!==null){var Bt=_.baseState;P=0,yt=ot=q=null,V=M;do{var zt=V.lane&-536870913,_e=zt!==V.lane;if(_e?(we&zt)===zt:(d&zt)===zt){zt!==0&&zt===Wo&&(u0=!0),yt!==null&&(yt=yt.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var Ji=a,tu=V;zt=o;var Pr=u;switch(tu.tag){case 1:if(Ji=tu.payload,typeof Ji=="function"){Bt=Ji.call(Pr,Bt,zt);break t}Bt=Ji;break t;case 3:Ji.flags=Ji.flags&-65537|128;case 0:if(Ji=tu.payload,zt=typeof Ji=="function"?Ji.call(Pr,Bt,zt):Ji,zt==null)break t;Bt=kg({},Bt,zt);break t;case 2:Da=!0}}zt=V.callback,zt!==null&&(a.flags|=64,_e&&(a.flags|=8192),_e=_.callbacks,_e===null?_.callbacks=[zt]:_e.push(zt))}else _e={lane:zt,tag:V.tag,payload:V.payload,callback:V.callback,next:null},yt===null?(ot=yt=_e,q=Bt):yt=yt.next=_e,P|=zt;if(V=V.next,V===null){if(V=_.shared.pending,V===null)break;_e=V,V=_e.next,_e.next=null,_.lastBaseUpdate=_e,_.shared.pending=null}}while(!0);yt===null&&(q=Bt),_.baseState=q,_.firstBaseUpdate=ot,_.lastBaseUpdate=yt,M===null&&(_.shared.lanes=0),Ia|=P,a.lanes=P,a.memoizedState=Bt}}function ge(a,o){if(typeof a!="function")throw Error(n(191,a));a.call(o)}function H(a,o){var u=a.callbacks;if(u!==null)for(a.callbacks=null,a=0;a<u.length;a++)ge(u[a],o)}function Ut(a,o){if(Ni(a,o))return!0;if(typeof a!="object"||a===null||typeof o!="object"||o===null)return!1;var u=Object.keys(a),d=Object.keys(o);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var _=u[d];if(!hA.call(o,_)||!Ni(a[_],o[_]))return!1}return!0}function xt(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Ot(){}function _t(a,o,u){switch(u=a[u],u===void 0?a.push(o):u!==o&&(o.then(Ot,Ot),o=u),o.status){case"fulfilled":return o.value;case"rejected":throw a=o.reason,a===qc?Error(n(483)):a;default:if(typeof o.status=="string")o.then(Ot,Ot);else{if(a=Ze,a!==null&&100<a.shellSuspendCounter)throw Error(n(482));a=o,a.status="pending",a.then(function(d){if(o.status==="pending"){var _=o;_.status="fulfilled",_.value=d}},function(d){if(o.status==="pending"){var _=o;_.status="rejected",_.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw a=o.reason,a===qc?Error(n(483)):a}throw qo=o,qc}}function ut(){if(qo===null)throw Error(n(459));var a=qo;return qo=null,a}function At(a){var o=Yc;return Yc+=1,Yo===null&&(Yo=[]),_t(Yo,a,o)}function oe(a,o){o=o.props.ref,a.ref=o!==void 0?o:null}function Be(a,o){throw o.$$typeof===zE?Error(n(525)):(a=Object.prototype.toString.call(o),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":a)))}function De(a){var o=a._init;return o(a._payload)}function Mi(a){function o(K,X){if(a){var tt=K.deletions;tt===null?(K.deletions=[X],K.flags|=16):tt.push(X)}}function u(K,X){if(!a)return null;for(;X!==null;)o(K,X),X=X.sibling;return null}function d(K){for(var X=new Map;K!==null;)K.key!==null?X.set(K.key,K):X.set(K.index,K),K=K.sibling;return X}function _(K,X){return K=Aa(K,X),K.index=0,K.sibling=null,K}function M(K,X,tt){return K.index=tt,a?(tt=K.alternate,tt!==null?(tt=tt.index,tt<X?(K.flags|=33554434,X):tt):(K.flags|=33554434,X)):(K.flags|=1048576,X)}function P(K){return a&&K.alternate===null&&(K.flags|=33554434),K}function V(K,X,tt,vt){return X===null||X.tag!==6?(X=Vg(tt,K.mode,vt),X.return=K,X):(X=_(X,tt),X.return=K,X)}function q(K,X,tt,vt){var ne=tt.type;return ne===Lo?yt(K,X,tt.props.children,vt,tt.key):X!==null&&(X.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===Ra&&De(ne)===X.type)?(X=_(X,tt.props),oe(X,tt),X.return=K,X):(X=Xf(tt.type,tt.key,tt.props,null,K.mode,vt),oe(X,tt),X.return=K,X)}function ot(K,X,tt,vt){return X===null||X.tag!==4||X.stateNode.containerInfo!==tt.containerInfo||X.stateNode.implementation!==tt.implementation?(X=Hg(tt,K.mode,vt),X.return=K,X):(X=_(X,tt.children||[]),X.return=K,X)}function yt(K,X,tt,vt,ne){return X===null||X.tag!==7?(X=Sr(tt,K.mode,vt,ne),X.return=K,X):(X=_(X,tt),X.return=K,X)}function Bt(K,X,tt){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Vg(""+X,K.mode,tt),X.return=K,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case qf:return tt=Xf(X.type,X.key,X.props,null,K.mode,tt),oe(tt,X),tt.return=K,tt;case Io:return X=Hg(X,K.mode,tt),X.return=K,X;case Ra:var vt=X._init;return X=vt(X._payload),Bt(K,X,tt)}if(Yf(X)||s(X))return X=Sr(X,K.mode,tt,null),X.return=K,X;if(typeof X.then=="function")return Bt(K,At(X),tt);if(X.$$typeof===Ca)return Bt(K,zf(K,X),tt);Be(K,X)}return null}function zt(K,X,tt,vt){var ne=X!==null?X.key:null;if(typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint")return ne!==null?null:V(K,X,""+tt,vt);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case qf:return tt.key===ne?q(K,X,tt,vt):null;case Io:return tt.key===ne?ot(K,X,tt,vt):null;case Ra:return ne=tt._init,tt=ne(tt._payload),zt(K,X,tt,vt)}if(Yf(tt)||s(tt))return ne!==null?null:yt(K,X,tt,vt,null);if(typeof tt.then=="function")return zt(K,X,At(tt),vt);if(tt.$$typeof===Ca)return zt(K,X,zf(K,tt),vt);Be(K,tt)}return null}function _e(K,X,tt,vt,ne){if(typeof vt=="string"&&vt!==""||typeof vt=="number"||typeof vt=="bigint")return K=K.get(tt)||null,V(X,K,""+vt,ne);if(typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case qf:return K=K.get(vt.key===null?tt:vt.key)||null,q(X,K,vt,ne);case Io:return K=K.get(vt.key===null?tt:vt.key)||null,ot(X,K,vt,ne);case Ra:var tn=vt._init;return vt=tn(vt._payload),_e(K,X,tt,vt,ne)}if(Yf(vt)||s(vt))return K=K.get(tt)||null,yt(X,K,vt,ne,null);if(typeof vt.then=="function")return _e(K,X,tt,At(vt),ne);if(vt.$$typeof===Ca)return _e(K,X,tt,zf(X,vt),ne);Be(X,vt)}return null}function Ji(K,X,tt,vt){for(var ne=null,tn=null,he=X,Ie=X=0,wn=null;he!==null&&Ie<tt.length;Ie++){he.index>Ie?(wn=he,he=null):wn=he.sibling;var Le=zt(K,he,tt[Ie],vt);if(Le===null){he===null&&(he=wn);break}a&&he&&Le.alternate===null&&o(K,he),X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le,he=wn}if(Ie===tt.length)return u(K,he),Pe&&St(K,Ie),ne;if(he===null){for(;Ie<tt.length;Ie++)he=Bt(K,tt[Ie],vt),he!==null&&(X=M(he,X,Ie),tn===null?ne=he:tn.sibling=he,tn=he);return Pe&&St(K,Ie),ne}for(he=d(he);Ie<tt.length;Ie++)wn=_e(he,K,Ie,tt[Ie],vt),wn!==null&&(a&&wn.alternate!==null&&he.delete(wn.key===null?Ie:wn.key),X=M(wn,X,Ie),tn===null?ne=wn:tn.sibling=wn,tn=wn);return a&&he.forEach(function(Oa){return o(K,Oa)}),Pe&&St(K,Ie),ne}function tu(K,X,tt,vt){if(tt==null)throw Error(n(151));for(var ne=null,tn=null,he=X,Ie=X=0,wn=null,Le=tt.next();he!==null&&!Le.done;Ie++,Le=tt.next()){he.index>Ie?(wn=he,he=null):wn=he.sibling;var Oa=zt(K,he,Le.value,vt);if(Oa===null){he===null&&(he=wn);break}a&&he&&Oa.alternate===null&&o(K,he),X=M(Oa,X,Ie),tn===null?ne=Oa:tn.sibling=Oa,tn=Oa,he=wn}if(Le.done)return u(K,he),Pe&&St(K,Ie),ne;if(he===null){for(;!Le.done;Ie++,Le=tt.next())Le=Bt(K,Le.value,vt),Le!==null&&(X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le);return Pe&&St(K,Ie),ne}for(he=d(he);!Le.done;Ie++,Le=tt.next())Le=_e(he,K,Ie,Le.value,vt),Le!==null&&(a&&Le.alternate!==null&&he.delete(Le.key===null?Ie:Le.key),X=M(Le,X,Ie),tn===null?ne=Le:tn.sibling=Le,tn=Le);return a&&he.forEach(function(vA){return o(K,vA)}),Pe&&St(K,Ie),ne}function Pr(K,X,tt,vt){if(typeof tt=="object"&&tt!==null&&tt.type===Lo&&tt.key===null&&(tt=tt.props.children),typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case qf:t:{for(var ne=tt.key;X!==null;){if(X.key===ne){if(ne=tt.type,ne===Lo){if(X.tag===7){u(K,X.sibling),vt=_(X,tt.props.children),vt.return=K,K=vt;break t}}else if(X.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===Ra&&De(ne)===X.type){u(K,X.sibling),vt=_(X,tt.props),oe(vt,tt),vt.return=K,K=vt;break t}u(K,X);break}else o(K,X);X=X.sibling}tt.type===Lo?(vt=Sr(tt.props.children,K.mode,vt,tt.key),vt.return=K,K=vt):(vt=Xf(tt.type,tt.key,tt.props,null,K.mode,vt),oe(vt,tt),vt.return=K,K=vt)}return P(K);case Io:t:{for(ne=tt.key;X!==null;){if(X.key===ne)if(X.tag===4&&X.stateNode.containerInfo===tt.containerInfo&&X.stateNode.implementation===tt.implementation){u(K,X.sibling),vt=_(X,tt.children||[]),vt.return=K,K=vt;break t}else{u(K,X);break}else o(K,X);X=X.sibling}vt=Hg(tt,K.mode,vt),vt.return=K,K=vt}return P(K);case Ra:return ne=tt._init,tt=ne(tt._payload),Pr(K,X,tt,vt)}if(Yf(tt))return Ji(K,X,tt,vt);if(s(tt)){if(ne=s(tt),typeof ne!="function")throw Error(n(150));return tt=ne.call(tt),tu(K,X,tt,vt)}if(typeof tt.then=="function")return Pr(K,X,At(tt),vt);if(tt.$$typeof===Ca)return Pr(K,X,zf(K,tt),vt);Be(K,tt)}return typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint"?(tt=""+tt,X!==null&&X.tag===6?(u(K,X.sibling),vt=_(X,tt),vt.return=K,K=vt):(u(K,X),vt=Vg(tt,K.mode,vt),vt.return=K,K=vt),P(K)):u(K,X)}return function(K,X,tt,vt){try{Yc=0;var ne=Pr(K,X,tt,vt);return Yo=null,ne}catch(he){if(he===qc)throw he;var tn=t(29,he,null,K.mode);return tn.lanes=vt,tn.return=K,tn}}}function zi(a,o){a=$s,x(sd,a),x(Zo,o),$s=a|o.baseLanes}function Rc(){x(sd,$s),x(Zo,Zo.current)}function bo(){$s=sd.current,S(Zo),S(sd)}function Vi(a){var o=a.alternate;x(Mn,Mn.current&1),x(Zi,a),As===null&&(o===null||Zo.current!==null||o.memoizedState!==null)&&(As=a)}function Lf(a){if(a.tag===22){if(x(Mn,Mn.current),x(Zi,a),As===null){var o=a.alternate;o!==null&&o.memoizedState!==null&&(As=a)}}else es(a)}function es(){x(Mn,Mn.current),x(Zi,Zi.current)}function Hi(a){S(Zi),As===a&&(As=null),S(Mn)}function Gi(a){for(var o=a;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||$g(u)||t0(u)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}function Ke(){throw Error(n(321))}function Eo(a,o){if(o===null)return!1;for(var u=0;u<o.length&&u<a.length;u++)if(!Ni(a[u],o[u]))return!1;return!0}function To(a,o,u,d,_,M){return Ua=M,Me=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,fe.H=a===null||a.memoizedState===null?Cr:Pa,Ar=!1,M=u(d,_),Ar=!1,jo&&(M=wc(o,u,d,_)),dr(a),M}function dr(a){fe.H=Cs;var o=We!==null&&We.next!==null;if(Ua=0,_n=We=Me=null,ad=!1,Zc=0,Jo=null,o)throw Error(n(300));a===null||Cn||(a=a.dependencies,a!==null&&Ff(a)&&(Cn=!0))}function wc(a,o,u,d){Me=a;var _=0;do{if(jo&&(Jo=null),Zc=0,jo=!1,25<=_)throw Error(n(301));if(_+=1,_n=We=null,a.updateQueue!=null){var M=a.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}fe.H=Rr,M=o(u,d)}while(jo);return M}function Ao(){var a=fe.H,o=a.useState()[0];return o=typeof o.then=="function"?pr(o):o,a=a.useState()[0],(We!==null?We.memoizedState:null)!==a&&(Me.flags|=1024),o}function Co(){var a=rd!==0;return rd=0,a}function Ro(a,o,u){o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~u}function Nc(a){if(ad){for(a=a.memoizedState;a!==null;){var o=a.queue;o!==null&&(o.pending=null),a=a.next}ad=!1}Ua=0,_n=We=Me=null,jo=!1,Zc=rd=0,Jo=null}function kn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?Me.memoizedState=_n=a:_n=_n.next=a,_n}function on(){if(We===null){var a=Me.alternate;a=a!==null?a.memoizedState:null}else a=We.next;var o=_n===null?Me.memoizedState:_n.next;if(o!==null)_n=o,We=a;else{if(a===null)throw Me.alternate===null?Error(n(467)):Error(n(310));We=a,a={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},_n===null?Me.memoizedState=_n=a:_n=_n.next=a}return _n}function pr(a){var o=Zc;return Zc+=1,Jo===null&&(Jo=[]),a=_t(Jo,a,o),o=Me,(_n===null?o.memoizedState:_n.next)===null&&(o=o.alternate,fe.H=o===null||o.memoizedState===null?Cr:Pa),a}function wo(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return pr(a);if(a.$$typeof===Ca)return Xn(a)}throw Error(n(438,String(a)))}function Dc(a){var o=null,u=Me.updateQueue;if(u!==null&&(o=u.memoCache),o==null){var d=Me.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(_){return _.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),u===null&&(u=f0(),Me.updateQueue=u),u.memoCache=o,u=o.data[o.index],u===void 0)for(u=o.data[o.index]=Array(a),d=0;d<a;d++)u[d]=HE;return o.index++,u}function U(a,o){return typeof o=="function"?o(a):o}function W(a){var o=on();return $(o,We,a)}function $(a,o,u){var d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=u;var _=a.baseQueue,M=d.pending;if(M!==null){if(_!==null){var P=_.next;_.next=M.next,M.next=P}o.baseQueue=_=M,d.pending=null}if(M=a.baseState,_===null)a.memoizedState=M;else{o=_.next;var V=P=null,q=null,ot=o,yt=!1;do{var Bt=ot.lane&-536870913;if(Bt!==ot.lane?(we&Bt)===Bt:(Ua&Bt)===Bt){var zt=ot.revertLane;if(zt===0)q!==null&&(q=q.next={lane:0,revertLane:0,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null}),Bt===Wo&&(yt=!0);else if((Ua&zt)===zt){ot=ot.next,zt===Wo&&(yt=!0);continue}else Bt={lane:0,revertLane:ot.revertLane,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null},q===null?(V=q=Bt,P=M):q=q.next=Bt,Me.lanes|=zt,Ia|=zt;Bt=ot.action,Ar&&u(M,Bt),M=ot.hasEagerState?ot.eagerState:u(M,Bt)}else zt={lane:Bt,revertLane:ot.revertLane,action:ot.action,hasEagerState:ot.hasEagerState,eagerState:ot.eagerState,next:null},q===null?(V=q=zt,P=M):q=q.next=zt,Me.lanes|=Bt,Ia|=Bt;ot=ot.next}while(ot!==null&&ot!==o);if(q===null?P=M:q.next=V,!Ni(M,a.memoizedState)&&(Cn=!0,yt&&(u=Xo,u!==null)))throw u;a.memoizedState=M,a.baseState=P,a.baseQueue=q,d.lastRenderedState=M}return _===null&&(d.lanes=0),[a.memoizedState,d.dispatch]}function Q(a){var o=on(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=a;var d=u.dispatch,_=u.pending,M=o.memoizedState;if(_!==null){u.pending=null;var P=_=_.next;do M=a(M,P.action),P=P.next;while(P!==_);Ni(M,o.memoizedState)||(Cn=!0),o.memoizedState=M,o.baseQueue===null&&(o.baseState=M),u.lastRenderedState=M}return[M,d]}function Z(a,o,u){var d=Me,_=on(),M=Pe;if(M){if(u===void 0)throw Error(n(407));u=u()}else u=o();var P=!Ni((We||_).memoizedState,u);if(P&&(_.memoizedState=u,Cn=!0),_=_.queue,mr(Pt.bind(null,d,_,a),[a]),_.getSnapshot!==o||P||_n!==null&&_n.memoizedState.tag&1){if(d.flags|=2048,Ne(9,Ht.bind(null,d,_,u,o),{destroy:void 0},null),Ze===null)throw Error(n(349));M||(Ua&60)!==0||Rt(d,o,u)}return u}function Rt(a,o,u){a.flags|=16384,a={getSnapshot:o,value:u},o=Me.updateQueue,o===null?(o=f0(),Me.updateQueue=o,o.stores=[a]):(u=o.stores,u===null?o.stores=[a]:u.push(a))}function Ht(a,o,u,d){o.value=u,o.getSnapshot=d,qt(o)&&Jt(a)}function Pt(a,o,u){return u(function(){qt(o)&&Jt(a)})}function qt(a){var o=a.getSnapshot;a=a.value;try{var u=o();return!Ni(a,u)}catch{return!0}}function Jt(a){var o=lt(a,2);o!==null&&si(o,a,2)}function ae(a){var o=kn();if(typeof a=="function"){var u=a;if(a=u(),Ar){J(!0);try{u()}finally{J(!1)}}}return o.memoizedState=o.baseState=a,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:a},o}function te(a,o,u,d){return a.baseState=u,$(a,We,typeof d=="function"?d:U)}function Se(a,o,u,d,_){if(Of(a))throw Error(n(485));if(a=o.action,a!==null){var M={payload:_,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){M.listeners.push(P)}};fe.T!==null?u(!0):M.isTransition=!1,d(M),u=o.pending,u===null?(M.next=o.pending=M,Fe(o,M)):(M.next=u.next,o.pending=u.next=M)}}function Fe(a,o){var u=o.action,d=o.payload,_=a.state;if(o.isTransition){var M=fe.T,P={};fe.T=P;try{var V=u(_,d),q=fe.S;q!==null&&q(P,V),Qe(a,o,V)}catch(ot){ze(a,o,ot)}finally{fe.T=M}}else try{M=u(_,d),Qe(a,o,M)}catch(ot){ze(a,o,ot)}}function Qe(a,o,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){$e(a,o,d)},function(d){return ze(a,o,d)}):$e(a,o,u)}function $e(a,o,u){o.status="fulfilled",o.value=u,ee(o),a.state=u,o=a.pending,o!==null&&(u=o.next,u===o?a.pending=null:(u=u.next,o.next=u,Fe(a,u)))}function ze(a,o,u){var d=a.pending;if(a.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=u,ee(o),o=o.next;while(o!==d)}a.action=null}function ee(a){a=a.listeners;for(var o=0;o<a.length;o++)(0,a[o])()}function Ue(a,o){return o}function Ae(a,o){if(Pe){var u=Ze.formState;if(u!==null){t:{var d=Me;if(Pe){if(Zn){var _=UT(Zn,Ts);if(_){Zn=Yy(_),d=PT(_);break t}}dt(d)}d=!1}d&&(o=u[0])}}u=kn(),u.memoizedState=u.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ue,lastRenderedState:o},u.queue=d,u=vx.bind(null,Me,d),d.dispatch=u,d=ae(!1);var M=rg.bind(null,Me,!1,d.queue);return d=kn(),_={state:o,dispatch:null,action:a,pending:null},d.queue=_,u=Se.bind(null,Me,_,M,u),_.dispatch=u,d.memoizedState=a,[o,u,!1]}function Wn(a){var o=on();return Gs(o,We,a)}function Gs(a,o,u){o=$(a,o,Ue)[0],a=W(U)[0],o=typeof o=="object"&&o!==null&&typeof o.then=="function"?pr(o):o;var d=on(),_=d.queue,M=_.dispatch;return u!==d.memoizedState&&(Me.flags|=2048,Ne(9,ii.bind(null,_,u),{destroy:void 0},null)),[o,M,a]}function ii(a,o){a.action=o}function Sa(a){var o=on(),u=We;if(u!==null)return Gs(o,u,a);on(),o=o.memoizedState,u=on();var d=u.queue.dispatch;return u.memoizedState=a,[o,d,!1]}function Ne(a,o,u,d){return a={tag:a,create:o,inst:u,deps:d,next:null},o=Me.updateQueue,o===null&&(o=f0(),Me.updateQueue=o),u=o.lastEffect,u===null?o.lastEffect=a.next=a:(d=u.next,u.next=a,a.next=d,o.lastEffect=a),a}function In(){return on().memoizedState}function Ln(a,o,u,d){var _=kn();Me.flags|=a,_.memoizedState=Ne(1|o,u,{destroy:void 0},d===void 0?null:d)}function gn(a,o,u,d){var _=on();d=d===void 0?null:d;var M=_.memoizedState.inst;We!==null&&d!==null&&Eo(d,We.memoizedState.deps)?_.memoizedState=Ne(o,u,M,d):(Me.flags|=a,_.memoizedState=Ne(1|o,u,M,d))}function On(a,o){Ln(8390656,8,a,o)}function mr(a,o){gn(2048,8,a,o)}function Es(a,o){return gn(4,2,a,o)}function lx(a,o){return gn(4,4,a,o)}function cx(a,o){if(typeof o=="function"){a=a();var u=o(a);return function(){typeof u=="function"?u():o(null)}}if(o!=null)return a=a(),o.current=a,function(){o.current=null}}function ux(a,o,u){u=u!=null?u.concat([a]):null,gn(4,4,cx.bind(null,o,a),u)}function ig(){}function hx(a,o){var u=on();o=o===void 0?null:o;var d=u.memoizedState;return o!==null&&Eo(o,d[1])?d[0]:(u.memoizedState=[a,o],a)}function fx(a,o){var u=on();o=o===void 0?null:o;var d=u.memoizedState;if(o!==null&&Eo(o,d[1]))return d[0];if(d=a(),Ar){J(!0);try{a()}finally{J(!1)}}return u.memoizedState=[d,o],d}function sg(a,o,u){return u===void 0||(Ua&1073741824)!==0?a.memoizedState=o:(a.memoizedState=u,a=ly(),Me.lanes|=a,Ia|=a,u)}function dx(a,o,u,d){return Ni(u,o)?u:Zo.current!==null?(a=sg(a,u,d),Ni(a,o)||(Cn=!0),a):(Ua&42)===0?(Cn=!0,a.memoizedState=u):(a=ly(),Me.lanes|=a,Ia|=a,o)}function px(a,o,u,d,_){var M=Mr();di(M!==0&&8>M?M:8);var P=fe.T,V={};fe.T=V,rg(a,!1,o,u);try{var q=_(),ot=fe.S;if(ot!==null&&ot(V,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var yt=jt(q,d);Uc(a,o,yt,Ai(a))}else Uc(a,o,d,Ai(a))}catch(Bt){Uc(a,o,{then:function(){},status:"rejected",reason:Bt},Ai())}finally{di(M),fe.T=P}}function mx(a){var o=a.memoizedState;if(o!==null)return o;o={memoizedState:Oo,baseState:Oo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:Oo},next:null};var u={};return o.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:U,lastRenderedState:u},next:null},a.memoizedState=o,a=a.alternate,a!==null&&(a.memoizedState=o),o}function ag(){return Xn(br)}function gx(){return on().memoizedState}function _x(){return on().memoizedState}function xE(a){for(var o=a.return;o!==null;){switch(o.tag){case 24:case 3:var u=Ai();a=Kt(u);var d=pt(o,a,u);d!==null&&(si(d,o,u),Ct(d,o,u)),o={cache:xg()},a.payload=o;return}o=o.return}}function yE(a,o,u){var d=Ai();u={lane:d,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null},Of(a)?xx(o,u):(u=gt(a,o,u,d),u!==null&&(si(u,a,d),yx(u,o,d)))}function vx(a,o,u){var d=Ai();Uc(a,o,u,d)}function Uc(a,o,u,d){var _={lane:d,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null};if(Of(a))xx(o,_);else{var M=a.alternate;if(a.lanes===0&&(M===null||M.lanes===0)&&(M=o.lastRenderedReducer,M!==null))try{var P=o.lastRenderedState,V=M(P,u);if(_.hasEagerState=!0,_.eagerState=V,Ni(V,P))return ct(a,o,_,0),Ze===null&&ce(),!1}catch{}if(u=gt(a,o,_,d),u!==null)return si(u,a,d),yx(u,o,d),!0}return!1}function rg(a,o,u,d){if(d={lane:2,revertLane:it(),action:d,hasEagerState:!1,eagerState:null,next:null},Of(a)){if(o)throw Error(n(479))}else o=gt(a,u,d,2),o!==null&&si(o,a,2)}function Of(a){var o=a.alternate;return a===Me||o!==null&&o===Me}function xx(a,o){jo=ad=!0;var u=a.pending;u===null?o.next=o:(o.next=u.next,u.next=o),a.pending=o}function yx(a,o,u){if((u&4194176)!==0){var d=o.lanes;d&=a.pendingLanes,u|=d,o.lanes=u,G(a,u)}}function og(a,o,u,d){o=a.memoizedState,u=u(d,o),u=u==null?o:kg({},o,u),a.memoizedState=u,a.lanes===0&&(a.updateQueue.baseState=u)}function Sx(a,o,u,d,_,M,P){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(d,M,P):o.prototype&&o.prototype.isPureReactComponent?!Ut(u,d)||!Ut(_,M):!0}function Mx(a,o,u,d){a=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,d),o.state!==a&&d0.enqueueReplaceState(o,o.state,null)}function gr(a,o){var u=o;if("ref"in o){u={};for(var d in o)d!=="ref"&&(u[d]=o[d])}if(a=a.defaultProps){u===o&&(u=kg({},u));for(var _ in a)u[_]===void 0&&(u[_]=a[_])}return u}function Bf(a,o){try{var u=a.onUncaughtError;u(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function bx(a,o,u){try{var d=a.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function lg(a,o,u){return u=Kt(u),u.tag=3,u.payload={element:null},u.callback=function(){Bf(a,o)},u}function Ex(a){return a=Kt(a),a.tag=3,a}function Tx(a,o,u,d){var _=u.type.getDerivedStateFromError;if(typeof _=="function"){var M=d.value;a.payload=function(){return _(M)},a.callback=function(){bx(o,u,d)}}var P=u.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(a.callback=function(){bx(o,u,d),typeof _!="function"&&(La===null?La=new Set([this]):La.add(this));var V=d.stack;this.componentDidCatch(d.value,{componentStack:V!==null?V:""})})}function SE(a,o,u,d,_){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=u.alternate,o!==null&&Ic(o,u,_,!0),u=Zi.current,u!==null){switch(u.tag){case 13:return As===null?Og():u.alternate===null&&un===0&&(un=3),u.flags&=-257,u.flags|=65536,u.lanes=_,d===id?u.flags|=16384:(o=u.updateQueue,o===null?u.updateQueue=new Set([d]):o.add(d),Fg(a,d,_)),!1;case 22:return u.flags|=65536,d===id?u.flags|=16384:(o=u.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=o):(u=o.retryQueue,u===null?o.retryQueue=new Set([d]):u.add(d)),Fg(a,d,_)),!1}throw Error(n(435,u.tag))}return Fg(a,d,_),Og(),!1}if(Pe)return o=Zi.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=_,d!==a0&&(a=Error(n(422),{cause:d}),Re(rt(a,u)))):(d!==a0&&(o=Error(n(423),{cause:d}),Re(rt(o,u))),a=a.current.alternate,a.flags|=65536,_&=-_,a.lanes|=_,d=rt(d,u),_=lg(a.stateNode,d,_),Xt(a,_),un!==4&&(un=2)),!1;var M=Error(n(520),{cause:d});if(M=rt(M,u),Jc===null?Jc=[M]:Jc.push(M),un!==4&&(un=2),o===null)return!0;d=rt(d,u),u=o;do{switch(u.tag){case 3:return u.flags|=65536,a=_&-_,u.lanes|=a,a=lg(u.stateNode,d,a),Xt(u,a),!1;case 1:if(o=u.type,M=u.stateNode,(u.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(La===null||!La.has(M))))return u.flags|=65536,_&=-_,u.lanes|=_,_=Ex(_),Tx(_,a,u,d),Xt(u,_),!1}u=u.return}while(u!==null);return!1}function Bn(a,o,u,d){o.child=a===null?oS(o,null,u,d):Tr(o,a.child,u,d)}function Ax(a,o,u,d,_){u=u.render;var M=o.ref;if("ref"in d){var P={};for(var V in d)V!=="ref"&&(P[V]=d[V])}else P=d;return _r(o),d=To(a,o,u,P,M,_),V=Co(),a!==null&&!Cn?(Ro(a,o,_),ks(a,o,_)):(Pe&&V&&mt(o),o.flags|=1,Bn(a,o,d,_),o.child)}function Cx(a,o,u,d,_){if(a===null){var M=u.type;return typeof M=="function"&&!zg(M)&&M.defaultProps===void 0&&u.compare===null?(o.tag=15,o.type=M,Rx(a,o,M,d,_)):(a=Xf(u.type,null,d,o,o.mode,_),a.ref=o.ref,a.return=o,o.child=a)}if(M=a.child,!gg(a,_)){var P=M.memoizedProps;if(u=u.compare,u=u!==null?u:Ut,u(P,d)&&a.ref===o.ref)return ks(a,o,_)}return o.flags|=1,a=Aa(M,d),a.ref=o.ref,a.return=o,o.child=a}function Rx(a,o,u,d,_){if(a!==null){var M=a.memoizedProps;if(Ut(M,d)&&a.ref===o.ref)if(Cn=!1,o.pendingProps=d=M,gg(a,_))(a.flags&131072)!==0&&(Cn=!0);else return o.lanes=a.lanes,ks(a,o,_)}return cg(a,o,u,d,_)}function wx(a,o,u){var d=o.pendingProps,_=d.children,M=(o.stateNode._pendingVisibility&2)!==0,P=a!==null?a.memoizedState:null;if(Pc(a,o),d.mode==="hidden"||M){if((o.flags&128)!==0){if(d=P!==null?P.baseLanes|u:u,a!==null){for(_=o.child=a.child,M=0;_!==null;)M=M|_.lanes|_.childLanes,_=_.sibling;o.childLanes=M&~d}else o.childLanes=0,o.child=null;return Nx(a,o,d,u)}if((u&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},a!==null&&Vf(o,P!==null?P.cachePool:null),P!==null?zi(o,P):Rc(),Lf(o);else return o.lanes=o.childLanes=536870912,Nx(a,o,P!==null?P.baseLanes|u:u,u)}else P!==null?(Vf(o,P.cachePool),zi(o,P),es(o),o.memoizedState=null):(a!==null&&Vf(o,null),Rc(),es(o));return Bn(a,o,_,u),o.child}function Nx(a,o,u,d){var _=yg();return _=_===null?null:{parent:Ys?ln._currentValue:ln._currentValue2,pool:_},o.memoizedState={baseLanes:u,cachePool:_},a!==null&&Vf(o,null),Rc(),Lf(o),a!==null&&Ic(a,o,d,!0),null}function Pc(a,o){var u=o.ref;if(u===null)a!==null&&a.ref!==null&&(o.flags|=2097664);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(a===null||a.ref!==u)&&(o.flags|=2097664)}}function cg(a,o,u,d,_){return _r(o),u=To(a,o,u,d,void 0,_),d=Co(),a!==null&&!Cn?(Ro(a,o,_),ks(a,o,_)):(Pe&&d&&mt(o),o.flags|=1,Bn(a,o,u,_),o.child)}function Dx(a,o,u,d,_,M){return _r(o),o.updateQueue=null,u=wc(o,d,u,_),dr(a),d=Co(),a!==null&&!Cn?(Ro(a,o,M),ks(a,o,M)):(Pe&&d&&mt(o),o.flags|=1,Bn(a,o,u,M),o.child)}function Ux(a,o,u,d,_){if(_r(o),o.stateNode===null){var M=Fo,P=u.contextType;typeof P=="object"&&P!==null&&(M=Xn(P)),M=new u(d,M),o.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=d0,o.stateNode=M,M._reactInternals=o,M=o.stateNode,M.props=d,M.state=o.memoizedState,M.refs={},Et(o),P=u.contextType,M.context=typeof P=="object"&&P!==null?Xn(P):Fo,M.state=o.memoizedState,P=u.getDerivedStateFromProps,typeof P=="function"&&(og(o,u,P,d),M.state=o.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(P=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),P!==M.state&&d0.enqueueReplaceState(M,M.state,null),Tt(o,d,M,_),Yt(),M.state=o.memoizedState),typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(a===null){M=o.stateNode;var V=o.memoizedProps,q=gr(u,V);M.props=q;var ot=M.context,yt=u.contextType;P=Fo,typeof yt=="object"&&yt!==null&&(P=Xn(yt));var Bt=u.getDerivedStateFromProps;yt=typeof Bt=="function"||typeof M.getSnapshotBeforeUpdate=="function",V=o.pendingProps!==V,yt||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(V||ot!==P)&&Mx(o,M,d,P),Da=!1;var zt=o.memoizedState;M.state=zt,Tt(o,d,M,_),Yt(),ot=o.memoizedState,V||zt!==ot||Da?(typeof Bt=="function"&&(og(o,u,Bt,d),ot=o.memoizedState),(q=Da||Sx(o,u,q,d,zt,ot,P))?(yt||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=ot),M.props=d,M.state=ot,M.context=P,d=q):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{M=o.stateNode,Wt(a,o),P=o.memoizedProps,yt=gr(u,P),M.props=yt,Bt=o.pendingProps,zt=M.context,ot=u.contextType,q=Fo,typeof ot=="object"&&ot!==null&&(q=Xn(ot)),V=u.getDerivedStateFromProps,(ot=typeof V=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(P!==Bt||zt!==q)&&Mx(o,M,d,q),Da=!1,zt=o.memoizedState,M.state=zt,Tt(o,d,M,_),Yt();var _e=o.memoizedState;P!==Bt||zt!==_e||Da||a!==null&&a.dependencies!==null&&Ff(a.dependencies)?(typeof V=="function"&&(og(o,u,V,d),_e=o.memoizedState),(yt=Da||Sx(o,u,yt,d,zt,_e,q)||a!==null&&a.dependencies!==null&&Ff(a.dependencies))?(ot||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(d,_e,q),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(d,_e,q)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=_e),M.props=d,M.state=_e,M.context=q,d=yt):(typeof M.componentDidUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||P===a.memoizedProps&&zt===a.memoizedState||(o.flags|=1024),d=!1)}return M=d,Pc(a,o),d=(o.flags&128)!==0,M||d?(M=o.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:M.render(),o.flags|=1,a!==null&&d?(o.child=Tr(o,a.child,null,_),o.child=Tr(o,null,u,_)):Bn(a,o,u,_),o.memoizedState=M.state,a=o.child):a=ks(a,o,_),a}function Px(a,o,u,d){return ye(),o.flags|=256,Bn(a,o,u,d),o.child}function ug(a){return{baseLanes:a,cachePool:zx()}}function hg(a,o,u){return a=a!==null?a.childLanes&~u:0,o&&(a|=ji),a}function Ix(a,o,u){var d=o.pendingProps,_=!1,M=(o.flags&128)!==0,P;if((P=M)||(P=a!==null&&a.memoizedState===null?!1:(Mn.current&2)!==0),P&&(_=!0,o.flags&=-129),P=(o.flags&32)!==0,o.flags&=-33,a===null){if(Pe){if(_?Vi(o):es(o),Pe){var V=Zn,q;(q=V)&&(V=FT(V,Ts),V!==null?(o.memoizedState={dehydrated:V,treeContext:Er!==null?{id:Zs,overflow:js}:null,retryLane:536870912},q=t(18,null,null,0),q.stateNode=V,q.return=o,o.child=q,ai=o,Zn=null,q=!0):q=!1),q||dt(o)}if(V=o.memoizedState,V!==null&&(V=V.dehydrated,V!==null))return t0(V)?o.lanes=16:o.lanes=536870912,null;Hi(o)}return V=d.children,d=d.fallback,_?(es(o),_=o.mode,V=dg({mode:"hidden",children:V},_),d=Sr(d,_,u,null),V.return=o,d.return=o,V.sibling=d,o.child=V,_=o.child,_.memoizedState=ug(u),_.childLanes=hg(a,P,u),o.memoizedState=p0,d):(Vi(o),fg(o,V))}if(q=a.memoizedState,q!==null&&(V=q.dehydrated,V!==null)){if(M)o.flags&256?(Vi(o),o.flags&=-257,o=pg(a,o,u)):o.memoizedState!==null?(es(o),o.child=a.child,o.flags|=128,o=null):(es(o),_=d.fallback,V=o.mode,d=dg({mode:"visible",children:d.children},V),_=Sr(_,V,u,null),_.flags|=2,d.return=o,_.return=o,d.sibling=_,o.child=d,Tr(o,a.child,null,u),d=o.child,d.memoizedState=ug(u),d.childLanes=hg(a,P,u),o.memoizedState=p0,o=_);else if(Vi(o),t0(V))P=NT(V).digest,d=Error(n(419)),d.stack="",d.digest=P,Re({value:d,source:null,stack:null}),o=pg(a,o,u);else if(Cn||Ic(a,o,u,!1),P=(u&a.childLanes)!==0,Cn||P){if(P=Ze,P!==null){if(d=u&-u,(d&42)!==0)d=1;else switch(d){case 2:d=1;break;case 8:d=4;break;case 32:d=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:d=64;break;case 268435456:d=134217728;break;default:d=0}if(d=(d&(P.suspendedLanes|u))!==0?0:d,d!==0&&d!==q.retryLane)throw q.retryLane=d,lt(a,d),si(P,a,d),cS}$g(V)||Og(),o=pg(a,o,u)}else $g(V)?(o.flags|=128,o.child=a.child,o=PE.bind(null,a),DT(V,o),o=null):(a=q.treeContext,ki&&(Zn=LT(V),ai=o,Pe=!0,ss=null,Ts=!1,a!==null&&(Xi[qi++]=Zs,Xi[qi++]=js,Xi[qi++]=Er,Zs=a.id,js=a.overflow,Er=o)),o=fg(o,d.children),o.flags|=4096);return o}return _?(es(o),_=d.fallback,V=o.mode,q=a.child,M=q.sibling,d=Aa(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&31457280,M!==null?_=Aa(M,_):(_=Sr(_,V,u,null),_.flags|=2),_.return=o,d.return=o,d.sibling=_,o.child=d,d=_,_=o.child,V=a.child.memoizedState,V===null?V=ug(u):(q=V.cachePool,q!==null?(M=Ys?ln._currentValue:ln._currentValue2,q=q.parent!==M?{parent:M,pool:M}:q):q=zx(),V={baseLanes:V.baseLanes|u,cachePool:q}),_.memoizedState=V,_.childLanes=hg(a,P,u),o.memoizedState=p0,d):(Vi(o),u=a.child,a=u.sibling,u=Aa(u,{mode:"visible",children:d.children}),u.return=o,u.sibling=null,a!==null&&(P=o.deletions,P===null?(o.deletions=[a],o.flags|=16):P.push(a)),o.child=u,o.memoizedState=null,u)}function fg(a,o){return o=dg({mode:"visible",children:o},a.mode),o.return=a,a.child=o}function dg(a,o){return Ey(a,o,0,null)}function pg(a,o,u){return Tr(o,a.child,null,u),a=fg(o,o.pendingProps.children),a.flags|=2,o.memoizedState=null,a}function Lx(a,o,u){a.lanes|=o;var d=a.alternate;d!==null&&(d.lanes|=o),_g(a.return,o,u)}function mg(a,o,u,d,_){var M=a.memoizedState;M===null?a.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:_}:(M.isBackwards=o,M.rendering=null,M.renderingStartTime=0,M.last=d,M.tail=u,M.tailMode=_)}function Ox(a,o,u){var d=o.pendingProps,_=d.revealOrder,M=d.tail;if(Bn(a,o,d.children,u),d=Mn.current,(d&2)!==0)d=d&1|2,o.flags|=128;else{if(a!==null&&(a.flags&128)!==0)t:for(a=o.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Lx(a,u,o);else if(a.tag===19)Lx(a,u,o);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break t;for(;a.sibling===null;){if(a.return===null||a.return===o)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}d&=1}switch(x(Mn,d),_){case"forwards":for(u=o.child,_=null;u!==null;)a=u.alternate,a!==null&&Gi(a)===null&&(_=u),u=u.sibling;u=_,u===null?(_=o.child,o.child=null):(_=u.sibling,u.sibling=null),mg(o,!1,_,u,M);break;case"backwards":for(u=null,_=o.child,o.child=null;_!==null;){if(a=_.alternate,a!==null&&Gi(a)===null){o.child=_;break}a=_.sibling,_.sibling=u,u=_,_=a}mg(o,!0,u,null,M);break;case"together":mg(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function ks(a,o,u){if(a!==null&&(o.dependencies=a.dependencies),Ia|=o.lanes,(u&o.childLanes)===0)if(a!==null){if(Ic(a,o,u,!1),(u&o.childLanes)===0)return null}else return null;if(a!==null&&o.child!==a.child)throw Error(n(153));if(o.child!==null){for(a=o.child,u=Aa(a,a.pendingProps),o.child=u,u.return=o;a.sibling!==null;)a=a.sibling,u=u.sibling=Aa(a,a.pendingProps),u.return=o;u.sibling=null}return o.child}function gg(a,o){return(a.lanes&o)!==0?!0:(a=a.dependencies,!!(a!==null&&Ff(a)))}function ME(a,o,u){switch(o.tag){case 3:$t(o,o.stateNode.containerInfo),Ma(o,ln,a.memoizedState.cache),ye();break;case 27:case 5:Ce(o);break;case 4:$t(o,o.stateNode.containerInfo);break;case 10:Ma(o,o.type,o.memoizedProps.value);break;case 13:var d=o.memoizedState;if(d!==null)return d.dehydrated!==null?(Vi(o),o.flags|=128,null):(u&o.child.childLanes)!==0?Ix(a,o,u):(Vi(o),a=ks(a,o,u),a!==null?a.sibling:null);Vi(o);break;case 19:var _=(a.flags&128)!==0;if(d=(u&o.childLanes)!==0,d||(Ic(a,o,u,!1),d=(u&o.childLanes)!==0),_){if(d)return Ox(a,o,u);o.flags|=128}if(_=o.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),x(Mn,Mn.current),d)break;return null;case 22:case 23:return o.lanes=0,wx(a,o,u);case 24:Ma(o,ln,a.memoizedState.cache)}return ks(a,o,u)}function Bx(a,o,u){if(a!==null)if(a.memoizedProps!==o.pendingProps)Cn=!0;else{if(!gg(a,u)&&(o.flags&128)===0)return Cn=!1,ME(a,o,u);Cn=(a.flags&131072)!==0}else Cn=!1,Pe&&(o.flags&1048576)!==0&&bt(o,$f,o.index);switch(o.lanes=0,o.tag){case 16:t:{a=o.pendingProps;var d=o.elementType,_=d._init;if(d=_(d._payload),o.type=d,typeof d=="function")zg(d)?(a=gr(d,a),o.tag=1,o=Ux(null,o,d,a,u)):(o.tag=0,o=cg(null,o,d,a,u));else{if(d!=null){if(_=d.$$typeof,_===Xg){o.tag=11,o=Ax(null,o,d,a,u);break t}else if(_===Zg){o.tag=14,o=Cx(null,o,d,a,u);break t}}throw o=r(d)||d,Error(n(306,o,""))}}return o;case 0:return cg(a,o,o.type,o.pendingProps,u);case 1:return d=o.type,_=gr(d,o.pendingProps),Ux(a,o,d,_,u);case 3:t:{if($t(o,o.stateNode.containerInfo),a===null)throw Error(n(387));var M=o.pendingProps;_=o.memoizedState,d=_.element,Wt(a,o),Tt(o,M,null,u);var P=o.memoizedState;if(M=P.cache,Ma(o,ln,M),M!==_.cache&&vg(o,[ln],u,!0),Yt(),M=P.element,ki&&_.isDehydrated)if(_={element:M,isDehydrated:!1,cache:P.cache},o.updateQueue.baseState=_,o.memoizedState=_,o.flags&256){o=Px(a,o,M,u);break t}else if(M!==d){d=rt(Error(n(424)),o),Re(d),o=Px(a,o,M,u);break t}else for(ki&&(Zn=IT(o.stateNode.containerInfo),ai=o,Pe=!0,ss=null,Ts=!0),u=oS(o,null,M,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ye(),M===d){o=ks(a,o,u);break t}Bn(a,o,M,u)}o=o.child}return o;case 26:if(Wi)return Pc(a,o),a===null?(u=Ky(o.type,null,o.pendingProps,null))?o.memoizedState=u:Pe||(o.stateNode=JT(o.type,o.pendingProps,Na.current,o)):o.memoizedState=Ky(o.type,a.memoizedProps,o.pendingProps,a.memoizedState),null;case 27:if(Yn)return Ce(o),a===null&&Yn&&Pe&&(d=o.stateNode=iS(o.type,o.pendingProps,Na.current,Fn.current,!1),ai=o,Ts=!0,Zn=Zy(d)),d=o.pendingProps.children,a!==null||Pe?Bn(a,o,d,u):o.child=Tr(o,null,d,u),Pc(a,o),o.child;case 5:return a===null&&Pe&&(YT(o.type,o.pendingProps,Fn.current),(_=d=Zn)&&(d=OT(d,o.type,o.pendingProps,Ts),d!==null?(o.stateNode=d,ai=o,Zn=Zy(d),Ts=!1,_=!0):_=!1),_||dt(o)),Ce(o),_=o.type,M=o.pendingProps,P=a!==null?a.memoizedProps:null,d=M.children,Zf(_,M)?d=null:P!==null&&Zf(_,P)&&(o.flags|=32),o.memoizedState!==null&&(_=To(a,o,Ao,null,null,u),Ys?br._currentValue=_:br._currentValue2=_),Pc(a,o),Bn(a,o,d,u),o.child;case 6:return a===null&&Pe&&(ZT(o.pendingProps,Fn.current),(a=u=Zn)&&(u=BT(u,o.pendingProps,Ts),u!==null?(o.stateNode=u,ai=o,Zn=null,a=!0):a=!1),a||dt(o)),null;case 13:return Ix(a,o,u);case 4:return $t(o,o.stateNode.containerInfo),d=o.pendingProps,a===null?o.child=Tr(o,null,d,u):Bn(a,o,d,u),o.child;case 11:return Ax(a,o,o.type,o.pendingProps,u);case 7:return Bn(a,o,o.pendingProps,u),o.child;case 8:return Bn(a,o,o.pendingProps.children,u),o.child;case 12:return Bn(a,o,o.pendingProps.children,u),o.child;case 10:return d=o.pendingProps,Ma(o,o.type,d.value),Bn(a,o,d.children,u),o.child;case 9:return _=o.type._context,d=o.pendingProps.children,_r(o),_=Xn(_),d=d(_),o.flags|=1,Bn(a,o,d,u),o.child;case 14:return Cx(a,o,o.type,o.pendingProps,u);case 15:return Rx(a,o,o.type,o.pendingProps,u);case 19:return Ox(a,o,u);case 22:return wx(a,o,u);case 24:return _r(o),d=Xn(ln),a===null?(_=yg(),_===null&&(_=Ze,M=xg(),_.pooledCache=M,M.refCount++,M!==null&&(_.pooledCacheLanes|=u),_=M),o.memoizedState={parent:d,cache:_},Et(o),Ma(o,ln,_)):((a.lanes&u)!==0&&(Wt(a,o),Tt(o,null,null,u),Yt()),_=a.memoizedState,M=o.memoizedState,_.parent!==d?(_={parent:d,cache:d},o.memoizedState=_,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=_),Ma(o,ln,d)):(d=M.cache,Ma(o,ln,d),d!==_.cache&&vg(o,[ln],u,!0))),Bn(a,o,o.pendingProps.children,u),o.child;case 29:throw o.pendingProps}throw Error(n(156,o.tag))}function Ma(a,o,u){Ys?(x(od,o._currentValue),o._currentValue=u):(x(od,o._currentValue2),o._currentValue2=u)}function Ws(a){var o=od.current;Ys?a._currentValue=o:a._currentValue2=o,S(od)}function _g(a,o,u){for(;a!==null;){var d=a.alternate;if((a.childLanes&o)!==o?(a.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),a===u)break;a=a.return}}function vg(a,o,u,d){var _=a.child;for(_!==null&&(_.return=a);_!==null;){var M=_.dependencies;if(M!==null){var P=_.child;M=M.firstContext;t:for(;M!==null;){var V=M;M=_;for(var q=0;q<o.length;q++)if(V.context===o[q]){M.lanes|=u,V=M.alternate,V!==null&&(V.lanes|=u),_g(M.return,u,a),d||(P=null);break t}M=V.next}}else if(_.tag===18){if(P=_.return,P===null)throw Error(n(341));P.lanes|=u,M=P.alternate,M!==null&&(M.lanes|=u),_g(P,u,a),P=null}else P=_.child;if(P!==null)P.return=_;else for(P=_;P!==null;){if(P===a){P=null;break}if(_=P.sibling,_!==null){_.return=P.return,P=_;break}P=P.return}_=P}}function Ic(a,o,u,d){a=null;for(var _=o,M=!1;_!==null;){if(!M){if((_.flags&524288)!==0)M=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var P=_.alternate;if(P===null)throw Error(n(387));if(P=P.memoizedProps,P!==null){var V=_.type;Ni(_.pendingProps.value,P.value)||(a!==null?a.push(V):a=[V])}}else if(_===td.current){if(P=_.alternate,P===null)throw Error(n(387));P.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(a!==null?a.push(br):a=[br])}_=_.return}a!==null&&vg(o,a,u,d),o.flags|=262144}function Ff(a){for(a=a.firstContext;a!==null;){var o=a.context;if(!Ni(Ys?o._currentValue:o._currentValue2,a.memoizedValue))return!0;a=a.next}return!1}function _r(a){wr=a,Js=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function Xn(a){return Fx(wr,a)}function zf(a,o){return wr===null&&_r(a),Fx(a,o)}function Fx(a,o){var u=Ys?o._currentValue:o._currentValue2;if(o={context:o,memoizedValue:u,next:null},Js===null){if(a===null)throw Error(n(308));Js=o,a.dependencies={lanes:0,firstContext:o},a.flags|=524288}else Js=Js.next=o;return u}function xg(){return{controller:new dA,data:new Map,refCount:0}}function Lc(a){a.refCount--,a.refCount===0&&pA(mA,function(){a.controller.abort()})}function yg(){var a=Nr.current;return a!==null?a:Ze.pooledCache}function Vf(a,o){o===null?x(Nr,Nr.current):x(Nr,o.pool)}function zx(){var a=yg();return a===null?null:{parent:Ys?ln._currentValue:ln._currentValue2,pool:a}}function bi(a){a.flags|=4}function Vx(a,o){if(a!==null&&a.child===o.child)return!1;if((o.flags&16)!==0)return!0;for(a=o.child;a!==null;){if((a.flags&13878)!==0||(a.subtreeFlags&13878)!==0)return!0;a=a.sibling}return!1}function Sg(a,o,u,d){if(qn)for(u=o.child;u!==null;){if(u.tag===5||u.tag===6)Kg(a,u.stateNode);else if(!(u.tag===4||Yn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(wa)for(var _=o.child;_!==null;){if(_.tag===5){var M=_.stateNode;u&&d&&(M=Xy(M,_.type,_.memoizedProps)),Kg(a,M)}else if(_.tag===6)M=_.stateNode,u&&d&&(M=qy(M,_.memoizedProps)),Kg(a,M);else if(_.tag!==4){if(_.tag===22&&_.memoizedState!==null)M=_.child,M!==null&&(M.return=_),Sg(a,_,!0,!0);else if(_.child!==null){_.child.return=_,_=_.child;continue}}if(_===o)break;for(;_.sibling===null;){if(_.return===null||_.return===o)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function Hx(a,o,u,d){if(wa)for(var _=o.child;_!==null;){if(_.tag===5){var M=_.stateNode;u&&d&&(M=Xy(M,_.type,_.memoizedProps)),ky(a,M)}else if(_.tag===6)M=_.stateNode,u&&d&&(M=qy(M,_.memoizedProps)),ky(a,M);else if(_.tag!==4){if(_.tag===22&&_.memoizedState!==null)M=_.child,M!==null&&(M.return=_),Hx(a,_,!(_.memoizedProps!==null&&_.memoizedProps.mode==="manual"),!0);else if(_.child!==null){_.child.return=_,_=_.child;continue}}if(_===o)break;for(;_.sibling===null;){if(_.return===null||_.return===o)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function Gx(a,o){if(wa&&Vx(a,o)){a=o.stateNode;var u=a.containerInfo,d=Gy();Hx(d,o,!1,!1),a.pendingChildren=d,bi(o),wT(u,d)}}function Mg(a,o,u,d){if(qn)a.memoizedProps!==d&&bi(o);else if(wa){var _=a.stateNode,M=a.memoizedProps;if((a=Vx(a,o))||M!==d){var P=Fn.current;M=RT(_,u,M,d,!a,null),M===_?o.stateNode=_:(Oy(M,u,d,P)&&bi(o),o.stateNode=M,a?Sg(M,o,!1,!1):bi(o))}else o.stateNode=_}}function bg(a,o,u){if(nT(o,u)){if(a.flags|=16777216,!zy(o,u))if(dy())a.flags|=8192;else throw qo=id,h0}else a.flags&=-16777217}function kx(a,o){if(QT(o)){if(a.flags|=16777216,!nS(o))if(dy())a.flags|=8192;else throw qo=id,h0}else a.flags&=-16777217}function Hf(a,o){o!==null&&(a.flags|=4),a.flags&16384&&(o=a.tag!==22?F():536870912,a.lanes|=o,$o|=o)}function Oc(a,o){if(!Pe)switch(a.tailMode){case"hidden":o=a.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a.tail=null:u.sibling=null;break;case"collapsed":u=a.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?o||a.tail===null?a.tail=null:a.tail.sibling=null:d.sibling=null}}function sn(a){var o=a.alternate!==null&&a.alternate.child===a.child,u=0,d=0;if(o)for(var _=a.child;_!==null;)u|=_.lanes|_.childLanes,d|=_.subtreeFlags&31457280,d|=_.flags&31457280,_.return=a,_=_.sibling;else for(_=a.child;_!==null;)u|=_.lanes|_.childLanes,d|=_.subtreeFlags,d|=_.flags,_.return=a,_=_.sibling;return a.subtreeFlags|=d,a.childLanes=u,o}function bE(a,o,u){var d=o.pendingProps;switch(kt(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(o),null;case 1:return sn(o),null;case 3:return u=o.stateNode,d=null,a!==null&&(d=a.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),Ws(ln),re(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(a===null||a.child===null)&&(Ft(o)?bi(o):a===null||a.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ss!==null&&(Ig(ss),ss=null))),Gx(a,o),sn(o),null;case 26:if(Wi){u=o.type;var _=o.memoizedState;return a===null?(bi(o),_!==null?(sn(o),kx(o,_)):(sn(o),bg(o,u,d))):_?_!==a.memoizedState?(bi(o),sn(o),kx(o,_)):(sn(o),o.flags&=-16777217):(qn?a.memoizedProps!==d&&bi(o):Mg(a,o,u,d),sn(o),bg(o,u,d)),null}case 27:if(Yn){if(at(o),u=Na.current,_=o.type,a!==null&&o.stateNode!=null)qn?a.memoizedProps!==d&&bi(o):Mg(a,o,_,d);else{if(!d){if(o.stateNode===null)throw Error(n(166));return sn(o),null}a=Fn.current,Ft(o)?Vt(o,a):(a=iS(_,d,u,a,!0),o.stateNode=a,bi(o))}return sn(o),null}case 5:if(at(o),u=o.type,a!==null&&o.stateNode!=null)Mg(a,o,u,d);else{if(!d){if(o.stateNode===null)throw Error(n(166));return sn(o),null}a=Fn.current,Ft(o)?Vt(o,a):(_=jE(u,d,Na.current,a,o),Sg(_,o,!1,!1),o.stateNode=_,Oy(_,u,d,a)&&bi(o))}return sn(o),bg(o,o.type,o.pendingProps),null;case 6:if(a&&o.stateNode!=null)u=a.memoizedProps,qn?u!==d&&bi(o):wa&&(u!==d?(o.stateNode=By(d,Na.current,Fn.current,o),bi(o)):o.stateNode=a.stateNode);else{if(typeof d!="string"&&o.stateNode===null)throw Error(n(166));if(a=Na.current,u=Fn.current,Ft(o)){if(!ki)throw Error(n(176));if(a=o.stateNode,u=o.memoizedProps,d=null,_=ai,_!==null)switch(_.tag){case 27:case 5:d=_.memoizedProps}VT(a,u,o,d)||dt(o)}else o.stateNode=By(d,a,u,o)}return sn(o),null;case 13:if(d=o.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(_=Ft(o),d!==null&&d.dehydrated!==null){if(a===null){if(!_)throw Error(n(318));if(!ki)throw Error(n(344));if(_=o.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));HT(_,o)}else ye(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;sn(o),_=!1}else ss!==null&&(Ig(ss),ss=null),_=!0;if(!_)return o.flags&256?(Hi(o),o):(Hi(o),null)}if(Hi(o),(o.flags&128)!==0)return o.lanes=u,o;if(u=d!==null,a=a!==null&&a.memoizedState!==null,u){d=o.child,_=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(_=d.alternate.memoizedState.cachePool.pool);var M=null;d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(M=d.memoizedState.cachePool.pool),M!==_&&(d.flags|=2048)}return u!==a&&u&&(o.child.flags|=8192),Hf(o,o.updateQueue),sn(o),null;case 4:return re(),Gx(a,o),a===null&&QE(o.stateNode.containerInfo),sn(o),null;case 10:return Ws(o.type),sn(o),null;case 19:if(S(Mn),_=o.memoizedState,_===null)return sn(o),null;if(d=(o.flags&128)!==0,M=_.rendering,M===null)if(d)Oc(_,!1);else{if(un!==0||a!==null&&(a.flags&128)!==0)for(a=o.child;a!==null;){if(M=Gi(a),M!==null){for(o.flags|=128,Oc(_,!1),a=M.updateQueue,o.updateQueue=a,Hf(o,a),o.subtreeFlags=0,a=u,u=o.child;u!==null;)by(u,a),u=u.sibling;return x(Mn,Mn.current&1|2),o.child}a=a.sibling}_.tail!==null&&is()>Kc&&(o.flags|=128,d=!0,Oc(_,!1),o.lanes=4194304)}else{if(!d)if(a=Gi(M),a!==null){if(o.flags|=128,d=!0,a=a.updateQueue,o.updateQueue=a,Hf(o,a),Oc(_,!0),_.tail===null&&_.tailMode==="hidden"&&!M.alternate&&!Pe)return sn(o),null}else 2*is()-_.renderingStartTime>Kc&&u!==536870912&&(o.flags|=128,d=!0,Oc(_,!1),o.lanes=4194304);_.isBackwards?(M.sibling=o.child,o.child=M):(a=_.last,a!==null?a.sibling=M:o.child=M,_.last=M)}return _.tail!==null?(o=_.tail,_.rendering=o,_.tail=o.sibling,_.renderingStartTime=is(),o.sibling=null,a=Mn.current,x(Mn,d?a&1|2:a&1),o):(sn(o),null);case 22:case 23:return Hi(o),bo(),d=o.memoizedState!==null,a!==null?a.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(u&536870912)!==0&&(o.flags&128)===0&&(sn(o),o.subtreeFlags&6&&(o.flags|=8192)):sn(o),u=o.updateQueue,u!==null&&Hf(o,u.retryQueue),u=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048),a!==null&&S(Nr),null;case 24:return u=null,a!==null&&(u=a.memoizedState.cache),o.memoizedState.cache!==u&&(o.flags|=2048),Ws(ln),sn(o),null;case 25:return null}throw Error(n(156,o.tag))}function EE(a,o){switch(kt(o),o.tag){case 1:return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 3:return Ws(ln),re(),a=o.flags,(a&65536)!==0&&(a&128)===0?(o.flags=a&-65537|128,o):null;case 26:case 27:case 5:return at(o),null;case 13:if(Hi(o),a=o.memoizedState,a!==null&&a.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ye()}return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 19:return S(Mn),null;case 4:return re(),null;case 10:return Ws(o.type),null;case 22:case 23:return Hi(o),bo(),a!==null&&S(Nr),a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 24:return Ws(ln),null;case 25:return null;default:return null}}function Wx(a,o){switch(kt(o),o.tag){case 3:Ws(ln),re();break;case 26:case 27:case 5:at(o);break;case 4:re();break;case 13:Hi(o);break;case 19:S(Mn);break;case 10:Ws(o.type);break;case 22:case 23:Hi(o),bo(),a!==null&&S(Nr);break;case 24:Ws(ln)}}function Bc(a,o){try{var u=o.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var _=d.next;u=_;do{if((u.tag&a)===a){d=void 0;var M=u.create,P=u.inst;d=M(),P.destroy=d}u=u.next}while(u!==_)}}catch(V){ke(o,o.return,V)}}function ba(a,o,u){try{var d=o.updateQueue,_=d!==null?d.lastEffect:null;if(_!==null){var M=_.next;d=M;do{if((d.tag&a)===a){var P=d.inst,V=P.destroy;if(V!==void 0){P.destroy=void 0,_=o;var q=u;try{V()}catch(ot){ke(_,q,ot)}}}d=d.next}while(d!==M)}}catch(ot){ke(o,o.return,ot)}}function Xx(a){var o=a.updateQueue;if(o!==null){var u=a.stateNode;try{H(o,u)}catch(d){ke(a,a.return,d)}}}function qx(a,o,u){u.props=gr(a.type,a.memoizedProps),u.state=a.memoizedState;try{u.componentWillUnmount()}catch(d){ke(a,o,d)}}function vr(a,o){try{var u=a.ref;if(u!==null){var d=a.stateNode;switch(a.tag){case 26:case 27:case 5:var _=Vc(d);break;default:_=d}typeof u=="function"?a.refCleanup=u(_):u.current=_}}catch(M){ke(a,o,M)}}function Ei(a,o){var u=a.ref,d=a.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(_){ke(a,o,_)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(_){ke(a,o,_)}else u.current=null}function Yx(a){var o=a.type,u=a.memoizedProps,d=a.stateNode;try{_T(d,o,u,a)}catch(_){ke(a,a.return,_)}}function Zx(a,o,u){try{vT(a.stateNode,a.type,u,o,a)}catch(d){ke(a,a.return,d)}}function jx(a){return a.tag===5||a.tag===3||(Wi?a.tag===26:!1)||(Yn?a.tag===27:!1)||a.tag===4}function Eg(a){t:for(;;){for(;a.sibling===null;){if(a.return===null||jx(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&(!Yn||a.tag!==27)&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue t;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Tg(a,o,u){var d=a.tag;if(d===5||d===6)a=a.stateNode,o?yT(u,a,o):mT(u,a);else if(!(d===4||Yn&&d===27)&&(a=a.child,a!==null))for(Tg(a,o,u),a=a.sibling;a!==null;)Tg(a,o,u),a=a.sibling}function Gf(a,o,u){var d=a.tag;if(d===5||d===6)a=a.stateNode,o?xT(u,a,o):pT(u,a);else if(!(d===4||Yn&&d===27)&&(a=a.child,a!==null))for(Gf(a,o,u),a=a.sibling;a!==null;)Gf(a,o,u),a=a.sibling}function Jx(a,o,u){a=a.containerInfo;try{Wy(a,u)}catch(d){ke(o,o.return,d)}}function TE(a,o){for(YE(a.containerInfo),Rn=o;Rn!==null;)if(a=Rn,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Rn=o;else for(;Rn!==null;){a=Rn;var u=a.alternate;switch(o=a.flags,a.tag){case 0:break;case 11:case 15:break;case 1:if((o&1024)!==0&&u!==null){o=void 0;var d=a,_=u.memoizedProps;u=u.memoizedState;var M=d.stateNode;try{var P=gr(d.type,_,d.elementType===d.type);o=M.getSnapshotBeforeUpdate(P,u),M.__reactInternalSnapshotBeforeUpdate=o}catch(V){ke(d,d.return,V)}}break;case 3:(o&1024)!==0&&qn&&CT(a.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(n(163))}if(o=a.sibling,o!==null){o.return=a.return,Rn=o;break}Rn=a.return}return P=fS,fS=!1,P}function Kx(a,o,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Xs(a,u),d&4&&Bc(5,u);break;case 1:if(Xs(a,u),d&4)if(a=u.stateNode,o===null)try{a.componentDidMount()}catch(V){ke(u,u.return,V)}else{var _=gr(u.type,o.memoizedProps);o=o.memoizedState;try{a.componentDidUpdate(_,o,a.__reactInternalSnapshotBeforeUpdate)}catch(V){ke(u,u.return,V)}}d&64&&Xx(u),d&512&&vr(u,u.return);break;case 3:if(Xs(a,u),d&64&&(d=u.updateQueue,d!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=Vc(u.child.stateNode);break;case 1:a=u.child.stateNode}try{H(d,a)}catch(V){ke(u,u.return,V)}}break;case 26:if(Wi){Xs(a,u),d&512&&vr(u,u.return);break}case 27:case 5:Xs(a,u),o===null&&d&4&&Yx(u),d&512&&vr(u,u.return);break;case 12:Xs(a,u);break;case 13:Xs(a,u),d&4&&$x(a,u);break;case 22:if(_=u.memoizedState!==null||Ks,!_){o=o!==null&&o.memoizedState!==null||cn;var M=Ks,P=cn;Ks=_,(cn=o)&&!P?Ea(a,u,(u.subtreeFlags&8772)!==0):Xs(a,u),Ks=M,cn=P}d&512&&(u.memoizedProps.mode==="manual"?vr(u,u.return):Ei(u,u.return));break;default:Xs(a,u)}}function Qx(a){var o=a.alternate;o!==null&&(a.alternate=null,Qx(o)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(o=a.stateNode,o!==null&&eT(o)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function ns(a,o,u){for(u=u.child;u!==null;)Ag(a,o,u),u=u.sibling}function Ag(a,o,u){if(wi&&typeof wi.onCommitFiberUnmount=="function")try{wi.onCommitFiberUnmount(kc,u)}catch{}switch(u.tag){case 26:if(Wi){cn||Ei(u,o),ns(a,o,u),u.memoizedState?$y(u.memoizedState):u.stateNode&&eS(u.stateNode);break}case 27:if(Yn){cn||Ei(u,o);var d=vn,_=Di;vn=u.stateNode,ns(a,o,u),nA(u.stateNode),vn=d,Di=_;break}case 5:cn||Ei(u,o);case 6:if(qn){if(d=vn,_=Di,vn=null,ns(a,o,u),vn=d,Di=_,vn!==null)if(Di)try{MT(vn,u.stateNode)}catch(M){ke(u,o,M)}else try{ST(vn,u.stateNode)}catch(M){ke(u,o,M)}}else ns(a,o,u);break;case 18:qn&&vn!==null&&(Di?qT(vn,u.stateNode):XT(vn,u.stateNode));break;case 4:qn?(d=vn,_=Di,vn=u.stateNode.containerInfo,Di=!0,ns(a,o,u),vn=d,Di=_):(wa&&Jx(u.stateNode,u,Gy()),ns(a,o,u));break;case 0:case 11:case 14:case 15:cn||ba(2,u,o),cn||ba(4,u,o),ns(a,o,u);break;case 1:cn||(Ei(u,o),d=u.stateNode,typeof d.componentWillUnmount=="function"&&qx(u,o,d)),ns(a,o,u);break;case 21:ns(a,o,u);break;case 22:cn||Ei(u,o),cn=(d=cn)||u.memoizedState!==null,ns(a,o,u),cn=d;break;default:ns(a,o,u)}}function $x(a,o){if(ki&&o.memoizedState===null&&(a=o.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{WT(a)}catch(u){ke(o,o.return,u)}}function AE(a){switch(a.tag){case 13:case 19:var o=a.stateNode;return o===null&&(o=a.stateNode=new hS),o;case 22:return a=a.stateNode,o=a._retryCache,o===null&&(o=a._retryCache=new hS),o;default:throw Error(n(435,a.tag))}}function Cg(a,o){var u=AE(a);o.forEach(function(d){var _=IE.bind(null,a,d);u.has(d)||(u.add(d),d.then(_,_))})}function fi(a,o){var u=o.deletions;if(u!==null)for(var d=0;d<u.length;d++){var _=u[d],M=a,P=o;if(qn){var V=P;t:for(;V!==null;){switch(V.tag){case 27:case 5:vn=V.stateNode,Di=!1;break t;case 3:vn=V.stateNode.containerInfo,Di=!0;break t;case 4:vn=V.stateNode.containerInfo,Di=!0;break t}V=V.return}if(vn===null)throw Error(n(160));Ag(M,P,_),vn=null,Di=!1}else Ag(M,P,_);M=_.alternate,M!==null&&(M.return=null),_.return=null}if(o.subtreeFlags&13878)for(o=o.child;o!==null;)ty(o,a),o=o.sibling}function ty(a,o){var u=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:fi(o,a),Ti(a),d&4&&(ba(3,a,a.return),Bc(3,a),ba(5,a,a.return));break;case 1:fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),d&64&&Ks&&(a=a.updateQueue,a!==null&&(d=a.callbacks,d!==null&&(u=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:if(Wi){var _=as;fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),d&4&&(d=u!==null?u.memoizedState:null,o=a.memoizedState,u===null?o===null?a.stateNode===null?a.stateNode=jT(_,a.type,a.memoizedProps,a):tS(_,a.type,a.stateNode):a.stateNode=Qy(_,o,a.memoizedProps):d!==o?(d===null?u.stateNode!==null&&eS(u.stateNode):$y(d),o===null?tS(_,a.type,a.stateNode):Qy(_,o,a.memoizedProps)):o===null&&a.stateNode!==null&&Zx(a,a.memoizedProps,u.memoizedProps));break}case 27:if(Yn&&d&4&&a.alternate===null){_=a.stateNode;var M=a.memoizedProps;try{tA(_),eA(a.type,M,_,a)}catch(yt){ke(a,a.return,yt)}}case 5:if(fi(o,a),Ti(a),d&512&&(cn||u===null||Ei(u,u.return)),qn){if(a.flags&32){o=a.stateNode;try{Hy(o)}catch(yt){ke(a,a.return,yt)}}d&4&&a.stateNode!=null&&(o=a.memoizedProps,Zx(a,o,u!==null?u.memoizedProps:o)),d&1024&&(m0=!0)}break;case 6:if(fi(o,a),Ti(a),d&4&&qn){if(a.stateNode===null)throw Error(n(162));d=a.memoizedProps,u=u!==null?u.memoizedProps:d,o=a.stateNode;try{gT(o,u,d)}catch(yt){ke(a,a.return,yt)}}break;case 3:if(Wi?(KT(),_=as,as=e0(o.containerInfo),fi(o,a),as=_):fi(o,a),Ti(a),d&4){if(qn&&ki&&u!==null&&u.memoizedState.isDehydrated)try{kT(o.containerInfo)}catch(yt){ke(a,a.return,yt)}if(wa){d=o.containerInfo,u=o.pendingChildren;try{Wy(d,u)}catch(yt){ke(a,a.return,yt)}}}m0&&(m0=!1,ey(a));break;case 4:Wi?(u=as,as=e0(a.stateNode.containerInfo),fi(o,a),Ti(a),as=u):(fi(o,a),Ti(a)),d&4&&wa&&Jx(a.stateNode,a,a.stateNode.pendingChildren);break;case 12:fi(o,a),Ti(a);break;case 13:fi(o,a),Ti(a),a.child.flags&8192&&a.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(x0=is()),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,Cg(a,d)));break;case 22:d&512&&(cn||u===null||Ei(u,u.return)),_=a.memoizedState!==null;var P=u!==null&&u.memoizedState!==null,V=Ks,q=cn;if(Ks=V||_,cn=q||P,fi(o,a),cn=q,Ks=V,Ti(a),o=a.stateNode,o._current=a,o._visibility&=-3,o._visibility|=o._pendingVisibility&2,d&8192&&(o._visibility=_?o._visibility&-2:o._visibility|1,_&&(o=Ks||cn,u===null||P||o||No(a)),qn&&(a.memoizedProps===null||a.memoizedProps.mode!=="manual"))){t:if(u=null,qn)for(o=a;;){if(o.tag===5||Wi&&o.tag===26||Yn&&o.tag===27){if(u===null){P=u=o;try{M=P.stateNode,_?bT(M):TT(P.stateNode,P.memoizedProps)}catch(yt){ke(P,P.return,yt)}}}else if(o.tag===6){if(u===null){P=o;try{var ot=P.stateNode;_?ET(ot):AT(ot,P.memoizedProps)}catch(yt){ke(P,P.return,yt)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===a)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break t;for(;o.sibling===null;){if(o.return===null||o.return===a)break t;u===o&&(u=null),o=o.return}u===o&&(u=null),o.sibling.return=o.return,o=o.sibling}}d&4&&(d=a.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Cg(a,u))));break;case 19:fi(o,a),Ti(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,Cg(a,d)));break;case 21:break;default:fi(o,a),Ti(a)}}function Ti(a){var o=a.flags;if(o&2){try{if(qn&&(!Yn||a.tag!==27)){t:{for(var u=a.return;u!==null;){if(jx(u)){var d=u;break t}u=u.return}throw Error(n(160))}switch(d.tag){case 27:if(Yn){var _=d.stateNode,M=Eg(a);Gf(a,M,_);break}case 5:var P=d.stateNode;d.flags&32&&(Hy(P),d.flags&=-33);var V=Eg(a);Gf(a,V,P);break;case 3:case 4:var q=d.stateNode.containerInfo,ot=Eg(a);Tg(a,ot,q);break;default:throw Error(n(161))}}}catch(yt){ke(a,a.return,yt)}a.flags&=-3}o&4096&&(a.flags&=-4097)}function ey(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var o=a;ey(o),o.tag===5&&o.flags&1024&&aT(o.stateNode),a=a.sibling}}function Xs(a,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)Kx(a,o.alternate,o),o=o.sibling}function No(a){for(a=a.child;a!==null;){var o=a;switch(o.tag){case 0:case 11:case 14:case 15:ba(4,o,o.return),No(o);break;case 1:Ei(o,o.return);var u=o.stateNode;typeof u.componentWillUnmount=="function"&&qx(o,o.return,u),No(o);break;case 26:case 27:case 5:Ei(o,o.return),No(o);break;case 22:Ei(o,o.return),o.memoizedState===null&&No(o);break;default:No(o)}a=a.sibling}}function Ea(a,o,u){for(u=u&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var d=o.alternate,_=a,M=o,P=M.flags;switch(M.tag){case 0:case 11:case 15:Ea(_,M,u),Bc(4,M);break;case 1:if(Ea(_,M,u),d=M,_=d.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ot){ke(d,d.return,ot)}if(d=M,_=d.updateQueue,_!==null){var V=d.stateNode;try{var q=_.shared.hiddenCallbacks;if(q!==null)for(_.shared.hiddenCallbacks=null,_=0;_<q.length;_++)ge(q[_],V)}catch(ot){ke(d,d.return,ot)}}u&&P&64&&Xx(M),vr(M,M.return);break;case 26:case 27:case 5:Ea(_,M,u),u&&d===null&&P&4&&Yx(M),vr(M,M.return);break;case 12:Ea(_,M,u);break;case 13:Ea(_,M,u),u&&P&4&&$x(_,M);break;case 22:M.memoizedState===null&&Ea(_,M,u),vr(M,M.return);break;default:Ea(_,M,u)}o=o.sibling}}function Rg(a,o){var u=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),a=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(a=o.memoizedState.cachePool.pool),a!==u&&(a!=null&&a.refCount++,u!=null&&Lc(u))}function wg(a,o){a=null,o.alternate!==null&&(a=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==a&&(o.refCount++,a!=null&&Lc(a))}function Ta(a,o,u,d){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)ny(a,o,u,d),o=o.sibling}function ny(a,o,u,d){var _=o.flags;switch(o.tag){case 0:case 11:case 15:Ta(a,o,u,d),_&2048&&Bc(9,o);break;case 3:Ta(a,o,u,d),_&2048&&(a=null,o.alternate!==null&&(a=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==a&&(o.refCount++,a!=null&&Lc(a)));break;case 12:if(_&2048){Ta(a,o,u,d),a=o.stateNode;try{var M=o.memoizedProps,P=M.id,V=M.onPostCommit;typeof V=="function"&&V(P,o.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(q){ke(o,o.return,q)}}else Ta(a,o,u,d);break;case 23:break;case 22:M=o.stateNode,o.memoizedState!==null?M._visibility&4?Ta(a,o,u,d):Fc(a,o):M._visibility&4?Ta(a,o,u,d):(M._visibility|=4,Do(a,o,u,d,(o.subtreeFlags&10256)!==0)),_&2048&&Rg(o.alternate,o);break;case 24:Ta(a,o,u,d),_&2048&&wg(o.alternate,o);break;default:Ta(a,o,u,d)}}function Do(a,o,u,d,_){for(_=_&&(o.subtreeFlags&10256)!==0,o=o.child;o!==null;){var M=a,P=o,V=u,q=d,ot=P.flags;switch(P.tag){case 0:case 11:case 15:Do(M,P,V,q,_),Bc(8,P);break;case 23:break;case 22:var yt=P.stateNode;P.memoizedState!==null?yt._visibility&4?Do(M,P,V,q,_):Fc(M,P):(yt._visibility|=4,Do(M,P,V,q,_)),_&&ot&2048&&Rg(P.alternate,P);break;case 24:Do(M,P,V,q,_),_&&ot&2048&&wg(P.alternate,P);break;default:Do(M,P,V,q,_)}o=o.sibling}}function Fc(a,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var u=a,d=o,_=d.flags;switch(d.tag){case 22:Fc(u,d),_&2048&&Rg(d.alternate,d);break;case 24:Fc(u,d),_&2048&&wg(d.alternate,d);break;default:Fc(u,d)}o=o.sibling}}function xr(a){if(a.subtreeFlags&Ko)for(a=a.child;a!==null;)iy(a),a=a.sibling}function iy(a){switch(a.tag){case 26:xr(a),a.flags&Ko&&(a.memoizedState!==null?$T(as,a.memoizedState,a.memoizedProps):Vy(a.type,a.memoizedProps));break;case 5:xr(a),a.flags&Ko&&Vy(a.type,a.memoizedProps);break;case 3:case 4:if(Wi){var o=as;as=e0(a.stateNode.containerInfo),xr(a),as=o}else xr(a);break;case 22:a.memoizedState===null&&(o=a.alternate,o!==null&&o.memoizedState!==null?(o=Ko,Ko=16777216,xr(a),Ko=o):xr(a));break;default:xr(a)}}function sy(a){var o=a.alternate;if(o!==null&&(a=o.child,a!==null)){o.child=null;do o=a.sibling,a.sibling=null,a=o;while(a!==null)}}function zc(a){var o=a.deletions;if((a.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var d=o[u];Rn=d,ry(d,a)}sy(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)ay(a),a=a.sibling}function ay(a){switch(a.tag){case 0:case 11:case 15:zc(a),a.flags&2048&&ba(9,a,a.return);break;case 3:zc(a);break;case 12:zc(a);break;case 22:var o=a.stateNode;a.memoizedState!==null&&o._visibility&4&&(a.return===null||a.return.tag!==13)?(o._visibility&=-5,kf(a)):zc(a);break;default:zc(a)}}function kf(a){var o=a.deletions;if((a.flags&16)!==0){if(o!==null)for(var u=0;u<o.length;u++){var d=o[u];Rn=d,ry(d,a)}sy(a)}for(a=a.child;a!==null;){switch(o=a,o.tag){case 0:case 11:case 15:ba(8,o,o.return),kf(o);break;case 22:u=o.stateNode,u._visibility&4&&(u._visibility&=-5,kf(o));break;default:kf(o)}a=a.sibling}}function ry(a,o){for(;Rn!==null;){var u=Rn;switch(u.tag){case 0:case 11:case 15:ba(8,u,o);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Lc(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,Rn=d;else t:for(u=a;Rn!==null;){d=Rn;var _=d.sibling,M=d.return;if(Qx(d),d===u){Rn=null;break t}if(_!==null){_.return=M,Rn=_;break t}Rn=M}}}function Ng(a){var o=Fy(a);if(o!=null){if(typeof o.memoizedProps["data-testname"]!="string")throw Error(n(364));return o}if(a=lT(a),a===null)throw Error(n(362));return a.stateNode.current}function Dg(a,o){var u=a.tag;switch(o.$$typeof){case ld:if(a.type===o.value)return!0;break;case cd:t:{for(o=o.value,a=[a,0],u=0;u<a.length;){var d=a[u++],_=d.tag,M=a[u++],P=o[M];if(_!==5&&_!==26&&_!==27||!Gc(d)){for(;P!=null&&Dg(d,P);)M++,P=o[M];if(M===o.length){o=!0;break t}else for(d=d.child;d!==null;)a.push(d,M),d=d.sibling}}o=!1}return o;case ud:if((u===5||u===26||u===27)&&hT(a.stateNode,o.value))return!0;break;case fd:if((u===5||u===6||u===26||u===27)&&(a=uT(a),a!==null&&0<=a.indexOf(o.value)))return!0;break;case hd:if((u===5||u===26||u===27)&&(a=a.memoizedProps["data-testname"],typeof a=="string"&&a.toLowerCase()===o.value.toLowerCase()))return!0;break;default:throw Error(n(365))}return!1}function Ug(a){switch(a.$$typeof){case ld:return"<"+(r(a.value)||"Unknown")+">";case cd:return":has("+(Ug(a)||"")+")";case ud:return'[role="'+a.value+'"]';case fd:return'"'+a.value+'"';case hd:return'[data-testname="'+a.value+'"]';default:throw Error(n(365))}}function oy(a,o){var u=[];a=[a,0];for(var d=0;d<a.length;){var _=a[d++],M=_.tag,P=a[d++],V=o[P];if(M!==5&&M!==26&&M!==27||!Gc(_)){for(;V!=null&&Dg(_,V);)P++,V=o[P];if(P===o.length)u.push(_);else for(_=_.child;_!==null;)a.push(_,P),_=_.sibling}}return u}function Pg(a,o){if(!Hc)throw Error(n(363));a=Ng(a),a=oy(a,o),o=[],a=Array.from(a);for(var u=0;u<a.length;){var d=a[u++],_=d.tag;if(_===5||_===26||_===27)Gc(d)||o.push(d.stateNode);else for(d=d.child;d!==null;)a.push(d),d=d.sibling}return o}function Ai(){if((Xe&2)!==0&&we!==0)return we&-we;if(fe.T!==null){var a=Wo;return a!==0?a:it()}return $E()}function ly(){ji===0&&(ji=(we&536870912)===0||Pe?L():536870912);var a=Zi.current;return a!==null&&(a.flags|=32),ji}function si(a,o,u){(a===Ze&&je===2||a.cancelPendingCommit!==null)&&(Uo(a,0),qs(a,we,ji,!1)),w(a,u),((Xe&2)===0||a!==Ze)&&(a===Ze&&((Xe&2)===0&&(Dr|=u),un===4&&qs(a,we,ji,!1)),Zt(a))}function cy(a,o,u){if((Xe&6)!==0)throw Error(n(327));var d=!u&&(o&60)===0&&(o&a.expiredLanes)===0||N(a,o),_=d?wE(a,o):Bg(a,o,!0),M=d;do{if(_===0){Qo&&!d&&qs(a,o,0,!1);break}else if(_===6)qs(a,o,0,!Qs);else{if(u=a.current.alternate,M&&!CE(u)){_=Bg(a,o,!1),M=!1;continue}if(_===2){if(M=o,a.errorRecoveryDisabledLanes&M)var P=0;else P=a.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){o=P;t:{var V=a;_=Jc;var q=ki&&V.current.memoizedState.isDehydrated;if(q&&(Uo(V,P).flags|=256),P=Bg(V,P,!1),P!==2){if(g0&&!q){V.errorRecoveryDisabledLanes|=M,Dr|=M,_=4;break t}M=Rs,Rs=_,M!==null&&Ig(M)}_=P}if(M=!1,_!==2)continue}}if(_===1){Uo(a,0),qs(a,o,0,!0);break}t:{switch(d=a,_){case 0:case 1:throw Error(n(345));case 4:if((o&4194176)===o){qs(d,o,ji,!Qs);break t}break;case 2:Rs=null;break;case 3:case 5:break;default:throw Error(n(329))}if(d.finishedWork=u,d.finishedLanes=o,(o&62914560)===o&&(M=x0+300-is(),10<M)){if(qs(d,o,ji,!Qs),A(d,0)!==0)break t;d.timeoutHandle=JE(uy.bind(null,d,u,Rs,dd,v0,o,ji,Dr,$o,Qs,2,-0,0),M);break t}uy(d,u,Rs,dd,v0,o,ji,Dr,$o,Qs,0,-0,0)}}break}while(!0);Zt(a)}function Ig(a){Rs===null?Rs=a:Rs.push.apply(Rs,a)}function uy(a,o,u,d,_,M,P,V,q,ot,yt,Bt,zt){var _e=o.subtreeFlags;if((_e&8192||(_e&16785408)===16785408)&&(iT(),iy(o),o=sT(),o!==null)){a.cancelPendingCommit=o(xy.bind(null,a,u,d,_,P,V,q,1,Bt,zt)),qs(a,M,P,!ot);return}xy(a,u,d,_,P,V,q,yt,Bt,zt)}function CE(a){for(var o=a;;){var u=o.tag;if((u===0||u===11||u===15)&&o.flags&16384&&(u=o.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var _=u[d],M=_.getSnapshot;_=_.value;try{if(!Ni(M(),_))return!1}catch{return!1}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function qs(a,o,u,d){o&=~_0,o&=~Dr,a.suspendedLanes|=o,a.pingedLanes&=~o,d&&(a.warmLanes|=o),d=a.expirationTimes;for(var _=o;0<_;){var M=31-Ri(_),P=1<<M;d[M]=-1,_&=~P}u!==0&&Y(a,u,o)}function hy(){return(Xe&6)===0?(Dt(0,!1),!1):!0}function Lg(){if(Te!==null){if(je===0)var a=Te.return;else a=Te,Js=wr=null,Nc(a),Yo=null,Yc=0,a=Te;for(;a!==null;)Wx(a.alternate,a),a=a.return;Te=null}}function Uo(a,o){a.finishedWork=null,a.finishedLanes=0;var u=a.timeoutHandle;u!==Qg&&(a.timeoutHandle=Qg,KE(u)),u=a.cancelPendingCommit,u!==null&&(a.cancelPendingCommit=null,u()),Lg(),Ze=a,Te=u=Aa(a.current,null),we=o,je=0,Ui=null,Qs=!1,Qo=N(a,o),g0=!1,$o=ji=_0=Dr=Ia=un=0,Rs=Jc=null,v0=!1,(o&8)!==0&&(o|=o&32);var d=a.entangledLanes;if(d!==0)for(a=a.entanglements,d&=o;0<d;){var _=31-Ri(d),M=1<<_;o|=a[_],d&=~M}return $s=o,ce(),u}function fy(a,o){Me=null,fe.H=Cs,o===qc?(o=ut(),je=3):o===h0?(o=ut(),je=4):je=o===cS?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Ui=o,Te===null&&(un=1,Bf(a,rt(o,a.current)))}function dy(){var a=Zi.current;return a===null?!0:(we&4194176)===we?As===null:(we&62914560)===we||(we&536870912)!==0?a===As:!1}function py(){var a=fe.H;return fe.H=Cs,a===null?Cs:a}function my(){var a=fe.A;return fe.A=gA,a}function Og(){un=4,Qs||(we&4194176)!==we&&Zi.current!==null||(Qo=!0),(Ia&134217727)===0&&(Dr&134217727)===0||Ze===null||qs(Ze,we,ji,!1)}function Bg(a,o,u){var d=Xe;Xe|=2;var _=py(),M=my();(Ze!==a||we!==o)&&(dd=null,Uo(a,o)),o=!1;var P=un;t:do try{if(je!==0&&Te!==null){var V=Te,q=Ui;switch(je){case 8:Lg(),P=6;break t;case 3:case 2:case 6:Zi.current===null&&(o=!0);var ot=je;if(je=0,Ui=null,Po(a,V,q,ot),u&&Qo){P=0;break t}break;default:ot=je,je=0,Ui=null,Po(a,V,q,ot)}}RE(),P=un;break}catch(yt){fy(a,yt)}while(!0);return o&&a.shellSuspendCounter++,Js=wr=null,Xe=d,fe.H=_,fe.A=M,Te===null&&(Ze=null,we=0,ce()),P}function RE(){for(;Te!==null;)gy(Te)}function wE(a,o){var u=Xe;Xe|=2;var d=py(),_=my();Ze!==a||we!==o?(dd=null,Kc=is()+500,Uo(a,o)):Qo=N(a,o);t:do try{if(je!==0&&Te!==null){o=Te;var M=Ui;e:switch(je){case 1:je=0,Ui=null,Po(a,o,M,1);break;case 2:if(xt(M)){je=0,Ui=null,_y(o);break}o=function(){je===2&&Ze===a&&(je=7),Zt(a)},M.then(o,o);break t;case 3:je=7;break t;case 4:je=5;break t;case 7:xt(M)?(je=0,Ui=null,_y(o)):(je=0,Ui=null,Po(a,o,M,7));break;case 5:var P=null;switch(Te.tag){case 26:P=Te.memoizedState;case 5:case 27:var V=Te,q=V.type,ot=V.pendingProps;if(P?nS(P):zy(q,ot)){je=0,Ui=null;var yt=V.sibling;if(yt!==null)Te=yt;else{var Bt=V.return;Bt!==null?(Te=Bt,Wf(Bt)):Te=null}break e}}je=0,Ui=null,Po(a,o,M,5);break;case 6:je=0,Ui=null,Po(a,o,M,6);break;case 8:Lg(),un=6;break t;default:throw Error(n(462))}}NE();break}catch(zt){fy(a,zt)}while(!0);return Js=wr=null,fe.H=d,fe.A=_,Xe=u,Te!==null?0:(Ze=null,we=0,ce(),un)}function NE(){for(;Te!==null&&!aA();)gy(Te)}function gy(a){var o=Bx(a.alternate,a,$s);a.memoizedProps=a.pendingProps,o===null?Wf(a):Te=o}function _y(a){var o=a,u=o.alternate;switch(o.tag){case 15:case 0:o=Dx(u,o,o.pendingProps,o.type,void 0,we);break;case 11:o=Dx(u,o,o.pendingProps,o.type.render,o.ref,we);break;case 5:Nc(o);default:Wx(u,o),o=Te=by(o,$s),o=Bx(u,o,$s)}a.memoizedProps=a.pendingProps,o===null?Wf(a):Te=o}function Po(a,o,u,d){Js=wr=null,Nc(o),Yo=null,Yc=0;var _=o.return;try{if(SE(a,_,o,u,we)){un=1,Bf(a,rt(u,a.current)),Te=null;return}}catch(M){if(_!==null)throw Te=_,M;un=1,Bf(a,rt(u,a.current)),Te=null;return}o.flags&32768?(Pe||d===1?a=!0:Qo||(we&536870912)!==0?a=!1:(Qs=a=!0,(d===2||d===3||d===6)&&(d=Zi.current,d!==null&&d.tag===13&&(d.flags|=16384))),vy(o,a)):Wf(o)}function Wf(a){var o=a;do{if((o.flags&32768)!==0){vy(o,Qs);return}a=o.return;var u=bE(o.alternate,o,$s);if(u!==null){Te=u;return}if(o=o.sibling,o!==null){Te=o;return}Te=o=a}while(o!==null);un===0&&(un=5)}function vy(a,o){do{var u=EE(a.alternate,a);if(u!==null){u.flags&=32767,Te=u;return}if(u=a.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!o&&(a=a.sibling,a!==null)){Te=a;return}Te=a=u}while(a!==null);un=6,Te=null}function xy(a,o,u,d,_,M,P,V,q,ot){var yt=fe.T,Bt=Mr();try{di(2),fe.T=null,DE(a,o,u,d,Bt,_,M,P,V,q,ot)}finally{fe.T=yt,di(Bt)}}function DE(a,o,u,d,_,M,P,V){do yr();while(Ur!==null);if((Xe&6)!==0)throw Error(n(327));var q=a.finishedWork;if(d=a.finishedLanes,q===null)return null;if(a.finishedWork=null,a.finishedLanes=0,q===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0,a.cancelPendingCommit=null;var ot=q.lanes|q.childLanes;if(ot|=r0,z(a,d,ot,M,P,V),a===Ze&&(Te=Ze=null,we=0),(q.subtreeFlags&10256)===0&&(q.flags&10256)===0||pd||(pd=!0,y0=ot,S0=u,LE(s0,function(){return yr(!0),null})),u=(q.flags&15990)!==0,(q.subtreeFlags&15990)!==0||u?(u=fe.T,fe.T=null,M=Mr(),di(2),P=Xe,Xe|=4,TE(a,q),ty(q,a),ZE(a.containerInfo),a.current=q,Kx(a,q.alternate,q),rA(),Xe=P,di(M),fe.T=u):a.current=q,pd?(pd=!1,Ur=a,Qc=d):yy(a,ot),ot=a.pendingLanes,ot===0&&(La=null),nt(q.stateNode,_),Zt(a),o!==null)for(_=a.onRecoverableError,q=0;q<o.length;q++)ot=o[q],_(ot.value,{componentStack:ot.stack});return(Qc&3)!==0&&yr(),ot=a.pendingLanes,(d&4194218)!==0&&(ot&42)!==0?a===M0?$c++:($c=0,M0=a):$c=0,Dt(0,!1),null}function yy(a,o){(a.pooledCacheLanes&=o)===0&&(o=a.pooledCache,o!=null&&(a.pooledCache=null,Lc(o)))}function yr(){if(Ur!==null){var a=Ur,o=y0;y0=0;var u=j(Qc),d=32>u?32:u;u=fe.T;var _=Mr();try{if(di(d),fe.T=null,Ur===null)var M=!1;else{d=S0,S0=null;var P=Ur,V=Qc;if(Ur=null,Qc=0,(Xe&6)!==0)throw Error(n(331));var q=Xe;if(Xe|=4,ay(P.current),ny(P,P.current,V,d),Xe=q,Dt(0,!1),wi&&typeof wi.onPostCommitFiberRoot=="function")try{wi.onPostCommitFiberRoot(kc,P)}catch{}M=!0}return M}finally{di(_),fe.T=u,yy(a,o)}}return!1}function Sy(a,o,u){o=rt(u,o),o=lg(a.stateNode,o,2),a=pt(a,o,2),a!==null&&(w(a,2),Zt(a))}function ke(a,o,u){if(a.tag===3)Sy(a,a,u);else for(;o!==null;){if(o.tag===3){Sy(o,a,u);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(La===null||!La.has(d))){a=rt(u,a),u=Ex(2),d=pt(o,u,2),d!==null&&(Tx(u,d,o,a),w(d,2),Zt(d));break}}o=o.return}}function Fg(a,o,u){var d=a.pingCache;if(d===null){d=a.pingCache=new _A;var _=new Set;d.set(o,_)}else _=d.get(o),_===void 0&&(_=new Set,d.set(o,_));_.has(u)||(g0=!0,_.add(u),a=UE.bind(null,a,o,u),o.then(a,a))}function UE(a,o,u){var d=a.pingCache;d!==null&&d.delete(o),a.pingedLanes|=a.suspendedLanes&u,a.warmLanes&=~u,Ze===a&&(we&u)===u&&(un===4||un===3&&(we&62914560)===we&&300>is()-x0?(Xe&2)===0&&Uo(a,0):_0|=u,$o===we&&($o=0)),Zt(a)}function My(a,o){o===0&&(o=F()),a=lt(a,o),a!==null&&(w(a,o),Zt(a))}function PE(a){var o=a.memoizedState,u=0;o!==null&&(u=o.retryLane),My(a,u)}function IE(a,o){var u=0;switch(a.tag){case 13:var d=a.stateNode,_=a.memoizedState;_!==null&&(u=_.retryLane);break;case 19:d=a.stateNode;break;case 22:d=a.stateNode._retryCache;break;default:throw Error(n(314))}d!==null&&d.delete(o),My(a,u)}function LE(a,o){return Kf(a,o)}function OE(a,o,u,d){this.tag=a,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,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 zg(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Aa(a,o){var u=a.alternate;return u===null?(u=t(a.tag,o,a.key,a.mode),u.elementType=a.elementType,u.type=a.type,u.stateNode=a.stateNode,u.alternate=a,a.alternate=u):(u.pendingProps=o,u.type=a.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=a.flags&31457280,u.childLanes=a.childLanes,u.lanes=a.lanes,u.child=a.child,u.memoizedProps=a.memoizedProps,u.memoizedState=a.memoizedState,u.updateQueue=a.updateQueue,o=a.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=a.sibling,u.index=a.index,u.ref=a.ref,u.refCleanup=a.refCleanup,u}function by(a,o){a.flags&=31457282;var u=a.alternate;return u===null?(a.childLanes=0,a.lanes=o,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=u.childLanes,a.lanes=u.lanes,a.child=u.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=u.memoizedProps,a.memoizedState=u.memoizedState,a.updateQueue=u.updateQueue,a.type=u.type,o=u.dependencies,a.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),a}function Xf(a,o,u,d,_,M){var P=0;if(d=a,typeof a=="function")zg(a)&&(P=1);else if(typeof a=="string")P=Wi&&Yn?Jy(a,u,Fn.current)?26:sS(a)?27:5:Wi?Jy(a,u,Fn.current)?26:5:Yn&&sS(a)?27:5;else t:switch(a){case Lo:return Sr(u.children,_,M,o);case Ny:P=8,_|=24;break;case Wg:return a=t(12,u,o,_|2),a.elementType=Wg,a.lanes=M,a;case qg:return a=t(13,u,o,_),a.elementType=qg,a.lanes=M,a;case Yg:return a=t(19,u,o,_),a.elementType=Yg,a.lanes=M,a;case Uy:return Ey(u,_,M,o);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case VE:case Ca:P=10;break t;case Dy:P=9;break t;case Xg:P=11;break t;case Zg:P=14;break t;case Ra:P=16,d=null;break t}P=29,u=Error(n(130,a===null?"null":typeof a,"")),d=null}return o=t(P,u,o,_),o.elementType=a,o.type=d,o.lanes=M,o}function Sr(a,o,u,d){return a=t(7,a,d,o),a.lanes=u,a}function Ey(a,o,u,d){a=t(22,a,d,o),a.elementType=Uy,a.lanes=u;var _={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var M=_._current;if(M===null)throw Error(n(456));if((_._pendingVisibility&2)===0){var P=lt(M,2);P!==null&&(_._pendingVisibility|=2,si(P,M,2))}},attach:function(){var M=_._current;if(M===null)throw Error(n(456));if((_._pendingVisibility&2)!==0){var P=lt(M,2);P!==null&&(_._pendingVisibility&=-3,si(P,M,2))}}};return a.stateNode=_,a}function Vg(a,o,u){return a=t(6,a,null,o),a.lanes=u,a}function Hg(a,o,u){return o=t(4,a.children!==null?a.children:[],a.key,o),o.lanes=u,o.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},o}function BE(a,o,u,d,_,M,P,V){this.tag=1,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Qg,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=C(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=C(0),this.hiddenUpdates=C(null),this.identifierPrefix=d,this.onUncaughtError=_,this.onCaughtError=M,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Ty(a,o,u,d,_,M,P,V,q,ot,yt,Bt){return a=new BE(a,o,u,P,V,q,ot,Bt),o=1,M===!0&&(o|=24),M=t(3,null,null,o),a.current=M,M.stateNode=a,o=xg(),o.refCount++,a.pooledCache=o,o.refCount++,M.memoizedState={element:d,isDehydrated:u,cache:o},Et(M),a}function Ay(a){return a?(a=Fo,a):Fo}function Cy(a){var o=a._reactInternals;if(o===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=g(o),a=a!==null?v(a):null,a===null?null:Vc(a.stateNode)}function Ry(a,o,u,d,_,M){_=Ay(_),d.context===null?d.context=_:d.pendingContext=_,d=Kt(o),d.payload={element:u},M=M===void 0?null:M,M!==null&&(d.callback=M),u=pt(a,d,o),u!==null&&(si(u,a,o),Ct(u,a,o))}function wy(a,o){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var u=a.retryLane;a.retryLane=u!==0&&u<o?u:o}}function Gg(a,o){wy(a,o),(a=a.alternate)&&wy(a,o)}var Ee={},FE=lr(),Ci=km(),kg=Object.assign,zE=Symbol.for("react.element"),qf=Symbol.for("react.transitional.element"),Io=Symbol.for("react.portal"),Lo=Symbol.for("react.fragment"),Ny=Symbol.for("react.strict_mode"),Wg=Symbol.for("react.profiler"),VE=Symbol.for("react.provider"),Dy=Symbol.for("react.consumer"),Ca=Symbol.for("react.context"),Xg=Symbol.for("react.forward_ref"),qg=Symbol.for("react.suspense"),Yg=Symbol.for("react.suspense_list"),Zg=Symbol.for("react.memo"),Ra=Symbol.for("react.lazy"),Uy=Symbol.for("react.offscreen"),HE=Symbol.for("react.memo_cache_sentinel"),Py=Symbol.iterator,GE=Symbol.for("react.client.reference"),fe=FE.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,jg,Iy,Jg=!1,Yf=Array.isArray,kE=i.rendererVersion,WE=i.rendererPackageName,Ly=i.extraDevToolsConfig,Vc=i.getPublicInstance,XE=i.getRootHostContext,qE=i.getChildHostContext,YE=i.prepareForCommit,ZE=i.resetAfterCommit,jE=i.createInstance,Kg=i.appendInitialChild,Oy=i.finalizeInitialChildren,Zf=i.shouldSetTextContent,By=i.createTextInstance,JE=i.scheduleTimeout,KE=i.cancelTimeout,Qg=i.noTimeout,Ys=i.isPrimaryRenderer;i.warnsIfNotActing;var qn=i.supportsMutation,wa=i.supportsPersistence,ki=i.supportsHydration,Fy=i.getInstanceFromNode;i.beforeActiveInstanceBlur,i.afterActiveInstanceBlur;var QE=i.preparePortalMount;i.prepareScopeUpdate,i.getInstanceFromScope;var di=i.setCurrentUpdatePriority,Mr=i.getCurrentUpdatePriority,$E=i.resolveUpdatePriority;i.resolveEventType,i.resolveEventTimeStamp;var tT=i.shouldAttemptEagerTransition,eT=i.detachDeletedInstance;i.requestPostPaintCallback;var nT=i.maySuspendCommit,zy=i.preloadInstance,iT=i.startSuspendingCommit,Vy=i.suspendInstance,sT=i.waitForCommitToBeReady,Oo=i.NotPendingTransition,br=i.HostTransitionContext,aT=i.resetFormInstance;i.bindToConsole;var rT=i.supportsMicrotasks,oT=i.scheduleMicrotask,Hc=i.supportsTestSelectors,lT=i.findFiberRoot,cT=i.getBoundingRect,uT=i.getTextContent,Gc=i.isHiddenSubtree,hT=i.matchAccessibilityRole,fT=i.setFocusIfFocusable,dT=i.setupIntersectionObserver,pT=i.appendChild,mT=i.appendChildToContainer,gT=i.commitTextUpdate,_T=i.commitMount,vT=i.commitUpdate,xT=i.insertBefore,yT=i.insertInContainerBefore,ST=i.removeChild,MT=i.removeChildFromContainer,Hy=i.resetTextContent,bT=i.hideInstance,ET=i.hideTextInstance,TT=i.unhideInstance,AT=i.unhideTextInstance,CT=i.clearContainer,RT=i.cloneInstance,Gy=i.createContainerChildSet,ky=i.appendChildToContainerChildSet,wT=i.finalizeContainerChildren,Wy=i.replaceContainerChildren,Xy=i.cloneHiddenInstance,qy=i.cloneHiddenTextInstance,$g=i.isSuspenseInstancePending,t0=i.isSuspenseInstanceFallback,NT=i.getSuspenseInstanceFallbackErrorDetails,DT=i.registerSuspenseInstanceRetry,UT=i.canHydrateFormStateMarker,PT=i.isFormStateMarkerMatching,Yy=i.getNextHydratableSibling,Zy=i.getFirstHydratableChild,IT=i.getFirstHydratableChildWithinContainer,LT=i.getFirstHydratableChildWithinSuspenseInstance,OT=i.canHydrateInstance,BT=i.canHydrateTextInstance,FT=i.canHydrateSuspenseInstance,zT=i.hydrateInstance,VT=i.hydrateTextInstance,HT=i.hydrateSuspenseInstance,GT=i.getNextHydratableInstanceAfterSuspenseInstance,kT=i.commitHydratedContainer,WT=i.commitHydratedSuspenseInstance,XT=i.clearSuspenseBoundary,qT=i.clearSuspenseBoundaryFromContainer,jy=i.shouldDeleteUnhydratedTailInstances;i.diffHydratedPropsForDevWarnings,i.diffHydratedTextForDevWarnings,i.describeHydratableInstanceForDevWarnings;var YT=i.validateHydratableInstance,ZT=i.validateHydratableTextInstance,Wi=i.supportsResources,Jy=i.isHostHoistableType,e0=i.getHoistableRoot,Ky=i.getResource,Qy=i.acquireResource,$y=i.releaseResource,jT=i.hydrateHoistable,tS=i.mountHoistable,eS=i.unmountHoistable,JT=i.createHoistableInstance,KT=i.prepareToCommitHoistables,QT=i.mayResourceSuspendCommit,nS=i.preloadResource,$T=i.suspendResource,Yn=i.supportsSingletons,iS=i.resolveSingletonInstance,tA=i.clearSingleton,eA=i.acquireSingletonInstance,nA=i.releaseSingletonInstance,sS=i.isHostSingletonType,n0=[],Bo=-1,Fo={},Ri=Math.clz32?Math.clz32:E,iA=Math.log,sA=Math.LN2,jf=128,Jf=4194304,Kf=Ci.unstable_scheduleCallback,i0=Ci.unstable_cancelCallback,aA=Ci.unstable_shouldYield,rA=Ci.unstable_requestPaint,is=Ci.unstable_now,aS=Ci.unstable_ImmediatePriority,oA=Ci.unstable_UserBlockingPriority,s0=Ci.unstable_NormalPriority,lA=Ci.unstable_IdlePriority,cA=Ci.log,uA=Ci.unstable_setDisableYieldValue,kc=null,wi=null,Ni=typeof Object.is=="function"?Object.is:et,rS=new WeakMap,zo=[],Vo=0,Qf=null,$f=0,Xi=[],qi=0,Er=null,Zs=1,js="",Fn=b(null),Wc=b(null),Na=b(null),td=b(null),ai=null,Zn=null,Pe=!1,ss=null,Ts=!1,a0=Error(n(519)),Yi=[],Ho=0,r0=0,ed=null,Go=null,o0=!1,nd=!1,l0=!1,ko=0,Xc=null,c0=0,Wo=0,Xo=null,Da=!1,u0=!1,hA=Object.prototype.hasOwnProperty,qc=Error(n(460)),h0=Error(n(474)),id={then:function(){}},qo=null,Yo=null,Yc=0,Tr=Mi(!0),oS=Mi(!1),Zo=b(null),sd=b(0),Zi=b(null),As=null,Mn=b(0),Ua=0,Me=null,We=null,_n=null,ad=!1,jo=!1,Ar=!1,rd=0,Zc=0,Jo=null,fA=0,f0=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},Cs={readContext:Xn,use:wo,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useLayoutEffect:Ke,useInsertionEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useSyncExternalStore:Ke,useId:Ke};Cs.useCacheRefresh=Ke,Cs.useMemoCache=Ke,Cs.useHostTransitionStatus=Ke,Cs.useFormState=Ke,Cs.useActionState=Ke,Cs.useOptimistic=Ke;var Cr={readContext:Xn,use:wo,useCallback:function(a,o){return kn().memoizedState=[a,o===void 0?null:o],a},useContext:Xn,useEffect:On,useImperativeHandle:function(a,o,u){u=u!=null?u.concat([a]):null,Ln(4194308,4,cx.bind(null,o,a),u)},useLayoutEffect:function(a,o){return Ln(4194308,4,a,o)},useInsertionEffect:function(a,o){Ln(4,2,a,o)},useMemo:function(a,o){var u=kn();o=o===void 0?null:o;var d=a();if(Ar){J(!0);try{a()}finally{J(!1)}}return u.memoizedState=[d,o],d},useReducer:function(a,o,u){var d=kn();if(u!==void 0){var _=u(o);if(Ar){J(!0);try{u(o)}finally{J(!1)}}}else _=o;return d.memoizedState=d.baseState=_,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:_},d.queue=a,a=a.dispatch=yE.bind(null,Me,a),[d.memoizedState,a]},useRef:function(a){var o=kn();return a={current:a},o.memoizedState=a},useState:function(a){a=ae(a);var o=a.queue,u=vx.bind(null,Me,o);return o.dispatch=u,[a.memoizedState,u]},useDebugValue:ig,useDeferredValue:function(a,o){var u=kn();return sg(u,a,o)},useTransition:function(){var a=ae(!1);return a=px.bind(null,Me,a.queue,!0,!1),kn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,o,u){var d=Me,_=kn();if(Pe){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Ze===null)throw Error(n(349));(we&60)!==0||Rt(d,o,u)}_.memoizedState=u;var M={value:u,getSnapshot:o};return _.queue=M,On(Pt.bind(null,d,M,a),[a]),d.flags|=2048,Ne(9,Ht.bind(null,d,M,u,o),{destroy:void 0},null),u},useId:function(){var a=kn(),o=Ze.identifierPrefix;if(Pe){var u=js,d=Zs;u=(d&~(1<<32-Ri(d)-1)).toString(32)+u,o=":"+o+"R"+u,u=rd++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=fA++,o=":"+o+"r"+u.toString(32)+":";return a.memoizedState=o},useCacheRefresh:function(){return kn().memoizedState=xE.bind(null,Me)}};Cr.useMemoCache=Dc,Cr.useHostTransitionStatus=ag,Cr.useFormState=Ae,Cr.useActionState=Ae,Cr.useOptimistic=function(a){var o=kn();o.memoizedState=o.baseState=a;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=u,o=rg.bind(null,Me,!0,u),u.dispatch=o,[a,o]};var Pa={readContext:Xn,use:wo,useCallback:hx,useContext:Xn,useEffect:mr,useImperativeHandle:ux,useInsertionEffect:Es,useLayoutEffect:lx,useMemo:fx,useReducer:W,useRef:In,useState:function(){return W(U)},useDebugValue:ig,useDeferredValue:function(a,o){var u=on();return dx(u,We.memoizedState,a,o)},useTransition:function(){var a=W(U)[0],o=on().memoizedState;return[typeof a=="boolean"?a:pr(a),o]},useSyncExternalStore:Z,useId:gx};Pa.useCacheRefresh=_x,Pa.useMemoCache=Dc,Pa.useHostTransitionStatus=ag,Pa.useFormState=Wn,Pa.useActionState=Wn,Pa.useOptimistic=function(a,o){var u=on();return te(u,We,a,o)};var Rr={readContext:Xn,use:wo,useCallback:hx,useContext:Xn,useEffect:mr,useImperativeHandle:ux,useInsertionEffect:Es,useLayoutEffect:lx,useMemo:fx,useReducer:Q,useRef:In,useState:function(){return Q(U)},useDebugValue:ig,useDeferredValue:function(a,o){var u=on();return We===null?sg(u,a,o):dx(u,We.memoizedState,a,o)},useTransition:function(){var a=Q(U)[0],o=on().memoizedState;return[typeof a=="boolean"?a:pr(a),o]},useSyncExternalStore:Z,useId:gx};Rr.useCacheRefresh=_x,Rr.useMemoCache=Dc,Rr.useHostTransitionStatus=ag,Rr.useFormState=Sa,Rr.useActionState=Sa,Rr.useOptimistic=function(a,o){var u=on();return We!==null?te(u,We,a,o):(u.baseState=a,[a,u.queue.dispatch])};var d0={isMounted:function(a){return(a=a._reactInternals)?p(a)===a:!1},enqueueSetState:function(a,o,u){a=a._reactInternals;var d=Ai(),_=Kt(d);_.payload=o,u!=null&&(_.callback=u),o=pt(a,_,d),o!==null&&(si(o,a,d),Ct(o,a,d))},enqueueReplaceState:function(a,o,u){a=a._reactInternals;var d=Ai(),_=Kt(d);_.tag=1,_.payload=o,u!=null&&(_.callback=u),o=pt(a,_,d),o!==null&&(si(o,a,d),Ct(o,a,d))},enqueueForceUpdate:function(a,o){a=a._reactInternals;var u=Ai(),d=Kt(u);d.tag=2,o!=null&&(d.callback=o),o=pt(a,d,u),o!==null&&(si(o,a,u),Ct(o,a,u))}},lS=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},cS=Error(n(461)),Cn=!1,p0={dehydrated:null,treeContext:null,retryLane:0},od=b(null),wr=null,Js=null,dA=typeof AbortController<"u"?AbortController:function(){var a=[],o=this.signal={aborted:!1,addEventListener:function(u,d){a.push(d)}};this.abort=function(){o.aborted=!0,a.forEach(function(u){return u()})}},pA=Ci.unstable_scheduleCallback,mA=Ci.unstable_NormalPriority,ln={$$typeof:Ca,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},uS=fe.S;fe.S=function(a,o){typeof o=="object"&&o!==null&&typeof o.then=="function"&&ht(a,o),uS!==null&&uS(a,o)};var Nr=b(null),Ks=!1,cn=!1,m0=!1,hS=typeof WeakSet=="function"?WeakSet:Set,Rn=null,fS=!1,vn=null,Di=!1,as=null,Ko=8192,gA={getCacheForType:function(a){var o=Xn(ln),u=o.data.get(a);return u===void 0&&(u=a(),o.data.set(a,u)),u}},ld=0,cd=1,ud=2,hd=3,fd=4;if(typeof Symbol=="function"&&Symbol.for){var jc=Symbol.for;ld=jc("selector.component"),cd=jc("selector.has_pseudo_class"),ud=jc("selector.role"),hd=jc("selector.test_id"),fd=jc("selector.text")}var _A=typeof WeakMap=="function"?WeakMap:Map,Xe=0,Ze=null,Te=null,we=0,je=0,Ui=null,Qs=!1,Qo=!1,g0=!1,$s=0,un=0,Ia=0,Dr=0,_0=0,ji=0,$o=0,Jc=null,Rs=null,v0=!1,x0=0,Kc=1/0,dd=null,La=null,pd=!1,Ur=null,Qc=0,y0=0,S0=null,$c=0,M0=null;return Ee.attemptContinuousHydration=function(a){if(a.tag===13){var o=lt(a,67108864);o!==null&&si(o,a,67108864),Gg(a,67108864)}},Ee.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var o=Ai(),u=lt(a,o);u!==null&&si(u,a,o),Gg(a,o)}},Ee.attemptSynchronousHydration=function(a){switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=T(a.pendingLanes);if(o!==0){for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var u=1<<31-Ri(o);a.entanglements[1]|=u,o&=~u}Zt(a),(Xe&6)===0&&(Kc=is()+500,Dt(0,!1))}}break;case 13:o=lt(a,2),o!==null&&si(o,a,2),hy(),Gg(a,2)}},Ee.batchedUpdates=function(a,o){return a(o)},Ee.createComponentSelector=function(a){return{$$typeof:ld,value:a}},Ee.createContainer=function(a,o,u,d,_,M,P,V,q,ot){return Ty(a,o,!1,null,u,d,M,P,V,q,ot,null)},Ee.createHasPseudoClassSelector=function(a){return{$$typeof:cd,value:a}},Ee.createHydrationContainer=function(a,o,u,d,_,M,P,V,q,ot,yt,Bt,zt){return a=Ty(u,d,!0,a,_,M,V,q,ot,yt,Bt,zt),a.context=Ay(null),u=a.current,d=Ai(),_=Kt(d),_.callback=o??null,pt(u,_,d),a.current.lanes=d,w(a,d),Zt(a),a},Ee.createPortal=function(a,o,u){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Io,key:d==null?null:""+d,children:a,containerInfo:o,implementation:u}},Ee.createRoleSelector=function(a){return{$$typeof:ud,value:a}},Ee.createTestNameSelector=function(a){return{$$typeof:hd,value:a}},Ee.createTextSelector=function(a){return{$$typeof:fd,value:a}},Ee.defaultOnCaughtError=function(a){console.error(a)},Ee.defaultOnRecoverableError=function(a){lS(a)},Ee.defaultOnUncaughtError=function(a){lS(a)},Ee.deferredUpdates=function(a){var o=fe.T,u=Mr();try{return di(32),fe.T=null,a()}finally{di(u),fe.T=o}},Ee.discreteUpdates=function(a,o,u,d,_){var M=fe.T,P=Mr();try{return di(2),fe.T=null,a(o,u,d,_)}finally{di(P),fe.T=M,Xe===0&&(Kc=is()+500)}},Ee.findAllNodes=Pg,Ee.findBoundingRects=function(a,o){if(!Hc)throw Error(n(363));o=Pg(a,o),a=[];for(var u=0;u<o.length;u++)a.push(cT(o[u]));for(o=a.length-1;0<o;o--){u=a[o];for(var d=u.x,_=d+u.width,M=u.y,P=M+u.height,V=o-1;0<=V;V--)if(o!==V){var q=a[V],ot=q.x,yt=ot+q.width,Bt=q.y,zt=Bt+q.height;if(d>=ot&&M>=Bt&&_<=yt&&P<=zt){a.splice(o,1);break}else if(d!==ot||u.width!==q.width||zt<M||Bt>P){if(!(M!==Bt||u.height!==q.height||yt<d||ot>_)){ot>d&&(q.width+=ot-d,q.x=d),yt<_&&(q.width=_-ot),a.splice(o,1);break}}else{Bt>M&&(q.height+=Bt-M,q.y=M),zt<P&&(q.height=P-Bt),a.splice(o,1);break}}}return a},Ee.findHostInstance=Cy,Ee.findHostInstanceWithNoPortals=function(a){return a=g(a),a=a!==null?y(a):null,a===null?null:Vc(a.stateNode)},Ee.findHostInstanceWithWarning=function(a){return Cy(a)},Ee.flushPassiveEffects=yr,Ee.flushSyncFromReconciler=function(a){var o=Xe;Xe|=1;var u=fe.T,d=Mr();try{if(di(2),fe.T=null,a)return a()}finally{di(d),fe.T=u,Xe=o,(Xe&6)===0&&Dt(0,!1)}},Ee.flushSyncWork=hy,Ee.focusWithin=function(a,o){if(!Hc)throw Error(n(363));for(a=Ng(a),o=oy(a,o),o=Array.from(o),a=0;a<o.length;){var u=o[a++],d=u.tag;if(!Gc(u)){if((d===5||d===26||d===27)&&fT(u.stateNode))return!0;for(u=u.child;u!==null;)o.push(u),u=u.sibling}}return!1},Ee.getFindAllNodesFailureDescription=function(a,o){if(!Hc)throw Error(n(363));var u=0,d=[];a=[Ng(a),0];for(var _=0;_<a.length;){var M=a[_++],P=M.tag,V=a[_++],q=o[V];if((P!==5&&P!==26&&P!==27||!Gc(M))&&(Dg(M,q)&&(d.push(Ug(q)),V++,V>u&&(u=V)),V<o.length))for(M=M.child;M!==null;)a.push(M,V),M=M.sibling}if(u<o.length){for(a=[];u<o.length;u++)a.push(Ug(o[u]));return`findAllNodes was able to match part of the selector:
9
9
  `+(d.join(" > ")+`
10
10
 
11
11
  No matching component was found for:
12
- `)+a.join(" > ")}return null},Ee.getPublicRootInstance=function(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 27:case 5:return Vc(a.child.stateNode);default:return a.child.stateNode}},Ee.injectIntoDevTools=function(){var a={bundleType:0,version:GE,rendererPackageName:kE,currentDispatcherRef:fe,findFiberByHostInstance:Fy,reconcilerVersion:"19.0.0"};if(Ly!==null&&(a.rendererConfig=Ly),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)a=!0;else{try{kc=o.inject(a),wi=o}catch{}a=!!o.checkDCE}}return a},Ee.isAlreadyRendering=function(){return!1},Ee.observeVisibleRects=function(a,o,u,d){if(!Hc)throw Error(n(363));a=Pg(a,o);var _=fT(a,u,d).disconnect;return{disconnect:function(){_()}}},Ee.shouldError=function(){return null},Ee.shouldSuspend=function(){return!1},Ee.startHostTransition=function(a,o,u,d){if(a.tag!==5)throw Error(n(476));var _=mx(a).queue;px(a,_,o,Oo,u===null?e:function(){var M=mx(a).next.queue;return Uc(a,M,{},Ai()),u(d)})},Ee.updateContainer=function(a,o,u,d){var _=o.current,M=Ai();return Ry(_,M,a,o,u,d),M},Ee.updateContainerSync=function(a,o,u,d){return o.tag===0&&xr(),Ry(o.current,2,a,o,u,d),2},Ee};Pf.exports.default=Pf.exports;Object.defineProperty(Pf.exports,"__esModule",{value:!0})});var Hv=pi((BU,V1)=>{"use strict";V1.exports=z1()});var G1=pi(Wm=>{"use strict";var HD=Symbol.for("react.transitional.element"),GD=Symbol.for("react.fragment");function H1(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var s in t)s!=="key"&&(e[s]=t[s])}else e=t;return t=e.ref,{$$typeof:HD,type:i,key:n,ref:t!==void 0?t:null,props:e}}Wm.Fragment=GD;Wm.jsx=H1;Wm.jsxs=H1});var So=pi((zU,k1)=>{"use strict";k1.exports=G1()});var Lm={};bA(Lm,{ACESFilmicToneMapping:()=>rc,AddEquation:()=>ca,AddOperation:()=>H_,AdditiveAnimationBlendMode:()=>Rm,AdditiveBlending:()=>fm,AgXToneMapping:()=>xm,AlphaFormat:()=>Am,AlwaysCompare:()=>$_,AlwaysDepth:()=>Dh,AlwaysStencilFunc:()=>sp,AmbientLight:()=>yh,AnimationAction:()=>wh,AnimationClip:()=>nr,AnimationLoader:()=>bp,AnimationMixer:()=>Op,AnimationObjectGroup:()=>Lp,AnimationUtils:()=>Mp,ArcCurve:()=>Vu,ArrayCamera:()=>Ah,ArrowHelper:()=>am,AttachedBindMode:()=>ip,Audio:()=>Ch,AudioAnalyser:()=>Ip,AudioContext:()=>ic,AudioListener:()=>Up,AudioLoader:()=>Np,AxesHelper:()=>rm,BackSide:()=>ti,BasicDepthPacking:()=>q_,BasicShadowMap:()=>hm,BatchedMesh:()=>Du,Bone:()=>Ll,BooleanKeyframeTrack:()=>Ls,Box2:()=>qp,Box3:()=>bn,Box3Helper:()=>im,BoxGeometry:()=>ja,BoxHelper:()=>nm,BufferAttribute:()=>He,BufferGeometry:()=>de,BufferGeometryLoader:()=>Th,ByteType:()=>Mm,Cache:()=>fs,Camera:()=>Qr,CameraHelper:()=>em,CanvasTexture:()=>yp,CapsuleGeometry:()=>Ou,CatmullRomCurve3:()=>Hu,CineonToneMapping:()=>_m,CircleGeometry:()=>Bu,ClampToEdgeWrapping:()=>li,Clock:()=>oo,Color:()=>Lt,ColorKeyframeTrack:()=>$l,ColorManagement:()=>be,CompressedArrayTexture:()=>vp,CompressedCubeTexture:()=>xp,CompressedTexture:()=>no,CompressedTextureLoader:()=>Ep,ConeGeometry:()=>zl,ConstantAlphaFactor:()=>F_,ConstantColorFactor:()=>O_,Controls:()=>lm,CubeCamera:()=>Mu,CubeDepthTexture:()=>Lu,CubeReflectionMapping:()=>xs,CubeRefractionMapping:()=>ga,CubeTexture:()=>Ja,CubeTextureLoader:()=>Tp,CubeUVReflectionMapping:()=>co,CubicBezierCurve:()=>Vl,CubicBezierCurve3:()=>Gu,CubicInterpolant:()=>fh,CullFaceBack:()=>um,CullFaceFront:()=>S_,CullFaceFrontBack:()=>SM,CullFaceNone:()=>y_,Curve:()=>yi,CurvePath:()=>Wu,CustomBlending:()=>M_,CustomToneMapping:()=>vm,CylinderGeometry:()=>Fl,Cylindrical:()=>Wp,Data3DTexture:()=>Kr,DataArrayTexture:()=>Jr,DataTexture:()=>vi,DataTextureLoader:()=>Ap,DataUtils:()=>op,DecrementStencilOp:()=>zM,DecrementWrapStencilOp:()=>HM,DefaultLoadingManager:()=>ov,DepthFormat:()=>ds,DepthStencilFormat:()=>_a,DepthTexture:()=>da,DetachedBindMode:()=>G_,DirectionalLight:()=>xh,DirectionalLightHelper:()=>tm,DiscreteInterpolant:()=>dh,DodecahedronGeometry:()=>Fu,DoubleSide:()=>_s,DstAlphaFactor:()=>D_,DstColorFactor:()=>P_,DynamicCopyUsage:()=>nb,DynamicDrawUsage:()=>JM,DynamicReadUsage:()=>$M,EdgesGeometry:()=>zu,EllipseCurve:()=>io,EqualCompare:()=>J_,EqualDepth:()=>Ph,EqualStencilFunc:()=>XM,EquirectangularReflectionMapping:()=>oc,EquirectangularRefractionMapping:()=>lc,Euler:()=>xi,EventDispatcher:()=>Oi,ExternalTexture:()=>Bl,ExtrudeGeometry:()=>Zu,FileLoader:()=>$i,Float16BufferAttribute:()=>dp,Float32BufferAttribute:()=>Gt,FloatType:()=>Qn,Fog:()=>Eu,FogExp2:()=>bu,FramebufferTexture:()=>_p,FrontSide:()=>Us,Frustum:()=>fa,FrustumArray:()=>Nu,GLBufferAttribute:()=>Hp,GLSL1:()=>sb,GLSL3:()=>wm,GreaterCompare:()=>K_,GreaterDepth:()=>Lh,GreaterEqualCompare:()=>Tf,GreaterEqualDepth:()=>Ih,GreaterEqualStencilFunc:()=>jM,GreaterStencilFunc:()=>YM,GridHelper:()=>Qp,Group:()=>oa,HalfFloatType:()=>Ss,HemisphereLight:()=>mh,HemisphereLightHelper:()=>Kp,IcosahedronGeometry:()=>ju,ImageBitmapLoader:()=>wp,ImageLoader:()=>ir,ImageUtils:()=>Su,IncrementStencilOp:()=>FM,IncrementWrapStencilOp:()=>VM,InstancedBufferAttribute:()=>ha,InstancedBufferGeometry:()=>Eh,InstancedInterleavedBuffer:()=>Vp,InstancedMesh:()=>wu,Int16BufferAttribute:()=>hp,Int32BufferAttribute:()=>fp,Int8BufferAttribute:()=>lp,IntType:()=>Fh,InterleavedBuffer:()=>eo,InterleavedBufferAttribute:()=>Ka,Interpolant:()=>Qa,InterpolateDiscrete:()=>El,InterpolateLinear:()=>yu,InterpolateSmooth:()=>pu,InterpolationSamplingMode:()=>ob,InterpolationSamplingType:()=>rb,InvertStencilOp:()=>GM,KeepStencilOp:()=>ka,KeyframeTrack:()=>ui,LOD:()=>Au,LatheGeometry:()=>Ju,Layers:()=>Is,LessCompare:()=>j_,LessDepth:()=>Uh,LessEqualCompare:()=>Ef,LessEqualDepth:()=>Ya,LessEqualStencilFunc:()=>qM,LessStencilFunc:()=>WM,Light:()=>gs,LightProbe:()=>Mh,Line:()=>ms,Line3:()=>Yp,LineBasicMaterial:()=>Pn,LineCurve:()=>Hl,LineCurve3:()=>ku,LineDashedMaterial:()=>hh,LineLoop:()=>Uu,LineSegments:()=>Bi,LinearFilter:()=>Je,LinearInterpolant:()=>Ql,LinearMipMapLinearFilter:()=>TM,LinearMipMapNearestFilter:()=>EM,LinearMipmapLinearFilter:()=>ys,LinearMipmapNearestFilter:()=>cc,LinearSRGBColorSpace:()=>Ps,LinearToneMapping:()=>mm,LinearTransfer:()=>Al,Loader:()=>Hn,LoaderUtils:()=>nc,LoadingManager:()=>tc,LoopOnce:()=>k_,LoopPingPong:()=>X_,LoopRepeat:()=>W_,MOUSE:()=>xM,Material:()=>En,MaterialLoader:()=>bh,MathUtils:()=>fb,Matrix2:()=>Xp,Matrix3:()=>pe,Matrix4:()=>ue,MaxEquation:()=>A_,Mesh:()=>rn,MeshBasicMaterial:()=>ps,MeshDepthMaterial:()=>Jl,MeshDistanceMaterial:()=>Kl,MeshLambertMaterial:()=>ch,MeshMatcapMaterial:()=>uh,MeshNormalMaterial:()=>lh,MeshPhongMaterial:()=>rh,MeshPhysicalMaterial:()=>ah,MeshStandardMaterial:()=>jl,MeshToonMaterial:()=>oh,MinEquation:()=>T_,MirroredRepeatWrapping:()=>bl,MixOperation:()=>V_,MultiplyBlending:()=>pm,MultiplyOperation:()=>ac,NearestFilter:()=>dn,NearestMipMapLinearFilter:()=>bM,NearestMipMapNearestFilter:()=>MM,NearestMipmapLinearFilter:()=>uo,NearestMipmapNearestFilter:()=>Sm,NeutralToneMapping:()=>ym,NeverCompare:()=>Z_,NeverDepth:()=>Nh,NeverStencilFunc:()=>kM,NoBlending:()=>vs,NoColorSpace:()=>Fs,NoNormalPacking:()=>PM,NoToneMapping:()=>Si,NormalAnimationBlendMode:()=>bf,NormalBlending:()=>qa,NormalGAPacking:()=>LM,NormalRGPacking:()=>IM,NotEqualCompare:()=>Q_,NotEqualDepth:()=>Oh,NotEqualStencilFunc:()=>ZM,NumberKeyframeTrack:()=>$a,Object3D:()=>Oe,ObjectLoader:()=>Rp,ObjectSpaceNormalMap:()=>Y_,OctahedronGeometry:()=>ql,OneFactor:()=>R_,OneMinusConstantAlphaFactor:()=>z_,OneMinusConstantColorFactor:()=>B_,OneMinusDstAlphaFactor:()=>U_,OneMinusDstColorFactor:()=>I_,OneMinusSrcAlphaFactor:()=>xu,OneMinusSrcColorFactor:()=>N_,OrthographicCamera:()=>Bs,PCFShadowMap:()=>sr,PCFSoftShadowMap:()=>lo,PMREMGenerator:()=>wf,Path:()=>so,PerspectiveCamera:()=>fn,Plane:()=>cs,PlaneGeometry:()=>ro,PlaneHelper:()=>sm,PointLight:()=>vh,PointLightHelper:()=>Jp,Points:()=>Pu,PointsMaterial:()=>Ol,PolarGridHelper:()=>$p,PolyhedronGeometry:()=>pa,PositionalAudio:()=>Pp,PropertyBinding:()=>Ge,PropertyMixer:()=>Rh,QuadraticBezierCurve:()=>Gl,QuadraticBezierCurve3:()=>kl,Quaternion:()=>Vn,QuaternionKeyframeTrack:()=>tr,QuaternionLinearInterpolant:()=>ph,R11_EAC_Format:()=>Kh,RED_GREEN_RGTC2_Format:()=>Sf,RED_RGTC1_Format:()=>xf,REVISION:()=>x_,RG11_EAC_Format:()=>$h,RGBADepthPacking:()=>NM,RGBAFormat:()=>Un,RGBAIntegerFormat:()=>kh,RGBA_ASTC_10x10_Format:()=>df,RGBA_ASTC_10x5_Format:()=>uf,RGBA_ASTC_10x6_Format:()=>hf,RGBA_ASTC_10x8_Format:()=>ff,RGBA_ASTC_12x10_Format:()=>pf,RGBA_ASTC_12x12_Format:()=>mf,RGBA_ASTC_4x4_Format:()=>ef,RGBA_ASTC_5x4_Format:()=>nf,RGBA_ASTC_5x5_Format:()=>sf,RGBA_ASTC_6x5_Format:()=>af,RGBA_ASTC_6x6_Format:()=>rf,RGBA_ASTC_8x5_Format:()=>of,RGBA_ASTC_8x6_Format:()=>lf,RGBA_ASTC_8x8_Format:()=>cf,RGBA_BPTC_Format:()=>gf,RGBA_ETC2_EAC_Format:()=>Jh,RGBA_PVRTC_2BPPV1_Format:()=>Yh,RGBA_PVRTC_4BPPV1_Format:()=>qh,RGBA_S3TC_DXT1_Format:()=>fc,RGBA_S3TC_DXT3_Format:()=>dc,RGBA_S3TC_DXT5_Format:()=>pc,RGBDepthPacking:()=>DM,RGBFormat:()=>Cm,RGBIntegerFormat:()=>AM,RGB_BPTC_SIGNED_Format:()=>_f,RGB_BPTC_UNSIGNED_Format:()=>vf,RGB_ETC1_Format:()=>Zh,RGB_ETC2_Format:()=>jh,RGB_PVRTC_2BPPV1_Format:()=>Xh,RGB_PVRTC_4BPPV1_Format:()=>Wh,RGB_S3TC_DXT1_Format:()=>hc,RGDepthPacking:()=>UM,RGFormat:()=>ar,RGIntegerFormat:()=>Gh,RawShaderMaterial:()=>Zl,Ray:()=>ua,Raycaster:()=>sc,RectAreaLight:()=>Sh,RedFormat:()=>Hh,RedIntegerFormat:()=>uc,ReinhardToneMapping:()=>gm,RenderTarget:()=>Nl,RenderTarget3D:()=>Bp,RepeatWrapping:()=>Ml,ReplaceStencilOp:()=>BM,ReverseSubtractEquation:()=>E_,RingGeometry:()=>Ku,SIGNED_R11_EAC_Format:()=>Qh,SIGNED_RED_GREEN_RGTC2_Format:()=>Mf,SIGNED_RED_RGTC1_Format:()=>yf,SIGNED_RG11_EAC_Format:()=>tf,SRGBColorSpace:()=>Dn,SRGBTransfer:()=>Ve,Scene:()=>to,ShaderChunk:()=>xe,ShaderLib:()=>Ms,ShaderMaterial:()=>ci,ShadowMaterial:()=>sh,Shape:()=>Ds,ShapeGeometry:()=>Qu,ShapePath:()=>om,ShapeUtils:()=>Qi,ShortType:()=>bm,Skeleton:()=>Ru,SkeletonHelper:()=>jp,SkinnedMesh:()=>Cu,Source:()=>hs,Sphere:()=>yn,SphereGeometry:()=>Yl,Spherical:()=>kp,SphericalHarmonics3:()=>ec,SplineCurve:()=>Wl,SpotLight:()=>_h,SpotLightHelper:()=>Zp,Sprite:()=>Tu,SpriteMaterial:()=>Il,SrcAlphaFactor:()=>vu,SrcAlphaSaturateFactor:()=>L_,SrcColorFactor:()=>w_,StaticCopyUsage:()=>eb,StaticDrawUsage:()=>Cl,StaticReadUsage:()=>QM,StereoCamera:()=>Dp,StreamCopyUsage:()=>ib,StreamDrawUsage:()=>KM,StreamReadUsage:()=>tb,StringKeyframeTrack:()=>Os,SubtractEquation:()=>b_,SubtractiveBlending:()=>dm,TOUCH:()=>yM,TangentSpaceNormalMap:()=>va,TetrahedronGeometry:()=>$u,Texture:()=>mn,TextureLoader:()=>Cp,TextureUtils:()=>cm,Timer:()=>Gp,TimestampQuery:()=>ab,TorusGeometry:()=>th,TorusKnotGeometry:()=>eh,Triangle:()=>us,TriangleFanDrawMode:()=>wM,TriangleStripDrawMode:()=>RM,TrianglesDrawMode:()=>CM,TubeGeometry:()=>nh,UVMapping:()=>Bh,Uint16BufferAttribute:()=>Dl,Uint32BufferAttribute:()=>Ul,Uint8BufferAttribute:()=>cp,Uint8ClampedBufferAttribute:()=>up,Uniform:()=>Fp,UniformsGroup:()=>zp,UniformsLib:()=>It,UniformsUtils:()=>sv,UnsignedByteType:()=>Gn,UnsignedInt101111Type:()=>Tm,UnsignedInt248Type:()=>fo,UnsignedInt5999Type:()=>Em,UnsignedIntType:()=>Fi,UnsignedShort4444Type:()=>zh,UnsignedShort5551Type:()=>Vh,UnsignedShortType:()=>ho,VSMShadowMap:()=>ma,Vector2:()=>ft,Vector3:()=>O,Vector4:()=>qe,VectorKeyframeTrack:()=>er,VideoFrameTexture:()=>gp,VideoTexture:()=>Iu,WebGL3DRenderTarget:()=>rp,WebGLArrayRenderTarget:()=>ap,WebGLCoordinateSystem:()=>_i,WebGLCubeRenderTarget:()=>Pl,WebGLRenderTarget:()=>$n,WebGLRenderer:()=>vo,WebGLUtils:()=>Zb,WebGPUCoordinateSystem:()=>Yr,WebXRController:()=>$r,WireframeGeometry:()=>ih,WrapAroundEnding:()=>Tl,ZeroCurvatureEnding:()=>Wa,ZeroFactor:()=>C_,ZeroSlopeEnding:()=>Xa,ZeroStencilOp:()=>OM,createCanvasElement:()=>ev,error:()=>Qt,getConsoleFunction:()=>ub,log:()=>wl,setConsoleFunction:()=>cb,warn:()=>wt,warnOnce:()=>Zr});var x_="182",xM={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yM={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},y_=0,um=1,S_=2,SM=3,hm=0,sr=1,lo=2,ma=3,Us=0,ti=1,_s=2,vs=0,qa=1,fm=2,dm=3,pm=4,M_=5,ca=100,b_=101,E_=102,T_=103,A_=104,C_=200,R_=201,w_=202,N_=203,vu=204,xu=205,D_=206,U_=207,P_=208,I_=209,L_=210,O_=211,B_=212,F_=213,z_=214,Nh=0,Dh=1,Uh=2,Ya=3,Ph=4,Ih=5,Lh=6,Oh=7,ac=0,V_=1,H_=2,Si=0,mm=1,gm=2,_m=3,rc=4,vm=5,xm=6,ym=7,ip="attached",G_="detached",Bh=300,xs=301,ga=302,oc=303,lc=304,co=306,Ml=1e3,li=1001,bl=1002,dn=1003,Sm=1004,MM=1004,uo=1005,bM=1005,Je=1006,cc=1007,EM=1007,ys=1008,TM=1008,Gn=1009,Mm=1010,bm=1011,ho=1012,Fh=1013,Fi=1014,Qn=1015,Ss=1016,zh=1017,Vh=1018,fo=1020,Em=35902,Tm=35899,Am=1021,Cm=1022,Un=1023,ds=1026,_a=1027,Hh=1028,uc=1029,ar=1030,Gh=1031,AM=1032,kh=1033,hc=33776,fc=33777,dc=33778,pc=33779,Wh=35840,Xh=35841,qh=35842,Yh=35843,Zh=36196,jh=37492,Jh=37496,Kh=37488,Qh=37489,$h=37490,tf=37491,ef=37808,nf=37809,sf=37810,af=37811,rf=37812,of=37813,lf=37814,cf=37815,uf=37816,hf=37817,ff=37818,df=37819,pf=37820,mf=37821,gf=36492,_f=36494,vf=36495,xf=36283,yf=36284,Sf=36285,Mf=36286,k_=2200,W_=2201,X_=2202,El=2300,yu=2301,pu=2302,Wa=2400,Xa=2401,Tl=2402,bf=2500,Rm=2501,CM=0,RM=1,wM=2,q_=3200,NM=3201,DM=3202,UM=3203,va=0,Y_=1,Fs="",Dn="srgb",Ps="srgb-linear",Al="linear",Ve="srgb",PM="",IM="rg",LM="ga",OM=0,ka=7680,BM=7681,FM=7682,zM=7683,VM=34055,HM=34056,GM=5386,kM=512,WM=513,XM=514,qM=515,YM=516,ZM=517,jM=518,sp=519,Z_=512,j_=513,J_=514,Ef=515,K_=516,Q_=517,Tf=518,$_=519,Cl=35044,JM=35048,KM=35040,QM=35045,$M=35049,tb=35041,eb=35046,nb=35050,ib=35042,sb="100",wm="300 es",_i=2e3,Yr=2001,ab={COMPUTE:"compute",RENDER:"render"},rb={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},ob={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function tv(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}var TA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function yl(i,t){return new TA[i](t)}function lb(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Rl(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ev(){let i=Rl("canvas");return i.style.display="block",i}var dS={},Za=null;function cb(i){Za=i}function ub(){return Za}function wl(...i){let t="THREE."+i.shift();Za?Za("log",t,...i):console.log(t,...i)}function wt(...i){let t="THREE."+i.shift();Za?Za("warn",t,...i):console.warn(t,...i)}function Qt(...i){let t="THREE."+i.shift();Za?Za("error",t,...i):console.error(t,...i)}function Zr(...i){let t=i.join(" ");t in dS||(dS[t]=!0,wt(...i))}function hb(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var Oi=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let s=n[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,l=s.length;r<l;r++)s[r].call(this,t);t.target=null}}},jn=["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"],pS=1234567,qr=Math.PI/180,jr=180/Math.PI;function Li(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(jn[i&255]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]+"-"+jn[t&255]+jn[t>>8&255]+"-"+jn[t>>16&15|64]+jn[t>>24&255]+"-"+jn[e&63|128]+jn[e>>8&255]+"-"+jn[e>>16&255]+jn[e>>24&255]+jn[n&255]+jn[n>>8&255]+jn[n>>16&255]+jn[n>>24&255]).toLowerCase()}function le(i,t,e){return Math.max(t,Math.min(e,i))}function nv(i,t){return(i%t+t)%t}function AA(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}function CA(i,t,e){return i!==t?(e-i)/(t-i):0}function mu(i,t,e){return(1-e)*i+e*t}function RA(i,t,e,n){return mu(i,t,1-Math.exp(-e*n))}function wA(i,t=1){return t-Math.abs(nv(i,t*2)-t)}function NA(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function DA(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function UA(i,t){return i+Math.floor(Math.random()*(t-i+1))}function PA(i,t){return i+Math.random()*(t-i)}function IA(i){return i*(.5-Math.random())}function LA(i){i!==void 0&&(pS=i);let t=pS+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function OA(i){return i*qr}function BA(i){return i*jr}function FA(i){return(i&i-1)===0&&i!==0}function zA(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function VA(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function HA(i,t,e,n,s){let r=Math.cos,l=Math.sin,c=r(e/2),h=l(e/2),f=r((t+n)/2),p=l((t+n)/2),m=r((t-n)/2),g=l((t-n)/2),v=r((n-t)/2),y=l((n-t)/2);switch(s){case"XYX":i.set(c*p,h*m,h*g,c*f);break;case"YZY":i.set(h*g,c*p,h*m,c*f);break;case"ZXZ":i.set(h*m,h*g,c*p,c*f);break;case"XZX":i.set(c*p,h*y,h*v,c*f);break;case"YXY":i.set(h*v,c*p,h*y,c*f);break;case"ZYZ":i.set(h*y,h*v,c*p,c*f);break;default:wt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function oi(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function ve(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var fb={DEG2RAD:qr,RAD2DEG:jr,generateUUID:Li,clamp:le,euclideanModulo:nv,mapLinear:AA,inverseLerp:CA,lerp:mu,damp:RA,pingpong:wA,smoothstep:NA,smootherstep:DA,randInt:UA,randFloat:PA,randFloatSpread:IA,seededRandom:LA,degToRad:OA,radToDeg:BA,isPowerOfTwo:FA,ceilPowerOfTwo:zA,floorPowerOfTwo:VA,setQuaternionFromProperEuler:HA,normalize:ve,denormalize:oi},ft=class i{constructor(t=0,e=0){i.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(le(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,l=this.y-t.y;return this.x=r*n-l*s+t.x,this.y=r*s+l*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Vn=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,l,c){let h=n[s+0],f=n[s+1],p=n[s+2],m=n[s+3],g=r[l+0],v=r[l+1],y=r[l+2],b=r[l+3];if(c<=0){t[e+0]=h,t[e+1]=f,t[e+2]=p,t[e+3]=m;return}if(c>=1){t[e+0]=g,t[e+1]=v,t[e+2]=y,t[e+3]=b;return}if(m!==b||h!==g||f!==v||p!==y){let S=h*g+f*v+p*y+m*b;S<0&&(g=-g,v=-v,y=-y,b=-b,S=-S);let x=1-c;if(S<.9995){let E=Math.acos(S),T=Math.sin(E);x=Math.sin(x*E)/T,c=Math.sin(c*E)/T,h=h*x+g*c,f=f*x+v*c,p=p*x+y*c,m=m*x+b*c}else{h=h*x+g*c,f=f*x+v*c,p=p*x+y*c,m=m*x+b*c;let E=1/Math.sqrt(h*h+f*f+p*p+m*m);h*=E,f*=E,p*=E,m*=E}}t[e]=h,t[e+1]=f,t[e+2]=p,t[e+3]=m}static multiplyQuaternionsFlat(t,e,n,s,r,l){let c=n[s],h=n[s+1],f=n[s+2],p=n[s+3],m=r[l],g=r[l+1],v=r[l+2],y=r[l+3];return t[e]=c*y+p*m+h*v-f*g,t[e+1]=h*y+p*g+f*m-c*v,t[e+2]=f*y+p*v+c*g-h*m,t[e+3]=p*y-c*m-h*g-f*v,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,s=t._y,r=t._z,l=t._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(s/2),m=c(r/2),g=h(n/2),v=h(s/2),y=h(r/2);switch(l){case"XYZ":this._x=g*p*m+f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m-g*v*y;break;case"YXZ":this._x=g*p*m+f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m+g*v*y;break;case"ZXY":this._x=g*p*m-f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m-g*v*y;break;case"ZYX":this._x=g*p*m-f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m+g*v*y;break;case"YZX":this._x=g*p*m+f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m-g*v*y;break;case"XZY":this._x=g*p*m-f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m+g*v*y;break;default:wt("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],l=e[1],c=e[5],h=e[9],f=e[2],p=e[6],m=e[10],g=n+c+m;if(g>0){let v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(p-h)*v,this._y=(r-f)*v,this._z=(l-s)*v}else if(n>c&&n>m){let v=2*Math.sqrt(1+n-c-m);this._w=(p-h)/v,this._x=.25*v,this._y=(s+l)/v,this._z=(r+f)/v}else if(c>m){let v=2*Math.sqrt(1+c-n-m);this._w=(r-f)/v,this._x=(s+l)/v,this._y=.25*v,this._z=(h+p)/v}else{let v=2*Math.sqrt(1+m-n-c);this._w=(l-s)/v,this._x=(r+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(le(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,s=t._y,r=t._z,l=t._w,c=e._x,h=e._y,f=e._z,p=e._w;return this._x=n*p+l*c+s*f-r*h,this._y=s*p+l*h+r*c-n*f,this._z=r*p+l*f+n*h-s*c,this._w=l*p-n*c-s*h-r*f,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let n=t._x,s=t._y,r=t._z,l=t._w,c=this.dot(t);c<0&&(n=-n,s=-s,r=-r,l=-l,c=-c);let h=1-e;if(c<.9995){let f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,e=Math.sin(e*f)/p,this._x=this._x*h+n*e,this._y=this._y*h+s*e,this._z=this._z*h+r*e,this._w=this._w*h+l*e,this._onChangeCallback()}else this._x=this._x*h+n*e,this._y=this._y*h+s*e,this._z=this._z*h+r*e,this._w=this._w*h+l*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},O=class i{constructor(t=0,e=0,n=0){i.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(mS.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(mS.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,l=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*l,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*l,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*l,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,l=t.y,c=t.z,h=t.w,f=2*(l*s-c*n),p=2*(c*e-r*s),m=2*(r*n-l*e);return this.x=e+h*f+l*m-c*p,this.y=n+h*p+c*f-r*m,this.z=s+h*m+r*p-l*f,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this.z=le(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this.z=le(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,s=t.y,r=t.z,l=e.x,c=e.y,h=e.z;return this.x=s*h-r*c,this.y=r*l-n*h,this.z=n*c-s*l,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return E0.copy(this).projectOnVector(t),this.sub(E0)}reflect(t){return this.sub(E0.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(le(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},E0=new O,mS=new Vn,pe=class i{constructor(t,e,n,s,r,l,c,h,f){i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,l,c,h,f)}set(t,e,n,s,r,l,c,h,f){let p=this.elements;return p[0]=t,p[1]=s,p[2]=c,p[3]=e,p[4]=r,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],m=n[7],g=n[2],v=n[5],y=n[8],b=s[0],S=s[3],x=s[6],E=s[1],T=s[4],A=s[7],N=s[2],D=s[5],L=s[8];return r[0]=l*b+c*E+h*N,r[3]=l*S+c*T+h*D,r[6]=l*x+c*A+h*L,r[1]=f*b+p*E+m*N,r[4]=f*S+p*T+m*D,r[7]=f*x+p*A+m*L,r[2]=g*b+v*E+y*N,r[5]=g*S+v*T+y*D,r[8]=g*x+v*A+y*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8];return e*l*p-e*c*f-n*r*p+n*c*h+s*r*f-s*l*h}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8],m=p*l-c*f,g=c*h-p*r,v=f*r-l*h,y=e*m+n*g+s*v;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let b=1/y;return t[0]=m*b,t[1]=(s*f-p*n)*b,t[2]=(c*n-s*l)*b,t[3]=g*b,t[4]=(p*e-s*h)*b,t[5]=(s*r-c*e)*b,t[6]=v*b,t[7]=(n*h-f*e)*b,t[8]=(l*e-n*r)*b,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,l,c){let h=Math.cos(r),f=Math.sin(r);return this.set(n*h,n*f,-n*(h*l+f*c)+l+t,-s*f,s*h,-s*(-f*l+h*c)+c+e,0,0,1),this}scale(t,e){return this.premultiply(T0.makeScale(t,e)),this}rotate(t){return this.premultiply(T0.makeRotation(-t)),this}translate(t,e){return this.premultiply(T0.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},T0=new pe,gS=new pe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_S=new pe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function GA(){let i={enabled:!0,workingColorSpace:Ps,spaces:{},convert:function(s,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===Ve&&(s.r=la(s.r),s.g=la(s.g),s.b=la(s.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Ve&&(s.r=Sl(s.r),s.g=Sl(s.g),s.b=Sl(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Fs?Al:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,l){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Zr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Zr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ps]:{primaries:t,whitePoint:n,transfer:Al,toXYZ:gS,fromXYZ:_S,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Dn},outputColorSpaceConfig:{drawingBufferColorSpace:Dn}},[Dn]:{primaries:t,whitePoint:n,transfer:Ve,toXYZ:gS,fromXYZ:_S,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Dn}}}),i}var be=GA();function la(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Sl(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var tl,Su=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{tl===void 0&&(tl=Rl("canvas")),tl.width=t.width,tl.height=t.height;let s=tl.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=tl}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Rl("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let l=0;l<r.length;l++)r[l]=la(r[l]/255)*255;return n.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(la(e[n]/255)*255):e[n]=la(e[n]);return{data:e,width:t.width,height:t.height}}else return wt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},kA=0,hs=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:kA++}),this.uuid=Li(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let l=0,c=s.length;l<c;l++)s[l].isDataTexture?r.push(A0(s[l].image)):r.push(A0(s[l]))}else r=A0(s);n.url=r}return e||(t.images[this.uuid]=n),n}};function A0(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Su.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(wt("Texture: Unable to serialize Texture."),{})}var WA=0,C0=new O,mn=class i extends Oi{constructor(t=i.DEFAULT_IMAGE,e=i.DEFAULT_MAPPING,n=li,s=li,r=Je,l=ys,c=Un,h=Gn,f=i.DEFAULT_ANISOTROPY,p=Fs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:WA++}),this.uuid=Li(),this.name="",this.source=new hs(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=l,this.anisotropy=f,this.format=c,this.internalFormat=null,this.type=h,this.offset=new ft(0,0),this.repeat=new ft(1,1),this.center=new ft(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(C0).x}get height(){return this.source.getSize(C0).y}get depth(){return this.source.getSize(C0).z}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){wt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){wt(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Bh)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ml:t.x=t.x-Math.floor(t.x);break;case li:t.x=t.x<0?0:1;break;case bl:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ml:t.y=t.y-Math.floor(t.y);break;case li:t.y=t.y<0?0:1;break;case bl:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};mn.DEFAULT_IMAGE=null;mn.DEFAULT_MAPPING=Bh;mn.DEFAULT_ANISOTROPY=1;var qe=class i{constructor(t=0,e=0,n=0,s=1){i.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=this.w,l=t.elements;return this.x=l[0]*e+l[4]*n+l[8]*s+l[12]*r,this.y=l[1]*e+l[5]*n+l[9]*s+l[13]*r,this.z=l[2]*e+l[6]*n+l[10]*s+l[14]*r,this.w=l[3]*e+l[7]*n+l[11]*s+l[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r,h=t.elements,f=h[0],p=h[4],m=h[8],g=h[1],v=h[5],y=h[9],b=h[2],S=h[6],x=h[10];if(Math.abs(p-g)<.01&&Math.abs(m-b)<.01&&Math.abs(y-S)<.01){if(Math.abs(p+g)<.1&&Math.abs(m+b)<.1&&Math.abs(y+S)<.1&&Math.abs(f+v+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let T=(f+1)/2,A=(v+1)/2,N=(x+1)/2,D=(p+g)/4,L=(m+b)/4,F=(y+S)/4;return T>A&&T>N?T<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(T),s=D/n,r=L/n):A>N?A<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(A),n=D/s,r=F/s):N<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(N),n=L/r,s=F/r),this.set(n,s,r,e),this}let E=Math.sqrt((S-y)*(S-y)+(m-b)*(m-b)+(g-p)*(g-p));return Math.abs(E)<.001&&(E=1),this.x=(S-y)/E,this.y=(m-b)/E,this.z=(g-p)/E,this.w=Math.acos((f+v+x-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this.z=le(this.z,t.z,e.z),this.w=le(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this.z=le(this.z,t,e),this.w=le(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},Nl=class extends Oi{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Je,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new qe(0,0,t,e),this.scissorTest=!1,this.viewport=new qe(0,0,t,e);let s={width:t,height:e,depth:n.depth},r=new mn(s);this.textures=[];let l=n.count;for(let c=0;c<l;c++)this.textures[c]=r.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(t={}){let e={minFilter:Je,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let s=Object.assign({},t.textures[e].image);this.textures[e].source=new hs(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},$n=class extends Nl{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}},Jr=class extends mn{constructor(t=null,e=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=dn,this.minFilter=dn,this.wrapR=li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},ap=class extends $n{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Jr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},Kr=class extends mn{constructor(t=null,e=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=dn,this.minFilter=dn,this.wrapR=li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},rp=class extends $n{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Kr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},bn=class{constructor(t=new O(1/0,1/0,1/0),e=new O(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(rs.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(rs.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=rs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let l=0,c=r.count;l<c;l++)t.isMesh===!0?t.getVertexPosition(l,rs):rs.fromBufferAttribute(r,l),rs.applyMatrix4(t.matrixWorld),this.expandByPoint(rs);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),md.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),md.copy(n.boundingBox)),md.applyMatrix4(t.matrixWorld),this.union(md)}let s=t.children;for(let r=0,l=s.length;r<l;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,rs),rs.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(eu),gd.subVectors(this.max,eu),el.subVectors(t.a,eu),nl.subVectors(t.b,eu),il.subVectors(t.c,eu),Oa.subVectors(nl,el),Ba.subVectors(il,nl),Pr.subVectors(el,il);let e=[0,-Oa.z,Oa.y,0,-Ba.z,Ba.y,0,-Pr.z,Pr.y,Oa.z,0,-Oa.x,Ba.z,0,-Ba.x,Pr.z,0,-Pr.x,-Oa.y,Oa.x,0,-Ba.y,Ba.x,0,-Pr.y,Pr.x,0];return!R0(e,el,nl,il,gd)||(e=[1,0,0,0,1,0,0,0,1],!R0(e,el,nl,il,gd))?!1:(_d.crossVectors(Oa,Ba),e=[_d.x,_d.y,_d.z],R0(e,el,nl,il,gd))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,rs).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(rs).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ta[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ta[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ta[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ta[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ta[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ta[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ta[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ta[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ta),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ta=[new O,new O,new O,new O,new O,new O,new O,new O],rs=new O,md=new bn,el=new O,nl=new O,il=new O,Oa=new O,Ba=new O,Pr=new O,eu=new O,gd=new O,_d=new O,Ir=new O;function R0(i,t,e,n,s){for(let r=0,l=i.length-3;r<=l;r+=3){Ir.fromArray(i,r);let c=s.x*Math.abs(Ir.x)+s.y*Math.abs(Ir.y)+s.z*Math.abs(Ir.z),h=t.dot(Ir),f=e.dot(Ir),p=n.dot(Ir);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}var XA=new bn,nu=new O,w0=new O,yn=class{constructor(t=new O,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):XA.setFromPoints(t).getCenter(n);let s=0;for(let r=0,l=t.length;r<l;r++)s=Math.max(s,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;nu.subVectors(t,this.center);let e=nu.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(nu,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(w0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(nu.copy(t.center).add(w0)),this.expandByPoint(nu.copy(t.center).sub(w0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},ea=new O,N0=new O,vd=new O,Fa=new O,D0=new O,xd=new O,U0=new O,ua=class{constructor(t=new O,e=new O(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ea)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ea.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ea.copy(this.origin).addScaledVector(this.direction,e),ea.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){N0.copy(t).add(e).multiplyScalar(.5),vd.copy(e).sub(t).normalize(),Fa.copy(this.origin).sub(N0);let r=t.distanceTo(e)*.5,l=-this.direction.dot(vd),c=Fa.dot(this.direction),h=-Fa.dot(vd),f=Fa.lengthSq(),p=Math.abs(1-l*l),m,g,v,y;if(p>0)if(m=l*h-c,g=l*c-h,y=r*p,m>=0)if(g>=-y)if(g<=y){let b=1/p;m*=b,g*=b,v=m*(m+l*g+2*c)+g*(l*m+g+2*h)+f}else g=r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;else g=-r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;else g<=-y?(m=Math.max(0,-(-l*r+c)),g=m>0?-r:Math.min(Math.max(-r,-h),r),v=-m*m+g*(g+2*h)+f):g<=y?(m=0,g=Math.min(Math.max(-r,-h),r),v=g*(g+2*h)+f):(m=Math.max(0,-(l*r+c)),g=m>0?r:Math.min(Math.max(-r,-h),r),v=-m*m+g*(g+2*h)+f);else g=l>0?-r:r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,m),s&&s.copy(N0).addScaledVector(vd,g),v}intersectSphere(t,e){ea.subVectors(t.center,this.origin);let n=ea.dot(this.direction),s=ea.dot(ea)-n*n,r=t.radius*t.radius;if(s>r)return null;let l=Math.sqrt(r-s),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,e):this.at(c,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,l,c,h,f=1/this.direction.x,p=1/this.direction.y,m=1/this.direction.z,g=this.origin;return f>=0?(n=(t.min.x-g.x)*f,s=(t.max.x-g.x)*f):(n=(t.max.x-g.x)*f,s=(t.min.x-g.x)*f),p>=0?(r=(t.min.y-g.y)*p,l=(t.max.y-g.y)*p):(r=(t.max.y-g.y)*p,l=(t.min.y-g.y)*p),n>l||r>s||((r>n||isNaN(n))&&(n=r),(l<s||isNaN(s))&&(s=l),m>=0?(c=(t.min.z-g.z)*m,h=(t.max.z-g.z)*m):(c=(t.max.z-g.z)*m,h=(t.min.z-g.z)*m),n>h||c>s)||((c>n||n!==n)&&(n=c),(h<s||s!==s)&&(s=h),s<0)?null:this.at(n>=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,ea)!==null}intersectTriangle(t,e,n,s,r){D0.subVectors(e,t),xd.subVectors(n,t),U0.crossVectors(D0,xd);let l=this.direction.dot(U0),c;if(l>0){if(s)return null;c=1}else if(l<0)c=-1,l=-l;else return null;Fa.subVectors(this.origin,t);let h=c*this.direction.dot(xd.crossVectors(Fa,xd));if(h<0)return null;let f=c*this.direction.dot(D0.cross(Fa));if(f<0||h+f>l)return null;let p=-c*Fa.dot(U0);return p<0?null:this.at(p/l,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ue=class i{constructor(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S){i.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S)}set(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S){let x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=s,x[1]=r,x[5]=l,x[9]=c,x[13]=h,x[2]=f,x[6]=p,x[10]=m,x[14]=g,x[3]=v,x[7]=y,x[11]=b,x[15]=S,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 i().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,s=1/sl.setFromMatrixColumn(t,0).length(),r=1/sl.setFromMatrixColumn(t,1).length(),l=1/sl.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*l,e[9]=n[9]*l,e[10]=n[10]*l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,s=t.y,r=t.z,l=Math.cos(n),c=Math.sin(n),h=Math.cos(s),f=Math.sin(s),p=Math.cos(r),m=Math.sin(r);if(t.order==="XYZ"){let g=l*p,v=l*m,y=c*p,b=c*m;e[0]=h*p,e[4]=-h*m,e[8]=f,e[1]=v+y*f,e[5]=g-b*f,e[9]=-c*h,e[2]=b-g*f,e[6]=y+v*f,e[10]=l*h}else if(t.order==="YXZ"){let g=h*p,v=h*m,y=f*p,b=f*m;e[0]=g+b*c,e[4]=y*c-v,e[8]=l*f,e[1]=l*m,e[5]=l*p,e[9]=-c,e[2]=v*c-y,e[6]=b+g*c,e[10]=l*h}else if(t.order==="ZXY"){let g=h*p,v=h*m,y=f*p,b=f*m;e[0]=g-b*c,e[4]=-l*m,e[8]=y+v*c,e[1]=v+y*c,e[5]=l*p,e[9]=b-g*c,e[2]=-l*f,e[6]=c,e[10]=l*h}else if(t.order==="ZYX"){let g=l*p,v=l*m,y=c*p,b=c*m;e[0]=h*p,e[4]=y*f-v,e[8]=g*f+b,e[1]=h*m,e[5]=b*f+g,e[9]=v*f-y,e[2]=-f,e[6]=c*h,e[10]=l*h}else if(t.order==="YZX"){let g=l*h,v=l*f,y=c*h,b=c*f;e[0]=h*p,e[4]=b-g*m,e[8]=y*m+v,e[1]=m,e[5]=l*p,e[9]=-c*p,e[2]=-f*p,e[6]=v*m+y,e[10]=g-b*m}else if(t.order==="XZY"){let g=l*h,v=l*f,y=c*h,b=c*f;e[0]=h*p,e[4]=-m,e[8]=f*p,e[1]=g*m+b,e[5]=l*p,e[9]=v*m-y,e[2]=y*m-v,e[6]=c*p,e[10]=b*m+g}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(qA,t,YA)}lookAt(t,e,n){let s=this.elements;return Pi.subVectors(t,e),Pi.lengthSq()===0&&(Pi.z=1),Pi.normalize(),za.crossVectors(n,Pi),za.lengthSq()===0&&(Math.abs(n.z)===1?Pi.x+=1e-4:Pi.z+=1e-4,Pi.normalize(),za.crossVectors(n,Pi)),za.normalize(),yd.crossVectors(Pi,za),s[0]=za.x,s[4]=yd.x,s[8]=Pi.x,s[1]=za.y,s[5]=yd.y,s[9]=Pi.y,s[2]=za.z,s[6]=yd.z,s[10]=Pi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,l=n[0],c=n[4],h=n[8],f=n[12],p=n[1],m=n[5],g=n[9],v=n[13],y=n[2],b=n[6],S=n[10],x=n[14],E=n[3],T=n[7],A=n[11],N=n[15],D=s[0],L=s[4],F=s[8],C=s[12],w=s[1],z=s[5],Y=s[9],G=s[13],j=s[2],nt=s[6],J=s[10],et=s[14],rt=s[3],St=s[7],bt=s[11],mt=s[15];return r[0]=l*D+c*w+h*j+f*rt,r[4]=l*L+c*z+h*nt+f*St,r[8]=l*F+c*Y+h*J+f*bt,r[12]=l*C+c*G+h*et+f*mt,r[1]=p*D+m*w+g*j+v*rt,r[5]=p*L+m*z+g*nt+v*St,r[9]=p*F+m*Y+g*J+v*bt,r[13]=p*C+m*G+g*et+v*mt,r[2]=y*D+b*w+S*j+x*rt,r[6]=y*L+b*z+S*nt+x*St,r[10]=y*F+b*Y+S*J+x*bt,r[14]=y*C+b*G+S*et+x*mt,r[3]=E*D+T*w+A*j+N*rt,r[7]=E*L+T*z+A*nt+N*St,r[11]=E*F+T*Y+A*J+N*bt,r[15]=E*C+T*G+A*et+N*mt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],l=t[1],c=t[5],h=t[9],f=t[13],p=t[2],m=t[6],g=t[10],v=t[14],y=t[3],b=t[7],S=t[11],x=t[15],E=h*v-f*g,T=c*v-f*m,A=c*g-h*m,N=l*v-f*p,D=l*g-h*p,L=l*m-c*p;return e*(b*E-S*T+x*A)-n*(y*E-S*N+x*D)+s*(y*T-b*N+x*L)-r*(y*A-b*D+S*L)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8],m=t[9],g=t[10],v=t[11],y=t[12],b=t[13],S=t[14],x=t[15],E=m*S*f-b*g*f+b*h*v-c*S*v-m*h*x+c*g*x,T=y*g*f-p*S*f-y*h*v+l*S*v+p*h*x-l*g*x,A=p*b*f-y*m*f+y*c*v-l*b*v-p*c*x+l*m*x,N=y*m*h-p*b*h-y*c*g+l*b*g+p*c*S-l*m*S,D=e*E+n*T+s*A+r*N;if(D===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let L=1/D;return t[0]=E*L,t[1]=(b*g*r-m*S*r-b*s*v+n*S*v+m*s*x-n*g*x)*L,t[2]=(c*S*r-b*h*r+b*s*f-n*S*f-c*s*x+n*h*x)*L,t[3]=(m*h*r-c*g*r-m*s*f+n*g*f+c*s*v-n*h*v)*L,t[4]=T*L,t[5]=(p*S*r-y*g*r+y*s*v-e*S*v-p*s*x+e*g*x)*L,t[6]=(y*h*r-l*S*r-y*s*f+e*S*f+l*s*x-e*h*x)*L,t[7]=(l*g*r-p*h*r+p*s*f-e*g*f-l*s*v+e*h*v)*L,t[8]=A*L,t[9]=(y*m*r-p*b*r-y*n*v+e*b*v+p*n*x-e*m*x)*L,t[10]=(l*b*r-y*c*r+y*n*f-e*b*f-l*n*x+e*c*x)*L,t[11]=(p*c*r-l*m*r-p*n*f+e*m*f+l*n*v-e*c*v)*L,t[12]=N*L,t[13]=(p*b*s-y*m*s+y*n*g-e*b*g-p*n*S+e*m*S)*L,t[14]=(y*c*s-l*b*s-y*n*h+e*b*h+l*n*S-e*c*S)*L,t[15]=(l*m*s-p*c*s+p*n*h-e*m*h-l*n*g+e*c*g)*L,this}scale(t){let e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),s=Math.sin(e),r=1-n,l=t.x,c=t.y,h=t.z,f=r*l,p=r*c;return this.set(f*l+n,f*c-s*h,f*h+s*c,0,f*c+s*h,p*c+n,p*h-s*l,0,f*h-s*c,p*h+s*l,r*h*h+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,s,r,l){return this.set(1,n,r,0,t,1,l,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){let s=this.elements,r=e._x,l=e._y,c=e._z,h=e._w,f=r+r,p=l+l,m=c+c,g=r*f,v=r*p,y=r*m,b=l*p,S=l*m,x=c*m,E=h*f,T=h*p,A=h*m,N=n.x,D=n.y,L=n.z;return s[0]=(1-(b+x))*N,s[1]=(v+A)*N,s[2]=(y-T)*N,s[3]=0,s[4]=(v-A)*D,s[5]=(1-(g+x))*D,s[6]=(S+E)*D,s[7]=0,s[8]=(y+T)*L,s[9]=(S-E)*L,s[10]=(1-(g+b))*L,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],this.determinant()===0)return n.set(1,1,1),e.identity(),this;let r=sl.set(s[0],s[1],s[2]).length(),l=sl.set(s[4],s[5],s[6]).length(),c=sl.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),os.copy(this);let f=1/r,p=1/l,m=1/c;return os.elements[0]*=f,os.elements[1]*=f,os.elements[2]*=f,os.elements[4]*=p,os.elements[5]*=p,os.elements[6]*=p,os.elements[8]*=m,os.elements[9]*=m,os.elements[10]*=m,e.setFromRotationMatrix(os),n.x=r,n.y=l,n.z=c,this}makePerspective(t,e,n,s,r,l,c=_i,h=!1){let f=this.elements,p=2*r/(e-t),m=2*r/(n-s),g=(e+t)/(e-t),v=(n+s)/(n-s),y,b;if(h)y=r/(l-r),b=l*r/(l-r);else if(c===_i)y=-(l+r)/(l-r),b=-2*l*r/(l-r);else if(c===Yr)y=-l/(l-r),b=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return f[0]=p,f[4]=0,f[8]=g,f[12]=0,f[1]=0,f[5]=m,f[9]=v,f[13]=0,f[2]=0,f[6]=0,f[10]=y,f[14]=b,f[3]=0,f[7]=0,f[11]=-1,f[15]=0,this}makeOrthographic(t,e,n,s,r,l,c=_i,h=!1){let f=this.elements,p=2/(e-t),m=2/(n-s),g=-(e+t)/(e-t),v=-(n+s)/(n-s),y,b;if(h)y=1/(l-r),b=l/(l-r);else if(c===_i)y=-2/(l-r),b=-(l+r)/(l-r);else if(c===Yr)y=-1/(l-r),b=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return f[0]=p,f[4]=0,f[8]=0,f[12]=g,f[1]=0,f[5]=m,f[9]=0,f[13]=v,f[2]=0,f[6]=0,f[10]=y,f[14]=b,f[3]=0,f[7]=0,f[11]=0,f[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},sl=new O,os=new ue,qA=new O(0,0,0),YA=new O(1,1,1),za=new O,yd=new O,Pi=new O,vS=new ue,xS=new Vn,xi=class i{constructor(t=0,e=0,n=0,s=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,s=this._order){return this._x=t,this._y=e,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let s=t.elements,r=s[0],l=s[4],c=s[8],h=s[1],f=s[5],p=s[9],m=s[2],g=s[6],v=s[10];switch(e){case"XYZ":this._y=Math.asin(le(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,v),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(g,f),this._z=0);break;case"YXZ":this._x=Math.asin(-le(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(c,v),this._z=Math.atan2(h,f)):(this._y=Math.atan2(-m,r),this._z=0);break;case"ZXY":this._x=Math.asin(le(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-m,v),this._z=Math.atan2(-l,f)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-le(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-l,f));break;case"YZX":this._z=Math.asin(le(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-p,f),this._y=Math.atan2(-m,r)):(this._x=0,this._y=Math.atan2(c,v));break;case"XZY":this._z=Math.asin(-le(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(g,f),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-p,v),this._y=0);break;default:wt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return vS.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vS,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return xS.setFromEuler(this),this.setFromQuaternion(xS,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};xi.DEFAULT_ORDER="XYZ";var Is=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},ZA=0,yS=new O,al=new Vn,na=new ue,Sd=new O,iu=new O,jA=new O,JA=new Vn,SS=new O(1,0,0),MS=new O(0,1,0),bS=new O(0,0,1),ES={type:"added"},KA={type:"removed"},rl={type:"childadded",child:null},P0={type:"childremoved",child:null},Oe=class i extends Oi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ZA++}),this.uuid=Li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new O,e=new xi,n=new Vn,s=new O(1,1,1);function r(){n.setFromEuler(e,!1)}function l(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new ue},normalMatrix:{value:new pe}}),this.matrix=new ue,this.matrixWorld=new ue,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Is,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return al.setFromAxisAngle(t,e),this.quaternion.multiply(al),this}rotateOnWorldAxis(t,e){return al.setFromAxisAngle(t,e),this.quaternion.premultiply(al),this}rotateX(t){return this.rotateOnAxis(SS,t)}rotateY(t){return this.rotateOnAxis(MS,t)}rotateZ(t){return this.rotateOnAxis(bS,t)}translateOnAxis(t,e){return yS.copy(t).applyQuaternion(this.quaternion),this.position.add(yS.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(SS,t)}translateY(t){return this.translateOnAxis(MS,t)}translateZ(t){return this.translateOnAxis(bS,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(na.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Sd.copy(t):Sd.set(t,e,n);let s=this.parent;this.updateWorldMatrix(!0,!1),iu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?na.lookAt(iu,Sd,this.up):na.lookAt(Sd,iu,this.up),this.quaternion.setFromRotationMatrix(na),s&&(na.extractRotation(s.matrixWorld),al.setFromRotationMatrix(na),this.quaternion.premultiply(al.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Qt("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ES),rl.child=t,this.dispatchEvent(rl),rl.child=null):Qt("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(KA),P0.child=t,this.dispatchEvent(P0),P0.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),na.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),na.multiply(t.parent.matrixWorld)),t.applyMatrix4(na),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ES),rl.child=t,this.dispatchEvent(rl),rl.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,s=this.children.length;n<s;n++){let l=this.children[n].getObjectByProperty(t,e);if(l!==void 0)return l}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let s=this.children;for(let r=0,l=s.length;r<l;r++)s[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iu,t,jA),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iu,JA,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let s=this.children;for(let r=0,l=s.length;r<l;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let 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(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(c=>({...c})),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(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(t)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f<p;f++){let m=h[f];r(t.shapes,m)}else r(t.shapes,h)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let h=0,f=this.material.length;h<f;h++)c.push(r(t.materials,this.material[h]));s.material=c}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let c=0;c<this.children.length;c++)s.children.push(this.children[c].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let c=0;c<this.animations.length;c++){let h=this.animations[c];s.animations.push(r(t.animations,h))}}if(e){let c=l(t.geometries),h=l(t.materials),f=l(t.textures),p=l(t.images),m=l(t.shapes),g=l(t.skeletons),v=l(t.animations),y=l(t.nodes);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),m.length>0&&(n.shapes=m),g.length>0&&(n.skeletons=g),v.length>0&&(n.animations=v),y.length>0&&(n.nodes=y)}return n.object=s,n;function l(c){let h=[];for(let f in c){let p=c[f];delete p.metadata,h.push(p)}return h}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}};Oe.DEFAULT_UP=new O(0,1,0);Oe.DEFAULT_MATRIX_AUTO_UPDATE=!0;Oe.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ls=new O,ia=new O,I0=new O,sa=new O,ol=new O,ll=new O,TS=new O,L0=new O,O0=new O,B0=new O,F0=new qe,z0=new qe,V0=new qe,us=class i{constructor(t=new O,e=new O,n=new O){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,s){s.subVectors(n,e),ls.subVectors(t,e),s.cross(ls);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){ls.subVectors(s,e),ia.subVectors(n,e),I0.subVectors(t,e);let l=ls.dot(ls),c=ls.dot(ia),h=ls.dot(I0),f=ia.dot(ia),p=ia.dot(I0),m=l*f-c*c;if(m===0)return r.set(0,0,0),null;let g=1/m,v=(f*h-c*p)*g,y=(l*p-c*h)*g;return r.set(1-v-y,y,v)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,sa)===null?!1:sa.x>=0&&sa.y>=0&&sa.x+sa.y<=1}static getInterpolation(t,e,n,s,r,l,c,h){return this.getBarycoord(t,e,n,s,sa)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(r,sa.x),h.addScaledVector(l,sa.y),h.addScaledVector(c,sa.z),h)}static getInterpolatedAttribute(t,e,n,s,r,l){return F0.setScalar(0),z0.setScalar(0),V0.setScalar(0),F0.fromBufferAttribute(t,e),z0.fromBufferAttribute(t,n),V0.fromBufferAttribute(t,s),l.setScalar(0),l.addScaledVector(F0,r.x),l.addScaledVector(z0,r.y),l.addScaledVector(V0,r.z),l}static isFrontFacing(t,e,n,s){return ls.subVectors(n,e),ia.subVectors(t,e),ls.cross(ia).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ls.subVectors(this.c,this.b),ia.subVectors(this.a,this.b),ls.cross(ia).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,l,c;ol.subVectors(s,n),ll.subVectors(r,n),L0.subVectors(t,n);let h=ol.dot(L0),f=ll.dot(L0);if(h<=0&&f<=0)return e.copy(n);O0.subVectors(t,s);let p=ol.dot(O0),m=ll.dot(O0);if(p>=0&&m<=p)return e.copy(s);let g=h*m-p*f;if(g<=0&&h>=0&&p<=0)return l=h/(h-p),e.copy(n).addScaledVector(ol,l);B0.subVectors(t,r);let v=ol.dot(B0),y=ll.dot(B0);if(y>=0&&v<=y)return e.copy(r);let b=v*f-h*y;if(b<=0&&f>=0&&y<=0)return c=f/(f-y),e.copy(n).addScaledVector(ll,c);let S=p*y-v*m;if(S<=0&&m-p>=0&&v-y>=0)return TS.subVectors(r,s),c=(m-p)/(m-p+(v-y)),e.copy(s).addScaledVector(TS,c);let x=1/(S+b+g);return l=b*x,c=g*x,e.copy(n).addScaledVector(ol,l).addScaledVector(ll,c)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},db={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},Va={h:0,s:0,l:0},Md={h:0,s:0,l:0};function H0(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var Lt=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Dn){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,be.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=be.workingColorSpace){return this.r=t,this.g=e,this.b=n,be.colorSpaceToWorking(this,s),this}setHSL(t,e,n,s=be.workingColorSpace){if(t=nv(t,1),e=le(e,0,1),n=le(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,l=2*n-r;this.r=H0(l,r,t+1/3),this.g=H0(l,r,t),this.b=H0(l,r,t-1/3)}return be.colorSpaceToWorking(this,s),this}setStyle(t,e=Dn){function n(r){r!==void 0&&parseFloat(r)<1&&wt("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,l=s[1],c=s[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:wt("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(l===6)return this.setHex(parseInt(r,16),e);wt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Dn){let n=db[t.toLowerCase()];return n!==void 0?this.setHex(n,e):wt("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=la(t.r),this.g=la(t.g),this.b=la(t.b),this}copyLinearToSRGB(t){return this.r=Sl(t.r),this.g=Sl(t.g),this.b=Sl(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Dn){return be.workingToColorSpace(Jn.copy(this),t),Math.round(le(Jn.r*255,0,255))*65536+Math.round(le(Jn.g*255,0,255))*256+Math.round(le(Jn.b*255,0,255))}getHexString(t=Dn){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=be.workingColorSpace){be.workingToColorSpace(Jn.copy(this),e);let n=Jn.r,s=Jn.g,r=Jn.b,l=Math.max(n,s,r),c=Math.min(n,s,r),h,f,p=(c+l)/2;if(c===l)h=0,f=0;else{let m=l-c;switch(f=p<=.5?m/(l+c):m/(2-l-c),l){case n:h=(s-r)/m+(s<r?6:0);break;case s:h=(r-n)/m+2;break;case r:h=(n-s)/m+4;break}h/=6}return t.h=h,t.s=f,t.l=p,t}getRGB(t,e=be.workingColorSpace){return be.workingToColorSpace(Jn.copy(this),e),t.r=Jn.r,t.g=Jn.g,t.b=Jn.b,t}getStyle(t=Dn){be.workingToColorSpace(Jn.copy(this),t);let e=Jn.r,n=Jn.g,s=Jn.b;return t!==Dn?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(t,e,n){return this.getHSL(Va),this.setHSL(Va.h+t,Va.s+e,Va.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Va),t.getHSL(Md);let n=mu(Va.h,Md.h,e),s=mu(Va.s,Md.s,e),r=mu(Va.l,Md.l,e);return this.setHSL(n,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*s,this.g=r[1]*e+r[4]*n+r[7]*s,this.b=r[2]*e+r[5]*n+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Jn=new Lt;Lt.NAMES=db;var QA=0,En=class extends Oi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:QA++}),this.uuid=Li(),this.name="",this.type="Material",this.blending=qa,this.side=Us,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=vu,this.blendDst=xu,this.blendEquation=ca,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Lt(0,0,0),this.blendAlpha=0,this.depthFunc=Ya,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=sp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ka,this.stencilZFail=ka,this.stencilZPass=ka,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){wt(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){wt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qa&&(n.blending=this.blending),this.side!==Us&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==vu&&(n.blendSrc=this.blendSrc),this.blendDst!==xu&&(n.blendDst=this.blendDst),this.blendEquation!==ca&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ya&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==sp&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ka&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ka&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ka&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let l=[];for(let c in r){let h=r[c];delete h.metadata,l.push(h)}return l}if(e){let r=s(t.textures),l=s(t.images);r.length>0&&(n.textures=r),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},ps=class extends En{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Lt(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 xi,this.combine=ac,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},ra=$A();function $A(){let i=new ArrayBuffer(4),t=new Float32Array(i),e=new Uint32Array(i),n=new Uint32Array(512),s=new Uint32Array(512);for(let h=0;h<256;++h){let f=h-127;f<-27?(n[h]=0,n[h|256]=32768,s[h]=24,s[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,s[h]=-f-1,s[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,s[h]=13,s[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,s[h]=24,s[h|256]=24):(n[h]=31744,n[h|256]=64512,s[h]=13,s[h|256]=13)}let r=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,r[h]=f|p}for(let h=1024;h<2048;++h)r[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:l,offsetTable:c}}function gi(i){Math.abs(i)>65504&&wt("DataUtils.toHalfFloat(): Value out of range."),i=le(i,-65504,65504),ra.floatView[0]=i;let t=ra.uint32View[0],e=t>>23&511;return ra.baseTable[e]+((t&8388607)>>ra.shiftTable[e])}function fu(i){let t=i>>10;return ra.uint32View[0]=ra.mantissaTable[ra.offsetTable[t]+(i&1023)]+ra.exponentTable[t],ra.floatView[0]}var op=class{static toHalfFloat(t){return gi(t)}static fromHalfFloat(t){return fu(t)}},xn=new O,bd=new ft,tC=0,He=class{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:tC++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Cl,this.updateRanges=[],this.gpuType=Qn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[n+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)bd.fromBufferAttribute(this,e),bd.applyMatrix3(t),this.setXY(e,bd.x,bd.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyMatrix3(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyMatrix4(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyNormalMatrix(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.transformDirection(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=oi(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ve(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=oi(e,this.array)),e}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=oi(e,this.array)),e}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=oi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=oi(e,this.array)),e}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Cl&&(t.usage=this.usage),t}},lp=class extends He{constructor(t,e,n){super(new Int8Array(t),e,n)}},cp=class extends He{constructor(t,e,n){super(new Uint8Array(t),e,n)}},up=class extends He{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}},hp=class extends He{constructor(t,e,n){super(new Int16Array(t),e,n)}},Dl=class extends He{constructor(t,e,n){super(new Uint16Array(t),e,n)}},fp=class extends He{constructor(t,e,n){super(new Int32Array(t),e,n)}},Ul=class extends He{constructor(t,e,n){super(new Uint32Array(t),e,n)}},dp=class extends He{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=fu(this.array[t*this.itemSize]);return this.normalized&&(e=oi(e,this.array)),e}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize]=gi(e),this}getY(t){let e=fu(this.array[t*this.itemSize+1]);return this.normalized&&(e=oi(e,this.array)),e}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+1]=gi(e),this}getZ(t){let e=fu(this.array[t*this.itemSize+2]);return this.normalized&&(e=oi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+2]=gi(e),this}getW(t){let e=fu(this.array[t*this.itemSize+3]);return this.normalized&&(e=oi(e,this.array)),e}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+3]=gi(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this.array[t+2]=gi(s),this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this.array[t+2]=gi(s),this.array[t+3]=gi(r),this}},Gt=class extends He{constructor(t,e,n){super(new Float32Array(t),e,n)}},eC=0,Ki=new ue,G0=new Oe,cl=new O,Ii=new bn,su=new bn,Nn=new O,de=class i extends Oi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:eC++}),this.uuid=Li(),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(t){return Array.isArray(t)?this.index=new(tv(t)?Ul:Dl)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new pe().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ki.makeRotationFromQuaternion(t),this.applyMatrix4(Ki),this}rotateX(t){return Ki.makeRotationX(t),this.applyMatrix4(Ki),this}rotateY(t){return Ki.makeRotationY(t),this.applyMatrix4(Ki),this}rotateZ(t){return Ki.makeRotationZ(t),this.applyMatrix4(Ki),this}translate(t,e,n){return Ki.makeTranslation(t,e,n),this.applyMatrix4(Ki),this}scale(t,e,n){return Ki.makeScale(t,e,n),this.applyMatrix4(Ki),this}lookAt(t){return G0.lookAt(t),G0.updateMatrix(),this.applyMatrix4(G0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cl).negate(),this.translate(cl.x,cl.y,cl.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;s<r;s++){let l=t[s];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Gt(n,3))}else{let n=Math.min(t.length,e.count);for(let s=0;s<n;s++){let r=t[s];e.setXYZ(s,r.x,r.y,r.z||0)}t.length>e.count&&wt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Qt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new O(-1/0,-1/0,-1/0),new O(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let r=e[n];Ii.setFromBufferAttribute(r),this.morphTargetsRelative?(Nn.addVectors(this.boundingBox.min,Ii.min),this.boundingBox.expandByPoint(Nn),Nn.addVectors(this.boundingBox.max,Ii.max),this.boundingBox.expandByPoint(Nn)):(this.boundingBox.expandByPoint(Ii.min),this.boundingBox.expandByPoint(Ii.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Qt('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 yn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Qt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new O,1/0);return}if(t){let n=this.boundingSphere.center;if(Ii.setFromBufferAttribute(t),e)for(let r=0,l=e.length;r<l;r++){let c=e[r];su.setFromBufferAttribute(c),this.morphTargetsRelative?(Nn.addVectors(Ii.min,su.min),Ii.expandByPoint(Nn),Nn.addVectors(Ii.max,su.max),Ii.expandByPoint(Nn)):(Ii.expandByPoint(su.min),Ii.expandByPoint(su.max))}Ii.getCenter(n);let s=0;for(let r=0,l=t.count;r<l;r++)Nn.fromBufferAttribute(t,r),s=Math.max(s,n.distanceToSquared(Nn));if(e)for(let r=0,l=e.length;r<l;r++){let c=e[r],h=this.morphTargetsRelative;for(let f=0,p=c.count;f<p;f++)Nn.fromBufferAttribute(c,f),h&&(cl.fromBufferAttribute(t,f),Nn.add(cl)),s=Math.max(s,n.distanceToSquared(Nn))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Qt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){Qt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,s=e.normal,r=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new He(new Float32Array(4*n.count),4));let l=this.getAttribute("tangent"),c=[],h=[];for(let F=0;F<n.count;F++)c[F]=new O,h[F]=new O;let f=new O,p=new O,m=new O,g=new ft,v=new ft,y=new ft,b=new O,S=new O;function x(F,C,w){f.fromBufferAttribute(n,F),p.fromBufferAttribute(n,C),m.fromBufferAttribute(n,w),g.fromBufferAttribute(r,F),v.fromBufferAttribute(r,C),y.fromBufferAttribute(r,w),p.sub(f),m.sub(f),v.sub(g),y.sub(g);let z=1/(v.x*y.y-y.x*v.y);isFinite(z)&&(b.copy(p).multiplyScalar(y.y).addScaledVector(m,-v.y).multiplyScalar(z),S.copy(m).multiplyScalar(v.x).addScaledVector(p,-y.x).multiplyScalar(z),c[F].add(b),c[C].add(b),c[w].add(b),h[F].add(S),h[C].add(S),h[w].add(S))}let E=this.groups;E.length===0&&(E=[{start:0,count:t.count}]);for(let F=0,C=E.length;F<C;++F){let w=E[F],z=w.start,Y=w.count;for(let G=z,j=z+Y;G<j;G+=3)x(t.getX(G+0),t.getX(G+1),t.getX(G+2))}let T=new O,A=new O,N=new O,D=new O;function L(F){N.fromBufferAttribute(s,F),D.copy(N);let C=c[F];T.copy(C),T.sub(N.multiplyScalar(N.dot(C))).normalize(),A.crossVectors(D,C);let z=A.dot(h[F])<0?-1:1;l.setXYZW(F,T.x,T.y,T.z,z)}for(let F=0,C=E.length;F<C;++F){let w=E[F],z=w.start,Y=w.count;for(let G=z,j=z+Y;G<j;G+=3)L(t.getX(G+0)),L(t.getX(G+1)),L(t.getX(G+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new He(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let g=0,v=n.count;g<v;g++)n.setXYZ(g,0,0,0);let s=new O,r=new O,l=new O,c=new O,h=new O,f=new O,p=new O,m=new O;if(t)for(let g=0,v=t.count;g<v;g+=3){let y=t.getX(g+0),b=t.getX(g+1),S=t.getX(g+2);s.fromBufferAttribute(e,y),r.fromBufferAttribute(e,b),l.fromBufferAttribute(e,S),p.subVectors(l,r),m.subVectors(s,r),p.cross(m),c.fromBufferAttribute(n,y),h.fromBufferAttribute(n,b),f.fromBufferAttribute(n,S),c.add(p),h.add(p),f.add(p),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(b,h.x,h.y,h.z),n.setXYZ(S,f.x,f.y,f.z)}else for(let g=0,v=e.count;g<v;g+=3)s.fromBufferAttribute(e,g+0),r.fromBufferAttribute(e,g+1),l.fromBufferAttribute(e,g+2),p.subVectors(l,r),m.subVectors(s,r),p.cross(m),n.setXYZ(g+0,p.x,p.y,p.z),n.setXYZ(g+1,p.x,p.y,p.z),n.setXYZ(g+2,p.x,p.y,p.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Nn.fromBufferAttribute(t,e),Nn.normalize(),t.setXYZ(e,Nn.x,Nn.y,Nn.z)}toNonIndexed(){function t(c,h){let f=c.array,p=c.itemSize,m=c.normalized,g=new f.constructor(h.length*p),v=0,y=0;for(let b=0,S=h.length;b<S;b++){c.isInterleavedBufferAttribute?v=h[b]*c.data.stride+c.offset:v=h[b]*p;for(let x=0;x<p;x++)g[y++]=f[v++]}return new He(g,p,m)}if(this.index===null)return wt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,s=this.attributes;for(let c in s){let h=s[c],f=t(h,n);e.setAttribute(c,f)}let r=this.morphAttributes;for(let c in r){let h=[],f=r[c];for(let p=0,m=f.length;p<m;p++){let g=f[p],v=t(g,n);h.push(v)}e.morphAttributes[c]=h}e.morphTargetsRelative=this.morphTargetsRelative;let l=this.groups;for(let c=0,h=l.length;c<h;c++){let f=l[c];e.addGroup(f.start,f.count,f.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let h=this.parameters;for(let f in h)h[f]!==void 0&&(t[f]=h[f]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let h in n){let f=n[h];t.data.attributes[h]=f.toJSON(t.data)}let s={},r=!1;for(let h in this.morphAttributes){let f=this.morphAttributes[h],p=[];for(let m=0,g=f.length;m<g;m++){let v=f[m];p.push(v.toJSON(t.data))}p.length>0&&(s[h]=p,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let l=this.groups;l.length>0&&(t.data.groups=JSON.parse(JSON.stringify(l)));let c=this.boundingSphere;return c!==null&&(t.data.boundingSphere=c.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let s=t.attributes;for(let f in s){let p=s[f];this.setAttribute(f,p.clone(e))}let r=t.morphAttributes;for(let f in r){let p=[],m=r[f];for(let g=0,v=m.length;g<v;g++)p.push(m[g].clone(e));this.morphAttributes[f]=p}this.morphTargetsRelative=t.morphTargetsRelative;let l=t.groups;for(let f=0,p=l.length;f<p;f++){let m=l[f];this.addGroup(m.start,m.count,m.materialIndex)}let c=t.boundingBox;c!==null&&(this.boundingBox=c.clone());let h=t.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},AS=new ue,Lr=new ua,Ed=new yn,CS=new O,Td=new O,Ad=new O,Cd=new O,k0=new O,Rd=new O,RS=new O,wd=new O,rn=class extends Oe{constructor(t=new de,e=new ps){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}getVertexPosition(t,e){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,l=n.morphTargetsRelative;e.fromBufferAttribute(s,t);let c=this.morphTargetInfluences;if(r&&c){Rd.set(0,0,0);for(let h=0,f=r.length;h<f;h++){let p=c[h],m=r[h];p!==0&&(k0.fromBufferAttribute(m,t),l?Rd.addScaledVector(k0,p):Rd.addScaledVector(k0.sub(e),p))}e.add(Rd)}return e}raycast(t,e){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ed.copy(n.boundingSphere),Ed.applyMatrix4(r),Lr.copy(t.ray).recast(t.near),!(Ed.containsPoint(Lr.origin)===!1&&(Lr.intersectSphere(Ed,CS)===null||Lr.origin.distanceToSquared(CS)>(t.far-t.near)**2))&&(AS.copy(r).invert(),Lr.copy(t.ray).applyMatrix4(AS),!(n.boundingBox!==null&&Lr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Lr)))}_computeIntersections(t,e,n){let s,r=this.geometry,l=this.material,c=r.index,h=r.attributes.position,f=r.attributes.uv,p=r.attributes.uv1,m=r.attributes.normal,g=r.groups,v=r.drawRange;if(c!==null)if(Array.isArray(l))for(let y=0,b=g.length;y<b;y++){let S=g[y],x=l[S.materialIndex],E=Math.max(S.start,v.start),T=Math.min(c.count,Math.min(S.start+S.count,v.start+v.count));for(let A=E,N=T;A<N;A+=3){let D=c.getX(A),L=c.getX(A+1),F=c.getX(A+2);s=Nd(this,x,t,n,f,p,m,D,L,F),s&&(s.faceIndex=Math.floor(A/3),s.face.materialIndex=S.materialIndex,e.push(s))}}else{let y=Math.max(0,v.start),b=Math.min(c.count,v.start+v.count);for(let S=y,x=b;S<x;S+=3){let E=c.getX(S),T=c.getX(S+1),A=c.getX(S+2);s=Nd(this,l,t,n,f,p,m,E,T,A),s&&(s.faceIndex=Math.floor(S/3),e.push(s))}}else if(h!==void 0)if(Array.isArray(l))for(let y=0,b=g.length;y<b;y++){let S=g[y],x=l[S.materialIndex],E=Math.max(S.start,v.start),T=Math.min(h.count,Math.min(S.start+S.count,v.start+v.count));for(let A=E,N=T;A<N;A+=3){let D=A,L=A+1,F=A+2;s=Nd(this,x,t,n,f,p,m,D,L,F),s&&(s.faceIndex=Math.floor(A/3),s.face.materialIndex=S.materialIndex,e.push(s))}}else{let y=Math.max(0,v.start),b=Math.min(h.count,v.start+v.count);for(let S=y,x=b;S<x;S+=3){let E=S,T=S+1,A=S+2;s=Nd(this,l,t,n,f,p,m,E,T,A),s&&(s.faceIndex=Math.floor(S/3),e.push(s))}}}};function nC(i,t,e,n,s,r,l,c){let h;if(t.side===ti?h=n.intersectTriangle(l,r,s,!0,c):h=n.intersectTriangle(s,r,l,t.side===Us,c),h===null)return null;wd.copy(c),wd.applyMatrix4(i.matrixWorld);let f=e.ray.origin.distanceTo(wd);return f<e.near||f>e.far?null:{distance:f,point:wd.clone(),object:i}}function Nd(i,t,e,n,s,r,l,c,h,f){i.getVertexPosition(c,Td),i.getVertexPosition(h,Ad),i.getVertexPosition(f,Cd);let p=nC(i,t,e,n,Td,Ad,Cd,RS);if(p){let m=new O;us.getBarycoord(RS,Td,Ad,Cd,m),s&&(p.uv=us.getInterpolatedAttribute(s,c,h,f,m,new ft)),r&&(p.uv1=us.getInterpolatedAttribute(r,c,h,f,m,new ft)),l&&(p.normal=us.getInterpolatedAttribute(l,c,h,f,m,new O),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));let g={a:c,b:h,c:f,normal:new O,materialIndex:0};us.getNormal(Td,Ad,Cd,g.normal),p.face=g,p.barycoord=m}return p}var ja=class i extends de{constructor(t=1,e=1,n=1,s=1,r=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:l};let c=this;s=Math.floor(s),r=Math.floor(r),l=Math.floor(l);let h=[],f=[],p=[],m=[],g=0,v=0;y("z","y","x",-1,-1,n,e,t,l,r,0),y("z","y","x",1,-1,n,e,-t,l,r,1),y("x","z","y",1,1,t,n,e,s,l,2),y("x","z","y",1,-1,t,n,-e,s,l,3),y("x","y","z",1,-1,t,e,n,s,r,4),y("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(h),this.setAttribute("position",new Gt(f,3)),this.setAttribute("normal",new Gt(p,3)),this.setAttribute("uv",new Gt(m,2));function y(b,S,x,E,T,A,N,D,L,F,C){let w=A/L,z=N/F,Y=A/2,G=N/2,j=D/2,nt=L+1,J=F+1,et=0,rt=0,St=new O;for(let bt=0;bt<J;bt++){let mt=bt*z-G;for(let kt=0;kt<nt;kt++){let $t=kt*w-Y;St[b]=$t*E,St[S]=mt*T,St[x]=j,f.push(St.x,St.y,St.z),St[b]=0,St[S]=0,St[x]=D>0?1:-1,p.push(St.x,St.y,St.z),m.push(kt/L),m.push(1-bt/F),et+=1}}for(let bt=0;bt<F;bt++)for(let mt=0;mt<L;mt++){let kt=g+mt+nt*bt,$t=g+mt+nt*(bt+1),re=g+(mt+1)+nt*(bt+1),Ce=g+(mt+1)+nt*bt;h.push(kt,$t,Ce),h.push($t,re,Ce),rt+=6}c.addGroup(v,rt,C),v+=rt,g+=et}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function po(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let s=i[e][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(wt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=s.clone():Array.isArray(s)?t[e][n]=s.slice():t[e][n]=s}}return t}function ei(i){let t={};for(let e=0;e<i.length;e++){let n=po(i[e]);for(let s in n)t[s]=n[s]}return t}function iC(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function iv(i){let t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:be.workingColorSpace}var sv={clone:po,merge:ei},sC=`void main() {
12
+ `)+a.join(" > ")}return null},Ee.getPublicRootInstance=function(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 27:case 5:return Vc(a.child.stateNode);default:return a.child.stateNode}},Ee.injectIntoDevTools=function(){var a={bundleType:0,version:kE,rendererPackageName:WE,currentDispatcherRef:fe,findFiberByHostInstance:Fy,reconcilerVersion:"19.0.0"};if(Ly!==null&&(a.rendererConfig=Ly),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)a=!0;else{try{kc=o.inject(a),wi=o}catch{}a=!!o.checkDCE}}return a},Ee.isAlreadyRendering=function(){return!1},Ee.observeVisibleRects=function(a,o,u,d){if(!Hc)throw Error(n(363));a=Pg(a,o);var _=dT(a,u,d).disconnect;return{disconnect:function(){_()}}},Ee.shouldError=function(){return null},Ee.shouldSuspend=function(){return!1},Ee.startHostTransition=function(a,o,u,d){if(a.tag!==5)throw Error(n(476));var _=mx(a).queue;px(a,_,o,Oo,u===null?e:function(){var M=mx(a).next.queue;return Uc(a,M,{},Ai()),u(d)})},Ee.updateContainer=function(a,o,u,d){var _=o.current,M=Ai();return Ry(_,M,a,o,u,d),M},Ee.updateContainerSync=function(a,o,u,d){return o.tag===0&&yr(),Ry(o.current,2,a,o,u,d),2},Ee};Pf.exports.default=Pf.exports;Object.defineProperty(Pf.exports,"__esModule",{value:!0})});var Hv=pi((FU,V1)=>{"use strict";V1.exports=z1()});var G1=pi(Wm=>{"use strict";var GD=Symbol.for("react.transitional.element"),kD=Symbol.for("react.fragment");function H1(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var s in t)s!=="key"&&(e[s]=t[s])}else e=t;return t=e.ref,{$$typeof:GD,type:i,key:n,ref:t!==void 0?t:null,props:e}}Wm.Fragment=kD;Wm.jsx=H1;Wm.jsxs=H1});var So=pi((VU,k1)=>{"use strict";k1.exports=G1()});var Lm={};EA(Lm,{ACESFilmicToneMapping:()=>rc,AddEquation:()=>ca,AddOperation:()=>H_,AdditiveAnimationBlendMode:()=>Rm,AdditiveBlending:()=>fm,AgXToneMapping:()=>xm,AlphaFormat:()=>Am,AlwaysCompare:()=>$_,AlwaysDepth:()=>Dh,AlwaysStencilFunc:()=>sp,AmbientLight:()=>yh,AnimationAction:()=>wh,AnimationClip:()=>ir,AnimationLoader:()=>bp,AnimationMixer:()=>Op,AnimationObjectGroup:()=>Lp,AnimationUtils:()=>Mp,ArcCurve:()=>Vu,ArrayCamera:()=>Ah,ArrowHelper:()=>am,AttachedBindMode:()=>ip,Audio:()=>Ch,AudioAnalyser:()=>Ip,AudioContext:()=>ic,AudioListener:()=>Up,AudioLoader:()=>Np,AxesHelper:()=>rm,BackSide:()=>ti,BasicDepthPacking:()=>q_,BasicShadowMap:()=>hm,BatchedMesh:()=>Du,Bone:()=>Ll,BooleanKeyframeTrack:()=>Ls,Box2:()=>qp,Box3:()=>bn,Box3Helper:()=>im,BoxGeometry:()=>Ja,BoxHelper:()=>nm,BufferAttribute:()=>He,BufferGeometry:()=>de,BufferGeometryLoader:()=>Th,ByteType:()=>Mm,Cache:()=>fs,Camera:()=>$r,CameraHelper:()=>em,CanvasTexture:()=>yp,CapsuleGeometry:()=>Ou,CatmullRomCurve3:()=>Hu,CineonToneMapping:()=>_m,CircleGeometry:()=>Bu,ClampToEdgeWrapping:()=>li,Clock:()=>lo,Color:()=>Lt,ColorKeyframeTrack:()=>$l,ColorManagement:()=>be,CompressedArrayTexture:()=>vp,CompressedCubeTexture:()=>xp,CompressedTexture:()=>io,CompressedTextureLoader:()=>Ep,ConeGeometry:()=>zl,ConstantAlphaFactor:()=>F_,ConstantColorFactor:()=>O_,Controls:()=>lm,CubeCamera:()=>Mu,CubeDepthTexture:()=>Lu,CubeReflectionMapping:()=>xs,CubeRefractionMapping:()=>_a,CubeTexture:()=>Ka,CubeTextureLoader:()=>Tp,CubeUVReflectionMapping:()=>co,CubicBezierCurve:()=>Vl,CubicBezierCurve3:()=>Gu,CubicInterpolant:()=>fh,CullFaceBack:()=>um,CullFaceFront:()=>S_,CullFaceFrontBack:()=>SM,CullFaceNone:()=>y_,Curve:()=>yi,CurvePath:()=>Wu,CustomBlending:()=>M_,CustomToneMapping:()=>vm,CylinderGeometry:()=>Fl,Cylindrical:()=>Wp,Data3DTexture:()=>Qr,DataArrayTexture:()=>Kr,DataTexture:()=>vi,DataTextureLoader:()=>Ap,DataUtils:()=>op,DecrementStencilOp:()=>zM,DecrementWrapStencilOp:()=>HM,DefaultLoadingManager:()=>ov,DepthFormat:()=>ds,DepthStencilFormat:()=>va,DepthTexture:()=>da,DetachedBindMode:()=>G_,DirectionalLight:()=>xh,DirectionalLightHelper:()=>tm,DiscreteInterpolant:()=>dh,DodecahedronGeometry:()=>Fu,DoubleSide:()=>_s,DstAlphaFactor:()=>D_,DstColorFactor:()=>P_,DynamicCopyUsage:()=>nb,DynamicDrawUsage:()=>JM,DynamicReadUsage:()=>$M,EdgesGeometry:()=>zu,EllipseCurve:()=>so,EqualCompare:()=>J_,EqualDepth:()=>Ph,EqualStencilFunc:()=>XM,EquirectangularReflectionMapping:()=>oc,EquirectangularRefractionMapping:()=>lc,Euler:()=>xi,EventDispatcher:()=>Oi,ExternalTexture:()=>Bl,ExtrudeGeometry:()=>Zu,FileLoader:()=>$i,Float16BufferAttribute:()=>dp,Float32BufferAttribute:()=>Gt,FloatType:()=>Qn,Fog:()=>Eu,FogExp2:()=>bu,FramebufferTexture:()=>_p,FrontSide:()=>Us,Frustum:()=>fa,FrustumArray:()=>Nu,GLBufferAttribute:()=>Hp,GLSL1:()=>sb,GLSL3:()=>wm,GreaterCompare:()=>K_,GreaterDepth:()=>Lh,GreaterEqualCompare:()=>Tf,GreaterEqualDepth:()=>Ih,GreaterEqualStencilFunc:()=>jM,GreaterStencilFunc:()=>YM,GridHelper:()=>Qp,Group:()=>oa,HalfFloatType:()=>Ss,HemisphereLight:()=>mh,HemisphereLightHelper:()=>Kp,IcosahedronGeometry:()=>ju,ImageBitmapLoader:()=>wp,ImageLoader:()=>sr,ImageUtils:()=>Su,IncrementStencilOp:()=>FM,IncrementWrapStencilOp:()=>VM,InstancedBufferAttribute:()=>ha,InstancedBufferGeometry:()=>Eh,InstancedInterleavedBuffer:()=>Vp,InstancedMesh:()=>wu,Int16BufferAttribute:()=>hp,Int32BufferAttribute:()=>fp,Int8BufferAttribute:()=>lp,IntType:()=>Fh,InterleavedBuffer:()=>no,InterleavedBufferAttribute:()=>Qa,Interpolant:()=>$a,InterpolateDiscrete:()=>El,InterpolateLinear:()=>yu,InterpolateSmooth:()=>pu,InterpolationSamplingMode:()=>ob,InterpolationSamplingType:()=>rb,InvertStencilOp:()=>GM,KeepStencilOp:()=>Wa,KeyframeTrack:()=>ui,LOD:()=>Au,LatheGeometry:()=>Ju,Layers:()=>Is,LessCompare:()=>j_,LessDepth:()=>Uh,LessEqualCompare:()=>Ef,LessEqualDepth:()=>Za,LessEqualStencilFunc:()=>qM,LessStencilFunc:()=>WM,Light:()=>gs,LightProbe:()=>Mh,Line:()=>ms,Line3:()=>Yp,LineBasicMaterial:()=>Pn,LineCurve:()=>Hl,LineCurve3:()=>ku,LineDashedMaterial:()=>hh,LineLoop:()=>Uu,LineSegments:()=>Bi,LinearFilter:()=>Je,LinearInterpolant:()=>Ql,LinearMipMapLinearFilter:()=>TM,LinearMipMapNearestFilter:()=>EM,LinearMipmapLinearFilter:()=>ys,LinearMipmapNearestFilter:()=>cc,LinearSRGBColorSpace:()=>Ps,LinearToneMapping:()=>mm,LinearTransfer:()=>Al,Loader:()=>Hn,LoaderUtils:()=>nc,LoadingManager:()=>tc,LoopOnce:()=>k_,LoopPingPong:()=>X_,LoopRepeat:()=>W_,MOUSE:()=>xM,Material:()=>En,MaterialLoader:()=>bh,MathUtils:()=>fb,Matrix2:()=>Xp,Matrix3:()=>pe,Matrix4:()=>ue,MaxEquation:()=>A_,Mesh:()=>rn,MeshBasicMaterial:()=>ps,MeshDepthMaterial:()=>Jl,MeshDistanceMaterial:()=>Kl,MeshLambertMaterial:()=>ch,MeshMatcapMaterial:()=>uh,MeshNormalMaterial:()=>lh,MeshPhongMaterial:()=>rh,MeshPhysicalMaterial:()=>ah,MeshStandardMaterial:()=>jl,MeshToonMaterial:()=>oh,MinEquation:()=>T_,MirroredRepeatWrapping:()=>bl,MixOperation:()=>V_,MultiplyBlending:()=>pm,MultiplyOperation:()=>ac,NearestFilter:()=>dn,NearestMipMapLinearFilter:()=>bM,NearestMipMapNearestFilter:()=>MM,NearestMipmapLinearFilter:()=>uo,NearestMipmapNearestFilter:()=>Sm,NeutralToneMapping:()=>ym,NeverCompare:()=>Z_,NeverDepth:()=>Nh,NeverStencilFunc:()=>kM,NoBlending:()=>vs,NoColorSpace:()=>Fs,NoNormalPacking:()=>PM,NoToneMapping:()=>Si,NormalAnimationBlendMode:()=>bf,NormalBlending:()=>Ya,NormalGAPacking:()=>LM,NormalRGPacking:()=>IM,NotEqualCompare:()=>Q_,NotEqualDepth:()=>Oh,NotEqualStencilFunc:()=>ZM,NumberKeyframeTrack:()=>tr,Object3D:()=>Oe,ObjectLoader:()=>Rp,ObjectSpaceNormalMap:()=>Y_,OctahedronGeometry:()=>ql,OneFactor:()=>R_,OneMinusConstantAlphaFactor:()=>z_,OneMinusConstantColorFactor:()=>B_,OneMinusDstAlphaFactor:()=>U_,OneMinusDstColorFactor:()=>I_,OneMinusSrcAlphaFactor:()=>xu,OneMinusSrcColorFactor:()=>N_,OrthographicCamera:()=>Bs,PCFShadowMap:()=>ar,PCFSoftShadowMap:()=>ma,PMREMGenerator:()=>wf,Path:()=>ao,PerspectiveCamera:()=>fn,Plane:()=>cs,PlaneGeometry:()=>oo,PlaneHelper:()=>sm,PointLight:()=>vh,PointLightHelper:()=>Jp,Points:()=>Pu,PointsMaterial:()=>Ol,PolarGridHelper:()=>$p,PolyhedronGeometry:()=>pa,PositionalAudio:()=>Pp,PropertyBinding:()=>Ge,PropertyMixer:()=>Rh,QuadraticBezierCurve:()=>Gl,QuadraticBezierCurve3:()=>kl,Quaternion:()=>Vn,QuaternionKeyframeTrack:()=>er,QuaternionLinearInterpolant:()=>ph,R11_EAC_Format:()=>Kh,RED_GREEN_RGTC2_Format:()=>Sf,RED_RGTC1_Format:()=>xf,REVISION:()=>x_,RG11_EAC_Format:()=>$h,RGBADepthPacking:()=>NM,RGBAFormat:()=>Un,RGBAIntegerFormat:()=>kh,RGBA_ASTC_10x10_Format:()=>df,RGBA_ASTC_10x5_Format:()=>uf,RGBA_ASTC_10x6_Format:()=>hf,RGBA_ASTC_10x8_Format:()=>ff,RGBA_ASTC_12x10_Format:()=>pf,RGBA_ASTC_12x12_Format:()=>mf,RGBA_ASTC_4x4_Format:()=>ef,RGBA_ASTC_5x4_Format:()=>nf,RGBA_ASTC_5x5_Format:()=>sf,RGBA_ASTC_6x5_Format:()=>af,RGBA_ASTC_6x6_Format:()=>rf,RGBA_ASTC_8x5_Format:()=>of,RGBA_ASTC_8x6_Format:()=>lf,RGBA_ASTC_8x8_Format:()=>cf,RGBA_BPTC_Format:()=>gf,RGBA_ETC2_EAC_Format:()=>Jh,RGBA_PVRTC_2BPPV1_Format:()=>Yh,RGBA_PVRTC_4BPPV1_Format:()=>qh,RGBA_S3TC_DXT1_Format:()=>fc,RGBA_S3TC_DXT3_Format:()=>dc,RGBA_S3TC_DXT5_Format:()=>pc,RGBDepthPacking:()=>DM,RGBFormat:()=>Cm,RGBIntegerFormat:()=>AM,RGB_BPTC_SIGNED_Format:()=>_f,RGB_BPTC_UNSIGNED_Format:()=>vf,RGB_ETC1_Format:()=>Zh,RGB_ETC2_Format:()=>jh,RGB_PVRTC_2BPPV1_Format:()=>Xh,RGB_PVRTC_4BPPV1_Format:()=>Wh,RGB_S3TC_DXT1_Format:()=>hc,RGDepthPacking:()=>UM,RGFormat:()=>rr,RGIntegerFormat:()=>Gh,RawShaderMaterial:()=>Zl,Ray:()=>ua,Raycaster:()=>sc,RectAreaLight:()=>Sh,RedFormat:()=>Hh,RedIntegerFormat:()=>uc,ReinhardToneMapping:()=>gm,RenderTarget:()=>Nl,RenderTarget3D:()=>Bp,RepeatWrapping:()=>Ml,ReplaceStencilOp:()=>BM,ReverseSubtractEquation:()=>E_,RingGeometry:()=>Ku,SIGNED_R11_EAC_Format:()=>Qh,SIGNED_RED_GREEN_RGTC2_Format:()=>Mf,SIGNED_RED_RGTC1_Format:()=>yf,SIGNED_RG11_EAC_Format:()=>tf,SRGBColorSpace:()=>Dn,SRGBTransfer:()=>Ve,Scene:()=>eo,ShaderChunk:()=>xe,ShaderLib:()=>Ms,ShaderMaterial:()=>ci,ShadowMaterial:()=>sh,Shape:()=>Ds,ShapeGeometry:()=>Qu,ShapePath:()=>om,ShapeUtils:()=>Qi,ShortType:()=>bm,Skeleton:()=>Ru,SkeletonHelper:()=>jp,SkinnedMesh:()=>Cu,Source:()=>hs,Sphere:()=>yn,SphereGeometry:()=>Yl,Spherical:()=>kp,SphericalHarmonics3:()=>ec,SplineCurve:()=>Wl,SpotLight:()=>_h,SpotLightHelper:()=>Zp,Sprite:()=>Tu,SpriteMaterial:()=>Il,SrcAlphaFactor:()=>vu,SrcAlphaSaturateFactor:()=>L_,SrcColorFactor:()=>w_,StaticCopyUsage:()=>eb,StaticDrawUsage:()=>Cl,StaticReadUsage:()=>QM,StereoCamera:()=>Dp,StreamCopyUsage:()=>ib,StreamDrawUsage:()=>KM,StreamReadUsage:()=>tb,StringKeyframeTrack:()=>Os,SubtractEquation:()=>b_,SubtractiveBlending:()=>dm,TOUCH:()=>yM,TangentSpaceNormalMap:()=>xa,TetrahedronGeometry:()=>$u,Texture:()=>mn,TextureLoader:()=>Cp,TextureUtils:()=>cm,Timer:()=>Gp,TimestampQuery:()=>ab,TorusGeometry:()=>th,TorusKnotGeometry:()=>eh,Triangle:()=>us,TriangleFanDrawMode:()=>wM,TriangleStripDrawMode:()=>RM,TrianglesDrawMode:()=>CM,TubeGeometry:()=>nh,UVMapping:()=>Bh,Uint16BufferAttribute:()=>Dl,Uint32BufferAttribute:()=>Ul,Uint8BufferAttribute:()=>cp,Uint8ClampedBufferAttribute:()=>up,Uniform:()=>Fp,UniformsGroup:()=>zp,UniformsLib:()=>It,UniformsUtils:()=>sv,UnsignedByteType:()=>Gn,UnsignedInt101111Type:()=>Tm,UnsignedInt248Type:()=>fo,UnsignedInt5999Type:()=>Em,UnsignedIntType:()=>Fi,UnsignedShort4444Type:()=>zh,UnsignedShort5551Type:()=>Vh,UnsignedShortType:()=>ho,VSMShadowMap:()=>ga,Vector2:()=>ft,Vector3:()=>O,Vector4:()=>qe,VectorKeyframeTrack:()=>nr,VideoFrameTexture:()=>gp,VideoTexture:()=>Iu,WebGL3DRenderTarget:()=>rp,WebGLArrayRenderTarget:()=>ap,WebGLCoordinateSystem:()=>_i,WebGLCubeRenderTarget:()=>Pl,WebGLRenderTarget:()=>$n,WebGLRenderer:()=>vo,WebGLUtils:()=>Zb,WebGPUCoordinateSystem:()=>Zr,WebXRController:()=>to,WireframeGeometry:()=>ih,WrapAroundEnding:()=>Tl,ZeroCurvatureEnding:()=>Xa,ZeroFactor:()=>C_,ZeroSlopeEnding:()=>qa,ZeroStencilOp:()=>OM,createCanvasElement:()=>ev,error:()=>Qt,getConsoleFunction:()=>ub,log:()=>wl,setConsoleFunction:()=>cb,warn:()=>wt,warnOnce:()=>jr});var x_="182",xM={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yM={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},y_=0,um=1,S_=2,SM=3,hm=0,ar=1,ma=2,ga=3,Us=0,ti=1,_s=2,vs=0,Ya=1,fm=2,dm=3,pm=4,M_=5,ca=100,b_=101,E_=102,T_=103,A_=104,C_=200,R_=201,w_=202,N_=203,vu=204,xu=205,D_=206,U_=207,P_=208,I_=209,L_=210,O_=211,B_=212,F_=213,z_=214,Nh=0,Dh=1,Uh=2,Za=3,Ph=4,Ih=5,Lh=6,Oh=7,ac=0,V_=1,H_=2,Si=0,mm=1,gm=2,_m=3,rc=4,vm=5,xm=6,ym=7,ip="attached",G_="detached",Bh=300,xs=301,_a=302,oc=303,lc=304,co=306,Ml=1e3,li=1001,bl=1002,dn=1003,Sm=1004,MM=1004,uo=1005,bM=1005,Je=1006,cc=1007,EM=1007,ys=1008,TM=1008,Gn=1009,Mm=1010,bm=1011,ho=1012,Fh=1013,Fi=1014,Qn=1015,Ss=1016,zh=1017,Vh=1018,fo=1020,Em=35902,Tm=35899,Am=1021,Cm=1022,Un=1023,ds=1026,va=1027,Hh=1028,uc=1029,rr=1030,Gh=1031,AM=1032,kh=1033,hc=33776,fc=33777,dc=33778,pc=33779,Wh=35840,Xh=35841,qh=35842,Yh=35843,Zh=36196,jh=37492,Jh=37496,Kh=37488,Qh=37489,$h=37490,tf=37491,ef=37808,nf=37809,sf=37810,af=37811,rf=37812,of=37813,lf=37814,cf=37815,uf=37816,hf=37817,ff=37818,df=37819,pf=37820,mf=37821,gf=36492,_f=36494,vf=36495,xf=36283,yf=36284,Sf=36285,Mf=36286,k_=2200,W_=2201,X_=2202,El=2300,yu=2301,pu=2302,Xa=2400,qa=2401,Tl=2402,bf=2500,Rm=2501,CM=0,RM=1,wM=2,q_=3200,NM=3201,DM=3202,UM=3203,xa=0,Y_=1,Fs="",Dn="srgb",Ps="srgb-linear",Al="linear",Ve="srgb",PM="",IM="rg",LM="ga",OM=0,Wa=7680,BM=7681,FM=7682,zM=7683,VM=34055,HM=34056,GM=5386,kM=512,WM=513,XM=514,qM=515,YM=516,ZM=517,jM=518,sp=519,Z_=512,j_=513,J_=514,Ef=515,K_=516,Q_=517,Tf=518,$_=519,Cl=35044,JM=35048,KM=35040,QM=35045,$M=35049,tb=35041,eb=35046,nb=35050,ib=35042,sb="100",wm="300 es",_i=2e3,Zr=2001,ab={COMPUTE:"compute",RENDER:"render"},rb={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},ob={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function tv(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}var AA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function yl(i,t){return new AA[i](t)}function lb(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Rl(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ev(){let i=Rl("canvas");return i.style.display="block",i}var dS={},ja=null;function cb(i){ja=i}function ub(){return ja}function wl(...i){let t="THREE."+i.shift();ja?ja("log",t,...i):console.log(t,...i)}function wt(...i){let t="THREE."+i.shift();ja?ja("warn",t,...i):console.warn(t,...i)}function Qt(...i){let t="THREE."+i.shift();ja?ja("error",t,...i):console.error(t,...i)}function jr(...i){let t=i.join(" ");t in dS||(dS[t]=!0,wt(...i))}function hb(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var Oi=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let s=n[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,l=s.length;r<l;r++)s[r].call(this,t);t.target=null}}},jn=["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"],pS=1234567,Yr=Math.PI/180,Jr=180/Math.PI;function Li(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(jn[i&255]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]+"-"+jn[t&255]+jn[t>>8&255]+"-"+jn[t>>16&15|64]+jn[t>>24&255]+"-"+jn[e&63|128]+jn[e>>8&255]+"-"+jn[e>>16&255]+jn[e>>24&255]+jn[n&255]+jn[n>>8&255]+jn[n>>16&255]+jn[n>>24&255]).toLowerCase()}function le(i,t,e){return Math.max(t,Math.min(e,i))}function nv(i,t){return(i%t+t)%t}function CA(i,t,e,n,s){return n+(i-t)*(s-n)/(e-t)}function RA(i,t,e){return i!==t?(e-i)/(t-i):0}function mu(i,t,e){return(1-e)*i+e*t}function wA(i,t,e,n){return mu(i,t,1-Math.exp(-e*n))}function NA(i,t=1){return t-Math.abs(nv(i,t*2)-t)}function DA(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function UA(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function PA(i,t){return i+Math.floor(Math.random()*(t-i+1))}function IA(i,t){return i+Math.random()*(t-i)}function LA(i){return i*(.5-Math.random())}function OA(i){i!==void 0&&(pS=i);let t=pS+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function BA(i){return i*Yr}function FA(i){return i*Jr}function zA(i){return(i&i-1)===0&&i!==0}function VA(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function HA(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function GA(i,t,e,n,s){let r=Math.cos,l=Math.sin,c=r(e/2),h=l(e/2),f=r((t+n)/2),p=l((t+n)/2),m=r((t-n)/2),g=l((t-n)/2),v=r((n-t)/2),y=l((n-t)/2);switch(s){case"XYX":i.set(c*p,h*m,h*g,c*f);break;case"YZY":i.set(h*g,c*p,h*m,c*f);break;case"ZXZ":i.set(h*m,h*g,c*p,c*f);break;case"XZX":i.set(c*p,h*y,h*v,c*f);break;case"YXY":i.set(h*v,c*p,h*y,c*f);break;case"ZYZ":i.set(h*y,h*v,c*p,c*f);break;default:wt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function oi(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function ve(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var fb={DEG2RAD:Yr,RAD2DEG:Jr,generateUUID:Li,clamp:le,euclideanModulo:nv,mapLinear:CA,inverseLerp:RA,lerp:mu,damp:wA,pingpong:NA,smoothstep:DA,smootherstep:UA,randInt:PA,randFloat:IA,randFloatSpread:LA,seededRandom:OA,degToRad:BA,radToDeg:FA,isPowerOfTwo:zA,ceilPowerOfTwo:VA,floorPowerOfTwo:HA,setQuaternionFromProperEuler:GA,normalize:ve,denormalize:oi},ft=class i{constructor(t=0,e=0){i.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(le(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,l=this.y-t.y;return this.x=r*n-l*s+t.x,this.y=r*s+l*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Vn=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,l,c){let h=n[s+0],f=n[s+1],p=n[s+2],m=n[s+3],g=r[l+0],v=r[l+1],y=r[l+2],b=r[l+3];if(c<=0){t[e+0]=h,t[e+1]=f,t[e+2]=p,t[e+3]=m;return}if(c>=1){t[e+0]=g,t[e+1]=v,t[e+2]=y,t[e+3]=b;return}if(m!==b||h!==g||f!==v||p!==y){let S=h*g+f*v+p*y+m*b;S<0&&(g=-g,v=-v,y=-y,b=-b,S=-S);let x=1-c;if(S<.9995){let E=Math.acos(S),T=Math.sin(E);x=Math.sin(x*E)/T,c=Math.sin(c*E)/T,h=h*x+g*c,f=f*x+v*c,p=p*x+y*c,m=m*x+b*c}else{h=h*x+g*c,f=f*x+v*c,p=p*x+y*c,m=m*x+b*c;let E=1/Math.sqrt(h*h+f*f+p*p+m*m);h*=E,f*=E,p*=E,m*=E}}t[e]=h,t[e+1]=f,t[e+2]=p,t[e+3]=m}static multiplyQuaternionsFlat(t,e,n,s,r,l){let c=n[s],h=n[s+1],f=n[s+2],p=n[s+3],m=r[l],g=r[l+1],v=r[l+2],y=r[l+3];return t[e]=c*y+p*m+h*v-f*g,t[e+1]=h*y+p*g+f*m-c*v,t[e+2]=f*y+p*v+c*g-h*m,t[e+3]=p*y-c*m-h*g-f*v,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,s=t._y,r=t._z,l=t._order,c=Math.cos,h=Math.sin,f=c(n/2),p=c(s/2),m=c(r/2),g=h(n/2),v=h(s/2),y=h(r/2);switch(l){case"XYZ":this._x=g*p*m+f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m-g*v*y;break;case"YXZ":this._x=g*p*m+f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m+g*v*y;break;case"ZXY":this._x=g*p*m-f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m-g*v*y;break;case"ZYX":this._x=g*p*m-f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m+g*v*y;break;case"YZX":this._x=g*p*m+f*v*y,this._y=f*v*m+g*p*y,this._z=f*p*y-g*v*m,this._w=f*p*m-g*v*y;break;case"XZY":this._x=g*p*m-f*v*y,this._y=f*v*m-g*p*y,this._z=f*p*y+g*v*m,this._w=f*p*m+g*v*y;break;default:wt("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],l=e[1],c=e[5],h=e[9],f=e[2],p=e[6],m=e[10],g=n+c+m;if(g>0){let v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(p-h)*v,this._y=(r-f)*v,this._z=(l-s)*v}else if(n>c&&n>m){let v=2*Math.sqrt(1+n-c-m);this._w=(p-h)/v,this._x=.25*v,this._y=(s+l)/v,this._z=(r+f)/v}else if(c>m){let v=2*Math.sqrt(1+c-n-m);this._w=(r-f)/v,this._x=(s+l)/v,this._y=.25*v,this._z=(h+p)/v}else{let v=2*Math.sqrt(1+m-n-c);this._w=(l-s)/v,this._x=(r+f)/v,this._y=(h+p)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(le(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,s=t._y,r=t._z,l=t._w,c=e._x,h=e._y,f=e._z,p=e._w;return this._x=n*p+l*c+s*f-r*h,this._y=s*p+l*h+r*c-n*f,this._z=r*p+l*f+n*h-s*c,this._w=l*p-n*c-s*h-r*f,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let n=t._x,s=t._y,r=t._z,l=t._w,c=this.dot(t);c<0&&(n=-n,s=-s,r=-r,l=-l,c=-c);let h=1-e;if(c<.9995){let f=Math.acos(c),p=Math.sin(f);h=Math.sin(h*f)/p,e=Math.sin(e*f)/p,this._x=this._x*h+n*e,this._y=this._y*h+s*e,this._z=this._z*h+r*e,this._w=this._w*h+l*e,this._onChangeCallback()}else this._x=this._x*h+n*e,this._y=this._y*h+s*e,this._z=this._z*h+r*e,this._w=this._w*h+l*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},O=class i{constructor(t=0,e=0,n=0){i.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(mS.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(mS.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,l=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*l,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*l,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*l,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,l=t.y,c=t.z,h=t.w,f=2*(l*s-c*n),p=2*(c*e-r*s),m=2*(r*n-l*e);return this.x=e+h*f+l*m-c*p,this.y=n+h*p+c*f-r*m,this.z=s+h*m+r*p-l*f,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this.z=le(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this.z=le(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,s=t.y,r=t.z,l=e.x,c=e.y,h=e.z;return this.x=s*h-r*c,this.y=r*l-n*h,this.z=n*c-s*l,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return E0.copy(this).projectOnVector(t),this.sub(E0)}reflect(t){return this.sub(E0.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(le(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},E0=new O,mS=new Vn,pe=class i{constructor(t,e,n,s,r,l,c,h,f){i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,l,c,h,f)}set(t,e,n,s,r,l,c,h,f){let p=this.elements;return p[0]=t,p[1]=s,p[2]=c,p[3]=e,p[4]=r,p[5]=h,p[6]=n,p[7]=l,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,l=n[0],c=n[3],h=n[6],f=n[1],p=n[4],m=n[7],g=n[2],v=n[5],y=n[8],b=s[0],S=s[3],x=s[6],E=s[1],T=s[4],A=s[7],N=s[2],D=s[5],L=s[8];return r[0]=l*b+c*E+h*N,r[3]=l*S+c*T+h*D,r[6]=l*x+c*A+h*L,r[1]=f*b+p*E+m*N,r[4]=f*S+p*T+m*D,r[7]=f*x+p*A+m*L,r[2]=g*b+v*E+y*N,r[5]=g*S+v*T+y*D,r[8]=g*x+v*A+y*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8];return e*l*p-e*c*f-n*r*p+n*c*h+s*r*f-s*l*h}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8],m=p*l-c*f,g=c*h-p*r,v=f*r-l*h,y=e*m+n*g+s*v;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let b=1/y;return t[0]=m*b,t[1]=(s*f-p*n)*b,t[2]=(c*n-s*l)*b,t[3]=g*b,t[4]=(p*e-s*h)*b,t[5]=(s*r-c*e)*b,t[6]=v*b,t[7]=(n*h-f*e)*b,t[8]=(l*e-n*r)*b,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,l,c){let h=Math.cos(r),f=Math.sin(r);return this.set(n*h,n*f,-n*(h*l+f*c)+l+t,-s*f,s*h,-s*(-f*l+h*c)+c+e,0,0,1),this}scale(t,e){return this.premultiply(T0.makeScale(t,e)),this}rotate(t){return this.premultiply(T0.makeRotation(-t)),this}translate(t,e){return this.premultiply(T0.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},T0=new pe,gS=new pe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_S=new pe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function kA(){let i={enabled:!0,workingColorSpace:Ps,spaces:{},convert:function(s,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===Ve&&(s.r=la(s.r),s.g=la(s.g),s.b=la(s.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===Ve&&(s.r=Sl(s.r),s.g=Sl(s.g),s.b=Sl(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Fs?Al:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,l){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return jr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return jr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ps]:{primaries:t,whitePoint:n,transfer:Al,toXYZ:gS,fromXYZ:_S,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Dn},outputColorSpaceConfig:{drawingBufferColorSpace:Dn}},[Dn]:{primaries:t,whitePoint:n,transfer:Ve,toXYZ:gS,fromXYZ:_S,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Dn}}}),i}var be=kA();function la(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Sl(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var tl,Su=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{tl===void 0&&(tl=Rl("canvas")),tl.width=t.width,tl.height=t.height;let s=tl.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=tl}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Rl("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let l=0;l<r.length;l++)r[l]=la(r[l]/255)*255;return n.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(la(e[n]/255)*255):e[n]=la(e[n]);return{data:e,width:t.width,height:t.height}}else return wt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},WA=0,hs=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:WA++}),this.uuid=Li(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let l=0,c=s.length;l<c;l++)s[l].isDataTexture?r.push(A0(s[l].image)):r.push(A0(s[l]))}else r=A0(s);n.url=r}return e||(t.images[this.uuid]=n),n}};function A0(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Su.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(wt("Texture: Unable to serialize Texture."),{})}var XA=0,C0=new O,mn=class i extends Oi{constructor(t=i.DEFAULT_IMAGE,e=i.DEFAULT_MAPPING,n=li,s=li,r=Je,l=ys,c=Un,h=Gn,f=i.DEFAULT_ANISOTROPY,p=Fs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:XA++}),this.uuid=Li(),this.name="",this.source=new hs(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=l,this.anisotropy=f,this.format=c,this.internalFormat=null,this.type=h,this.offset=new ft(0,0),this.repeat=new ft(1,1),this.center=new ft(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(C0).x}get height(){return this.source.getSize(C0).y}get depth(){return this.source.getSize(C0).z}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){wt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){wt(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Bh)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ml:t.x=t.x-Math.floor(t.x);break;case li:t.x=t.x<0?0:1;break;case bl:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ml:t.y=t.y-Math.floor(t.y);break;case li:t.y=t.y<0?0:1;break;case bl:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};mn.DEFAULT_IMAGE=null;mn.DEFAULT_MAPPING=Bh;mn.DEFAULT_ANISOTROPY=1;var qe=class i{constructor(t=0,e=0,n=0,s=1){i.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=this.w,l=t.elements;return this.x=l[0]*e+l[4]*n+l[8]*s+l[12]*r,this.y=l[1]*e+l[5]*n+l[9]*s+l[13]*r,this.z=l[2]*e+l[6]*n+l[10]*s+l[14]*r,this.w=l[3]*e+l[7]*n+l[11]*s+l[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r,h=t.elements,f=h[0],p=h[4],m=h[8],g=h[1],v=h[5],y=h[9],b=h[2],S=h[6],x=h[10];if(Math.abs(p-g)<.01&&Math.abs(m-b)<.01&&Math.abs(y-S)<.01){if(Math.abs(p+g)<.1&&Math.abs(m+b)<.1&&Math.abs(y+S)<.1&&Math.abs(f+v+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let T=(f+1)/2,A=(v+1)/2,N=(x+1)/2,D=(p+g)/4,L=(m+b)/4,F=(y+S)/4;return T>A&&T>N?T<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(T),s=D/n,r=L/n):A>N?A<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(A),n=D/s,r=F/s):N<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(N),n=L/r,s=F/r),this.set(n,s,r,e),this}let E=Math.sqrt((S-y)*(S-y)+(m-b)*(m-b)+(g-p)*(g-p));return Math.abs(E)<.001&&(E=1),this.x=(S-y)/E,this.y=(m-b)/E,this.z=(g-p)/E,this.w=Math.acos((f+v+x-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=le(this.x,t.x,e.x),this.y=le(this.y,t.y,e.y),this.z=le(this.z,t.z,e.z),this.w=le(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=le(this.x,t,e),this.y=le(this.y,t,e),this.z=le(this.z,t,e),this.w=le(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(le(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},Nl=class extends Oi{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Je,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new qe(0,0,t,e),this.scissorTest=!1,this.viewport=new qe(0,0,t,e);let s={width:t,height:e,depth:n.depth},r=new mn(s);this.textures=[];let l=n.count;for(let c=0;c<l;c++)this.textures[c]=r.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(t={}){let e={minFilter:Je,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let s=Object.assign({},t.textures[e].image);this.textures[e].source=new hs(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},$n=class extends Nl{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}},Kr=class extends mn{constructor(t=null,e=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=dn,this.minFilter=dn,this.wrapR=li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},ap=class extends $n{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Kr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},Qr=class extends mn{constructor(t=null,e=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=dn,this.minFilter=dn,this.wrapR=li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},rp=class extends $n{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Qr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},bn=class{constructor(t=new O(1/0,1/0,1/0),e=new O(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(rs.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(rs.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=rs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let l=0,c=r.count;l<c;l++)t.isMesh===!0?t.getVertexPosition(l,rs):rs.fromBufferAttribute(r,l),rs.applyMatrix4(t.matrixWorld),this.expandByPoint(rs);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),md.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),md.copy(n.boundingBox)),md.applyMatrix4(t.matrixWorld),this.union(md)}let s=t.children;for(let r=0,l=s.length;r<l;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,rs),rs.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(eu),gd.subVectors(this.max,eu),el.subVectors(t.a,eu),nl.subVectors(t.b,eu),il.subVectors(t.c,eu),Ba.subVectors(nl,el),Fa.subVectors(il,nl),Ir.subVectors(el,il);let e=[0,-Ba.z,Ba.y,0,-Fa.z,Fa.y,0,-Ir.z,Ir.y,Ba.z,0,-Ba.x,Fa.z,0,-Fa.x,Ir.z,0,-Ir.x,-Ba.y,Ba.x,0,-Fa.y,Fa.x,0,-Ir.y,Ir.x,0];return!R0(e,el,nl,il,gd)||(e=[1,0,0,0,1,0,0,0,1],!R0(e,el,nl,il,gd))?!1:(_d.crossVectors(Ba,Fa),e=[_d.x,_d.y,_d.z],R0(e,el,nl,il,gd))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,rs).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(rs).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ta[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ta[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ta[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ta[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ta[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ta[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ta[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ta[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ta),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ta=[new O,new O,new O,new O,new O,new O,new O,new O],rs=new O,md=new bn,el=new O,nl=new O,il=new O,Ba=new O,Fa=new O,Ir=new O,eu=new O,gd=new O,_d=new O,Lr=new O;function R0(i,t,e,n,s){for(let r=0,l=i.length-3;r<=l;r+=3){Lr.fromArray(i,r);let c=s.x*Math.abs(Lr.x)+s.y*Math.abs(Lr.y)+s.z*Math.abs(Lr.z),h=t.dot(Lr),f=e.dot(Lr),p=n.dot(Lr);if(Math.max(-Math.max(h,f,p),Math.min(h,f,p))>c)return!1}return!0}var qA=new bn,nu=new O,w0=new O,yn=class{constructor(t=new O,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):qA.setFromPoints(t).getCenter(n);let s=0;for(let r=0,l=t.length;r<l;r++)s=Math.max(s,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;nu.subVectors(t,this.center);let e=nu.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(nu,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(w0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(nu.copy(t.center).add(w0)),this.expandByPoint(nu.copy(t.center).sub(w0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},ea=new O,N0=new O,vd=new O,za=new O,D0=new O,xd=new O,U0=new O,ua=class{constructor(t=new O,e=new O(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ea)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ea.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ea.copy(this.origin).addScaledVector(this.direction,e),ea.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){N0.copy(t).add(e).multiplyScalar(.5),vd.copy(e).sub(t).normalize(),za.copy(this.origin).sub(N0);let r=t.distanceTo(e)*.5,l=-this.direction.dot(vd),c=za.dot(this.direction),h=-za.dot(vd),f=za.lengthSq(),p=Math.abs(1-l*l),m,g,v,y;if(p>0)if(m=l*h-c,g=l*c-h,y=r*p,m>=0)if(g>=-y)if(g<=y){let b=1/p;m*=b,g*=b,v=m*(m+l*g+2*c)+g*(l*m+g+2*h)+f}else g=r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;else g=-r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;else g<=-y?(m=Math.max(0,-(-l*r+c)),g=m>0?-r:Math.min(Math.max(-r,-h),r),v=-m*m+g*(g+2*h)+f):g<=y?(m=0,g=Math.min(Math.max(-r,-h),r),v=g*(g+2*h)+f):(m=Math.max(0,-(l*r+c)),g=m>0?r:Math.min(Math.max(-r,-h),r),v=-m*m+g*(g+2*h)+f);else g=l>0?-r:r,m=Math.max(0,-(l*g+c)),v=-m*m+g*(g+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,m),s&&s.copy(N0).addScaledVector(vd,g),v}intersectSphere(t,e){ea.subVectors(t.center,this.origin);let n=ea.dot(this.direction),s=ea.dot(ea)-n*n,r=t.radius*t.radius;if(s>r)return null;let l=Math.sqrt(r-s),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,e):this.at(c,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,l,c,h,f=1/this.direction.x,p=1/this.direction.y,m=1/this.direction.z,g=this.origin;return f>=0?(n=(t.min.x-g.x)*f,s=(t.max.x-g.x)*f):(n=(t.max.x-g.x)*f,s=(t.min.x-g.x)*f),p>=0?(r=(t.min.y-g.y)*p,l=(t.max.y-g.y)*p):(r=(t.max.y-g.y)*p,l=(t.min.y-g.y)*p),n>l||r>s||((r>n||isNaN(n))&&(n=r),(l<s||isNaN(s))&&(s=l),m>=0?(c=(t.min.z-g.z)*m,h=(t.max.z-g.z)*m):(c=(t.max.z-g.z)*m,h=(t.min.z-g.z)*m),n>h||c>s)||((c>n||n!==n)&&(n=c),(h<s||s!==s)&&(s=h),s<0)?null:this.at(n>=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,ea)!==null}intersectTriangle(t,e,n,s,r){D0.subVectors(e,t),xd.subVectors(n,t),U0.crossVectors(D0,xd);let l=this.direction.dot(U0),c;if(l>0){if(s)return null;c=1}else if(l<0)c=-1,l=-l;else return null;za.subVectors(this.origin,t);let h=c*this.direction.dot(xd.crossVectors(za,xd));if(h<0)return null;let f=c*this.direction.dot(D0.cross(za));if(f<0||h+f>l)return null;let p=-c*za.dot(U0);return p<0?null:this.at(p/l,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ue=class i{constructor(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S){i.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S)}set(t,e,n,s,r,l,c,h,f,p,m,g,v,y,b,S){let x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=s,x[1]=r,x[5]=l,x[9]=c,x[13]=h,x[2]=f,x[6]=p,x[10]=m,x[14]=g,x[3]=v,x[7]=y,x[11]=b,x[15]=S,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 i().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,s=1/sl.setFromMatrixColumn(t,0).length(),r=1/sl.setFromMatrixColumn(t,1).length(),l=1/sl.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*l,e[9]=n[9]*l,e[10]=n[10]*l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,s=t.y,r=t.z,l=Math.cos(n),c=Math.sin(n),h=Math.cos(s),f=Math.sin(s),p=Math.cos(r),m=Math.sin(r);if(t.order==="XYZ"){let g=l*p,v=l*m,y=c*p,b=c*m;e[0]=h*p,e[4]=-h*m,e[8]=f,e[1]=v+y*f,e[5]=g-b*f,e[9]=-c*h,e[2]=b-g*f,e[6]=y+v*f,e[10]=l*h}else if(t.order==="YXZ"){let g=h*p,v=h*m,y=f*p,b=f*m;e[0]=g+b*c,e[4]=y*c-v,e[8]=l*f,e[1]=l*m,e[5]=l*p,e[9]=-c,e[2]=v*c-y,e[6]=b+g*c,e[10]=l*h}else if(t.order==="ZXY"){let g=h*p,v=h*m,y=f*p,b=f*m;e[0]=g-b*c,e[4]=-l*m,e[8]=y+v*c,e[1]=v+y*c,e[5]=l*p,e[9]=b-g*c,e[2]=-l*f,e[6]=c,e[10]=l*h}else if(t.order==="ZYX"){let g=l*p,v=l*m,y=c*p,b=c*m;e[0]=h*p,e[4]=y*f-v,e[8]=g*f+b,e[1]=h*m,e[5]=b*f+g,e[9]=v*f-y,e[2]=-f,e[6]=c*h,e[10]=l*h}else if(t.order==="YZX"){let g=l*h,v=l*f,y=c*h,b=c*f;e[0]=h*p,e[4]=b-g*m,e[8]=y*m+v,e[1]=m,e[5]=l*p,e[9]=-c*p,e[2]=-f*p,e[6]=v*m+y,e[10]=g-b*m}else if(t.order==="XZY"){let g=l*h,v=l*f,y=c*h,b=c*f;e[0]=h*p,e[4]=-m,e[8]=f*p,e[1]=g*m+b,e[5]=l*p,e[9]=v*m-y,e[2]=y*m-v,e[6]=c*p,e[10]=b*m+g}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(YA,t,ZA)}lookAt(t,e,n){let s=this.elements;return Pi.subVectors(t,e),Pi.lengthSq()===0&&(Pi.z=1),Pi.normalize(),Va.crossVectors(n,Pi),Va.lengthSq()===0&&(Math.abs(n.z)===1?Pi.x+=1e-4:Pi.z+=1e-4,Pi.normalize(),Va.crossVectors(n,Pi)),Va.normalize(),yd.crossVectors(Pi,Va),s[0]=Va.x,s[4]=yd.x,s[8]=Pi.x,s[1]=Va.y,s[5]=yd.y,s[9]=Pi.y,s[2]=Va.z,s[6]=yd.z,s[10]=Pi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,l=n[0],c=n[4],h=n[8],f=n[12],p=n[1],m=n[5],g=n[9],v=n[13],y=n[2],b=n[6],S=n[10],x=n[14],E=n[3],T=n[7],A=n[11],N=n[15],D=s[0],L=s[4],F=s[8],C=s[12],w=s[1],z=s[5],Y=s[9],G=s[13],j=s[2],nt=s[6],J=s[10],et=s[14],rt=s[3],St=s[7],bt=s[11],mt=s[15];return r[0]=l*D+c*w+h*j+f*rt,r[4]=l*L+c*z+h*nt+f*St,r[8]=l*F+c*Y+h*J+f*bt,r[12]=l*C+c*G+h*et+f*mt,r[1]=p*D+m*w+g*j+v*rt,r[5]=p*L+m*z+g*nt+v*St,r[9]=p*F+m*Y+g*J+v*bt,r[13]=p*C+m*G+g*et+v*mt,r[2]=y*D+b*w+S*j+x*rt,r[6]=y*L+b*z+S*nt+x*St,r[10]=y*F+b*Y+S*J+x*bt,r[14]=y*C+b*G+S*et+x*mt,r[3]=E*D+T*w+A*j+N*rt,r[7]=E*L+T*z+A*nt+N*St,r[11]=E*F+T*Y+A*J+N*bt,r[15]=E*C+T*G+A*et+N*mt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],l=t[1],c=t[5],h=t[9],f=t[13],p=t[2],m=t[6],g=t[10],v=t[14],y=t[3],b=t[7],S=t[11],x=t[15],E=h*v-f*g,T=c*v-f*m,A=c*g-h*m,N=l*v-f*p,D=l*g-h*p,L=l*m-c*p;return e*(b*E-S*T+x*A)-n*(y*E-S*N+x*D)+s*(y*T-b*N+x*L)-r*(y*A-b*D+S*L)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],l=t[4],c=t[5],h=t[6],f=t[7],p=t[8],m=t[9],g=t[10],v=t[11],y=t[12],b=t[13],S=t[14],x=t[15],E=m*S*f-b*g*f+b*h*v-c*S*v-m*h*x+c*g*x,T=y*g*f-p*S*f-y*h*v+l*S*v+p*h*x-l*g*x,A=p*b*f-y*m*f+y*c*v-l*b*v-p*c*x+l*m*x,N=y*m*h-p*b*h-y*c*g+l*b*g+p*c*S-l*m*S,D=e*E+n*T+s*A+r*N;if(D===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let L=1/D;return t[0]=E*L,t[1]=(b*g*r-m*S*r-b*s*v+n*S*v+m*s*x-n*g*x)*L,t[2]=(c*S*r-b*h*r+b*s*f-n*S*f-c*s*x+n*h*x)*L,t[3]=(m*h*r-c*g*r-m*s*f+n*g*f+c*s*v-n*h*v)*L,t[4]=T*L,t[5]=(p*S*r-y*g*r+y*s*v-e*S*v-p*s*x+e*g*x)*L,t[6]=(y*h*r-l*S*r-y*s*f+e*S*f+l*s*x-e*h*x)*L,t[7]=(l*g*r-p*h*r+p*s*f-e*g*f-l*s*v+e*h*v)*L,t[8]=A*L,t[9]=(y*m*r-p*b*r-y*n*v+e*b*v+p*n*x-e*m*x)*L,t[10]=(l*b*r-y*c*r+y*n*f-e*b*f-l*n*x+e*c*x)*L,t[11]=(p*c*r-l*m*r-p*n*f+e*m*f+l*n*v-e*c*v)*L,t[12]=N*L,t[13]=(p*b*s-y*m*s+y*n*g-e*b*g-p*n*S+e*m*S)*L,t[14]=(y*c*s-l*b*s-y*n*h+e*b*h+l*n*S-e*c*S)*L,t[15]=(l*m*s-p*c*s+p*n*h-e*m*h-l*n*g+e*c*g)*L,this}scale(t){let e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),s=Math.sin(e),r=1-n,l=t.x,c=t.y,h=t.z,f=r*l,p=r*c;return this.set(f*l+n,f*c-s*h,f*h+s*c,0,f*c+s*h,p*c+n,p*h-s*l,0,f*h-s*c,p*h+s*l,r*h*h+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,s,r,l){return this.set(1,n,r,0,t,1,l,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){let s=this.elements,r=e._x,l=e._y,c=e._z,h=e._w,f=r+r,p=l+l,m=c+c,g=r*f,v=r*p,y=r*m,b=l*p,S=l*m,x=c*m,E=h*f,T=h*p,A=h*m,N=n.x,D=n.y,L=n.z;return s[0]=(1-(b+x))*N,s[1]=(v+A)*N,s[2]=(y-T)*N,s[3]=0,s[4]=(v-A)*D,s[5]=(1-(g+x))*D,s[6]=(S+E)*D,s[7]=0,s[8]=(y+T)*L,s[9]=(S-E)*L,s[10]=(1-(g+b))*L,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],this.determinant()===0)return n.set(1,1,1),e.identity(),this;let r=sl.set(s[0],s[1],s[2]).length(),l=sl.set(s[4],s[5],s[6]).length(),c=sl.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),os.copy(this);let f=1/r,p=1/l,m=1/c;return os.elements[0]*=f,os.elements[1]*=f,os.elements[2]*=f,os.elements[4]*=p,os.elements[5]*=p,os.elements[6]*=p,os.elements[8]*=m,os.elements[9]*=m,os.elements[10]*=m,e.setFromRotationMatrix(os),n.x=r,n.y=l,n.z=c,this}makePerspective(t,e,n,s,r,l,c=_i,h=!1){let f=this.elements,p=2*r/(e-t),m=2*r/(n-s),g=(e+t)/(e-t),v=(n+s)/(n-s),y,b;if(h)y=r/(l-r),b=l*r/(l-r);else if(c===_i)y=-(l+r)/(l-r),b=-2*l*r/(l-r);else if(c===Zr)y=-l/(l-r),b=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return f[0]=p,f[4]=0,f[8]=g,f[12]=0,f[1]=0,f[5]=m,f[9]=v,f[13]=0,f[2]=0,f[6]=0,f[10]=y,f[14]=b,f[3]=0,f[7]=0,f[11]=-1,f[15]=0,this}makeOrthographic(t,e,n,s,r,l,c=_i,h=!1){let f=this.elements,p=2/(e-t),m=2/(n-s),g=-(e+t)/(e-t),v=-(n+s)/(n-s),y,b;if(h)y=1/(l-r),b=l/(l-r);else if(c===_i)y=-2/(l-r),b=-(l+r)/(l-r);else if(c===Zr)y=-1/(l-r),b=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return f[0]=p,f[4]=0,f[8]=0,f[12]=g,f[1]=0,f[5]=m,f[9]=0,f[13]=v,f[2]=0,f[6]=0,f[10]=y,f[14]=b,f[3]=0,f[7]=0,f[11]=0,f[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},sl=new O,os=new ue,YA=new O(0,0,0),ZA=new O(1,1,1),Va=new O,yd=new O,Pi=new O,vS=new ue,xS=new Vn,xi=class i{constructor(t=0,e=0,n=0,s=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,s=this._order){return this._x=t,this._y=e,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let s=t.elements,r=s[0],l=s[4],c=s[8],h=s[1],f=s[5],p=s[9],m=s[2],g=s[6],v=s[10];switch(e){case"XYZ":this._y=Math.asin(le(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,v),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(g,f),this._z=0);break;case"YXZ":this._x=Math.asin(-le(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(c,v),this._z=Math.atan2(h,f)):(this._y=Math.atan2(-m,r),this._z=0);break;case"ZXY":this._x=Math.asin(le(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-m,v),this._z=Math.atan2(-l,f)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-le(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-l,f));break;case"YZX":this._z=Math.asin(le(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-p,f),this._y=Math.atan2(-m,r)):(this._x=0,this._y=Math.atan2(c,v));break;case"XZY":this._z=Math.asin(-le(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(g,f),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-p,v),this._y=0);break;default:wt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return vS.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vS,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return xS.setFromEuler(this),this.setFromQuaternion(xS,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};xi.DEFAULT_ORDER="XYZ";var Is=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},jA=0,yS=new O,al=new Vn,na=new ue,Sd=new O,iu=new O,JA=new O,KA=new Vn,SS=new O(1,0,0),MS=new O(0,1,0),bS=new O(0,0,1),ES={type:"added"},QA={type:"removed"},rl={type:"childadded",child:null},P0={type:"childremoved",child:null},Oe=class i extends Oi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jA++}),this.uuid=Li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new O,e=new xi,n=new Vn,s=new O(1,1,1);function r(){n.setFromEuler(e,!1)}function l(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new ue},normalMatrix:{value:new pe}}),this.matrix=new ue,this.matrixWorld=new ue,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Is,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return al.setFromAxisAngle(t,e),this.quaternion.multiply(al),this}rotateOnWorldAxis(t,e){return al.setFromAxisAngle(t,e),this.quaternion.premultiply(al),this}rotateX(t){return this.rotateOnAxis(SS,t)}rotateY(t){return this.rotateOnAxis(MS,t)}rotateZ(t){return this.rotateOnAxis(bS,t)}translateOnAxis(t,e){return yS.copy(t).applyQuaternion(this.quaternion),this.position.add(yS.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(SS,t)}translateY(t){return this.translateOnAxis(MS,t)}translateZ(t){return this.translateOnAxis(bS,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(na.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Sd.copy(t):Sd.set(t,e,n);let s=this.parent;this.updateWorldMatrix(!0,!1),iu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?na.lookAt(iu,Sd,this.up):na.lookAt(Sd,iu,this.up),this.quaternion.setFromRotationMatrix(na),s&&(na.extractRotation(s.matrixWorld),al.setFromRotationMatrix(na),this.quaternion.premultiply(al.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Qt("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ES),rl.child=t,this.dispatchEvent(rl),rl.child=null):Qt("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(QA),P0.child=t,this.dispatchEvent(P0),P0.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),na.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),na.multiply(t.parent.matrixWorld)),t.applyMatrix4(na),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ES),rl.child=t,this.dispatchEvent(rl),rl.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,s=this.children.length;n<s;n++){let l=this.children[n].getObjectByProperty(t,e);if(l!==void 0)return l}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let s=this.children;for(let r=0,l=s.length;r<l;r++)s[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iu,t,JA),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iu,KA,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let s=this.children;for(let r=0,l=s.length;r<l;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let 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(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(c=>({...c})),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(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(t)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let h=c.shapes;if(Array.isArray(h))for(let f=0,p=h.length;f<p;f++){let m=h[f];r(t.shapes,m)}else r(t.shapes,h)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let h=0,f=this.material.length;h<f;h++)c.push(r(t.materials,this.material[h]));s.material=c}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let c=0;c<this.children.length;c++)s.children.push(this.children[c].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let c=0;c<this.animations.length;c++){let h=this.animations[c];s.animations.push(r(t.animations,h))}}if(e){let c=l(t.geometries),h=l(t.materials),f=l(t.textures),p=l(t.images),m=l(t.shapes),g=l(t.skeletons),v=l(t.animations),y=l(t.nodes);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),m.length>0&&(n.shapes=m),g.length>0&&(n.skeletons=g),v.length>0&&(n.animations=v),y.length>0&&(n.nodes=y)}return n.object=s,n;function l(c){let h=[];for(let f in c){let p=c[f];delete p.metadata,h.push(p)}return h}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}};Oe.DEFAULT_UP=new O(0,1,0);Oe.DEFAULT_MATRIX_AUTO_UPDATE=!0;Oe.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ls=new O,ia=new O,I0=new O,sa=new O,ol=new O,ll=new O,TS=new O,L0=new O,O0=new O,B0=new O,F0=new qe,z0=new qe,V0=new qe,us=class i{constructor(t=new O,e=new O,n=new O){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,s){s.subVectors(n,e),ls.subVectors(t,e),s.cross(ls);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){ls.subVectors(s,e),ia.subVectors(n,e),I0.subVectors(t,e);let l=ls.dot(ls),c=ls.dot(ia),h=ls.dot(I0),f=ia.dot(ia),p=ia.dot(I0),m=l*f-c*c;if(m===0)return r.set(0,0,0),null;let g=1/m,v=(f*h-c*p)*g,y=(l*p-c*h)*g;return r.set(1-v-y,y,v)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,sa)===null?!1:sa.x>=0&&sa.y>=0&&sa.x+sa.y<=1}static getInterpolation(t,e,n,s,r,l,c,h){return this.getBarycoord(t,e,n,s,sa)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(r,sa.x),h.addScaledVector(l,sa.y),h.addScaledVector(c,sa.z),h)}static getInterpolatedAttribute(t,e,n,s,r,l){return F0.setScalar(0),z0.setScalar(0),V0.setScalar(0),F0.fromBufferAttribute(t,e),z0.fromBufferAttribute(t,n),V0.fromBufferAttribute(t,s),l.setScalar(0),l.addScaledVector(F0,r.x),l.addScaledVector(z0,r.y),l.addScaledVector(V0,r.z),l}static isFrontFacing(t,e,n,s){return ls.subVectors(n,e),ia.subVectors(t,e),ls.cross(ia).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ls.subVectors(this.c,this.b),ia.subVectors(this.a,this.b),ls.cross(ia).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,l,c;ol.subVectors(s,n),ll.subVectors(r,n),L0.subVectors(t,n);let h=ol.dot(L0),f=ll.dot(L0);if(h<=0&&f<=0)return e.copy(n);O0.subVectors(t,s);let p=ol.dot(O0),m=ll.dot(O0);if(p>=0&&m<=p)return e.copy(s);let g=h*m-p*f;if(g<=0&&h>=0&&p<=0)return l=h/(h-p),e.copy(n).addScaledVector(ol,l);B0.subVectors(t,r);let v=ol.dot(B0),y=ll.dot(B0);if(y>=0&&v<=y)return e.copy(r);let b=v*f-h*y;if(b<=0&&f>=0&&y<=0)return c=f/(f-y),e.copy(n).addScaledVector(ll,c);let S=p*y-v*m;if(S<=0&&m-p>=0&&v-y>=0)return TS.subVectors(r,s),c=(m-p)/(m-p+(v-y)),e.copy(s).addScaledVector(TS,c);let x=1/(S+b+g);return l=b*x,c=g*x,e.copy(n).addScaledVector(ol,l).addScaledVector(ll,c)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},db={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},Ha={h:0,s:0,l:0},Md={h:0,s:0,l:0};function H0(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var Lt=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Dn){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,be.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=be.workingColorSpace){return this.r=t,this.g=e,this.b=n,be.colorSpaceToWorking(this,s),this}setHSL(t,e,n,s=be.workingColorSpace){if(t=nv(t,1),e=le(e,0,1),n=le(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,l=2*n-r;this.r=H0(l,r,t+1/3),this.g=H0(l,r,t),this.b=H0(l,r,t-1/3)}return be.colorSpaceToWorking(this,s),this}setStyle(t,e=Dn){function n(r){r!==void 0&&parseFloat(r)<1&&wt("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,l=s[1],c=s[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:wt("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(l===6)return this.setHex(parseInt(r,16),e);wt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Dn){let n=db[t.toLowerCase()];return n!==void 0?this.setHex(n,e):wt("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=la(t.r),this.g=la(t.g),this.b=la(t.b),this}copyLinearToSRGB(t){return this.r=Sl(t.r),this.g=Sl(t.g),this.b=Sl(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Dn){return be.workingToColorSpace(Jn.copy(this),t),Math.round(le(Jn.r*255,0,255))*65536+Math.round(le(Jn.g*255,0,255))*256+Math.round(le(Jn.b*255,0,255))}getHexString(t=Dn){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=be.workingColorSpace){be.workingToColorSpace(Jn.copy(this),e);let n=Jn.r,s=Jn.g,r=Jn.b,l=Math.max(n,s,r),c=Math.min(n,s,r),h,f,p=(c+l)/2;if(c===l)h=0,f=0;else{let m=l-c;switch(f=p<=.5?m/(l+c):m/(2-l-c),l){case n:h=(s-r)/m+(s<r?6:0);break;case s:h=(r-n)/m+2;break;case r:h=(n-s)/m+4;break}h/=6}return t.h=h,t.s=f,t.l=p,t}getRGB(t,e=be.workingColorSpace){return be.workingToColorSpace(Jn.copy(this),e),t.r=Jn.r,t.g=Jn.g,t.b=Jn.b,t}getStyle(t=Dn){be.workingToColorSpace(Jn.copy(this),t);let e=Jn.r,n=Jn.g,s=Jn.b;return t!==Dn?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(t,e,n){return this.getHSL(Ha),this.setHSL(Ha.h+t,Ha.s+e,Ha.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ha),t.getHSL(Md);let n=mu(Ha.h,Md.h,e),s=mu(Ha.s,Md.s,e),r=mu(Ha.l,Md.l,e);return this.setHSL(n,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*s,this.g=r[1]*e+r[4]*n+r[7]*s,this.b=r[2]*e+r[5]*n+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Jn=new Lt;Lt.NAMES=db;var $A=0,En=class extends Oi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:$A++}),this.uuid=Li(),this.name="",this.type="Material",this.blending=Ya,this.side=Us,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=vu,this.blendDst=xu,this.blendEquation=ca,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Lt(0,0,0),this.blendAlpha=0,this.depthFunc=Za,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=sp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Wa,this.stencilZFail=Wa,this.stencilZPass=Wa,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){wt(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){wt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ya&&(n.blending=this.blending),this.side!==Us&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==vu&&(n.blendSrc=this.blendSrc),this.blendDst!==xu&&(n.blendDst=this.blendDst),this.blendEquation!==ca&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Za&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==sp&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Wa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Wa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Wa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let l=[];for(let c in r){let h=r[c];delete h.metadata,l.push(h)}return l}if(e){let r=s(t.textures),l=s(t.images);r.length>0&&(n.textures=r),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},ps=class extends En{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Lt(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 xi,this.combine=ac,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},ra=tC();function tC(){let i=new ArrayBuffer(4),t=new Float32Array(i),e=new Uint32Array(i),n=new Uint32Array(512),s=new Uint32Array(512);for(let h=0;h<256;++h){let f=h-127;f<-27?(n[h]=0,n[h|256]=32768,s[h]=24,s[h|256]=24):f<-14?(n[h]=1024>>-f-14,n[h|256]=1024>>-f-14|32768,s[h]=-f-1,s[h|256]=-f-1):f<=15?(n[h]=f+15<<10,n[h|256]=f+15<<10|32768,s[h]=13,s[h|256]=13):f<128?(n[h]=31744,n[h|256]=64512,s[h]=24,s[h|256]=24):(n[h]=31744,n[h|256]=64512,s[h]=13,s[h|256]=13)}let r=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let f=h<<13,p=0;for(;(f&8388608)===0;)f<<=1,p-=8388608;f&=-8388609,p+=947912704,r[h]=f|p}for(let h=1024;h<2048;++h)r[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:l,offsetTable:c}}function gi(i){Math.abs(i)>65504&&wt("DataUtils.toHalfFloat(): Value out of range."),i=le(i,-65504,65504),ra.floatView[0]=i;let t=ra.uint32View[0],e=t>>23&511;return ra.baseTable[e]+((t&8388607)>>ra.shiftTable[e])}function fu(i){let t=i>>10;return ra.uint32View[0]=ra.mantissaTable[ra.offsetTable[t]+(i&1023)]+ra.exponentTable[t],ra.floatView[0]}var op=class{static toHalfFloat(t){return gi(t)}static fromHalfFloat(t){return fu(t)}},xn=new O,bd=new ft,eC=0,He=class{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:eC++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Cl,this.updateRanges=[],this.gpuType=Qn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[n+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)bd.fromBufferAttribute(this,e),bd.applyMatrix3(t),this.setXY(e,bd.x,bd.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyMatrix3(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyMatrix4(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.applyNormalMatrix(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)xn.fromBufferAttribute(this,e),xn.transformDirection(t),this.setXYZ(e,xn.x,xn.y,xn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=oi(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ve(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=oi(e,this.array)),e}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=oi(e,this.array)),e}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=oi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=oi(e,this.array)),e}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Cl&&(t.usage=this.usage),t}},lp=class extends He{constructor(t,e,n){super(new Int8Array(t),e,n)}},cp=class extends He{constructor(t,e,n){super(new Uint8Array(t),e,n)}},up=class extends He{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}},hp=class extends He{constructor(t,e,n){super(new Int16Array(t),e,n)}},Dl=class extends He{constructor(t,e,n){super(new Uint16Array(t),e,n)}},fp=class extends He{constructor(t,e,n){super(new Int32Array(t),e,n)}},Ul=class extends He{constructor(t,e,n){super(new Uint32Array(t),e,n)}},dp=class extends He{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=fu(this.array[t*this.itemSize]);return this.normalized&&(e=oi(e,this.array)),e}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize]=gi(e),this}getY(t){let e=fu(this.array[t*this.itemSize+1]);return this.normalized&&(e=oi(e,this.array)),e}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+1]=gi(e),this}getZ(t){let e=fu(this.array[t*this.itemSize+2]);return this.normalized&&(e=oi(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+2]=gi(e),this}getW(t){let e=fu(this.array[t*this.itemSize+3]);return this.normalized&&(e=oi(e,this.array)),e}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.array[t*this.itemSize+3]=gi(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this.array[t+2]=gi(s),this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.array[t+0]=gi(e),this.array[t+1]=gi(n),this.array[t+2]=gi(s),this.array[t+3]=gi(r),this}},Gt=class extends He{constructor(t,e,n){super(new Float32Array(t),e,n)}},nC=0,Ki=new ue,G0=new Oe,cl=new O,Ii=new bn,su=new bn,Nn=new O,de=class i extends Oi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nC++}),this.uuid=Li(),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(t){return Array.isArray(t)?this.index=new(tv(t)?Ul:Dl)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new pe().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ki.makeRotationFromQuaternion(t),this.applyMatrix4(Ki),this}rotateX(t){return Ki.makeRotationX(t),this.applyMatrix4(Ki),this}rotateY(t){return Ki.makeRotationY(t),this.applyMatrix4(Ki),this}rotateZ(t){return Ki.makeRotationZ(t),this.applyMatrix4(Ki),this}translate(t,e,n){return Ki.makeTranslation(t,e,n),this.applyMatrix4(Ki),this}scale(t,e,n){return Ki.makeScale(t,e,n),this.applyMatrix4(Ki),this}lookAt(t){return G0.lookAt(t),G0.updateMatrix(),this.applyMatrix4(G0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cl).negate(),this.translate(cl.x,cl.y,cl.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;s<r;s++){let l=t[s];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Gt(n,3))}else{let n=Math.min(t.length,e.count);for(let s=0;s<n;s++){let r=t[s];e.setXYZ(s,r.x,r.y,r.z||0)}t.length>e.count&&wt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Qt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new O(-1/0,-1/0,-1/0),new O(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let r=e[n];Ii.setFromBufferAttribute(r),this.morphTargetsRelative?(Nn.addVectors(this.boundingBox.min,Ii.min),this.boundingBox.expandByPoint(Nn),Nn.addVectors(this.boundingBox.max,Ii.max),this.boundingBox.expandByPoint(Nn)):(this.boundingBox.expandByPoint(Ii.min),this.boundingBox.expandByPoint(Ii.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Qt('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 yn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Qt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new O,1/0);return}if(t){let n=this.boundingSphere.center;if(Ii.setFromBufferAttribute(t),e)for(let r=0,l=e.length;r<l;r++){let c=e[r];su.setFromBufferAttribute(c),this.morphTargetsRelative?(Nn.addVectors(Ii.min,su.min),Ii.expandByPoint(Nn),Nn.addVectors(Ii.max,su.max),Ii.expandByPoint(Nn)):(Ii.expandByPoint(su.min),Ii.expandByPoint(su.max))}Ii.getCenter(n);let s=0;for(let r=0,l=t.count;r<l;r++)Nn.fromBufferAttribute(t,r),s=Math.max(s,n.distanceToSquared(Nn));if(e)for(let r=0,l=e.length;r<l;r++){let c=e[r],h=this.morphTargetsRelative;for(let f=0,p=c.count;f<p;f++)Nn.fromBufferAttribute(c,f),h&&(cl.fromBufferAttribute(t,f),Nn.add(cl)),s=Math.max(s,n.distanceToSquared(Nn))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Qt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){Qt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,s=e.normal,r=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new He(new Float32Array(4*n.count),4));let l=this.getAttribute("tangent"),c=[],h=[];for(let F=0;F<n.count;F++)c[F]=new O,h[F]=new O;let f=new O,p=new O,m=new O,g=new ft,v=new ft,y=new ft,b=new O,S=new O;function x(F,C,w){f.fromBufferAttribute(n,F),p.fromBufferAttribute(n,C),m.fromBufferAttribute(n,w),g.fromBufferAttribute(r,F),v.fromBufferAttribute(r,C),y.fromBufferAttribute(r,w),p.sub(f),m.sub(f),v.sub(g),y.sub(g);let z=1/(v.x*y.y-y.x*v.y);isFinite(z)&&(b.copy(p).multiplyScalar(y.y).addScaledVector(m,-v.y).multiplyScalar(z),S.copy(m).multiplyScalar(v.x).addScaledVector(p,-y.x).multiplyScalar(z),c[F].add(b),c[C].add(b),c[w].add(b),h[F].add(S),h[C].add(S),h[w].add(S))}let E=this.groups;E.length===0&&(E=[{start:0,count:t.count}]);for(let F=0,C=E.length;F<C;++F){let w=E[F],z=w.start,Y=w.count;for(let G=z,j=z+Y;G<j;G+=3)x(t.getX(G+0),t.getX(G+1),t.getX(G+2))}let T=new O,A=new O,N=new O,D=new O;function L(F){N.fromBufferAttribute(s,F),D.copy(N);let C=c[F];T.copy(C),T.sub(N.multiplyScalar(N.dot(C))).normalize(),A.crossVectors(D,C);let z=A.dot(h[F])<0?-1:1;l.setXYZW(F,T.x,T.y,T.z,z)}for(let F=0,C=E.length;F<C;++F){let w=E[F],z=w.start,Y=w.count;for(let G=z,j=z+Y;G<j;G+=3)L(t.getX(G+0)),L(t.getX(G+1)),L(t.getX(G+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new He(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let g=0,v=n.count;g<v;g++)n.setXYZ(g,0,0,0);let s=new O,r=new O,l=new O,c=new O,h=new O,f=new O,p=new O,m=new O;if(t)for(let g=0,v=t.count;g<v;g+=3){let y=t.getX(g+0),b=t.getX(g+1),S=t.getX(g+2);s.fromBufferAttribute(e,y),r.fromBufferAttribute(e,b),l.fromBufferAttribute(e,S),p.subVectors(l,r),m.subVectors(s,r),p.cross(m),c.fromBufferAttribute(n,y),h.fromBufferAttribute(n,b),f.fromBufferAttribute(n,S),c.add(p),h.add(p),f.add(p),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(b,h.x,h.y,h.z),n.setXYZ(S,f.x,f.y,f.z)}else for(let g=0,v=e.count;g<v;g+=3)s.fromBufferAttribute(e,g+0),r.fromBufferAttribute(e,g+1),l.fromBufferAttribute(e,g+2),p.subVectors(l,r),m.subVectors(s,r),p.cross(m),n.setXYZ(g+0,p.x,p.y,p.z),n.setXYZ(g+1,p.x,p.y,p.z),n.setXYZ(g+2,p.x,p.y,p.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Nn.fromBufferAttribute(t,e),Nn.normalize(),t.setXYZ(e,Nn.x,Nn.y,Nn.z)}toNonIndexed(){function t(c,h){let f=c.array,p=c.itemSize,m=c.normalized,g=new f.constructor(h.length*p),v=0,y=0;for(let b=0,S=h.length;b<S;b++){c.isInterleavedBufferAttribute?v=h[b]*c.data.stride+c.offset:v=h[b]*p;for(let x=0;x<p;x++)g[y++]=f[v++]}return new He(g,p,m)}if(this.index===null)return wt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,s=this.attributes;for(let c in s){let h=s[c],f=t(h,n);e.setAttribute(c,f)}let r=this.morphAttributes;for(let c in r){let h=[],f=r[c];for(let p=0,m=f.length;p<m;p++){let g=f[p],v=t(g,n);h.push(v)}e.morphAttributes[c]=h}e.morphTargetsRelative=this.morphTargetsRelative;let l=this.groups;for(let c=0,h=l.length;c<h;c++){let f=l[c];e.addGroup(f.start,f.count,f.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let h=this.parameters;for(let f in h)h[f]!==void 0&&(t[f]=h[f]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let h in n){let f=n[h];t.data.attributes[h]=f.toJSON(t.data)}let s={},r=!1;for(let h in this.morphAttributes){let f=this.morphAttributes[h],p=[];for(let m=0,g=f.length;m<g;m++){let v=f[m];p.push(v.toJSON(t.data))}p.length>0&&(s[h]=p,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let l=this.groups;l.length>0&&(t.data.groups=JSON.parse(JSON.stringify(l)));let c=this.boundingSphere;return c!==null&&(t.data.boundingSphere=c.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let s=t.attributes;for(let f in s){let p=s[f];this.setAttribute(f,p.clone(e))}let r=t.morphAttributes;for(let f in r){let p=[],m=r[f];for(let g=0,v=m.length;g<v;g++)p.push(m[g].clone(e));this.morphAttributes[f]=p}this.morphTargetsRelative=t.morphTargetsRelative;let l=t.groups;for(let f=0,p=l.length;f<p;f++){let m=l[f];this.addGroup(m.start,m.count,m.materialIndex)}let c=t.boundingBox;c!==null&&(this.boundingBox=c.clone());let h=t.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},AS=new ue,Or=new ua,Ed=new yn,CS=new O,Td=new O,Ad=new O,Cd=new O,k0=new O,Rd=new O,RS=new O,wd=new O,rn=class extends Oe{constructor(t=new de,e=new ps){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}getVertexPosition(t,e){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,l=n.morphTargetsRelative;e.fromBufferAttribute(s,t);let c=this.morphTargetInfluences;if(r&&c){Rd.set(0,0,0);for(let h=0,f=r.length;h<f;h++){let p=c[h],m=r[h];p!==0&&(k0.fromBufferAttribute(m,t),l?Rd.addScaledVector(k0,p):Rd.addScaledVector(k0.sub(e),p))}e.add(Rd)}return e}raycast(t,e){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ed.copy(n.boundingSphere),Ed.applyMatrix4(r),Or.copy(t.ray).recast(t.near),!(Ed.containsPoint(Or.origin)===!1&&(Or.intersectSphere(Ed,CS)===null||Or.origin.distanceToSquared(CS)>(t.far-t.near)**2))&&(AS.copy(r).invert(),Or.copy(t.ray).applyMatrix4(AS),!(n.boundingBox!==null&&Or.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Or)))}_computeIntersections(t,e,n){let s,r=this.geometry,l=this.material,c=r.index,h=r.attributes.position,f=r.attributes.uv,p=r.attributes.uv1,m=r.attributes.normal,g=r.groups,v=r.drawRange;if(c!==null)if(Array.isArray(l))for(let y=0,b=g.length;y<b;y++){let S=g[y],x=l[S.materialIndex],E=Math.max(S.start,v.start),T=Math.min(c.count,Math.min(S.start+S.count,v.start+v.count));for(let A=E,N=T;A<N;A+=3){let D=c.getX(A),L=c.getX(A+1),F=c.getX(A+2);s=Nd(this,x,t,n,f,p,m,D,L,F),s&&(s.faceIndex=Math.floor(A/3),s.face.materialIndex=S.materialIndex,e.push(s))}}else{let y=Math.max(0,v.start),b=Math.min(c.count,v.start+v.count);for(let S=y,x=b;S<x;S+=3){let E=c.getX(S),T=c.getX(S+1),A=c.getX(S+2);s=Nd(this,l,t,n,f,p,m,E,T,A),s&&(s.faceIndex=Math.floor(S/3),e.push(s))}}else if(h!==void 0)if(Array.isArray(l))for(let y=0,b=g.length;y<b;y++){let S=g[y],x=l[S.materialIndex],E=Math.max(S.start,v.start),T=Math.min(h.count,Math.min(S.start+S.count,v.start+v.count));for(let A=E,N=T;A<N;A+=3){let D=A,L=A+1,F=A+2;s=Nd(this,x,t,n,f,p,m,D,L,F),s&&(s.faceIndex=Math.floor(A/3),s.face.materialIndex=S.materialIndex,e.push(s))}}else{let y=Math.max(0,v.start),b=Math.min(h.count,v.start+v.count);for(let S=y,x=b;S<x;S+=3){let E=S,T=S+1,A=S+2;s=Nd(this,l,t,n,f,p,m,E,T,A),s&&(s.faceIndex=Math.floor(S/3),e.push(s))}}}};function iC(i,t,e,n,s,r,l,c){let h;if(t.side===ti?h=n.intersectTriangle(l,r,s,!0,c):h=n.intersectTriangle(s,r,l,t.side===Us,c),h===null)return null;wd.copy(c),wd.applyMatrix4(i.matrixWorld);let f=e.ray.origin.distanceTo(wd);return f<e.near||f>e.far?null:{distance:f,point:wd.clone(),object:i}}function Nd(i,t,e,n,s,r,l,c,h,f){i.getVertexPosition(c,Td),i.getVertexPosition(h,Ad),i.getVertexPosition(f,Cd);let p=iC(i,t,e,n,Td,Ad,Cd,RS);if(p){let m=new O;us.getBarycoord(RS,Td,Ad,Cd,m),s&&(p.uv=us.getInterpolatedAttribute(s,c,h,f,m,new ft)),r&&(p.uv1=us.getInterpolatedAttribute(r,c,h,f,m,new ft)),l&&(p.normal=us.getInterpolatedAttribute(l,c,h,f,m,new O),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));let g={a:c,b:h,c:f,normal:new O,materialIndex:0};us.getNormal(Td,Ad,Cd,g.normal),p.face=g,p.barycoord=m}return p}var Ja=class i extends de{constructor(t=1,e=1,n=1,s=1,r=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:l};let c=this;s=Math.floor(s),r=Math.floor(r),l=Math.floor(l);let h=[],f=[],p=[],m=[],g=0,v=0;y("z","y","x",-1,-1,n,e,t,l,r,0),y("z","y","x",1,-1,n,e,-t,l,r,1),y("x","z","y",1,1,t,n,e,s,l,2),y("x","z","y",1,-1,t,n,-e,s,l,3),y("x","y","z",1,-1,t,e,n,s,r,4),y("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(h),this.setAttribute("position",new Gt(f,3)),this.setAttribute("normal",new Gt(p,3)),this.setAttribute("uv",new Gt(m,2));function y(b,S,x,E,T,A,N,D,L,F,C){let w=A/L,z=N/F,Y=A/2,G=N/2,j=D/2,nt=L+1,J=F+1,et=0,rt=0,St=new O;for(let bt=0;bt<J;bt++){let mt=bt*z-G;for(let kt=0;kt<nt;kt++){let $t=kt*w-Y;St[b]=$t*E,St[S]=mt*T,St[x]=j,f.push(St.x,St.y,St.z),St[b]=0,St[S]=0,St[x]=D>0?1:-1,p.push(St.x,St.y,St.z),m.push(kt/L),m.push(1-bt/F),et+=1}}for(let bt=0;bt<F;bt++)for(let mt=0;mt<L;mt++){let kt=g+mt+nt*bt,$t=g+mt+nt*(bt+1),re=g+(mt+1)+nt*(bt+1),Ce=g+(mt+1)+nt*bt;h.push(kt,$t,Ce),h.push($t,re,Ce),rt+=6}c.addGroup(v,rt,C),v+=rt,g+=et}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function po(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let s=i[e][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(wt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=s.clone():Array.isArray(s)?t[e][n]=s.slice():t[e][n]=s}}return t}function ei(i){let t={};for(let e=0;e<i.length;e++){let n=po(i[e]);for(let s in n)t[s]=n[s]}return t}function sC(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function iv(i){let t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:be.workingColorSpace}var sv={clone:po,merge:ei},aC=`void main() {
13
13
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
14
- }`,aC=`void main() {
14
+ }`,rC=`void main() {
15
15
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
16
- }`,ci=class extends En{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sC,this.fragmentShader=aC,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,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=po(t.uniforms),this.uniformsGroups=iC(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let l=this.uniforms[s].value;l&&l.isTexture?e.uniforms[s]={type:"t",value:l.toJSON(t).uuid}:l&&l.isColor?e.uniforms[s]={type:"c",value:l.getHex()}:l&&l.isVector2?e.uniforms[s]={type:"v2",value:l.toArray()}:l&&l.isVector3?e.uniforms[s]={type:"v3",value:l.toArray()}:l&&l.isVector4?e.uniforms[s]={type:"v4",value:l.toArray()}:l&&l.isMatrix3?e.uniforms[s]={type:"m3",value:l.toArray()}:l&&l.isMatrix4?e.uniforms[s]={type:"m4",value:l.toArray()}:e.uniforms[s]={value:l}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}},Qr=class extends Oe{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ue,this.projectionMatrix=new ue,this.projectionMatrixInverse=new ue,this.coordinateSystem=_i,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ha=new O,wS=new ft,NS=new ft,fn=class extends Qr{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=jr*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(qr*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return jr*2*Math.atan(Math.tan(qr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Ha.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ha.x,Ha.y).multiplyScalar(-t/Ha.z),Ha.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ha.x,Ha.y).multiplyScalar(-t/Ha.z)}getViewSize(t,e){return this.getViewBounds(t,wS,NS),e.subVectors(NS,wS)}setViewOffset(t,e,n,s,r,l){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(qr*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s,l=this.view;if(this.view!==null&&this.view.enabled){let h=l.fullWidth,f=l.fullHeight;r+=l.offsetX*s/h,e-=l.offsetY*n/f,s*=l.width/h,n*=l.height/f}let c=this.filmOffset;c!==0&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},ul=-90,hl=1,Mu=class extends Oe{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new fn(ul,hl,t,e);s.layers=this.layers,this.add(s);let r=new fn(ul,hl,t,e);r.layers=this.layers,this.add(r);let l=new fn(ul,hl,t,e);l.layers=this.layers,this.add(l);let c=new fn(ul,hl,t,e);c.layers=this.layers,this.add(c);let h=new fn(ul,hl,t,e);h.layers=this.layers,this.add(h);let f=new fn(ul,hl,t,e);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,s,r,l,c,h]=e;for(let f of e)this.remove(f);if(t===_i)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(t===Yr)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let f of e)this.add(f),f.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,l,c,h,f,p]=this.children,m=t.getRenderTarget(),g=t.getActiveCubeFace(),v=t.getActiveMipmapLevel(),y=t.xr.enabled;t.xr.enabled=!1;let b=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,s),t.render(e,r),t.setRenderTarget(n,1,s),t.render(e,l),t.setRenderTarget(n,2,s),t.render(e,c),t.setRenderTarget(n,3,s),t.render(e,h),t.setRenderTarget(n,4,s),t.render(e,f),n.texture.generateMipmaps=b,t.setRenderTarget(n,5,s),t.render(e,p),t.setRenderTarget(m,g,v),t.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},Ja=class extends mn{constructor(t=[],e=xs,n,s,r,l,c,h,f,p){super(t,e,n,s,r,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Pl=class extends $n{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new Ja(s),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
16
+ }`,ci=class extends En{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=aC,this.fragmentShader=rC,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,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=po(t.uniforms),this.uniformsGroups=sC(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let l=this.uniforms[s].value;l&&l.isTexture?e.uniforms[s]={type:"t",value:l.toJSON(t).uuid}:l&&l.isColor?e.uniforms[s]={type:"c",value:l.getHex()}:l&&l.isVector2?e.uniforms[s]={type:"v2",value:l.toArray()}:l&&l.isVector3?e.uniforms[s]={type:"v3",value:l.toArray()}:l&&l.isVector4?e.uniforms[s]={type:"v4",value:l.toArray()}:l&&l.isMatrix3?e.uniforms[s]={type:"m3",value:l.toArray()}:l&&l.isMatrix4?e.uniforms[s]={type:"m4",value:l.toArray()}:e.uniforms[s]={value:l}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}},$r=class extends Oe{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ue,this.projectionMatrix=new ue,this.projectionMatrixInverse=new ue,this.coordinateSystem=_i,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ga=new O,wS=new ft,NS=new ft,fn=class extends $r{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=Jr*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Yr*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Jr*2*Math.atan(Math.tan(Yr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Ga.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ga.x,Ga.y).multiplyScalar(-t/Ga.z),Ga.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ga.x,Ga.y).multiplyScalar(-t/Ga.z)}getViewSize(t,e){return this.getViewBounds(t,wS,NS),e.subVectors(NS,wS)}setViewOffset(t,e,n,s,r,l){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Yr*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s,l=this.view;if(this.view!==null&&this.view.enabled){let h=l.fullWidth,f=l.fullHeight;r+=l.offsetX*s/h,e-=l.offsetY*n/f,s*=l.width/h,n*=l.height/f}let c=this.filmOffset;c!==0&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},ul=-90,hl=1,Mu=class extends Oe{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new fn(ul,hl,t,e);s.layers=this.layers,this.add(s);let r=new fn(ul,hl,t,e);r.layers=this.layers,this.add(r);let l=new fn(ul,hl,t,e);l.layers=this.layers,this.add(l);let c=new fn(ul,hl,t,e);c.layers=this.layers,this.add(c);let h=new fn(ul,hl,t,e);h.layers=this.layers,this.add(h);let f=new fn(ul,hl,t,e);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,s,r,l,c,h]=e;for(let f of e)this.remove(f);if(t===_i)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(t===Zr)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let f of e)this.add(f),f.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,l,c,h,f,p]=this.children,m=t.getRenderTarget(),g=t.getActiveCubeFace(),v=t.getActiveMipmapLevel(),y=t.xr.enabled;t.xr.enabled=!1;let b=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,s),t.render(e,r),t.setRenderTarget(n,1,s),t.render(e,l),t.setRenderTarget(n,2,s),t.render(e,c),t.setRenderTarget(n,3,s),t.render(e,h),t.setRenderTarget(n,4,s),t.render(e,f),n.texture.generateMipmaps=b,t.setRenderTarget(n,5,s),t.render(e,p),t.setRenderTarget(m,g,v),t.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},Ka=class extends mn{constructor(t=[],e=xs,n,s,r,l,c,h,f,p){super(t,e,n,s,r,l,c,h,f,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Pl=class extends $n{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new Ka(s),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
17
17
 
18
18
  varying vec3 vWorldDirection;
19
19
 
@@ -48,9 +48,9 @@ No matching component was found for:
48
48
  gl_FragColor = texture2D( tEquirect, sampleUV );
49
49
 
50
50
  }
51
- `},s=new ja(5,5,5),r=new ci({name:"CubemapFromEquirect",uniforms:po(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ti,blending:vs});r.uniforms.tEquirect.value=e;let l=new rn(s,r),c=e.minFilter;return e.minFilter===ys&&(e.minFilter=Je),new Mu(1,10,this).update(t,l),e.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(t,e=!0,n=!0,s=!0){let r=t.getRenderTarget();for(let l=0;l<6;l++)t.setRenderTarget(this,l),t.clear(e,n,s);t.setRenderTarget(r)}},oa=class extends Oe{constructor(){super(),this.isGroup=!0,this.type="Group"}},rC={type:"move"},$r=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new oa,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 oa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new O,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new O),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new oa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new O,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new O),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let s=null,r=null,l=null,c=this._targetRay,h=this._grip,f=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(f&&t.hand){l=!0;for(let b of t.hand.values()){let S=e.getJointPose(b,n),x=this._getHandJoint(f,b);S!==null&&(x.matrix.fromArray(S.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=S.radius),x.visible=S!==null}let p=f.joints["index-finger-tip"],m=f.joints["thumb-tip"],g=p.position.distanceTo(m.position),v=.02,y=.005;f.inputState.pinching&&g>v+y?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&g<=v-y&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else h!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(h.matrix.fromArray(r.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,r.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(r.linearVelocity)):h.hasLinearVelocity=!1,r.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(r.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(rC)))}return c!==null&&(c.visible=s!==null),h!==null&&(h.visible=r!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new oa;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},bu=class i{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Lt(t),this.density=e}clone(){return new i(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},Eu=class i{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Lt(t),this.near=e,this.far=n}clone(){return new i(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},to=class extends Oe{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 xi,this.environmentIntensity=1,this.environmentRotation=new xi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},eo=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Cl,this.updateRanges=[],this.version=0,this.uuid=Li()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[n+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Li()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Li()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}},ri=new O,Ka=class i{constructor(t,e,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.applyMatrix4(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.applyNormalMatrix(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.transformDirection(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=oi(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ve(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=oi(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=oi(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=oi(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=oi(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(t===void 0){wl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return new He(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new i(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){wl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Il=class extends En{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Lt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},fl,au=new O,dl=new O,pl=new O,ml=new ft,ru=new ft,pb=new ue,Dd=new O,ou=new O,Ud=new O,DS=new ft,W0=new ft,US=new ft,Tu=class extends Oe{constructor(t=new Il){if(super(),this.isSprite=!0,this.type="Sprite",fl===void 0){fl=new de;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new eo(e,5);fl.setIndex([0,1,2,0,2,3]),fl.setAttribute("position",new Ka(n,3,0,!1)),fl.setAttribute("uv",new Ka(n,2,3,!1))}this.geometry=fl,this.material=t,this.center=new ft(.5,.5),this.count=1}raycast(t,e){t.camera===null&&Qt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),dl.setFromMatrixScale(this.matrixWorld),pb.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),pl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&dl.multiplyScalar(-pl.z);let n=this.material.rotation,s,r;n!==0&&(r=Math.cos(n),s=Math.sin(n));let l=this.center;Pd(Dd.set(-.5,-.5,0),pl,l,dl,s,r),Pd(ou.set(.5,-.5,0),pl,l,dl,s,r),Pd(Ud.set(.5,.5,0),pl,l,dl,s,r),DS.set(0,0),W0.set(1,0),US.set(1,1);let c=t.ray.intersectTriangle(Dd,ou,Ud,!1,au);if(c===null&&(Pd(ou.set(-.5,.5,0),pl,l,dl,s,r),W0.set(0,1),c=t.ray.intersectTriangle(Dd,Ud,ou,!1,au),c===null))return;let h=t.ray.origin.distanceTo(au);h<t.near||h>t.far||e.push({distance:h,point:au.clone(),uv:us.getInterpolation(au,Dd,ou,Ud,DS,W0,US,new ft),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};function Pd(i,t,e,n,s,r){ml.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(ru.x=r*ml.x-s*ml.y,ru.y=s*ml.x+r*ml.y):ru.copy(ml),i.copy(t),i.x+=ru.x,i.y+=ru.y,i.applyMatrix4(pb)}var Id=new O,PS=new O,Au=class extends Oe{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let n=0,s=e.length;n<s;n++){let r=e[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);let s=this.levels,r;for(r=0;r<s.length&&!(e<s[r].distance);r++);return s.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){let e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){let s=e.splice(n,1);return this.remove(s[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){let e=this.levels;if(e.length>0){let n,s;for(n=1,s=e.length;n<s;n++){let r=e[n].distance;if(e[n].object.visible&&(r-=r*e[n].hysteresis),t<r)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Id.setFromMatrixPosition(this.matrixWorld);let s=t.ray.origin.distanceTo(Id);this.getObjectForDistance(s).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){Id.setFromMatrixPosition(t.matrixWorld),PS.setFromMatrixPosition(this.matrixWorld);let n=Id.distanceTo(PS)/t.zoom;e[0].object.visible=!0;let s,r;for(s=1,r=e.length;s<r;s++){let l=e[s].distance;if(e[s].object.visible&&(l-=l*e[s].hysteresis),n>=l)e[s-1].object.visible=!1,e[s].object.visible=!0;else break}for(this._currentLevel=s-1;s<r;s++)e[s].object.visible=!1}}toJSON(t){let e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];let n=this.levels;for(let s=0,r=n.length;s<r;s++){let l=n[s];e.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return e}},IS=new O,LS=new qe,OS=new qe,oC=new O,BS=new ue,Ld=new O,X0=new yn,FS=new ue,q0=new ua,Cu=class extends rn{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ip,this.bindMatrix=new ue,this.bindMatrixInverse=new ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;this.boundingBox===null&&(this.boundingBox=new bn),this.boundingBox.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Ld),this.boundingBox.expandByPoint(Ld)}computeBoundingSphere(){let t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new yn),this.boundingSphere.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Ld),this.boundingSphere.expandByPoint(Ld)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){let n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),X0.copy(this.boundingSphere),X0.applyMatrix4(s),t.ray.intersectsSphere(X0)!==!1&&(FS.copy(s).invert(),q0.copy(t.ray).applyMatrix4(FS),!(this.boundingBox!==null&&q0.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,q0)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let t=new qe,e=this.geometry.attributes.skinWeight;for(let n=0,s=e.count;n<s;n++){t.fromBufferAttribute(e,n);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===ip?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===G_?this.bindMatrixInverse.copy(this.bindMatrix).invert():wt("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){let n=this.skeleton,s=this.geometry;LS.fromBufferAttribute(s.attributes.skinIndex,t),OS.fromBufferAttribute(s.attributes.skinWeight,t),IS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let l=OS.getComponent(r);if(l!==0){let c=LS.getComponent(r);BS.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),e.addScaledVector(oC.copy(IS).applyMatrix4(BS),l)}}return e.applyMatrix4(this.bindMatrixInverse)}},Ll=class extends Oe{constructor(){super(),this.isBone=!0,this.type="Bone"}},vi=class extends mn{constructor(t=null,e=1,n=1,s,r,l,c,h,f=dn,p=dn,m,g){super(null,l,c,h,f,p,s,r,m,g),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},zS=new ue,lC=new ue,Ru=class i{constructor(t=[],e=[]){this.uuid=Li(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){wt("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new ue)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let n=new ue;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let t=this.bones,e=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,l=t.length;r<l;r++){let c=t[r]?t[r].matrixWorld:lC;zS.multiplyMatrices(c,e[r]),zS.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new i(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let n=new vi(e,t,t,Un,Qn);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){let s=this.bones[e];if(s.name===t)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,s=t.bones.length;n<s;n++){let r=t.bones[n],l=e[r];l===void 0&&(wt("Skeleton: No bone found with UUID:",r),l=new Ll),this.bones.push(l),this.boneInverses.push(new ue().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,n=this.boneInverses;for(let s=0,r=e.length;s<r;s++){let l=e[s];t.bones.push(l.uuid);let c=n[s];t.boneInverses.push(c.toArray())}return t}},ha=class extends He{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},gl=new ue,VS=new ue,Od=[],HS=new bn,cC=new ue,lu=new rn,cu=new yn,wu=class extends rn{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new ha(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,cC)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new bn),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,gl),HS.copy(t.boundingBox).applyMatrix4(gl),this.boundingBox.union(HS)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new yn),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,gl),cu.copy(t.boundingSphere).applyMatrix4(gl),this.boundingSphere.union(cu)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){let n=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,l=t*r+1;for(let c=0;c<n.length;c++)n[c]=s[l+c]}raycast(t,e){let n=this.matrixWorld,s=this.count;if(lu.geometry=this.geometry,lu.material=this.material,lu.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cu.copy(this.boundingSphere),cu.applyMatrix4(n),t.ray.intersectsSphere(cu)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,gl),VS.multiplyMatrices(n,gl),lu.matrixWorld=VS,lu.raycast(t,Od);for(let l=0,c=Od.length;l<c;l++){let h=Od[l];h.instanceId=r,h.object=this,e.push(h)}Od.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new ha(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){let n=e.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new vi(new Float32Array(s*this.count),s,this.count,Hh,Qn));let r=this.morphTexture.source.data.data,l=0;for(let f=0;f<n.length;f++)l+=n[f];let c=this.geometry.morphTargetsRelative?1:1-l,h=s*t;r[h]=c,r.set(n,h+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Y0=new O,uC=new O,hC=new pe,cs=class{constructor(t=new O(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,s){return this.normal.set(t,e,n),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let s=Y0.subVectors(n,e).cross(uC.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let n=t.delta(Y0),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||hC.getNormalMatrix(t),s=this.coplanarPoint(Y0).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Or=new yn,fC=new ft(.5,.5),Bd=new O,fa=class{constructor(t=new cs,e=new cs,n=new cs,s=new cs,r=new cs,l=new cs){this.planes=[t,e,n,s,r,l]}set(t,e,n,s,r,l){let c=this.planes;return c[0].copy(t),c[1].copy(e),c[2].copy(n),c[3].copy(s),c[4].copy(r),c[5].copy(l),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=_i,n=!1){let s=this.planes,r=t.elements,l=r[0],c=r[1],h=r[2],f=r[3],p=r[4],m=r[5],g=r[6],v=r[7],y=r[8],b=r[9],S=r[10],x=r[11],E=r[12],T=r[13],A=r[14],N=r[15];if(s[0].setComponents(f-l,v-p,x-y,N-E).normalize(),s[1].setComponents(f+l,v+p,x+y,N+E).normalize(),s[2].setComponents(f+c,v+m,x+b,N+T).normalize(),s[3].setComponents(f-c,v-m,x-b,N-T).normalize(),n)s[4].setComponents(h,g,S,A).normalize(),s[5].setComponents(f-h,v-g,x-S,N-A).normalize();else if(s[4].setComponents(f-h,v-g,x-S,N-A).normalize(),e===_i)s[5].setComponents(f+h,v+g,x+S,N+A).normalize();else if(e===Yr)s[5].setComponents(h,g,S,A).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Or.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Or.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Or)}intersectsSprite(t){Or.center.set(0,0,0);let e=fC.distanceTo(t.center);return Or.radius=.7071067811865476+e,Or.applyMatrix4(t.matrixWorld),this.intersectsSphere(Or)}intersectsSphere(t){let e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let n=0;n<6;n++){let s=e[n];if(Bd.x=s.normal.x>0?t.max.x:t.min.x,Bd.y=s.normal.y>0?t.max.y:t.min.y,Bd.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Bd)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ws=new ue,Ns=new fa,Nu=class i{constructor(){this.coordinateSystem=_i}intersectsObject(t,e){if(!e.isArrayCamera||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsObject(t))return!0}return!1}intersectsSprite(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsSprite(t))return!0}return!1}intersectsSphere(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsSphere(t))return!0}return!1}intersectsBox(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsBox(t))return!0}return!1}containsPoint(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.containsPoint(t))return!0}return!1}clone(){return new i}};function Z0(i,t){return i-t}function dC(i,t){return i.z-t.z}function pC(i,t){return t.z-i.z}var o_=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,s){let r=this.pool,l=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let c=r[this.index];l.push(c),this.index++,c.start=t,c.count=e,c.z=n,c.index=s}reset(){this.list.length=0,this.index=0}},mi=new ue,mC=new Lt(1,1,1),GS=new fa,gC=new Nu,Fd=new bn,Br=new yn,uu=new O,kS=new O,_C=new O,j0=new o_,Kn=new rn,zd=[];function vC(i,t,e=0){let n=t.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==t.array.constructor){let s=i.count;for(let r=0;r<s;r++)for(let l=0;l<n;l++)t.setComponent(r+e,l,i.getComponent(r,l))}else t.array.set(i.array,e*n);t.needsUpdate=!0}function Fr(i,t){if(i.constructor!==t.constructor){let e=Math.min(i.length,t.length);for(let n=0;n<e;n++)t[n]=i[n]}else{let e=Math.min(i.length,t.length);t.set(new i.constructor(i.buffer,0,e))}}var Du=class extends rn{constructor(t,e,n=e*2,s){super(new de,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=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),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 t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4),n=new vi(e,t,t,Un,Qn);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Uint32Array(t*t),n=new vi(e,t,t,uc,Fi);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Float32Array(t*t*4).fill(1),n=new vi(e,t,t,Un,Qn);n.colorSpace=be.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){let e=this.geometry,n=this._maxVertexCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in t.attributes){let l=t.getAttribute(r),{array:c,itemSize:h,normalized:f}=l,p=new c.constructor(n*h),m=new He(p,h,f);e.setAttribute(r,m)}if(t.getIndex()!==null){let r=n>65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new He(r,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let s=t.getAttribute(n),r=e.getAttribute(n);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bn);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,mi),this.getBoundingBoxAt(r,Fd).applyMatrix4(mi),t.union(Fd)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yn);let t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,mi),this.getBoundingSphereAt(r,Br).applyMatrix4(mi),t.union(Br)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");let n={visible:!0,active:!0,geometryIndex:t},s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Z0),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=n):(s=this._instanceInfo.length,this._instanceInfo.push(n));let r=this._matricesTexture;mi.identity().toArray(r.image.data,s*16),r.needsUpdate=!0;let l=this._colorsTexture;return l&&(mC.toArray(l.image.data,s*4),l.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);let s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=e===-1?t.getAttribute("position").count:e;let l=t.getIndex();if(l!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=n===-1?l.count:n),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Z0),h=this._availableGeometryIds.shift(),r[h]=s):(h=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(h,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,h}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let n=this.geometry,s=n.getIndex()!==null,r=n.getIndex(),l=e.getIndex(),c=this._geometryInfo[t];if(s&&l.count>c.reservedIndexCount||e.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=e.getAttribute("position").count;for(let p in n.attributes){let m=e.getAttribute(p),g=n.getAttribute(p);vC(m,g,h);let v=m.itemSize;for(let y=m.count,b=f;y<b;y++){let S=h+y;for(let x=0;x<v;x++)g.setComponent(S,x,0)}g.needsUpdate=!0,g.addUpdateRange(h*v,f*v)}if(s){let p=c.indexStart,m=c.reservedIndexCount;c.indexCount=e.getIndex().count;for(let g=0;g<l.count;g++)r.setX(p+g,h+l.getX(g));for(let g=l.count,v=m;g<v;g++)r.setX(p+g,h);r.needsUpdate=!0,r.addUpdateRange(p,c.reservedIndexCount)}return c.start=s?c.indexStart:c.vertexStart,c.count=s?c.indexCount:c.vertexCount,c.boundingBox=null,e.boundingBox!==null&&(c.boundingBox=e.boundingBox.clone()),c.boundingSphere=null,e.boundingSphere!==null&&(c.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){let e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;let n=this._instanceInfo;for(let s=0,r=n.length;s<r;s++)n[s].active&&n[s].geometryIndex===t&&this.deleteInstance(s);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0,n=this._geometryInfo,s=n.map((l,c)=>c).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),r=this.geometry;for(let l=0,c=n.length;l<c;l++){let h=s[l],f=n[h];if(f.active!==!1){if(r.index!==null){if(f.indexStart!==e){let{indexStart:p,vertexStart:m,reservedIndexCount:g}=f,v=r.index,y=v.array,b=t-m;for(let S=p;S<p+g;S++)y[S]=y[S]+b;v.array.copyWithin(e,p,p+g),v.addUpdateRange(e,g),v.needsUpdate=!0,f.indexStart=e}e+=f.reservedIndexCount}if(f.vertexStart!==t){let{vertexStart:p,reservedVertexCount:m}=f,g=r.attributes;for(let v in g){let y=g[v],{array:b,itemSize:S}=y;b.copyWithin(t*S,p*S,(p+m)*S),y.addUpdateRange(t*S,m*S),y.needsUpdate=!0}f.vertexStart=t}t+=f.reservedVertexCount,f.start=r.index?f.indexStart:f.vertexStart,this._nextIndexStart=r.index?f.indexStart+f.reservedIndexCount:0,this._nextVertexStart=f.vertexStart+f.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingBox===null){let r=new bn,l=n.index,c=n.attributes.position;for(let h=s.start,f=s.start+s.count;h<f;h++){let p=h;l&&(p=l.getX(p)),r.expandByPoint(uu.fromBufferAttribute(c,p))}s.boundingBox=r}return e.copy(s.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingSphere===null){let r=new yn;this.getBoundingBoxAt(t,Fd),Fd.getCenter(r.center);let l=n.index,c=n.attributes.position,h=0;for(let f=s.start,p=s.start+s.count;f<p;f++){let m=f;l&&(m=l.getX(m)),uu.fromBufferAttribute(c,m),h=Math.max(h,r.center.distanceToSquared(uu))}r.radius=Math.sqrt(h),s.boundingSphere=r}return e.copy(s.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);let n=this._matricesTexture,s=this._matricesTexture.image.data;return e.toArray(s,t*16),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,t*16)}setColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,t*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,t*4)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e?this:(this._instanceInfo[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);let n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){let e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Z0);e[e.length-1]===n.length-1;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);let s=new Int32Array(t),r=new Int32Array(t);Fr(this._multiDrawCounts,s),Fr(this._multiDrawStarts,r),this._multiDrawCounts=s,this._multiDrawStarts=r,this._maxInstanceCount=t;let l=this._indirectTexture,c=this._matricesTexture,h=this._colorsTexture;l.dispose(),this._initIndirectTexture(),Fr(l.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),Fr(c.image.data,this._matricesTexture.image.data),h&&(h.dispose(),this._initColorsTexture(),Fr(h.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){let n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new de,this._initializeGeometry(r));let l=this.geometry;r.index&&Fr(r.index.array,l.index.array);for(let c in r.attributes)Fr(r.attributes[c].array,l.attributes[c].array)}raycast(t,e){let n=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,l=this.geometry;Kn.material=this.material,Kn.geometry.index=l.index,Kn.geometry.attributes=l.attributes,Kn.geometry.boundingBox===null&&(Kn.geometry.boundingBox=new bn),Kn.geometry.boundingSphere===null&&(Kn.geometry.boundingSphere=new yn);for(let c=0,h=n.length;c<h;c++){if(!n[c].visible||!n[c].active)continue;let f=n[c].geometryIndex,p=s[f];Kn.geometry.setDrawRange(p.start,p.count),this.getMatrixAt(c,Kn.matrixWorld).premultiply(r),this.getBoundingBoxAt(f,Kn.geometry.boundingBox),this.getBoundingSphereAt(f,Kn.geometry.boundingSphere),Kn.raycast(t,zd);for(let m=0,g=zd.length;m<g;m++){let v=zd[m];v.object=this,v.batchId=c,e.push(v)}zd.length=0}Kn.material=null,Kn.geometry.index=null,Kn.geometry.attributes={},Kn.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._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(t,e,n,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let l=s.getIndex(),c=l===null?1:l.array.BYTES_PER_ELEMENT,h=this._instanceInfo,f=this._multiDrawStarts,p=this._multiDrawCounts,m=this._geometryInfo,g=this.perObjectFrustumCulled,v=this._indirectTexture,y=v.image.data,b=n.isArrayCamera?gC:GS;g&&!n.isArrayCamera&&(mi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),GS.setFromProjectionMatrix(mi,n.coordinateSystem,n.reversedDepth));let S=0;if(this.sortObjects){mi.copy(this.matrixWorld).invert(),uu.setFromMatrixPosition(n.matrixWorld).applyMatrix4(mi),kS.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(mi);for(let T=0,A=h.length;T<A;T++)if(h[T].visible&&h[T].active){let N=h[T].geometryIndex;this.getMatrixAt(T,mi),this.getBoundingSphereAt(N,Br).applyMatrix4(mi);let D=!1;if(g&&(D=!b.intersectsSphere(Br,n)),!D){let L=m[N],F=_C.subVectors(Br.center,uu).dot(kS);j0.push(L.start,L.count,F,T)}}let x=j0.list,E=this.customSort;E===null?x.sort(r.transparent?pC:dC):E.call(this,x,n);for(let T=0,A=x.length;T<A;T++){let N=x[T];f[S]=N.start*c,p[S]=N.count,y[S]=N.index,S++}j0.reset()}else for(let x=0,E=h.length;x<E;x++)if(h[x].visible&&h[x].active){let T=h[x].geometryIndex,A=!1;if(g&&(this.getMatrixAt(x,mi),this.getBoundingSphereAt(T,Br).applyMatrix4(mi),A=!b.intersectsSphere(Br,n)),!A){let N=m[T];f[S]=N.start*c,p[S]=N.count,y[S]=x,S++}}v.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(t,e,n,s,r,l){this.onBeforeRender(t,null,s,r,l)}},Pn=class extends En{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Lt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},pp=new O,mp=new O,WS=new ue,hu=new ua,Vd=new yn,J0=new O,XS=new O,ms=class extends Oe{constructor(t=new de,e=new Pn){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let s=1,r=e.count;s<r;s++)pp.fromBufferAttribute(e,s-1),mp.fromBufferAttribute(e,s),n[s]=n[s-1],n[s]+=pp.distanceTo(mp);t.setAttribute("lineDistance",new Gt(n,1))}else wt("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vd.copy(n.boundingSphere),Vd.applyMatrix4(s),Vd.radius+=r,t.ray.intersectsSphere(Vd)===!1)return;WS.copy(s).invert(),hu.copy(t.ray).applyMatrix4(WS);let c=r/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,f=this.isLineSegments?2:1,p=n.index,g=n.attributes.position;if(p!==null){let v=Math.max(0,l.start),y=Math.min(p.count,l.start+l.count);for(let b=v,S=y-1;b<S;b+=f){let x=p.getX(b),E=p.getX(b+1),T=Hd(this,t,hu,h,x,E,b);T&&e.push(T)}if(this.isLineLoop){let b=p.getX(y-1),S=p.getX(v),x=Hd(this,t,hu,h,b,S,y-1);x&&e.push(x)}}else{let v=Math.max(0,l.start),y=Math.min(g.count,l.start+l.count);for(let b=v,S=y-1;b<S;b+=f){let x=Hd(this,t,hu,h,b,b+1,b);x&&e.push(x)}if(this.isLineLoop){let b=Hd(this,t,hu,h,y-1,v,y-1);b&&e.push(b)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}};function Hd(i,t,e,n,s,r,l){let c=i.geometry.attributes.position;if(pp.fromBufferAttribute(c,s),mp.fromBufferAttribute(c,r),e.distanceSqToSegment(pp,mp,J0,XS)>n)return;J0.applyMatrix4(i.matrixWorld);let f=t.ray.origin.distanceTo(J0);if(!(f<t.near||f>t.far))return{distance:f,point:XS.clone().applyMatrix4(i.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:i}}var qS=new O,YS=new O,Bi=class extends ms{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let s=0,r=e.count;s<r;s+=2)qS.fromBufferAttribute(e,s),YS.fromBufferAttribute(e,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+qS.distanceTo(YS);t.setAttribute("lineDistance",new Gt(n,1))}else wt("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Uu=class extends ms{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}},Ol=class extends En{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Lt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},ZS=new ue,l_=new ua,Gd=new yn,kd=new O,Pu=class extends Oe{constructor(t=new de,e=new Ol){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Gd.copy(n.boundingSphere),Gd.applyMatrix4(s),Gd.radius+=r,t.ray.intersectsSphere(Gd)===!1)return;ZS.copy(s).invert(),l_.copy(t.ray).applyMatrix4(ZS);let c=r/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,f=n.index,m=n.attributes.position;if(f!==null){let g=Math.max(0,l.start),v=Math.min(f.count,l.start+l.count);for(let y=g,b=v;y<b;y++){let S=f.getX(y);kd.fromBufferAttribute(m,S),jS(kd,S,h,s,t,e,this)}}else{let g=Math.max(0,l.start),v=Math.min(m.count,l.start+l.count);for(let y=g,b=v;y<b;y++)kd.fromBufferAttribute(m,y),jS(kd,y,h,s,t,e,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}};function jS(i,t,e,n,s,r,l){let c=l_.distanceSqToPoint(i);if(c<e){let h=new O;l_.closestPointToPoint(i,h),h.applyMatrix4(n);let f=s.ray.origin.distanceTo(h);if(f<s.near||f>s.far)return;r.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:t,face:null,faceIndex:null,barycoord:null,object:l})}}var Iu=class extends mn{constructor(t,e,n,s,r=Je,l=Je,c,h,f){super(t,e,n,s,r,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let p=this;function m(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=t.requestVideoFrameCallback(m)}"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(m))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},gp=class extends Iu{constructor(t,e,n,s,r,l,c,h){super({},t,e,n,s,r,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},_p=class extends mn{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=dn,this.minFilter=dn,this.generateMipmaps=!1,this.needsUpdate=!0}},no=class extends mn{constructor(t,e,n,s,r,l,c,h,f,p,m,g){super(null,l,c,h,f,p,s,r,m,g),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}},vp=class extends no{constructor(t,e,n,s,r,l){super(t,e,n,r,l),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=li,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},xp=class extends no{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},yp=class extends mn{constructor(t,e,n,s,r,l,c,h,f){super(t,e,n,s,r,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}},da=class extends mn{constructor(t,e,n=Fi,s,r,l,c=dn,h=dn,f,p=ds,m=1){if(p!==ds&&p!==_a)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let g={width:t,height:e,depth:m};super(g,s,r,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new hs(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Lu=class extends da{constructor(t,e=Fi,n=xs,s,r,l=dn,c=dn,h,f=ds){let p={width:t,height:t,depth:1},m=[p,p,p,p,p,p];super(t,t,e,n,s,r,l,c,h,f),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},Bl=class extends mn{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},Ou=class i extends de{constructor(t=1,e=1,n=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:n,radialSegments:s,heightSegments:r},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),s=Math.max(3,Math.floor(s)),r=Math.max(1,Math.floor(r));let l=[],c=[],h=[],f=[],p=e/2,m=Math.PI/2*t,g=e,v=2*m+g,y=n*2+r,b=s+1,S=new O,x=new O;for(let E=0;E<=y;E++){let T=0,A=0,N=0,D=0;if(E<=n){let C=E/n,w=C*Math.PI/2;A=-p-t*Math.cos(w),N=t*Math.sin(w),D=-t*Math.cos(w),T=C*m}else if(E<=n+r){let C=(E-n)/r;A=-p+C*e,N=t,D=0,T=m+C*g}else{let C=(E-n-r)/n,w=C*Math.PI/2;A=p+t*Math.sin(w),N=t*Math.cos(w),D=t*Math.sin(w),T=m+g+C*m}let L=Math.max(0,Math.min(1,T/v)),F=0;E===0?F=.5/s:E===y&&(F=-.5/s);for(let C=0;C<=s;C++){let w=C/s,z=w*Math.PI*2,Y=Math.sin(z),G=Math.cos(z);x.x=-N*G,x.y=A,x.z=N*Y,c.push(x.x,x.y,x.z),S.set(-N*G,D,N*Y),S.normalize(),h.push(S.x,S.y,S.z),f.push(w+F,L)}if(E>0){let C=(E-1)*b;for(let w=0;w<s;w++){let z=C+w,Y=C+w+1,G=E*b+w,j=E*b+w+1;l.push(z,Y,G),l.push(Y,j,G)}}}this.setIndex(l),this.setAttribute("position",new Gt(c,3)),this.setAttribute("normal",new Gt(h,3)),this.setAttribute("uv",new Gt(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},Bu=class i extends de{constructor(t=1,e=32,n=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:s},e=Math.max(3,e);let r=[],l=[],c=[],h=[],f=new O,p=new ft;l.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(let m=0,g=3;m<=e;m++,g+=3){let v=n+m/e*s;f.x=t*Math.cos(v),f.y=t*Math.sin(v),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(l[g]/t+1)/2,p.y=(l[g+1]/t+1)/2,h.push(p.x,p.y)}for(let m=1;m<=e;m++)r.push(m,m+1,0);this.setIndex(r),this.setAttribute("position",new Gt(l,3)),this.setAttribute("normal",new Gt(c,3)),this.setAttribute("uv",new Gt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Fl=class i extends de{constructor(t=1,e=1,n=1,s=32,r=1,l=!1,c=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:s,heightSegments:r,openEnded:l,thetaStart:c,thetaLength:h};let f=this;s=Math.floor(s),r=Math.floor(r);let p=[],m=[],g=[],v=[],y=0,b=[],S=n/2,x=0;E(),l===!1&&(t>0&&T(!0),e>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Gt(m,3)),this.setAttribute("normal",new Gt(g,3)),this.setAttribute("uv",new Gt(v,2));function E(){let A=new O,N=new O,D=0,L=(e-t)/n;for(let F=0;F<=r;F++){let C=[],w=F/r,z=w*(e-t)+t;for(let Y=0;Y<=s;Y++){let G=Y/s,j=G*h+c,nt=Math.sin(j),J=Math.cos(j);N.x=z*nt,N.y=-w*n+S,N.z=z*J,m.push(N.x,N.y,N.z),A.set(nt,L,J).normalize(),g.push(A.x,A.y,A.z),v.push(G,1-w),C.push(y++)}b.push(C)}for(let F=0;F<s;F++)for(let C=0;C<r;C++){let w=b[C][F],z=b[C+1][F],Y=b[C+1][F+1],G=b[C][F+1];(t>0||C!==0)&&(p.push(w,z,G),D+=3),(e>0||C!==r-1)&&(p.push(z,Y,G),D+=3)}f.addGroup(x,D,0),x+=D}function T(A){let N=y,D=new ft,L=new O,F=0,C=A===!0?t:e,w=A===!0?1:-1;for(let Y=1;Y<=s;Y++)m.push(0,S*w,0),g.push(0,w,0),v.push(.5,.5),y++;let z=y;for(let Y=0;Y<=s;Y++){let j=Y/s*h+c,nt=Math.cos(j),J=Math.sin(j);L.x=C*J,L.y=S*w,L.z=C*nt,m.push(L.x,L.y,L.z),g.push(0,w,0),D.x=nt*.5+.5,D.y=J*.5*w+.5,v.push(D.x,D.y),y++}for(let Y=0;Y<s;Y++){let G=N+Y,j=z+Y;A===!0?p.push(j,j+1,G):p.push(j+1,j,G),F+=3}f.addGroup(x,F,A===!0?1:2),x+=F}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},zl=class i extends Fl{constructor(t=1,e=1,n=32,s=1,r=!1,l=0,c=Math.PI*2){super(0,t,e,n,s,r,l,c),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:s,openEnded:r,thetaStart:l,thetaLength:c}}static fromJSON(t){return new i(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},pa=class i extends de{constructor(t=[],e=[],n=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:s};let r=[],l=[];c(s),f(n),p(),this.setAttribute("position",new Gt(r,3)),this.setAttribute("normal",new Gt(r.slice(),3)),this.setAttribute("uv",new Gt(l,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function c(E){let T=new O,A=new O,N=new O;for(let D=0;D<e.length;D+=3)v(e[D+0],T),v(e[D+1],A),v(e[D+2],N),h(T,A,N,E)}function h(E,T,A,N){let D=N+1,L=[];for(let F=0;F<=D;F++){L[F]=[];let C=E.clone().lerp(A,F/D),w=T.clone().lerp(A,F/D),z=D-F;for(let Y=0;Y<=z;Y++)Y===0&&F===D?L[F][Y]=C:L[F][Y]=C.clone().lerp(w,Y/z)}for(let F=0;F<D;F++)for(let C=0;C<2*(D-F)-1;C++){let w=Math.floor(C/2);C%2===0?(g(L[F][w+1]),g(L[F+1][w]),g(L[F][w])):(g(L[F][w+1]),g(L[F+1][w+1]),g(L[F+1][w]))}}function f(E){let T=new O;for(let A=0;A<r.length;A+=3)T.x=r[A+0],T.y=r[A+1],T.z=r[A+2],T.normalize().multiplyScalar(E),r[A+0]=T.x,r[A+1]=T.y,r[A+2]=T.z}function p(){let E=new O;for(let T=0;T<r.length;T+=3){E.x=r[T+0],E.y=r[T+1],E.z=r[T+2];let A=S(E)/2/Math.PI+.5,N=x(E)/Math.PI+.5;l.push(A,1-N)}y(),m()}function m(){for(let E=0;E<l.length;E+=6){let T=l[E+0],A=l[E+2],N=l[E+4],D=Math.max(T,A,N),L=Math.min(T,A,N);D>.9&&L<.1&&(T<.2&&(l[E+0]+=1),A<.2&&(l[E+2]+=1),N<.2&&(l[E+4]+=1))}}function g(E){r.push(E.x,E.y,E.z)}function v(E,T){let A=E*3;T.x=t[A+0],T.y=t[A+1],T.z=t[A+2]}function y(){let E=new O,T=new O,A=new O,N=new O,D=new ft,L=new ft,F=new ft;for(let C=0,w=0;C<r.length;C+=9,w+=6){E.set(r[C+0],r[C+1],r[C+2]),T.set(r[C+3],r[C+4],r[C+5]),A.set(r[C+6],r[C+7],r[C+8]),D.set(l[w+0],l[w+1]),L.set(l[w+2],l[w+3]),F.set(l[w+4],l[w+5]),N.copy(E).add(T).add(A).divideScalar(3);let z=S(N);b(D,w+0,E,z),b(L,w+2,T,z),b(F,w+4,A,z)}}function b(E,T,A,N){N<0&&E.x===1&&(l[T]=E.x-1),A.x===0&&A.z===0&&(l[T]=N/2/Math.PI+.5)}function S(E){return Math.atan2(E.z,-E.x)}function x(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.vertices,t.indices,t.radius,t.detail)}},Fu=class i extends pa{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],l=[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(r,l,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},Wd=new O,Xd=new O,K0=new O,qd=new us,zu=class extends de{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){let s=Math.pow(10,4),r=Math.cos(qr*e),l=t.getIndex(),c=t.getAttribute("position"),h=l?l.count:c.count,f=[0,0,0],p=["a","b","c"],m=new Array(3),g={},v=[];for(let y=0;y<h;y+=3){l?(f[0]=l.getX(y),f[1]=l.getX(y+1),f[2]=l.getX(y+2)):(f[0]=y,f[1]=y+1,f[2]=y+2);let{a:b,b:S,c:x}=qd;if(b.fromBufferAttribute(c,f[0]),S.fromBufferAttribute(c,f[1]),x.fromBufferAttribute(c,f[2]),qd.getNormal(K0),m[0]=`${Math.round(b.x*s)},${Math.round(b.y*s)},${Math.round(b.z*s)}`,m[1]=`${Math.round(S.x*s)},${Math.round(S.y*s)},${Math.round(S.z*s)}`,m[2]=`${Math.round(x.x*s)},${Math.round(x.y*s)},${Math.round(x.z*s)}`,!(m[0]===m[1]||m[1]===m[2]||m[2]===m[0]))for(let E=0;E<3;E++){let T=(E+1)%3,A=m[E],N=m[T],D=qd[p[E]],L=qd[p[T]],F=`${A}_${N}`,C=`${N}_${A}`;C in g&&g[C]?(K0.dot(g[C].normal)<=r&&(v.push(D.x,D.y,D.z),v.push(L.x,L.y,L.z)),g[C]=null):F in g||(g[F]={index0:f[E],index1:f[T],normal:K0.clone()})}}for(let y in g)if(g[y]){let{index0:b,index1:S}=g[y];Wd.fromBufferAttribute(c,b),Xd.fromBufferAttribute(c,S),v.push(Wd.x,Wd.y,Wd.z),v.push(Xd.x,Xd.y,Xd.z)}this.setAttribute("position",new Gt(v,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}},yi=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){wt("Curve: .getPoint() not implemented.")}getPointAt(t,e){let n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],n,s=this.getPoint(0),r=0;e.push(0);for(let l=1;l<=t;l++)n=this.getPoint(l/t),r+=n.distanceTo(s),e.push(r),s=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let n=this.getLengths(),s=0,r=n.length,l;e?l=e:l=t*n[r-1];let c=0,h=r-1,f;for(;c<=h;)if(s=Math.floor(c+(h-c)/2),f=n[s]-l,f<0)c=s+1;else if(f>0)h=s-1;else{h=s;break}if(s=h,n[s]===l)return s/(r-1);let p=n[s],g=n[s+1]-p,v=(l-p)/g;return(s+v)/(r-1)}getTangent(t,e){let s=t-1e-4,r=t+1e-4;s<0&&(s=0),r>1&&(r=1);let l=this.getPoint(s),c=this.getPoint(r),h=e||(l.isVector2?new ft:new O);return h.copy(c).sub(l).normalize(),h}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){let n=new O,s=[],r=[],l=[],c=new O,h=new ue;for(let v=0;v<=t;v++){let y=v/t;s[v]=this.getTangentAt(y,new O)}r[0]=new O,l[0]=new O;let f=Number.MAX_VALUE,p=Math.abs(s[0].x),m=Math.abs(s[0].y),g=Math.abs(s[0].z);p<=f&&(f=p,n.set(1,0,0)),m<=f&&(f=m,n.set(0,1,0)),g<=f&&n.set(0,0,1),c.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],c),l[0].crossVectors(s[0],r[0]);for(let v=1;v<=t;v++){if(r[v]=r[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(s[v-1],s[v]),c.length()>Number.EPSILON){c.normalize();let y=Math.acos(le(s[v-1].dot(s[v]),-1,1));r[v].applyMatrix4(h.makeRotationAxis(c,y))}l[v].crossVectors(s[v],r[v])}if(e===!0){let v=Math.acos(le(r[0].dot(r[t]),-1,1));v/=t,s[0].dot(c.crossVectors(r[0],r[t]))>0&&(v=-v);for(let y=1;y<=t;y++)r[y].applyMatrix4(h.makeRotationAxis(s[y],v*y)),l[y].crossVectors(s[y],r[y])}return{tangents:s,normals:r,binormals:l}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},io=class extends yi{constructor(t=0,e=0,n=1,s=1,r=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(t,e=new ft){let n=e,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,l=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(l?r=0:r=s),this.aClockwise===!0&&!l&&(r===s?r=-s:r=r-s);let c=this.aStartAngle+t*r,h=this.aX+this.xRadius*Math.cos(c),f=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){let p=Math.cos(this.aRotation),m=Math.sin(this.aRotation),g=h-this.aX,v=f-this.aY;h=g*p-v*m+this.aX,f=g*m+v*p+this.aY}return n.set(h,f)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},Vu=class extends io{constructor(t,e,n,s,r,l){super(t,e,n,n,s,r,l),this.isArcCurve=!0,this.type="ArcCurve"}};function av(){let i=0,t=0,e=0,n=0;function s(r,l,c,h){i=r,t=c,e=-3*r+3*l-2*c-h,n=2*r-2*l+c+h}return{initCatmullRom:function(r,l,c,h,f){s(l,c,f*(c-r),f*(h-l))},initNonuniformCatmullRom:function(r,l,c,h,f,p,m){let g=(l-r)/f-(c-r)/(f+p)+(c-l)/p,v=(c-l)/p-(h-l)/(p+m)+(h-c)/m;g*=p,v*=p,s(l,c,g,v)},calc:function(r){let l=r*r,c=l*r;return i+t*r+e*l+n*c}}}var Yd=new O,Q0=new av,$0=new av,t_=new av,Hu=class extends yi{constructor(t=[],e=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=s}getPoint(t,e=new O){let n=e,s=this.points,r=s.length,l=(r-(this.closed?0:1))*t,c=Math.floor(l),h=l-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/r)+1)*r:h===0&&c===r-1&&(c=r-2,h=1);let f,p;this.closed||c>0?f=s[(c-1)%r]:(Yd.subVectors(s[0],s[1]).add(s[0]),f=Yd);let m=s[c%r],g=s[(c+1)%r];if(this.closed||c+2<r?p=s[(c+2)%r]:(Yd.subVectors(s[r-1],s[r-2]).add(s[r-1]),p=Yd),this.curveType==="centripetal"||this.curveType==="chordal"){let v=this.curveType==="chordal"?.5:.25,y=Math.pow(f.distanceToSquared(m),v),b=Math.pow(m.distanceToSquared(g),v),S=Math.pow(g.distanceToSquared(p),v);b<1e-4&&(b=1),y<1e-4&&(y=b),S<1e-4&&(S=b),Q0.initNonuniformCatmullRom(f.x,m.x,g.x,p.x,y,b,S),$0.initNonuniformCatmullRom(f.y,m.y,g.y,p.y,y,b,S),t_.initNonuniformCatmullRom(f.z,m.z,g.z,p.z,y,b,S)}else this.curveType==="catmullrom"&&(Q0.initCatmullRom(f.x,m.x,g.x,p.x,this.tension),$0.initCatmullRom(f.y,m.y,g.y,p.y,this.tension),t_.initCatmullRom(f.z,m.z,g.z,p.z,this.tension));return n.set(Q0.calc(h),$0.calc(h),t_.calc(h)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new O().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function JS(i,t,e,n,s){let r=(n-t)*.5,l=(s-e)*.5,c=i*i,h=i*c;return(2*e-2*n+r+l)*h+(-3*e+3*n-2*r-l)*c+r*i+e}function xC(i,t){let e=1-i;return e*e*t}function yC(i,t){return 2*(1-i)*i*t}function SC(i,t){return i*i*t}function gu(i,t,e,n){return xC(i,t)+yC(i,e)+SC(i,n)}function MC(i,t){let e=1-i;return e*e*e*t}function bC(i,t){let e=1-i;return 3*e*e*i*t}function EC(i,t){return 3*(1-i)*i*i*t}function TC(i,t){return i*i*i*t}function _u(i,t,e,n,s){return MC(i,t)+bC(i,e)+EC(i,n)+TC(i,s)}var Vl=class extends yi{constructor(t=new ft,e=new ft,n=new ft,s=new ft){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new ft){let n=e,s=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(_u(t,s.x,r.x,l.x,c.x),_u(t,s.y,r.y,l.y,c.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Gu=class extends yi{constructor(t=new O,e=new O,n=new O,s=new O){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new O){let n=e,s=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(_u(t,s.x,r.x,l.x,c.x),_u(t,s.y,r.y,l.y,c.y),_u(t,s.z,r.z,l.z,c.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Hl=class extends yi{constructor(t=new ft,e=new ft){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ft){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new ft){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},ku=class extends yi{constructor(t=new O,e=new O){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new O){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new O){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Gl=class extends yi{constructor(t=new ft,e=new ft,n=new ft){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ft){let n=e,s=this.v0,r=this.v1,l=this.v2;return n.set(gu(t,s.x,r.x,l.x),gu(t,s.y,r.y,l.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},kl=class extends yi{constructor(t=new O,e=new O,n=new O){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new O){let n=e,s=this.v0,r=this.v1,l=this.v2;return n.set(gu(t,s.x,r.x,l.x),gu(t,s.y,r.y,l.y),gu(t,s.z,r.z,l.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Wl=class extends yi{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new ft){let n=e,s=this.points,r=(s.length-1)*t,l=Math.floor(r),c=r-l,h=s[l===0?l:l-1],f=s[l],p=s[l>s.length-2?s.length-1:l+1],m=s[l>s.length-3?s.length-1:l+2];return n.set(JS(c,h.x,f.x,p.x,m.x),JS(c,h.y,f.y,p.y,m.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new ft().fromArray(s))}return this}},Sp=Object.freeze({__proto__:null,ArcCurve:Vu,CatmullRomCurve3:Hu,CubicBezierCurve:Vl,CubicBezierCurve3:Gu,EllipseCurve:io,LineCurve:Hl,LineCurve3:ku,QuadraticBezierCurve:Gl,QuadraticBezierCurve3:kl,SplineCurve:Wl}),Wu=class extends yi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Sp[n](e,t))}return this}getPoint(t,e){let n=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=n){let l=s[r]-n,c=this.curves[r],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let n=0,s=this.curves.length;n<s;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],n;for(let s=0,r=this.curves;s<r.length;s++){let l=r[s],c=l.isEllipseCurve?t*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?t*l.points.length:t,h=l.getPoints(c);for(let f=0;f<h.length;f++){let p=h[f];n&&n.equals(p)||(e.push(p),n=p)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(new Sp[s.type]().fromJSON(s))}return this}},so=class extends Wu{constructor(t){super(),this.type="Path",this.currentPoint=new ft,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let n=new Hl(this.currentPoint.clone(),new ft(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,s){let r=new Gl(this.currentPoint.clone(),new ft(t,e),new ft(n,s));return this.curves.push(r),this.currentPoint.set(n,s),this}bezierCurveTo(t,e,n,s,r,l){let c=new Vl(this.currentPoint.clone(),new ft(t,e),new ft(n,s),new ft(r,l));return this.curves.push(c),this.currentPoint.set(r,l),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),n=new Wl(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,s,r,l){let c=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(t+c,e+h,n,s,r,l),this}absarc(t,e,n,s,r,l){return this.absellipse(t,e,n,n,s,r,l),this}ellipse(t,e,n,s,r,l,c,h){let f=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(t+f,e+p,n,s,r,l,c,h),this}absellipse(t,e,n,s,r,l,c,h){let f=new io(t,e,n,s,r,l,c,h);if(this.curves.length>0){let m=f.getPoint(0);m.equals(this.currentPoint)||this.lineTo(m.x,m.y)}this.curves.push(f);let p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},Ds=class extends so{constructor(t){super(t),this.uuid=Li(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,s=this.holes.length;n<s;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(new so().fromJSON(s))}return this}};function AC(i,t,e=2){let n=t&&t.length,s=n?t[0]*e:i.length,r=mb(i,0,s,e,!0),l=[];if(!r||r.next===r.prev)return l;let c,h,f;if(n&&(r=DC(i,t,r,e)),i.length>80*e){c=i[0],h=i[1];let p=c,m=h;for(let g=e;g<s;g+=e){let v=i[g],y=i[g+1];v<c&&(c=v),y<h&&(h=y),v>p&&(p=v),y>m&&(m=y)}f=Math.max(p-c,m-h),f=f!==0?32767/f:0}return Xu(r,l,e,c,h,f,0),l}function mb(i,t,e,n,s){let r;if(s===GC(i,t,e,n)>0)for(let l=t;l<e;l+=n)r=KS(l/n|0,i[l],i[l+1],r);else for(let l=e-n;l>=t;l-=n)r=KS(l/n|0,i[l],i[l+1],r);return r&&Xl(r,r.next)&&(Yu(r),r=r.next),r}function ao(i,t){if(!i)return i;t||(t=i);let e=i,n;do if(n=!1,!e.steiner&&(Xl(e,e.next)||an(e.prev,e,e.next)===0)){if(Yu(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Xu(i,t,e,n,s,r,l){if(!i)return;!l&&r&&OC(i,n,s,r);let c=i;for(;i.prev!==i.next;){let h=i.prev,f=i.next;if(r?RC(i,n,s,r):CC(i)){t.push(h.i,i.i,f.i),Yu(i),i=f.next,c=f.next;continue}if(i=f,i===c){l?l===1?(i=wC(ao(i),t),Xu(i,t,e,n,s,r,2)):l===2&&NC(i,t,e,n,s,r):Xu(ao(i),t,e,n,s,r,1);break}}}function CC(i){let t=i.prev,e=i,n=i.next;if(an(t,e,n)>=0)return!1;let s=t.x,r=e.x,l=n.x,c=t.y,h=e.y,f=n.y,p=Math.min(s,r,l),m=Math.min(c,h,f),g=Math.max(s,r,l),v=Math.max(c,h,f),y=n.next;for(;y!==t;){if(y.x>=p&&y.x<=g&&y.y>=m&&y.y<=v&&du(s,c,r,h,l,f,y.x,y.y)&&an(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function RC(i,t,e,n){let s=i.prev,r=i,l=i.next;if(an(s,r,l)>=0)return!1;let c=s.x,h=r.x,f=l.x,p=s.y,m=r.y,g=l.y,v=Math.min(c,h,f),y=Math.min(p,m,g),b=Math.max(c,h,f),S=Math.max(p,m,g),x=c_(v,y,t,e,n),E=c_(b,S,t,e,n),T=i.prevZ,A=i.nextZ;for(;T&&T.z>=x&&A&&A.z<=E;){if(T.x>=v&&T.x<=b&&T.y>=y&&T.y<=S&&T!==s&&T!==l&&du(c,p,h,m,f,g,T.x,T.y)&&an(T.prev,T,T.next)>=0||(T=T.prevZ,A.x>=v&&A.x<=b&&A.y>=y&&A.y<=S&&A!==s&&A!==l&&du(c,p,h,m,f,g,A.x,A.y)&&an(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;T&&T.z>=x;){if(T.x>=v&&T.x<=b&&T.y>=y&&T.y<=S&&T!==s&&T!==l&&du(c,p,h,m,f,g,T.x,T.y)&&an(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;A&&A.z<=E;){if(A.x>=v&&A.x<=b&&A.y>=y&&A.y<=S&&A!==s&&A!==l&&du(c,p,h,m,f,g,A.x,A.y)&&an(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function wC(i,t){let e=i;do{let n=e.prev,s=e.next.next;!Xl(n,s)&&_b(n,e,e.next,s)&&qu(n,s)&&qu(s,n)&&(t.push(n.i,e.i,s.i),Yu(e),Yu(e.next),e=i=s),e=e.next}while(e!==i);return ao(e)}function NC(i,t,e,n,s,r){let l=i;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&zC(l,c)){let h=vb(l,c);l=ao(l,l.next),h=ao(h,h.next),Xu(l,t,e,n,s,r,0),Xu(h,t,e,n,s,r,0);return}c=c.next}l=l.next}while(l!==i)}function DC(i,t,e,n){let s=[];for(let r=0,l=t.length;r<l;r++){let c=t[r]*n,h=r<l-1?t[r+1]*n:i.length,f=mb(i,c,h,n,!1);f===f.next&&(f.steiner=!0),s.push(FC(f))}s.sort(UC);for(let r=0;r<s.length;r++)e=PC(s[r],e);return e}function UC(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=n-s}return e}function PC(i,t){let e=IC(i,t);if(!e)return t;let n=vb(e,i);return ao(n,n.next),ao(e,e.next)}function IC(i,t){let e=t,n=i.x,s=i.y,r=-1/0,l;if(Xl(i,e))return e;do{if(Xl(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let m=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(m<=n&&m>r&&(r=m,l=e.x<e.next.x?e:e.next,m===n))return l}e=e.next}while(e!==t);if(!l)return null;let c=l,h=l.x,f=l.y,p=1/0;e=l;do{if(n>=e.x&&e.x>=h&&n!==e.x&&gb(s<f?n:r,s,h,f,s<f?r:n,s,e.x,e.y)){let m=Math.abs(s-e.y)/(n-e.x);qu(e,i)&&(m<p||m===p&&(e.x>l.x||e.x===l.x&&LC(l,e)))&&(l=e,p=m)}e=e.next}while(e!==c);return l}function LC(i,t){return an(i.prev,i,t.prev)<0&&an(t.next,i,i.next)<0}function OC(i,t,e,n){let s=i;do s.z===0&&(s.z=c_(s.x,s.y,t,e,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,BC(s)}function BC(i){let t,e=1;do{let n=i,s;i=null;let r=null;for(t=0;n;){t++;let l=n,c=0;for(let f=0;f<e&&(c++,l=l.nextZ,!!l);f++);let h=e;for(;c>0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(s=n,n=n.nextZ,c--):(s=l,l=l.nextZ,h--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=l}r.nextZ=null,e*=2}while(t>1);return i}function c_(i,t,e,n,s){return i=(i-e)*s|0,t=(t-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function FC(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function gb(i,t,e,n,s,r,l,c){return(s-l)*(t-c)>=(i-l)*(r-c)&&(i-l)*(n-c)>=(e-l)*(t-c)&&(e-l)*(r-c)>=(s-l)*(n-c)}function du(i,t,e,n,s,r,l,c){return!(i===l&&t===c)&&gb(i,t,e,n,s,r,l,c)}function zC(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!VC(i,t)&&(qu(i,t)&&qu(t,i)&&HC(i,t)&&(an(i.prev,i,t.prev)||an(i,t.prev,t))||Xl(i,t)&&an(i.prev,i,i.next)>0&&an(t.prev,t,t.next)>0)}function an(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xl(i,t){return i.x===t.x&&i.y===t.y}function _b(i,t,e,n){let s=jd(an(i,t,e)),r=jd(an(i,t,n)),l=jd(an(e,n,i)),c=jd(an(e,n,t));return!!(s!==r&&l!==c||s===0&&Zd(i,e,t)||r===0&&Zd(i,n,t)||l===0&&Zd(e,i,n)||c===0&&Zd(e,t,n))}function Zd(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function jd(i){return i>0?1:i<0?-1:0}function VC(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&_b(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function qu(i,t){return an(i.prev,i,i.next)<0?an(i,t,i.next)>=0&&an(i,i.prev,t)>=0:an(i,t,i.prev)<0||an(i,i.next,t)<0}function HC(i,t){let e=i,n=!1,s=(i.x+t.x)/2,r=(i.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&s<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==i);return n}function vb(i,t){let e=u_(i.i,i.x,i.y),n=u_(t.i,t.x,t.y),s=i.next,r=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function KS(i,t,e,n){let s=u_(i,t,e);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Yu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function u_(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function GC(i,t,e,n){let s=0;for(let r=t,l=e-n;r<e;r+=n)s+=(i[l]-i[r])*(i[r+1]+i[l+1]),l=r;return s}var h_=class{static triangulate(t,e,n=2){return AC(t,e,n)}},Qi=class i{static area(t){let e=t.length,n=0;for(let s=e-1,r=0;r<e;s=r++)n+=t[s].x*t[r].y-t[r].x*t[s].y;return n*.5}static isClockWise(t){return i.area(t)<0}static triangulateShape(t,e){let n=[],s=[],r=[];QS(t),$S(n,t);let l=t.length;e.forEach(QS);for(let h=0;h<e.length;h++)s.push(l),l+=e[h].length,$S(n,e[h]);let c=h_.triangulate(n,s);for(let h=0;h<c.length;h+=3)r.push(c.slice(h,h+3));return r}};function QS(i){let t=i.length;t>2&&i[t-1].equals(i[0])&&i.pop()}function $S(i,t){for(let e=0;e<t.length;e++)i.push(t[e].x),i.push(t[e].y)}var Zu=class i extends de{constructor(t=new Ds([new ft(.5,.5),new ft(-.5,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let n=this,s=[],r=[];for(let c=0,h=t.length;c<h;c++){let f=t[c];l(f)}this.setAttribute("position",new Gt(s,3)),this.setAttribute("uv",new Gt(r,2)),this.computeVertexNormals();function l(c){let h=[],f=e.curveSegments!==void 0?e.curveSegments:12,p=e.steps!==void 0?e.steps:1,m=e.depth!==void 0?e.depth:1,g=e.bevelEnabled!==void 0?e.bevelEnabled:!0,v=e.bevelThickness!==void 0?e.bevelThickness:.2,y=e.bevelSize!==void 0?e.bevelSize:v-.1,b=e.bevelOffset!==void 0?e.bevelOffset:0,S=e.bevelSegments!==void 0?e.bevelSegments:3,x=e.extrudePath,E=e.UVGenerator!==void 0?e.UVGenerator:kC,T,A=!1,N,D,L,F;if(x){T=x.getSpacedPoints(p),A=!0,g=!1;let ct=x.isCatmullRomCurve3?x.closed:!1;N=x.computeFrenetFrames(p,ct),D=new O,L=new O,F=new O}g||(S=0,v=0,y=0,b=0);let C=c.extractPoints(f),w=C.shape,z=C.holes;if(!Qi.isClockWise(w)){w=w.reverse();for(let ct=0,gt=z.length;ct<gt;ct++){let lt=z[ct];Qi.isClockWise(lt)&&(z[ct]=lt.reverse())}}function G(ct){let lt=10000000000000001e-36,Nt=ct[0];for(let B=1;B<=ct.length;B++){let Zt=B%ct.length,Dt=ct[Zt],se=Dt.x-Nt.x,Mt=Dt.y-Nt.y,I=se*se+Mt*Mt,R=Math.max(Math.abs(Dt.x),Math.abs(Dt.y),Math.abs(Nt.x),Math.abs(Nt.y)),k=lt*R*R;if(I<=k){ct.splice(Zt,1),B--;continue}Nt=Dt}}G(w),z.forEach(G);let j=z.length,nt=w;for(let ct=0;ct<j;ct++){let gt=z[ct];w=w.concat(gt)}function J(ct,gt,lt){return gt||Qt("ExtrudeGeometry: vec does not exist"),ct.clone().addScaledVector(gt,lt)}let et=w.length;function rt(ct,gt,lt){let Nt,B,Zt,Dt=ct.x-gt.x,se=ct.y-gt.y,Mt=lt.x-ct.x,I=lt.y-ct.y,R=Dt*Dt+se*se,k=Dt*I-se*Mt;if(Math.abs(k)>Number.EPSILON){let it=Math.sqrt(R),ht=Math.sqrt(Mt*Mt+I*I),st=gt.x-se/it,jt=gt.y+Dt/it,Et=lt.x-I/ht,Wt=lt.y+Mt/ht,Kt=((Et-st)*I-(Wt-jt)*Mt)/(Dt*I-se*Mt);Nt=st+Dt*Kt-ct.x,B=jt+se*Kt-ct.y;let pt=Nt*Nt+B*B;if(pt<=2)return new ft(Nt,B);Zt=Math.sqrt(pt/2)}else{let it=!1;Dt>Number.EPSILON?Mt>Number.EPSILON&&(it=!0):Dt<-Number.EPSILON?Mt<-Number.EPSILON&&(it=!0):Math.sign(se)===Math.sign(I)&&(it=!0),it?(Nt=-se,B=Dt,Zt=Math.sqrt(R)):(Nt=Dt,B=se,Zt=Math.sqrt(R/2))}return new ft(Nt/Zt,B/Zt)}let St=[];for(let ct=0,gt=nt.length,lt=gt-1,Nt=ct+1;ct<gt;ct++,lt++,Nt++)lt===gt&&(lt=0),Nt===gt&&(Nt=0),St[ct]=rt(nt[ct],nt[lt],nt[Nt]);let bt=[],mt,kt=St.concat();for(let ct=0,gt=j;ct<gt;ct++){let lt=z[ct];mt=[];for(let Nt=0,B=lt.length,Zt=B-1,Dt=Nt+1;Nt<B;Nt++,Zt++,Dt++)Zt===B&&(Zt=0),Dt===B&&(Dt=0),mt[Nt]=rt(lt[Nt],lt[Zt],lt[Dt]);bt.push(mt),kt=kt.concat(mt)}let $t;if(S===0)$t=Qi.triangulateShape(nt,z);else{let ct=[],gt=[];for(let lt=0;lt<S;lt++){let Nt=lt/S,B=v*Math.cos(Nt*Math.PI/2),Zt=y*Math.sin(Nt*Math.PI/2)+b;for(let Dt=0,se=nt.length;Dt<se;Dt++){let Mt=J(nt[Dt],St[Dt],Zt);ie(Mt.x,Mt.y,-B),Nt===0&&ct.push(Mt)}for(let Dt=0,se=j;Dt<se;Dt++){let Mt=z[Dt];mt=bt[Dt];let I=[];for(let R=0,k=Mt.length;R<k;R++){let it=J(Mt[R],mt[R],Zt);ie(it.x,it.y,-B),Nt===0&&I.push(it)}Nt===0&&gt.push(I)}}$t=Qi.triangulateShape(ct,gt)}let re=$t.length,Ce=y+b;for(let ct=0;ct<et;ct++){let gt=g?J(w[ct],kt[ct],Ce):w[ct];A?(L.copy(N.normals[0]).multiplyScalar(gt.x),D.copy(N.binormals[0]).multiplyScalar(gt.y),F.copy(T[0]).add(L).add(D),ie(F.x,F.y,F.z)):ie(gt.x,gt.y,0)}for(let ct=1;ct<=p;ct++)for(let gt=0;gt<et;gt++){let lt=g?J(w[gt],kt[gt],Ce):w[gt];A?(L.copy(N.normals[ct]).multiplyScalar(lt.x),D.copy(N.binormals[ct]).multiplyScalar(lt.y),F.copy(T[ct]).add(L).add(D),ie(F.x,F.y,F.z)):ie(lt.x,lt.y,m/p*ct)}for(let ct=S-1;ct>=0;ct--){let gt=ct/S,lt=v*Math.cos(gt*Math.PI/2),Nt=y*Math.sin(gt*Math.PI/2)+b;for(let B=0,Zt=nt.length;B<Zt;B++){let Dt=J(nt[B],St[B],Nt);ie(Dt.x,Dt.y,m+lt)}for(let B=0,Zt=z.length;B<Zt;B++){let Dt=z[B];mt=bt[B];for(let se=0,Mt=Dt.length;se<Mt;se++){let I=J(Dt[se],mt[se],Nt);A?ie(I.x,I.y+T[p-1].y,T[p-1].x+lt):ie(I.x,I.y,m+lt)}}}at(),dt();function at(){let ct=s.length/3;if(g){let gt=0,lt=et*gt;for(let Nt=0;Nt<re;Nt++){let B=$t[Nt];Ft(B[2]+lt,B[1]+lt,B[0]+lt)}gt=p+S*2,lt=et*gt;for(let Nt=0;Nt<re;Nt++){let B=$t[Nt];Ft(B[0]+lt,B[1]+lt,B[2]+lt)}}else{for(let gt=0;gt<re;gt++){let lt=$t[gt];Ft(lt[2],lt[1],lt[0])}for(let gt=0;gt<re;gt++){let lt=$t[gt];Ft(lt[0]+et*p,lt[1]+et*p,lt[2]+et*p)}}n.addGroup(ct,s.length/3-ct,0)}function dt(){let ct=s.length/3,gt=0;Vt(nt,gt),gt+=nt.length;for(let lt=0,Nt=z.length;lt<Nt;lt++){let B=z[lt];Vt(B,gt),gt+=B.length}n.addGroup(ct,s.length/3-ct,1)}function Vt(ct,gt){let lt=ct.length;for(;--lt>=0;){let Nt=lt,B=lt-1;B<0&&(B=ct.length-1);for(let Zt=0,Dt=p+S*2;Zt<Dt;Zt++){let se=et*Zt,Mt=et*(Zt+1),I=gt+Nt+se,R=gt+B+se,k=gt+B+Mt,it=gt+Nt+Mt;ye(I,R,k,it)}}}function ie(ct,gt,lt){h.push(ct),h.push(gt),h.push(lt)}function Ft(ct,gt,lt){Re(ct),Re(gt),Re(lt);let Nt=s.length/3,B=E.generateTopUV(n,s,Nt-3,Nt-2,Nt-1);ce(B[0]),ce(B[1]),ce(B[2])}function ye(ct,gt,lt,Nt){Re(ct),Re(gt),Re(Nt),Re(gt),Re(lt),Re(Nt);let B=s.length/3,Zt=E.generateSideWallUV(n,s,B-6,B-3,B-2,B-1);ce(Zt[0]),ce(Zt[1]),ce(Zt[3]),ce(Zt[1]),ce(Zt[2]),ce(Zt[3])}function Re(ct){s.push(h[ct*3+0]),s.push(h[ct*3+1]),s.push(h[ct*3+2])}function ce(ct){r.push(ct.x),r.push(ct.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return WC(e,n,t)}static fromJSON(t,e){let n=[];for(let r=0,l=t.shapes.length;r<l;r++){let c=e[t.shapes[r]];n.push(c)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Sp[s.type]().fromJSON(s)),new i(n,t.options)}},kC={generateTopUV:function(i,t,e,n,s){let r=t[e*3],l=t[e*3+1],c=t[n*3],h=t[n*3+1],f=t[s*3],p=t[s*3+1];return[new ft(r,l),new ft(c,h),new ft(f,p)]},generateSideWallUV:function(i,t,e,n,s,r){let l=t[e*3],c=t[e*3+1],h=t[e*3+2],f=t[n*3],p=t[n*3+1],m=t[n*3+2],g=t[s*3],v=t[s*3+1],y=t[s*3+2],b=t[r*3],S=t[r*3+1],x=t[r*3+2];return Math.abs(c-p)<Math.abs(l-f)?[new ft(l,1-h),new ft(f,1-m),new ft(g,1-y),new ft(b,1-x)]:[new ft(c,1-h),new ft(p,1-m),new ft(v,1-y),new ft(S,1-x)]}};function WC(i,t,e){if(e.shapes=[],Array.isArray(i))for(let n=0,s=i.length;n<s;n++){let r=i[n];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var ju=class i extends pa{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[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,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},Ju=class i extends de{constructor(t=[new ft(0,-.5),new ft(.5,0),new ft(0,.5)],e=12,n=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:s},e=Math.floor(e),s=le(s,0,Math.PI*2);let r=[],l=[],c=[],h=[],f=[],p=1/e,m=new O,g=new ft,v=new O,y=new O,b=new O,S=0,x=0;for(let E=0;E<=t.length-1;E++)switch(E){case 0:S=t[E+1].x-t[E].x,x=t[E+1].y-t[E].y,v.x=x*1,v.y=-S,v.z=x*0,b.copy(v),v.normalize(),h.push(v.x,v.y,v.z);break;case t.length-1:h.push(b.x,b.y,b.z);break;default:S=t[E+1].x-t[E].x,x=t[E+1].y-t[E].y,v.x=x*1,v.y=-S,v.z=x*0,y.copy(v),v.x+=b.x,v.y+=b.y,v.z+=b.z,v.normalize(),h.push(v.x,v.y,v.z),b.copy(y)}for(let E=0;E<=e;E++){let T=n+E*p*s,A=Math.sin(T),N=Math.cos(T);for(let D=0;D<=t.length-1;D++){m.x=t[D].x*A,m.y=t[D].y,m.z=t[D].x*N,l.push(m.x,m.y,m.z),g.x=E/e,g.y=D/(t.length-1),c.push(g.x,g.y);let L=h[3*D+0]*A,F=h[3*D+1],C=h[3*D+0]*N;f.push(L,F,C)}}for(let E=0;E<e;E++)for(let T=0;T<t.length-1;T++){let A=T+E*t.length,N=A,D=A+t.length,L=A+t.length+1,F=A+1;r.push(N,D,F),r.push(L,F,D)}this.setIndex(r),this.setAttribute("position",new Gt(l,3)),this.setAttribute("uv",new Gt(c,2)),this.setAttribute("normal",new Gt(f,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.points,t.segments,t.phiStart,t.phiLength)}},ql=class i extends pa{constructor(t=1,e=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,s,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},ro=class i extends de{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};let r=t/2,l=e/2,c=Math.floor(n),h=Math.floor(s),f=c+1,p=h+1,m=t/c,g=e/h,v=[],y=[],b=[],S=[];for(let x=0;x<p;x++){let E=x*g-l;for(let T=0;T<f;T++){let A=T*m-r;y.push(A,-E,0),b.push(0,0,1),S.push(T/c),S.push(1-x/h)}}for(let x=0;x<h;x++)for(let E=0;E<c;E++){let T=E+f*x,A=E+f*(x+1),N=E+1+f*(x+1),D=E+1+f*x;v.push(T,A,D),v.push(A,N,D)}this.setIndex(v),this.setAttribute("position",new Gt(y,3)),this.setAttribute("normal",new Gt(b,3)),this.setAttribute("uv",new Gt(S,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}},Ku=class i extends de{constructor(t=.5,e=1,n=32,s=1,r=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:s,thetaStart:r,thetaLength:l},n=Math.max(3,n),s=Math.max(1,s);let c=[],h=[],f=[],p=[],m=t,g=(e-t)/s,v=new O,y=new ft;for(let b=0;b<=s;b++){for(let S=0;S<=n;S++){let x=r+S/n*l;v.x=m*Math.cos(x),v.y=m*Math.sin(x),h.push(v.x,v.y,v.z),f.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,p.push(y.x,y.y)}m+=g}for(let b=0;b<s;b++){let S=b*(n+1);for(let x=0;x<n;x++){let E=x+S,T=E,A=E+n+1,N=E+n+2,D=E+1;c.push(T,A,D),c.push(A,N,D)}}this.setIndex(c),this.setAttribute("position",new Gt(h,3)),this.setAttribute("normal",new Gt(f,3)),this.setAttribute("uv",new Gt(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Qu=class i extends de{constructor(t=new Ds([new ft(0,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let n=[],s=[],r=[],l=[],c=0,h=0;if(Array.isArray(t)===!1)f(t);else for(let p=0;p<t.length;p++)f(t[p]),this.addGroup(c,h,p),c+=h,h=0;this.setIndex(n),this.setAttribute("position",new Gt(s,3)),this.setAttribute("normal",new Gt(r,3)),this.setAttribute("uv",new Gt(l,2));function f(p){let m=s.length/3,g=p.extractPoints(e),v=g.shape,y=g.holes;Qi.isClockWise(v)===!1&&(v=v.reverse());for(let S=0,x=y.length;S<x;S++){let E=y[S];Qi.isClockWise(E)===!0&&(y[S]=E.reverse())}let b=Qi.triangulateShape(v,y);for(let S=0,x=y.length;S<x;S++){let E=y[S];v=v.concat(E)}for(let S=0,x=v.length;S<x;S++){let E=v[S];s.push(E.x,E.y,0),r.push(0,0,1),l.push(E.x,E.y)}for(let S=0,x=b.length;S<x;S++){let E=b[S],T=E[0]+m,A=E[1]+m,N=E[2]+m;n.push(T,A,N),h+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return XC(e,t)}static fromJSON(t,e){let n=[];for(let s=0,r=t.shapes.length;s<r;s++){let l=e[t.shapes[s]];n.push(l)}return new i(n,t.curveSegments)}};function XC(i,t){if(t.shapes=[],Array.isArray(i))for(let e=0,n=i.length;e<n;e++){let s=i[e];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t}var Yl=class i extends de{constructor(t=1,e=32,n=16,s=0,r=Math.PI*2,l=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:s,phiLength:r,thetaStart:l,thetaLength:c},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));let h=Math.min(l+c,Math.PI),f=0,p=[],m=new O,g=new O,v=[],y=[],b=[],S=[];for(let x=0;x<=n;x++){let E=[],T=x/n,A=0;x===0&&l===0?A=.5/e:x===n&&h===Math.PI&&(A=-.5/e);for(let N=0;N<=e;N++){let D=N/e;m.x=-t*Math.cos(s+D*r)*Math.sin(l+T*c),m.y=t*Math.cos(l+T*c),m.z=t*Math.sin(s+D*r)*Math.sin(l+T*c),y.push(m.x,m.y,m.z),g.copy(m).normalize(),b.push(g.x,g.y,g.z),S.push(D+A,1-T),E.push(f++)}p.push(E)}for(let x=0;x<n;x++)for(let E=0;E<e;E++){let T=p[x][E+1],A=p[x][E],N=p[x+1][E],D=p[x+1][E+1];(x!==0||l>0)&&v.push(T,A,D),(x!==n-1||h<Math.PI)&&v.push(A,N,D)}this.setIndex(v),this.setAttribute("position",new Gt(y,3)),this.setAttribute("normal",new Gt(b,3)),this.setAttribute("uv",new Gt(S,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},$u=class i extends pa{constructor(t=1,e=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,s,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},th=class i extends de{constructor(t=1,e=.4,n=12,s=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:s,arc:r},n=Math.floor(n),s=Math.floor(s);let l=[],c=[],h=[],f=[],p=new O,m=new O,g=new O;for(let v=0;v<=n;v++)for(let y=0;y<=s;y++){let b=y/s*r,S=v/n*Math.PI*2;m.x=(t+e*Math.cos(S))*Math.cos(b),m.y=(t+e*Math.cos(S))*Math.sin(b),m.z=e*Math.sin(S),c.push(m.x,m.y,m.z),p.x=t*Math.cos(b),p.y=t*Math.sin(b),g.subVectors(m,p).normalize(),h.push(g.x,g.y,g.z),f.push(y/s),f.push(v/n)}for(let v=1;v<=n;v++)for(let y=1;y<=s;y++){let b=(s+1)*v+y-1,S=(s+1)*(v-1)+y-1,x=(s+1)*(v-1)+y,E=(s+1)*v+y;l.push(b,S,E),l.push(S,x,E)}this.setIndex(l),this.setAttribute("position",new Gt(c,3)),this.setAttribute("normal",new Gt(h,3)),this.setAttribute("uv",new Gt(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},eh=class i extends de{constructor(t=1,e=.4,n=64,s=8,r=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:s,p:r,q:l},n=Math.floor(n),s=Math.floor(s);let c=[],h=[],f=[],p=[],m=new O,g=new O,v=new O,y=new O,b=new O,S=new O,x=new O;for(let T=0;T<=n;++T){let A=T/n*r*Math.PI*2;E(A,r,l,t,v),E(A+.01,r,l,t,y),S.subVectors(y,v),x.addVectors(y,v),b.crossVectors(S,x),x.crossVectors(b,S),b.normalize(),x.normalize();for(let N=0;N<=s;++N){let D=N/s*Math.PI*2,L=-e*Math.cos(D),F=e*Math.sin(D);m.x=v.x+(L*x.x+F*b.x),m.y=v.y+(L*x.y+F*b.y),m.z=v.z+(L*x.z+F*b.z),h.push(m.x,m.y,m.z),g.subVectors(m,v).normalize(),f.push(g.x,g.y,g.z),p.push(T/n),p.push(N/s)}}for(let T=1;T<=n;T++)for(let A=1;A<=s;A++){let N=(s+1)*(T-1)+(A-1),D=(s+1)*T+(A-1),L=(s+1)*T+A,F=(s+1)*(T-1)+A;c.push(N,D,F),c.push(D,L,F)}this.setIndex(c),this.setAttribute("position",new Gt(h,3)),this.setAttribute("normal",new Gt(f,3)),this.setAttribute("uv",new Gt(p,2));function E(T,A,N,D,L){let F=Math.cos(T),C=Math.sin(T),w=N/A*T,z=Math.cos(w);L.x=D*(2+z)*.5*F,L.y=D*(2+z)*C*.5,L.z=D*Math.sin(w)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},nh=class i extends de{constructor(t=new kl(new O(-1,-1,0),new O(-1,1,0),new O(1,1,0)),e=64,n=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:s,closed:r};let l=t.computeFrenetFrames(e,r);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;let c=new O,h=new O,f=new ft,p=new O,m=[],g=[],v=[],y=[];b(),this.setIndex(y),this.setAttribute("position",new Gt(m,3)),this.setAttribute("normal",new Gt(g,3)),this.setAttribute("uv",new Gt(v,2));function b(){for(let T=0;T<e;T++)S(T);S(r===!1?e:0),E(),x()}function S(T){p=t.getPointAt(T/e,p);let A=l.normals[T],N=l.binormals[T];for(let D=0;D<=s;D++){let L=D/s*Math.PI*2,F=Math.sin(L),C=-Math.cos(L);h.x=C*A.x+F*N.x,h.y=C*A.y+F*N.y,h.z=C*A.z+F*N.z,h.normalize(),g.push(h.x,h.y,h.z),c.x=p.x+n*h.x,c.y=p.y+n*h.y,c.z=p.z+n*h.z,m.push(c.x,c.y,c.z)}}function x(){for(let T=1;T<=e;T++)for(let A=1;A<=s;A++){let N=(s+1)*(T-1)+(A-1),D=(s+1)*T+(A-1),L=(s+1)*T+A,F=(s+1)*(T-1)+A;y.push(N,D,F),y.push(D,L,F)}}function E(){for(let T=0;T<=e;T++)for(let A=0;A<=s;A++)f.x=T/e,f.y=A/s,v.push(f.x,f.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new i(new Sp[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},ih=class extends de{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],n=new Set,s=new O,r=new O;if(t.index!==null){let l=t.attributes.position,c=t.index,h=t.groups;h.length===0&&(h=[{start:0,count:c.count,materialIndex:0}]);for(let f=0,p=h.length;f<p;++f){let m=h[f],g=m.start,v=m.count;for(let y=g,b=g+v;y<b;y+=3)for(let S=0;S<3;S++){let x=c.getX(y+S),E=c.getX(y+(S+1)%3);s.fromBufferAttribute(l,x),r.fromBufferAttribute(l,E),tM(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}}else{let l=t.attributes.position;for(let c=0,h=l.count/3;c<h;c++)for(let f=0;f<3;f++){let p=3*c+f,m=3*c+(f+1)%3;s.fromBufferAttribute(l,p),r.fromBufferAttribute(l,m),tM(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Gt(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};function tM(i,t,e){let n=`${i.x},${i.y},${i.z}-${t.x},${t.y},${t.z}`,s=`${t.x},${t.y},${t.z}-${i.x},${i.y},${i.z}`;return e.has(n)===!0||e.has(s)===!0?!1:(e.add(n),e.add(s),!0)}var eM=Object.freeze({__proto__:null,BoxGeometry:ja,CapsuleGeometry:Ou,CircleGeometry:Bu,ConeGeometry:zl,CylinderGeometry:Fl,DodecahedronGeometry:Fu,EdgesGeometry:zu,ExtrudeGeometry:Zu,IcosahedronGeometry:ju,LatheGeometry:Ju,OctahedronGeometry:ql,PlaneGeometry:ro,PolyhedronGeometry:pa,RingGeometry:Ku,ShapeGeometry:Qu,SphereGeometry:Yl,TetrahedronGeometry:$u,TorusGeometry:th,TorusKnotGeometry:eh,TubeGeometry:nh,WireframeGeometry:ih}),sh=class extends En{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Lt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},Zl=class extends ci{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},jl=class extends En{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Lt(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 Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(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 xi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},ah=class extends jl{constructor(t){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 ft(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return le(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Lt(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 Lt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Lt(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(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}},rh=class extends En{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Lt(16777215),this.specular=new Lt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xi,this.combine=ac,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},oh=class extends En{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Lt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},lh=class extends En{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}},ch=class extends En{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xi,this.combine=ac,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Jl=class extends En{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=q_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Kl=class extends En{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},uh=class extends En{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Lt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=va,this.normalScale=new ft(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(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}},hh=class extends Pn{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}};function Xr(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function xb(i){function t(s,r){return i[s]-i[r]}let e=i.length,n=new Array(e);for(let s=0;s!==e;++s)n[s]=s;return n.sort(t),n}function f_(i,t,e){let n=i.length,s=new i.constructor(n);for(let r=0,l=0;l!==n;++r){let c=e[r]*t;for(let h=0;h!==t;++h)s[l++]=i[c+h]}return s}function rv(i,t,e,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];if(r===void 0)return;let l=r[n];if(l!==void 0)if(Array.isArray(l))do l=r[n],l!==void 0&&(t.push(r.time),e.push(...l)),r=i[s++];while(r!==void 0);else if(l.toArray!==void 0)do l=r[n],l!==void 0&&(t.push(r.time),l.toArray(e,e.length)),r=i[s++];while(r!==void 0);else do l=r[n],l!==void 0&&(t.push(r.time),e.push(l)),r=i[s++];while(r!==void 0)}function qC(i,t,e,n,s=30){let r=i.clone();r.name=t;let l=[];for(let h=0;h<r.tracks.length;++h){let f=r.tracks[h],p=f.getValueSize(),m=[],g=[];for(let v=0;v<f.times.length;++v){let y=f.times[v]*s;if(!(y<e||y>=n)){m.push(f.times[v]);for(let b=0;b<p;++b)g.push(f.values[v*p+b])}}m.length!==0&&(f.times=Xr(m,f.times.constructor),f.values=Xr(g,f.values.constructor),l.push(f))}r.tracks=l;let c=1/0;for(let h=0;h<r.tracks.length;++h)c>r.tracks[h].times[0]&&(c=r.tracks[h].times[0]);for(let h=0;h<r.tracks.length;++h)r.tracks[h].shift(-1*c);return r.resetDuration(),r}function YC(i,t=0,e=i,n=30){n<=0&&(n=30);let s=e.tracks.length,r=t/n;for(let l=0;l<s;++l){let c=e.tracks[l],h=c.ValueTypeName;if(h==="bool"||h==="string")continue;let f=i.tracks.find(function(x){return x.name===c.name&&x.ValueTypeName===h});if(f===void 0)continue;let p=0,m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);let g=0,v=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);let y=c.times.length-1,b;if(r<=c.times[0]){let x=p,E=m-p;b=c.values.slice(x,E)}else if(r>=c.times[y]){let x=y*m+p,E=x+m-p;b=c.values.slice(x,E)}else{let x=c.createInterpolant(),E=p,T=m-p;x.evaluate(r),b=x.resultBuffer.slice(E,T)}h==="quaternion"&&new Vn().fromArray(b).normalize().conjugate().toArray(b);let S=f.times.length;for(let x=0;x<S;++x){let E=x*v+g;if(h==="quaternion")Vn.multiplyQuaternionsFlat(f.values,E,b,0,f.values,E);else{let T=v-g*2;for(let A=0;A<T;++A)f.values[E+A]-=b[A]}}}return i.blendMode=Rm,i}var Mp=class{static convertArray(t,e){return Xr(t,e)}static isTypedArray(t){return lb(t)}static getKeyframeOrder(t){return xb(t)}static sortedArray(t,e,n){return f_(t,e,n)}static flattenJSON(t,e,n,s){rv(t,e,n,s)}static subclip(t,e,n,s,r=30){return qC(t,e,n,s,r)}static makeClipAdditive(t,e=0,n=t,s=30){return YC(t,e,n,s)}},Qa=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];t:{e:{let l;n:{i:if(!(t<s)){for(let c=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=s,s=e[++n],t<s)break e}l=e.length;break n}if(!(t>=r)){let c=e[1];t<c&&(n=2,r=c);for(let h=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(s=r,r=e[--n-1],t>=r)break e}l=n,n=0;break n}break t}for(;n<l;){let c=n+l>>>1;t<e[c]?l=c:n=c+1}if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let l=0;l!==s;++l)e[l]=n[r+l];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},fh=class extends Qa{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Wa,endingEnd:Wa}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,l=t+1,c=s[r],h=s[l];if(c===void 0)switch(this.getSettings_().endingStart){case Xa:r=t,c=2*e-n;break;case Tl:r=s.length-2,c=e+s[r]-s[r+1];break;default:r=t,c=n}if(h===void 0)switch(this.getSettings_().endingEnd){case Xa:l=t,h=2*n-e;break;case Tl:l=1,h=n+s[1]-s[0];break;default:l=t-1,h=e}let f=(n-e)*.5,p=this.valueSize;this._weightPrev=f/(e-c),this._weightNext=f/(h-n),this._offsetPrev=r*p,this._offsetNext=l*p}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=t*c,f=h-c,p=this._offsetPrev,m=this._offsetNext,g=this._weightPrev,v=this._weightNext,y=(n-e)/(s-e),b=y*y,S=b*y,x=-g*S+2*g*b-g*y,E=(1+g)*S+(-1.5-2*g)*b+(-.5+g)*y+1,T=(-1-v)*S+(1.5+v)*b+.5*y,A=v*S-v*b;for(let N=0;N!==c;++N)r[N]=x*l[p+N]+E*l[f+N]+T*l[h+N]+A*l[m+N];return r}},Ql=class extends Qa{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=t*c,f=h-c,p=(n-e)/(s-e),m=1-p;for(let g=0;g!==c;++g)r[g]=l[f+g]*m+l[h+g]*p;return r}},dh=class extends Qa{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},ui=class{constructor(t,e,n,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xr(e,this.TimeBufferType),this.values=Xr(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Xr(t.times,Array),values:Xr(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new dh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ql(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new fh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case El:e=this.InterpolantFactoryMethodDiscrete;break;case yu:e=this.InterpolantFactoryMethodLinear;break;case pu:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return wt("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return El;case this.InterpolantFactoryMethodLinear:return yu;case this.InterpolantFactoryMethodSmooth:return pu}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t}return this}trim(t,e){let n=this.times,s=n.length,r=0,l=s-1;for(;r!==s&&n[r]<t;)++r;for(;l!==-1&&n[l]>e;)--l;if(++l,r!==0||l!==s){r>=l&&(l=Math.max(l,1),r=l-1);let c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(Qt("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Qt("KeyframeTrack: Track is empty.",this),t=!1);let l=null;for(let c=0;c!==r;c++){let h=n[c];if(typeof h=="number"&&isNaN(h)){Qt("KeyframeTrack: Time is not a valid number.",this,c,h),t=!1;break}if(l!==null&&l>h){Qt("KeyframeTrack: Out of order keys.",this,c,h,l),t=!1;break}l=h}if(s!==void 0&&lb(s))for(let c=0,h=s.length;c!==h;++c){let f=s[c];if(isNaN(f)){Qt("KeyframeTrack: Value is not a valid number.",this,c,f),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===pu,r=t.length-1,l=1;for(let c=1;c<r;++c){let h=!1,f=t[c],p=t[c+1];if(f!==p&&(c!==1||f!==t[0]))if(s)h=!0;else{let m=c*n,g=m-n,v=m+n;for(let y=0;y!==n;++y){let b=e[m+y];if(b!==e[g+y]||b!==e[v+y]){h=!0;break}}}if(h){if(c!==l){t[l]=t[c];let m=c*n,g=l*n;for(let v=0;v!==n;++v)e[g+v]=e[m+v]}++l}}if(r>0){t[l]=t[r];for(let c=r*n,h=l*n,f=0;f!==n;++f)e[h+f]=e[c+f];++l}return l!==t.length?(this.times=t.slice(0,l),this.values=e.slice(0,l*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};ui.prototype.ValueTypeName="";ui.prototype.TimeBufferType=Float32Array;ui.prototype.ValueBufferType=Float32Array;ui.prototype.DefaultInterpolation=yu;var Ls=class extends ui{constructor(t,e,n){super(t,e,n)}};Ls.prototype.ValueTypeName="bool";Ls.prototype.ValueBufferType=Array;Ls.prototype.DefaultInterpolation=El;Ls.prototype.InterpolantFactoryMethodLinear=void 0;Ls.prototype.InterpolantFactoryMethodSmooth=void 0;var $l=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};$l.prototype.ValueTypeName="color";var $a=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};$a.prototype.ValueTypeName="number";var ph=class extends Qa{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-e)/(s-e),f=t*c;for(let p=f+c;f!==p;f+=4)Vn.slerpFlat(r,0,l,f-c,l,f,h);return r}},tr=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new ph(this.times,this.values,this.getValueSize(),t)}};tr.prototype.ValueTypeName="quaternion";tr.prototype.InterpolantFactoryMethodSmooth=void 0;var Os=class extends ui{constructor(t,e,n){super(t,e,n)}};Os.prototype.ValueTypeName="string";Os.prototype.ValueBufferType=Array;Os.prototype.DefaultInterpolation=El;Os.prototype.InterpolantFactoryMethodLinear=void 0;Os.prototype.InterpolantFactoryMethodSmooth=void 0;var er=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};er.prototype.ValueTypeName="vector";var nr=class{constructor(t="",e=-1,n=[],s=bf){this.name=t,this.tracks=n,this.duration=e,this.blendMode=s,this.uuid=Li(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],n=t.tracks,s=1/(t.fps||1);for(let l=0,c=n.length;l!==c;++l)e.push(jC(n[l]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],n=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let r=0,l=n.length;r!==l;++r)e.push(ui.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(t,e,n,s){let r=e.length,l=[];for(let c=0;c<r;c++){let h=[],f=[];h.push((c+r-1)%r,c,(c+1)%r),f.push(0,1,0);let p=xb(h);h=f_(h,1,p),f=f_(f,1,p),!s&&h[0]===0&&(h.push(r),f.push(f[0])),l.push(new $a(".morphTargetInfluences["+e[c].name+"]",h,f).scale(1/n))}return new this(t,-1,l)}static findByName(t,e){let n=t;if(!Array.isArray(t)){let s=t;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===e)return n[s];return null}static CreateClipsFromMorphTargetSequences(t,e,n){let s={},r=/^([\w-]*?)([\d]+)$/;for(let c=0,h=t.length;c<h;c++){let f=t[c],p=f.name.match(r);if(p&&p.length>1){let m=p[1],g=s[m];g||(s[m]=g=[]),g.push(f)}}let l=[];for(let c in s)l.push(this.CreateFromMorphTargetSequence(c,s[c],e,n));return l}static parseAnimation(t,e){if(wt("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return Qt("AnimationClip: No animation in JSONLoader data."),null;let n=function(m,g,v,y,b){if(v.length!==0){let S=[],x=[];rv(v,S,x,y),S.length!==0&&b.push(new m(g,S,x))}},s=[],r=t.name||"default",l=t.fps||30,c=t.blendMode,h=t.length||-1,f=t.hierarchy||[];for(let m=0;m<f.length;m++){let g=f[m].keys;if(!(!g||g.length===0))if(g[0].morphTargets){let v={},y;for(y=0;y<g.length;y++)if(g[y].morphTargets)for(let b=0;b<g[y].morphTargets.length;b++)v[g[y].morphTargets[b]]=-1;for(let b in v){let S=[],x=[];for(let E=0;E!==g[y].morphTargets.length;++E){let T=g[y];S.push(T.time),x.push(T.morphTarget===b?1:0)}s.push(new $a(".morphTargetInfluence["+b+"]",S,x))}h=v.length*l}else{let v=".bones["+e[m].name+"]";n(er,v+".position",g,"pos",s),n(tr,v+".quaternion",g,"rot",s),n(er,v+".scale",g,"scl",s)}}return s.length===0?null:new this(r,h,s,c)}resetDuration(){let t=this.tracks,e=0;for(let n=0,s=t.length;n!==s;++n){let r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let n=0;n<this.tracks.length;n++)t.push(this.tracks[n].clone());let e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}};function ZC(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $a;case"vector":case"vector2":case"vector3":case"vector4":return er;case"color":return $l;case"quaternion":return tr;case"bool":case"boolean":return Ls;case"string":return Os}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function jC(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=ZC(i.type);if(i.times===void 0){let e=[],n=[];rv(i.keys,e,n,"value"),i.times=e,i.values=n}return t.parse!==void 0?t.parse(i):new t(i.name,i.times,i.values,i.interpolation)}var fs={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(this.files[i]=t)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},tc=class{constructor(t,e,n){let s=this,r=!1,l=0,c=0,h,f=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(p){c++,r===!1&&s.onStart!==void 0&&s.onStart(p,l,c),r=!0},this.itemEnd=function(p){l++,s.onProgress!==void 0&&s.onProgress(p,l,c),l===c&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(p){s.onError!==void 0&&s.onError(p)},this.resolveURL=function(p){return h?h(p):p},this.setURLModifier=function(p){return h=p,this},this.addHandler=function(p,m){return f.push(p,m),this},this.removeHandler=function(p){let m=f.indexOf(p);return m!==-1&&f.splice(m,2),this},this.getHandler=function(p){for(let m=0,g=f.length;m<g;m+=2){let v=f[m],y=f[m+1];if(v.global&&(v.lastIndex=0),v.test(p))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},ov=new tc,Hn=class{constructor(t){this.manager=t!==void 0?t:ov,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let n=this;return new Promise(function(s,r){n.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};Hn.DEFAULT_MATERIAL_NAME="__DEFAULT";var aa={},d_=class extends Error{constructor(t,e){super(t),this.response=e}},$i=class extends Hn{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=fs.get(`file:${t}`);if(r!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(aa[t]!==void 0){aa[t].push({onLoad:e,onProgress:n,onError:s});return}aa[t]=[],aa[t].push({onLoad:e,onProgress:n,onError:s});let l=new Request(t,{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}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&wt("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;let p=aa[t],m=f.body.getReader(),g=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=g?parseInt(g):0,y=v!==0,b=0,S=new ReadableStream({start(x){E();function E(){m.read().then(({done:T,value:A})=>{if(T)x.close();else{b+=A.byteLength;let N=new ProgressEvent("progress",{lengthComputable:y,loaded:b,total:v});for(let D=0,L=p.length;D<L;D++){let F=p[D];F.onProgress&&F.onProgress(N)}x.enqueue(A),E()}},T=>{x.error(T)})}}});return new Response(S)}else throw new d_(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{let m=/charset="?([^;"\s]*)"?/i.exec(c),g=m&&m[1]?m[1].toLowerCase():void 0,v=new TextDecoder(g);return f.arrayBuffer().then(y=>v.decode(y))}}}).then(f=>{fs.add(`file:${t}`,f);let p=aa[t];delete aa[t];for(let m=0,g=p.length;m<g;m++){let v=p[m];v.onLoad&&v.onLoad(f)}}).catch(f=>{let p=aa[t];if(p===void 0)throw this.manager.itemError(t),f;delete aa[t];for(let m=0,g=p.length;m<g;m++){let v=p[m];v.onError&&v.onError(f)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},bp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e=[];for(let n=0;n<t.length;n++){let s=nr.parse(t[n]);e.push(s)}return e}},Ep=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=[],c=new no,h=new $i(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(r.withCredentials);let f=0;function p(m){h.load(t[m],function(g){let v=r.parse(g,!0);l[m]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},f+=1,f===6&&(v.mipmapCount===1&&(c.minFilter=Je),c.image=l,c.format=v.format,c.needsUpdate=!0,e&&e(c))},n,s)}if(Array.isArray(t))for(let m=0,g=t.length;m<g;++m)p(m);else h.load(t,function(m){let g=r.parse(m,!0);if(g.isCubemap){let v=g.mipmaps.length/g.mipmapCount;for(let y=0;y<v;y++){l[y]={mipmaps:[]};for(let b=0;b<g.mipmapCount;b++)l[y].mipmaps.push(g.mipmaps[y*g.mipmapCount+b]),l[y].format=g.format,l[y].width=g.width,l[y].height=g.height}c.image=l}else c.image.width=g.width,c.image.height=g.height,c.mipmaps=g.mipmaps;g.mipmapCount===1&&(c.minFilter=Je),c.format=g.format,c.needsUpdate=!0,e&&e(c)},n,s);return c}},_l=new WeakMap,ir=class extends Hn{constructor(t){super(t)}load(t,e,n,s){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,l=fs.get(`image:${t}`);if(l!==void 0){if(l.complete===!0)r.manager.itemStart(t),setTimeout(function(){e&&e(l),r.manager.itemEnd(t)},0);else{let m=_l.get(l);m===void 0&&(m=[],_l.set(l,m)),m.push({onLoad:e,onError:s})}return l}let c=Rl("img");function h(){p(),e&&e(this);let m=_l.get(this)||[];for(let g=0;g<m.length;g++){let v=m[g];v.onLoad&&v.onLoad(this)}_l.delete(this),r.manager.itemEnd(t)}function f(m){p(),s&&s(m),fs.remove(`image:${t}`);let g=_l.get(this)||[];for(let v=0;v<g.length;v++){let y=g[v];y.onError&&y.onError(m)}_l.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function p(){c.removeEventListener("load",h,!1),c.removeEventListener("error",f,!1)}return c.addEventListener("load",h,!1),c.addEventListener("error",f,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),fs.add(`image:${t}`,c),r.manager.itemStart(t),c.src=t,c}},Tp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=new Ja;r.colorSpace=Dn;let l=new ir(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let c=0;function h(f){l.load(t[f],function(p){r.images[f]=p,c++,c===6&&(r.needsUpdate=!0,e&&e(r))},void 0,s)}for(let f=0;f<t.length;++f)h(f);return r}},Ap=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new vi,c=new $i(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(r.withCredentials),c.load(t,function(h){let f;try{f=r.parse(h)}catch(p){if(s!==void 0)s(p);else{p(p);return}}f.image!==void 0?l.image=f.image:f.data!==void 0&&(l.image.width=f.width,l.image.height=f.height,l.image.data=f.data),l.wrapS=f.wrapS!==void 0?f.wrapS:li,l.wrapT=f.wrapT!==void 0?f.wrapT:li,l.magFilter=f.magFilter!==void 0?f.magFilter:Je,l.minFilter=f.minFilter!==void 0?f.minFilter:Je,l.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.colorSpace!==void 0&&(l.colorSpace=f.colorSpace),f.flipY!==void 0&&(l.flipY=f.flipY),f.format!==void 0&&(l.format=f.format),f.type!==void 0&&(l.type=f.type),f.mipmaps!==void 0&&(l.mipmaps=f.mipmaps,l.minFilter=ys),f.mipmapCount===1&&(l.minFilter=Je),f.generateMipmaps!==void 0&&(l.generateMipmaps=f.generateMipmaps),l.needsUpdate=!0,e&&e(l,f)},n,s),l}},Cp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=new mn,l=new ir(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(t,function(c){r.image=c,r.needsUpdate=!0,e!==void 0&&e(r)},n,s),r}},gs=class extends Oe{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Lt(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}},mh=class extends gs{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Lt(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}toJSON(t){let e=super.toJSON(t);return e.object.groundColor=this.groundColor.getHex(),e}},e_=new ue,nM=new O,iM=new O,gh=class{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ft(512,512),this.mapType=Gn,this.map=null,this.mapPass=null,this.matrix=new ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fa,this._frameExtents=new ft(1,1),this._viewportCount=1,this._viewports=[new qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,n=this.matrix;nM.setFromMatrixPosition(t.matrixWorld),e.position.copy(nM),iM.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(iM),e.updateMatrixWorld(),e_.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e_,e.coordinateSystem,e.reversedDepth),e.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e_)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}},p_=class extends gh{constructor(){super(new fn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){let e=this.camera,n=jr*2*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;(n!==e.fov||s!==e.aspect||r!==e.far)&&(e.fov=n,e.aspect=s,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}},_h=class extends gs{constructor(t,e,n=0,s=Math.PI/3,r=0,l=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.target=new Oe,this.distance=n,this.angle=s,this.penumbra=r,this.decay=l,this.map=null,this.shadow=new p_}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}},m_=class extends gh{constructor(){super(new fn(90,1,.5,500)),this.isPointLightShadow=!0}},vh=class extends gs{constructor(t,e,n=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new m_}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}},Bs=class extends Qr{constructor(t=-1,e=1,n=1,s=-1,r=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,this.far=l,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,s,r,l){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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,l=n+t,c=s+e,h=s-e;if(this.view!==null&&this.view.enabled){let f=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=f*this.view.offsetX,l=r+f*this.view.width,c-=p*this.view.offsetY,h=c-p*this.view.height}this.projectionMatrix.makeOrthographic(r,l,c,h,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},g_=class extends gh{constructor(){super(new Bs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},xh=class extends gs{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.target=new Oe,this.shadow=new g_}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}},yh=class extends gs{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}},Sh=class extends gs{constructor(t,e,n=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){let e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}},ec=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new O)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){let n=t.x,s=t.y,r=t.z,l=this.coefficients;return e.copy(l[0]).multiplyScalar(.282095),e.addScaledVector(l[1],.488603*s),e.addScaledVector(l[2],.488603*r),e.addScaledVector(l[3],.488603*n),e.addScaledVector(l[4],1.092548*(n*s)),e.addScaledVector(l[5],1.092548*(s*r)),e.addScaledVector(l[6],.315392*(3*r*r-1)),e.addScaledVector(l[7],1.092548*(n*r)),e.addScaledVector(l[8],.546274*(n*n-s*s)),e}getIrradianceAt(t,e){let n=t.x,s=t.y,r=t.z,l=this.coefficients;return e.copy(l[0]).multiplyScalar(.886227),e.addScaledVector(l[1],2*.511664*s),e.addScaledVector(l[2],2*.511664*r),e.addScaledVector(l[3],2*.511664*n),e.addScaledVector(l[4],2*.429043*n*s),e.addScaledVector(l[5],2*.429043*s*r),e.addScaledVector(l[6],.743125*r*r-.247708),e.addScaledVector(l[7],2*.429043*n*r),e.addScaledVector(l[8],.429043*(n*n-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].fromArray(t,e+s*3);return this}toArray(t=[],e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].toArray(t,e+s*3);return t}static getBasisAt(t,e){let n=t.x,s=t.y,r=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*s,e[5]=1.092548*s*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-s*s)}},Mh=class extends gs{constructor(t=new ec,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}toJSON(t){let e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}},bh=class i extends Hn{constructor(t){super(t),this.textures={}}load(t,e,n,s){let r=this,l=new $i(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e=this.textures;function n(r){return e[r]===void 0&&wt("MaterialLoader: Undefined texture",r),e[r]}let s=this.createMaterialFromType(t.type);if(t.uuid!==void 0&&(s.uuid=t.uuid),t.name!==void 0&&(s.name=t.name),t.color!==void 0&&s.color!==void 0&&s.color.setHex(t.color),t.roughness!==void 0&&(s.roughness=t.roughness),t.metalness!==void 0&&(s.metalness=t.metalness),t.sheen!==void 0&&(s.sheen=t.sheen),t.sheenColor!==void 0&&(s.sheenColor=new Lt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(s.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&s.emissive!==void 0&&s.emissive.setHex(t.emissive),t.specular!==void 0&&s.specular!==void 0&&s.specular.setHex(t.specular),t.specularIntensity!==void 0&&(s.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&s.specularColor!==void 0&&s.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(s.shininess=t.shininess),t.clearcoat!==void 0&&(s.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(s.dispersion=t.dispersion),t.iridescence!==void 0&&(s.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(s.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(s.transmission=t.transmission),t.thickness!==void 0&&(s.thickness=t.thickness),t.attenuationDistance!==void 0&&(s.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&s.attenuationColor!==void 0&&s.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(s.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(s.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(s.fog=t.fog),t.flatShading!==void 0&&(s.flatShading=t.flatShading),t.blending!==void 0&&(s.blending=t.blending),t.combine!==void 0&&(s.combine=t.combine),t.side!==void 0&&(s.side=t.side),t.shadowSide!==void 0&&(s.shadowSide=t.shadowSide),t.opacity!==void 0&&(s.opacity=t.opacity),t.transparent!==void 0&&(s.transparent=t.transparent),t.alphaTest!==void 0&&(s.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(s.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(s.depthFunc=t.depthFunc),t.depthTest!==void 0&&(s.depthTest=t.depthTest),t.depthWrite!==void 0&&(s.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(s.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(s.blendSrc=t.blendSrc),t.blendDst!==void 0&&(s.blendDst=t.blendDst),t.blendEquation!==void 0&&(s.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(s.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(s.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(s.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&s.blendColor!==void 0&&s.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(s.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(s.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(s.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(s.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(s.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(s.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(s.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(s.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(s.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(s.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(s.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(s.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(s.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(s.rotation=t.rotation),t.linewidth!==void 0&&(s.linewidth=t.linewidth),t.dashSize!==void 0&&(s.dashSize=t.dashSize),t.gapSize!==void 0&&(s.gapSize=t.gapSize),t.scale!==void 0&&(s.scale=t.scale),t.polygonOffset!==void 0&&(s.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(s.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(s.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(s.dithering=t.dithering),t.alphaToCoverage!==void 0&&(s.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(s.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(s.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(s.allowOverride=t.allowOverride),t.visible!==void 0&&(s.visible=t.visible),t.toneMapped!==void 0&&(s.toneMapped=t.toneMapped),t.userData!==void 0&&(s.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?s.vertexColors=t.vertexColors>0:s.vertexColors=t.vertexColors),t.uniforms!==void 0)for(let r in t.uniforms){let l=t.uniforms[r];switch(s.uniforms[r]={},l.type){case"t":s.uniforms[r].value=n(l.value);break;case"c":s.uniforms[r].value=new Lt().setHex(l.value);break;case"v2":s.uniforms[r].value=new ft().fromArray(l.value);break;case"v3":s.uniforms[r].value=new O().fromArray(l.value);break;case"v4":s.uniforms[r].value=new qe().fromArray(l.value);break;case"m3":s.uniforms[r].value=new pe().fromArray(l.value);break;case"m4":s.uniforms[r].value=new ue().fromArray(l.value);break;default:s.uniforms[r].value=l.value}}if(t.defines!==void 0&&(s.defines=t.defines),t.vertexShader!==void 0&&(s.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(s.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(s.glslVersion=t.glslVersion),t.extensions!==void 0)for(let r in t.extensions)s.extensions[r]=t.extensions[r];if(t.lights!==void 0&&(s.lights=t.lights),t.clipping!==void 0&&(s.clipping=t.clipping),t.size!==void 0&&(s.size=t.size),t.sizeAttenuation!==void 0&&(s.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(s.map=n(t.map)),t.matcap!==void 0&&(s.matcap=n(t.matcap)),t.alphaMap!==void 0&&(s.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(s.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(s.bumpScale=t.bumpScale),t.normalMap!==void 0&&(s.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(s.normalMapType=t.normalMapType),t.normalScale!==void 0){let r=t.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new ft().fromArray(r)}return t.displacementMap!==void 0&&(s.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(s.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(s.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(s.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(s.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(s.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(s.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(s.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(s.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(s.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(s.envMap=n(t.envMap)),t.envMapRotation!==void 0&&s.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(s.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(s.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(s.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(s.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(s.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(s.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(s.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(s.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(s.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new ft().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(s.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(s.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(s.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(s.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(s.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=n(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return i.createMaterialFromType(t)}static createMaterialFromType(t){let e={ShadowMaterial:sh,SpriteMaterial:Il,RawShaderMaterial:Zl,ShaderMaterial:ci,PointsMaterial:Ol,MeshPhysicalMaterial:ah,MeshStandardMaterial:jl,MeshPhongMaterial:rh,MeshToonMaterial:oh,MeshNormalMaterial:lh,MeshLambertMaterial:ch,MeshDepthMaterial:Jl,MeshDistanceMaterial:Kl,MeshBasicMaterial:ps,MeshMatcapMaterial:uh,LineDashedMaterial:hh,LineBasicMaterial:Pn,Material:En};return new e[t]}},nc=class{static extractUrlBase(t){let e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}},Eh=class extends de{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}},Th=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e={},n={};function s(v,y){if(e[y]!==void 0)return e[y];let S=v.interleavedBuffers[y],x=r(v,S.buffer),E=yl(S.type,x),T=new eo(E,S.stride);return T.uuid=S.uuid,e[y]=T,T}function r(v,y){if(n[y]!==void 0)return n[y];let S=v.arrayBuffers[y],x=new Uint32Array(S).buffer;return n[y]=x,x}let l=t.isInstancedBufferGeometry?new Eh:new de,c=t.data.index;if(c!==void 0){let v=yl(c.type,c.array);l.setIndex(new He(v,1))}let h=t.data.attributes;for(let v in h){let y=h[v],b;if(y.isInterleavedBufferAttribute){let S=s(t.data,y.data);b=new Ka(S,y.itemSize,y.offset,y.normalized)}else{let S=yl(y.type,y.array),x=y.isInstancedBufferAttribute?ha:He;b=new x(S,y.itemSize,y.normalized)}y.name!==void 0&&(b.name=y.name),y.usage!==void 0&&b.setUsage(y.usage),l.setAttribute(v,b)}let f=t.data.morphAttributes;if(f)for(let v in f){let y=f[v],b=[];for(let S=0,x=y.length;S<x;S++){let E=y[S],T;if(E.isInterleavedBufferAttribute){let A=s(t.data,E.data);T=new Ka(A,E.itemSize,E.offset,E.normalized)}else{let A=yl(E.type,E.array);T=new He(A,E.itemSize,E.normalized)}E.name!==void 0&&(T.name=E.name),b.push(T)}l.morphAttributes[v]=b}t.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);let m=t.data.groups||t.data.drawcalls||t.data.offsets;if(m!==void 0)for(let v=0,y=m.length;v!==y;++v){let b=m[v];l.addGroup(b.start,b.count,b.materialIndex)}let g=t.data.boundingSphere;return g!==void 0&&(l.boundingSphere=new yn().fromJSON(g)),t.name&&(l.name=t.name),t.userData&&(l.userData=t.userData),l}},Rp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=this.path===""?nc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||l;let c=new $i(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(t,function(h){let f=null;try{f=JSON.parse(h)}catch(m){s!==void 0&&s(m),m("ObjectLoader: Can't parse "+t+".",m.message);return}let p=f.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){s!==void 0&&s(new Error("THREE.ObjectLoader: Can't load "+t)),Qt("ObjectLoader: Can't load "+t);return}r.parse(f,e)},n,s)}async loadAsync(t,e){let n=this,s=this.path===""?nc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;let r=new $i(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let l=await r.loadAsync(t,e),c=JSON.parse(l),h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(c)}parse(t,e){let n=this.parseAnimations(t.animations),s=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,s),l=this.parseImages(t.images,function(){e!==void 0&&e(f)}),c=this.parseTextures(t.textures,l),h=this.parseMaterials(t.materials,c),f=this.parseObject(t.object,r,h,c,n),p=this.parseSkeletons(t.skeletons,f);if(this.bindSkeletons(f,p),this.bindLightTargets(f),e!==void 0){let m=!1;for(let g in l)if(l[g].data instanceof HTMLImageElement){m=!0;break}m===!1&&e(f)}return f}async parseAsync(t){let e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),l=this.parseTextures(t.textures,r),c=this.parseMaterials(t.materials,l),h=this.parseObject(t.object,s,c,l,e),f=this.parseSkeletons(t.skeletons,h);return this.bindSkeletons(h,f),this.bindLightTargets(h),h}parseShapes(t){let e={};if(t!==void 0)for(let n=0,s=t.length;n<s;n++){let r=new Ds().fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){let n={},s={};if(e.traverse(function(r){r.isBone&&(s[r.uuid]=r)}),t!==void 0)for(let r=0,l=t.length;r<l;r++){let c=new Ru().fromJSON(t[r],s);n[c.uuid]=c}return n}parseGeometries(t,e){let n={};if(t!==void 0){let s=new Th;for(let r=0,l=t.length;r<l;r++){let c,h=t[r];switch(h.type){case"BufferGeometry":case"InstancedBufferGeometry":c=s.parse(h);break;default:h.type in eM?c=eM[h.type].fromJSON(h,e):wt(`ObjectLoader: Unsupported geometry type "${h.type}"`)}c.uuid=h.uuid,h.name!==void 0&&(c.name=h.name),h.userData!==void 0&&(c.userData=h.userData),n[h.uuid]=c}}return n}parseMaterials(t,e){let n={},s={};if(t!==void 0){let r=new bh;r.setTextures(e);for(let l=0,c=t.length;l<c;l++){let h=t[l];n[h.uuid]===void 0&&(n[h.uuid]=r.parse(h)),s[h.uuid]=n[h.uuid]}}return s}parseAnimations(t){let e={};if(t!==void 0)for(let n=0;n<t.length;n++){let s=t[n],r=nr.parse(s);e[r.uuid]=r}return e}parseImages(t,e){let n=this,s={},r;function l(h){return n.manager.itemStart(h),r.load(h,function(){n.manager.itemEnd(h)},void 0,function(){n.manager.itemError(h),n.manager.itemEnd(h)})}function c(h){if(typeof h=="string"){let f=h,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:n.resourcePath+f;return l(p)}else return h.data?{data:yl(h.type,h.data),width:h.width,height:h.height}:null}if(t!==void 0&&t.length>0){let h=new tc(e);r=new ir(h),r.setCrossOrigin(this.crossOrigin);for(let f=0,p=t.length;f<p;f++){let m=t[f],g=m.url;if(Array.isArray(g)){let v=[];for(let y=0,b=g.length;y<b;y++){let S=g[y],x=c(S);x!==null&&(x instanceof HTMLImageElement?v.push(x):v.push(new vi(x.data,x.width,x.height)))}s[m.uuid]=new hs(v)}else{let v=c(m.url);s[m.uuid]=new hs(v)}}}return s}async parseImagesAsync(t){let e=this,n={},s;async function r(l){if(typeof l=="string"){let c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:e.resourcePath+c;return await s.loadAsync(h)}else return l.data?{data:yl(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){s=new ir(this.manager),s.setCrossOrigin(this.crossOrigin);for(let l=0,c=t.length;l<c;l++){let h=t[l],f=h.url;if(Array.isArray(f)){let p=[];for(let m=0,g=f.length;m<g;m++){let v=f[m],y=await r(v);y!==null&&(y instanceof HTMLImageElement?p.push(y):p.push(new vi(y.data,y.width,y.height)))}n[h.uuid]=new hs(p)}else{let p=await r(h.url);n[h.uuid]=new hs(p)}}}return n}parseTextures(t,e){function n(r,l){return typeof r=="number"?r:(wt("ObjectLoader.parseTexture: Constant should be in numeric form.",r),l[r])}let s={};if(t!==void 0)for(let r=0,l=t.length;r<l;r++){let c=t[r];c.image===void 0&&wt('ObjectLoader: No "image" specified for',c.uuid),e[c.image]===void 0&&wt("ObjectLoader: Undefined image",c.image);let h=e[c.image],f=h.data,p;Array.isArray(f)?(p=new Ja,f.length===6&&(p.needsUpdate=!0)):(f&&f.data?p=new vi:p=new mn,f&&(p.needsUpdate=!0)),p.source=h,p.uuid=c.uuid,c.name!==void 0&&(p.name=c.name),c.mapping!==void 0&&(p.mapping=n(c.mapping,JC)),c.channel!==void 0&&(p.channel=c.channel),c.offset!==void 0&&p.offset.fromArray(c.offset),c.repeat!==void 0&&p.repeat.fromArray(c.repeat),c.center!==void 0&&p.center.fromArray(c.center),c.rotation!==void 0&&(p.rotation=c.rotation),c.wrap!==void 0&&(p.wrapS=n(c.wrap[0],sM),p.wrapT=n(c.wrap[1],sM)),c.format!==void 0&&(p.format=c.format),c.internalFormat!==void 0&&(p.internalFormat=c.internalFormat),c.type!==void 0&&(p.type=c.type),c.colorSpace!==void 0&&(p.colorSpace=c.colorSpace),c.minFilter!==void 0&&(p.minFilter=n(c.minFilter,aM)),c.magFilter!==void 0&&(p.magFilter=n(c.magFilter,aM)),c.anisotropy!==void 0&&(p.anisotropy=c.anisotropy),c.flipY!==void 0&&(p.flipY=c.flipY),c.generateMipmaps!==void 0&&(p.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(p.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(p.compareFunction=c.compareFunction),c.userData!==void 0&&(p.userData=c.userData),s[c.uuid]=p}return s}parseObject(t,e,n,s,r){let l;function c(g){return e[g]===void 0&&wt("ObjectLoader: Undefined geometry",g),e[g]}function h(g){if(g!==void 0){if(Array.isArray(g)){let v=[];for(let y=0,b=g.length;y<b;y++){let S=g[y];n[S]===void 0&&wt("ObjectLoader: Undefined material",S),v.push(n[S])}return v}return n[g]===void 0&&wt("ObjectLoader: Undefined material",g),n[g]}}function f(g){return s[g]===void 0&&wt("ObjectLoader: Undefined texture",g),s[g]}let p,m;switch(t.type){case"Scene":l=new to,t.background!==void 0&&(Number.isInteger(t.background)?l.background=new Lt(t.background):l.background=f(t.background)),t.environment!==void 0&&(l.environment=f(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?l.fog=new Eu(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(l.fog=new bu(t.fog.color,t.fog.density)),t.fog.name!==""&&(l.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(l.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(l.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&l.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":l=new fn(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(l.focus=t.focus),t.zoom!==void 0&&(l.zoom=t.zoom),t.filmGauge!==void 0&&(l.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(l.filmOffset=t.filmOffset),t.view!==void 0&&(l.view=Object.assign({},t.view));break;case"OrthographicCamera":l=new Bs(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(l.zoom=t.zoom),t.view!==void 0&&(l.view=Object.assign({},t.view));break;case"AmbientLight":l=new yh(t.color,t.intensity);break;case"DirectionalLight":l=new xh(t.color,t.intensity),l.target=t.target||"";break;case"PointLight":l=new vh(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":l=new Sh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":l=new _h(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),l.target=t.target||"";break;case"HemisphereLight":l=new mh(t.color,t.groundColor,t.intensity);break;case"LightProbe":let g=new ec().fromArray(t.sh);l=new Mh(g,t.intensity);break;case"SkinnedMesh":p=c(t.geometry),m=h(t.material),l=new Cu(p,m),t.bindMode!==void 0&&(l.bindMode=t.bindMode),t.bindMatrix!==void 0&&l.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(l.skeleton=t.skeleton);break;case"Mesh":p=c(t.geometry),m=h(t.material),l=new rn(p,m);break;case"InstancedMesh":p=c(t.geometry),m=h(t.material);let v=t.count,y=t.instanceMatrix,b=t.instanceColor;l=new wu(p,m,v),l.instanceMatrix=new ha(new Float32Array(y.array),16),b!==void 0&&(l.instanceColor=new ha(new Float32Array(b.array),b.itemSize));break;case"BatchedMesh":p=c(t.geometry),m=h(t.material),l=new Du(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,m),l.geometry=p,l.perObjectFrustumCulled=t.perObjectFrustumCulled,l.sortObjects=t.sortObjects,l._drawRanges=t.drawRanges,l._reservedRanges=t.reservedRanges,l._geometryInfo=t.geometryInfo.map(S=>{let x=null,E=null;return S.boundingBox!==void 0&&(x=new bn().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(E=new yn().fromJSON(S.boundingSphere)),{...S,boundingBox:x,boundingSphere:E}}),l._instanceInfo=t.instanceInfo,l._availableInstanceIds=t._availableInstanceIds,l._availableGeometryIds=t._availableGeometryIds,l._nextIndexStart=t.nextIndexStart,l._nextVertexStart=t.nextVertexStart,l._geometryCount=t.geometryCount,l._maxInstanceCount=t.maxInstanceCount,l._maxVertexCount=t.maxVertexCount,l._maxIndexCount=t.maxIndexCount,l._geometryInitialized=t.geometryInitialized,l._matricesTexture=f(t.matricesTexture.uuid),l._indirectTexture=f(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(l._colorsTexture=f(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(l.boundingSphere=new yn().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(l.boundingBox=new bn().fromJSON(t.boundingBox));break;case"LOD":l=new Au;break;case"Line":l=new ms(c(t.geometry),h(t.material));break;case"LineLoop":l=new Uu(c(t.geometry),h(t.material));break;case"LineSegments":l=new Bi(c(t.geometry),h(t.material));break;case"PointCloud":case"Points":l=new Pu(c(t.geometry),h(t.material));break;case"Sprite":l=new Tu(h(t.material));break;case"Group":l=new oa;break;case"Bone":l=new Ll;break;default:l=new Oe}if(l.uuid=t.uuid,t.name!==void 0&&(l.name=t.name),t.matrix!==void 0?(l.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=t.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(t.position!==void 0&&l.position.fromArray(t.position),t.rotation!==void 0&&l.rotation.fromArray(t.rotation),t.quaternion!==void 0&&l.quaternion.fromArray(t.quaternion),t.scale!==void 0&&l.scale.fromArray(t.scale)),t.up!==void 0&&l.up.fromArray(t.up),t.castShadow!==void 0&&(l.castShadow=t.castShadow),t.receiveShadow!==void 0&&(l.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(l.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(l.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(l.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(l.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(l.visible=t.visible),t.frustumCulled!==void 0&&(l.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(l.renderOrder=t.renderOrder),t.userData!==void 0&&(l.userData=t.userData),t.layers!==void 0&&(l.layers.mask=t.layers),t.children!==void 0){let g=t.children;for(let v=0;v<g.length;v++)l.add(this.parseObject(g[v],e,n,s,r))}if(t.animations!==void 0){let g=t.animations;for(let v=0;v<g.length;v++){let y=g[v];l.animations.push(r[y])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(l.autoUpdate=t.autoUpdate);let g=t.levels;for(let v=0;v<g.length;v++){let y=g[v],b=l.getObjectByProperty("uuid",y.object);b!==void 0&&l.addLevel(b,y.distance,y.hysteresis)}}return l}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let s=e[n.skeleton];s===void 0?wt("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(s,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){let n=e.target,s=t.getObjectByProperty("uuid",n);s!==void 0?e.target=s:e.target=new Oe}})}},JC={UVMapping:Bh,CubeReflectionMapping:xs,CubeRefractionMapping:ga,EquirectangularReflectionMapping:oc,EquirectangularRefractionMapping:lc,CubeUVReflectionMapping:co},sM={RepeatWrapping:Ml,ClampToEdgeWrapping:li,MirroredRepeatWrapping:bl},aM={NearestFilter:dn,NearestMipmapNearestFilter:Sm,NearestMipmapLinearFilter:uo,LinearFilter:Je,LinearMipmapNearestFilter:cc,LinearMipmapLinearFilter:ys},n_=new WeakMap,wp=class extends Hn{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&wt("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&wt("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,l=fs.get(`image-bitmap:${t}`);if(l!==void 0){if(r.manager.itemStart(t),l.then){l.then(f=>{if(n_.has(l)===!0)s&&s(n_.get(l)),r.manager.itemError(t),r.manager.itemEnd(t);else return e&&e(f),r.manager.itemEnd(t),f});return}return setTimeout(function(){e&&e(l),r.manager.itemEnd(t)},0),l}let c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let h=fetch(t,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(f){return fs.add(`image-bitmap:${t}`,f),e&&e(f),r.manager.itemEnd(t),f}).catch(function(f){s&&s(f),n_.set(h,f),fs.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});fs.add(`image-bitmap:${t}`,h),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},Jd,ic=class{static getContext(){return Jd===void 0&&(Jd=new(window.AudioContext||window.webkitAudioContext)),Jd}static setContext(t){Jd=t}},Np=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(h){try{let f=h.slice(0);ic.getContext().decodeAudioData(f,function(m){e(m)}).catch(c)}catch(f){c(f)}},n,s);function c(h){s?s(h):Qt(h),r.manager.itemError(t)}}},rM=new ue,oM=new ue,zr=new ue,Dp=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fn,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(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,zr.copy(t.projectionMatrix);let s=e.eyeSep/2,r=s*e.near/e.focus,l=e.near*Math.tan(qr*e.fov*.5)/e.zoom,c,h;oM.elements[12]=-s,rM.elements[12]=s,c=-l*e.aspect+r,h=l*e.aspect+r,zr.elements[0]=2*e.near/(h-c),zr.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(zr),c=-l*e.aspect-r,h=l*e.aspect-r,zr.elements[0]=2*e.near/(h-c),zr.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(zr)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(oM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(rM)}},Ah=class extends fn{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}},oo=class{constructor(t=!0){this.autoStart=t,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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},Vr=new O,i_=new Vn,KC=new O,Hr=new O,Gr=new O,Up=class extends Oe{constructor(){super(),this.type="AudioListener",this.context=ic.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new oo}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(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Vr,i_,KC),Hr.set(0,0,-1).applyQuaternion(i_),Gr.set(0,1,0).applyQuaternion(i_),e.positionX){let n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Vr.x,n),e.positionY.linearRampToValueAtTime(Vr.y,n),e.positionZ.linearRampToValueAtTime(Vr.z,n),e.forwardX.linearRampToValueAtTime(Hr.x,n),e.forwardY.linearRampToValueAtTime(Hr.y,n),e.forwardZ.linearRampToValueAtTime(Hr.z,n),e.upX.linearRampToValueAtTime(Gr.x,n),e.upY.linearRampToValueAtTime(Gr.y,n),e.upZ.linearRampToValueAtTime(Gr.z,n)}else e.setPosition(Vr.x,Vr.y,Vr.z),e.setOrientation(Hr.x,Hr.y,Hr.z,Gr.x,Gr.y,Gr.z)}},Ch=class extends Oe{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){wt("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){wt("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(t=0){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);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(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,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(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this.playbackRate=t,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?(wt("Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),t.sourceType!=="buffer"?(wt("Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}},kr=new O,lM=new Vn,QC=new O,Wr=new O,Pp=class extends Ch{constructor(t){super(t),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(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(kr,lM,QC),Wr.set(0,0,1).applyQuaternion(lM);let e=this.panner;if(e.positionX){let n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(kr.x,n),e.positionY.linearRampToValueAtTime(kr.y,n),e.positionZ.linearRampToValueAtTime(kr.z,n),e.orientationX.linearRampToValueAtTime(Wr.x,n),e.orientationY.linearRampToValueAtTime(Wr.y,n),e.orientationZ.linearRampToValueAtTime(Wr.z,n)}else e.setPosition(kr.x,kr.y,kr.z),e.setOrientation(Wr.x,Wr.y,Wr.z)}},Ip=class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0,e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}},Rh=class{constructor(t,e,n){this.binding=t,this.valueSize=n;let s,r,l;switch(e){case"quaternion":s=this._slerp,r=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,r=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let n=this.buffer,s=this.valueSize,r=t*s+s,l=this.cumulativeWeight;if(l===0){for(let c=0;c!==s;++c)n[r+c]=n[c];l=e}else{l+=e;let c=e/l;this._mixBufferRegion(n,r,0,c,s)}this.cumulativeWeight=l}accumulateAdditive(t){let e=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,s,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,n=this.buffer,s=t*e+e,r=this.cumulativeWeight,l=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let h=e*this._origIndex;this._mixBufferRegion(n,s,h,1-r,e)}l>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*e,1,e);for(let h=e,f=e+e;h!==f;++h)if(n[h]!==n[h+e]){c.setValue(n,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,n=this.valueSize,s=n*this._origIndex;t.getValue(e,s);for(let r=n,l=s;r!==l;++r)e[r]=e[s+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,s,r){if(s>=.5)for(let l=0;l!==r;++l)t[e+l]=t[n+l]}_slerp(t,e,n,s){Vn.slerpFlat(t,e,t,e,t,n,s)}_slerpAdditive(t,e,n,s,r){let l=this._workIndex*r;Vn.multiplyQuaternionsFlat(t,l,t,e,t,n),Vn.slerpFlat(t,e,t,e,t,l,s)}_lerp(t,e,n,s,r){let l=1-s;for(let c=0;c!==r;++c){let h=e+c;t[h]=t[h]*l+t[n+c]*s}}_lerpAdditive(t,e,n,s,r){for(let l=0;l!==r;++l){let c=e+l;t[c]=t[c]+t[n+l]*s}}},lv="\\[\\]\\.:\\/",$C=new RegExp("["+lv+"]","g"),cv="[^"+lv+"]",tR="[^"+lv.replace("\\.","")+"]",eR=/((?:WC+[\/:])*)/.source.replace("WC",cv),nR=/(WCOD+)?/.source.replace("WCOD",tR),iR=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",cv),sR=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",cv),aR=new RegExp("^"+eR+nR+iR+sR+"$"),rR=["material","materials","bones","map"],__=class{constructor(t,e,n){let s=n||Ge.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ge=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace($C,"")}static parseTrackName(t){let e=aR.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);rR.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let l=0;l<r.length;l++){let c=r[l];if(c.name===e||c.uuid===e)return c;let h=n(c.children);if(h)return h}return null},s=n(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)t[e++]=n[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){wt("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let f=e.objectIndex;switch(n){case"materials":if(!t.material){Qt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){Qt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){Qt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let p=0;p<t.length;p++)if(t[p].name===f){f=p;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){Qt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){Qt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){Qt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(f!==void 0){if(t[f]===void 0){Qt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[f]}}let l=t[s];if(l===void 0){let f=e.nodeName;Qt("PropertyBinding: Trying to update property for track: "+f+"."+s+" but it wasn't found.",t);return}let c=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?c=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){Qt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){Qt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}h=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(h=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=s;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Ge.Composite=__;Ge.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ge.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ge.prototype.GetterByBindingType=[Ge.prototype._getValue_direct,Ge.prototype._getValue_array,Ge.prototype._getValue_arrayElement,Ge.prototype._getValue_toArray];Ge.prototype.SetterByBindingTypeAndVersioning=[[Ge.prototype._setValue_direct,Ge.prototype._setValue_direct_setNeedsUpdate,Ge.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_array,Ge.prototype._setValue_array_setNeedsUpdate,Ge.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_arrayElement,Ge.prototype._setValue_arrayElement_setNeedsUpdate,Ge.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_fromArray,Ge.prototype._setValue_fromArray_setNeedsUpdate,Ge.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Lp=class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Li(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let t={};this._indicesByUUID=t;for(let n=0,s=arguments.length;n!==s;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){let t=this._objects,e=this._indicesByUUID,n=this._paths,s=this._parsedPaths,r=this._bindings,l=r.length,c,h=t.length,f=this.nCachedObjects_;for(let p=0,m=arguments.length;p!==m;++p){let g=arguments[p],v=g.uuid,y=e[v];if(y===void 0){y=h++,e[v]=y,t.push(g);for(let b=0,S=l;b!==S;++b)r[b].push(new Ge(g,n[b],s[b]))}else if(y<f){c=t[y];let b=--f,S=t[b];e[S.uuid]=y,t[y]=S,e[v]=b,t[b]=g;for(let x=0,E=l;x!==E;++x){let T=r[x],A=T[b],N=T[y];T[y]=A,N===void 0&&(N=new Ge(g,n[x],s[x])),T[b]=N}}else t[y]!==c&&Qt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_;for(let l=0,c=arguments.length;l!==c;++l){let h=arguments[l],f=h.uuid,p=e[f];if(p!==void 0&&p>=r){let m=r++,g=t[m];e[g.uuid]=p,t[p]=g,e[f]=m,t[m]=h;for(let v=0,y=s;v!==y;++v){let b=n[v],S=b[m],x=b[p];b[p]=S,b[m]=x}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_,l=t.length;for(let c=0,h=arguments.length;c!==h;++c){let f=arguments[c],p=f.uuid,m=e[p];if(m!==void 0)if(delete e[p],m<r){let g=--r,v=t[g],y=--l,b=t[y];e[v.uuid]=m,t[m]=v,e[b.uuid]=g,t[g]=b,t.pop();for(let S=0,x=s;S!==x;++S){let E=n[S],T=E[g],A=E[y];E[m]=T,E[g]=A,E.pop()}}else{let g=--l,v=t[g];g>0&&(e[v.uuid]=m),t[m]=v,t.pop();for(let y=0,b=s;y!==b;++y){let S=n[y];S[m]=S[g],S.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let n=this._bindingsIndicesByPath,s=n[t],r=this._bindings;if(s!==void 0)return r[s];let l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,m=new Array(f);s=r.length,n[t]=s,l.push(t),c.push(e),r.push(m);for(let g=p,v=h.length;g!==v;++g){let y=h[g];m[g]=new Ge(y,t,e)}return m}unsubscribe_(t){let e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){let s=this._paths,r=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=t[c];e[f]=n,l[n]=h,l.pop(),r[n]=r[c],r.pop(),s[n]=s[c],s.pop()}}},wh=class{constructor(t,e,n=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=s;let r=e.tracks,l=r.length,c=new Array(l),h={endingStart:Wa,endingEnd:Wa};for(let f=0;f!==l;++f){let p=r[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=W_,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(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),n===!0){let s=this._clip.duration,r=t._clip.duration,l=r/s,c=s/r;t.warp(1,l,e),this.warp(c,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){let t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){let s=this._mixer,r=s.time,l=this.timeScale,c=this._timeScaleInterpolant;c===null&&(c=s._lendControlInterpolant(),this._timeScaleInterpolant=c);let h=c.parameterPositions,f=c.sampleValues;return h[0]=r,h[1]=r+n,f[0]=t/l,f[1]=e/l,this}stopWarping(){let t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,s){if(!this.enabled){this._updateWeight(t);return}let r=this._startTime;if(r!==null){let h=(t-r)*n;h<0||n===0?e=0:(this._startTime=null,e=n*h)}e*=this._updateTimeScale(t);let l=this._updateTime(e),c=this._updateWeight(t);if(c>0){let h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Rm:for(let p=0,m=h.length;p!==m;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case bf:default:for(let p=0,m=h.length;p!==m;++p)h[p].evaluate(l),f[p].accumulate(s,c)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let n=this._weightInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,n=this.loop,s=this.time+t,r=this._loopCount,l=n===X_;if(t===0)return r===-1?s:l&&(r&1)===1?e-s:s;if(n===k_){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(r===-1&&(t>=0?(r=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),s>=e||s<0){let c=Math.floor(s/e);s-=e*c,r+=Math.abs(c);let h=this.repetitions-r;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(h===1){let f=t<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=s;if(l&&(r&1)===1)return e-s}return s}_setEndings(t,e,n){let s=this._interpolantSettings;n?(s.endingStart=Xa,s.endingEnd=Xa):(t?s.endingStart=this.zeroSlopeAtStart?Xa:Wa:s.endingStart=Tl,e?s.endingEnd=this.zeroSlopeAtEnd?Xa:Wa:s.endingEnd=Tl)}_scheduleFading(t,e,n){let s=this._mixer,r=s.time,l=this._weightInterpolant;l===null&&(l=s._lendControlInterpolant(),this._weightInterpolant=l);let c=l.parameterPositions,h=l.sampleValues;return c[0]=r,h[0]=e,c[1]=r+t,h[1]=n,this}},oR=new Float32Array(1),Op=class extends Oi{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let n=t._localRoot||this._root,s=t._clip.tracks,r=s.length,l=t._propertyBindings,c=t._interpolants,h=n.uuid,f=this._bindingsByRootAndName,p=f[h];p===void 0&&(p={},f[h]=p);for(let m=0;m!==r;++m){let g=s[m],v=g.name,y=p[v];if(y!==void 0)++y.referenceCount,l[m]=y;else{if(y=l[m],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,h,v));continue}let b=e&&e._propertyBindings[m].binding.parsedPath;y=new Rh(Ge.create(n,v,b),g.ValueTypeName,g.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,h,v),l[m]=y}c[m].resultBuffer=y.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){let n=(t._localRoot||this._root).uuid,s=t._clip.uuid,r=this._actionsByClip[s];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,s,n)}let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){let s=this._actions,r=this._actionsByClip,l=r[e];if(l===void 0)l={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=l;else{let c=l.knownActions;t._byClipCacheIndex=c.length,c.push(t)}t._cacheIndex=s.length,s.push(t),l.actionByRoot[n]=t}_removeInactiveAction(t){let e=this._actions,n=e[e.length-1],s=t._cacheIndex;n._cacheIndex=s,e[s]=n,e.pop(),t._cacheIndex=null;let r=t._clip.uuid,l=this._actionsByClip,c=l[r],h=c.knownActions,f=h[h.length-1],p=t._byClipCacheIndex;f._byClipCacheIndex=p,h[p]=f,h.pop(),t._byClipCacheIndex=null;let m=c.actionByRoot,g=(t._localRoot||this._root).uuid;delete m[g],h.length===0&&delete l[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(t){let e=this._actions,n=t._cacheIndex,s=this._nActiveActions++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){let e=this._actions,n=t._cacheIndex,s=--this._nActiveActions,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){let s=this._bindingsByRootAndName,r=this._bindings,l=s[e];l===void 0&&(l={},s[e]=l),l[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){let e=this._bindings,n=t.binding,s=n.rootNode.uuid,r=n.path,l=this._bindingsByRootAndName,c=l[s],h=e[e.length-1],f=t._cacheIndex;h._cacheIndex=f,e[f]=h,e.pop(),delete c[r],Object.keys(c).length===0&&delete l[s]}_lendBinding(t){let e=this._bindings,n=t._cacheIndex,s=this._nActiveBindings++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){let e=this._bindings,n=t._cacheIndex,s=--this._nActiveBindings,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return n===void 0&&(n=new Ql(new Float32Array(2),new Float32Array(2),1,oR),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){let e=this._controlInterpolants,n=t.__cacheIndex,s=--this._nActiveControlInterpolants,r=e[s];t.__cacheIndex=s,e[s]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){let s=e||this._root,r=s.uuid,l=typeof t=="string"?nr.findByName(s,t):t,c=l!==null?l.uuid:t,h=this._actionsByClip[c],f=null;if(n===void 0&&(l!==null?n=l.blendMode:n=bf),h!==void 0){let m=h.actionByRoot[r];if(m!==void 0&&m.blendMode===n)return m;f=h.knownActions[0],l===null&&(l=f._clip)}if(l===null)return null;let p=new wh(this,l,e,n);return this._bindAction(p,f),this._addInactiveAction(p,c,r),p}existingAction(t,e){let n=e||this._root,s=n.uuid,r=typeof t=="string"?nr.findByName(n,t):t,l=r?r.uuid:t,c=this._actionsByClip[l];return c!==void 0&&c.actionByRoot[s]||null}stopAllAction(){let t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;let e=this._actions,n=this._nActiveActions,s=this.time+=t,r=Math.sign(t),l=this._accuIndex^=1;for(let f=0;f!==n;++f)e[f]._update(s,t,r,l);let c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,n=t.uuid,s=this._actionsByClip,r=s[n];if(r!==void 0){let l=r.knownActions;for(let c=0,h=l.length;c!==h;++c){let f=l[c];this._deactivateAction(f);let p=f._cacheIndex,m=e[e.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,m._cacheIndex=p,e[p]=m,e.pop(),this._removeInactiveBindingsForAction(f)}delete s[n]}}uncacheRoot(t){let e=t.uuid,n=this._actionsByClip;for(let l in n){let c=n[l].actionByRoot,h=c[e];h!==void 0&&(this._deactivateAction(h),this._removeInactiveAction(h))}let s=this._bindingsByRootAndName,r=s[e];if(r!==void 0)for(let l in r){let c=r[l];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(t,e){let n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Bp=class extends Nl{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Kr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},Fp=class i{constructor(t){this.value=t}clone(){return new i(this.value.clone===void 0?this.value:this.value.clone())}},lR=0,zp=class extends Oi{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:lR++}),this.name="",this.usage=Cl,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){let e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;let e=t.uniforms;this.uniforms.length=0;for(let n=0,s=e.length;n<s;n++){let r=Array.isArray(e[n])?e[n]:[e[n]];for(let l=0;l<r.length;l++)this.uniforms.push(r[l].clone())}return this}clone(){return new this.constructor().copy(this)}},Vp=class extends eo{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},Hp=class{constructor(t,e,n,s,r,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=s,this.count=r,this.normalized=l,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},cM=new ue,sc=class{constructor(t,e,n=0,s=1/0){this.ray=new ua(t,e),this.near=n,this.far=s,this.camera=null,this.layers=new Is,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):Qt("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return cM.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cM),this}intersectObject(t,e=!0,n=[]){return v_(t,this,n,e),n.sort(uM),n}intersectObjects(t,e=!0,n=[]){for(let s=0,r=t.length;s<r;s++)v_(t[s],this,n,e);return n.sort(uM),n}};function uM(i,t){return i.distance-t.distance}function v_(i,t,e,n){let s=!0;if(i.layers.test(t.layers)&&i.raycast(t,e)===!1&&(s=!1),s===!0&&n===!0){let r=i.children;for(let l=0,c=r.length;l<c;l++)v_(r[l],t,e,!0)}}var Gp=class{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(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=cR.bind(this),t.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(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function cR(){this._document.hidden===!1&&this.reset()}var kp=class{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=le(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(le(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},Wp=class{constructor(t=1,e=0,n=0){this.radius=t,this.theta=e,this.y=n}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}},Xp=class i{constructor(t,e,n,s){i.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,s){let r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=s,this}},hM=new ft,qp=class{constructor(t=new ft(1/0,1/0),e=new ft(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=hM.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,hM).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},fM=new O,Kd=new O,vl=new O,xl=new O,s_=new O,uR=new O,hR=new O,Yp=class{constructor(t=new O,e=new O){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){fM.subVectors(t,this.start),Kd.subVectors(this.end,this.start);let n=Kd.dot(Kd),r=Kd.dot(fM)/n;return e&&(r=le(r,0,1)),r}closestPointToPoint(t,e,n){let s=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=uR,n=hR){let s=10000000000000001e-32,r,l,c=this.start,h=t.start,f=this.end,p=t.end;vl.subVectors(f,c),xl.subVectors(p,h),s_.subVectors(c,h);let m=vl.dot(vl),g=xl.dot(xl),v=xl.dot(s_);if(m<=s&&g<=s)return e.copy(c),n.copy(h),e.sub(n),e.dot(e);if(m<=s)r=0,l=v/g,l=le(l,0,1);else{let y=vl.dot(s_);if(g<=s)l=0,r=le(-y/m,0,1);else{let b=vl.dot(xl),S=m*g-b*b;S!==0?r=le((b*v-y*g)/S,0,1):r=0,l=(b*r+v)/g,l<0?(l=0,r=le(-y/m,0,1)):l>1&&(l=1,r=le((b-y)/m,0,1))}}return e.copy(c).add(vl.multiplyScalar(r)),n.copy(h).add(xl.multiplyScalar(l)),e.sub(n),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},dM=new O,Zp=class extends Oe{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";let n=new de,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 l=0,c=1,h=32;l<h;l++,c++){let f=l/h*Math.PI*2,p=c/h*Math.PI*2;s.push(Math.cos(f),Math.sin(f),1,Math.cos(p),Math.sin(p),1)}n.setAttribute("position",new Gt(s,3));let r=new Pn({fog:!1,toneMapped:!1});this.cone=new Bi(n,r),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);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),dM.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(dM),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Ga=new O,Qd=new ue,a_=new ue,jp=class extends Bi{constructor(t){let e=yb(t),n=new de,s=[],r=[];for(let f=0;f<e.length;f++){let p=e[f];p.parent&&p.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new Gt(s,3)),n.setAttribute("color",new Gt(r,3));let l=new Pn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;let c=new Lt(255),h=new Lt(65280);this.setColors(c,h)}updateMatrixWorld(t){let e=this.bones,n=this.geometry,s=n.getAttribute("position");a_.copy(this.root.matrixWorld).invert();for(let r=0,l=0;r<e.length;r++){let c=e[r];c.parent&&c.parent.isBone&&(Qd.multiplyMatrices(a_,c.matrixWorld),Ga.setFromMatrixPosition(Qd),s.setXYZ(l,Ga.x,Ga.y,Ga.z),Qd.multiplyMatrices(a_,c.parent.matrixWorld),Ga.setFromMatrixPosition(Qd),s.setXYZ(l+1,Ga.x,Ga.y,Ga.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){let s=this.geometry.getAttribute("color");for(let r=0;r<s.count;r+=2)s.setXYZ(r,t.r,t.g,t.b),s.setXYZ(r+1,e.r,e.g,e.b);return s.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};function yb(i){let t=[];i.isBone===!0&&t.push(i);for(let e=0;e<i.children.length;e++)t.push(...yb(i.children[e]));return t}var Jp=class extends rn{constructor(t,e,n){let s=new Yl(e,4,2),r=new ps({wireframe:!0,fog:!1,toneMapped:!1});super(s,r),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},fR=new O,pM=new Lt,mM=new Lt,Kp=class extends Oe{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";let s=new ql(e);s.rotateY(Math.PI*.5),this.material=new ps({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let r=s.getAttribute("position"),l=new Float32Array(r.count*3);s.setAttribute("color",new He(l,3)),this.add(new rn(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let e=t.geometry.getAttribute("color");pM.copy(this.light.color),mM.copy(this.light.groundColor);for(let n=0,s=e.count;n<s;n++){let r=n<s/2?pM:mM;e.setXYZ(n,r.r,r.g,r.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(fR.setFromMatrixPosition(this.light.matrixWorld).negate())}},Qp=class extends Bi{constructor(t=10,e=10,n=4473924,s=8947848){n=new Lt(n),s=new Lt(s);let r=e/2,l=t/e,c=t/2,h=[],f=[];for(let g=0,v=0,y=-c;g<=e;g++,y+=l){h.push(-c,0,y,c,0,y),h.push(y,0,-c,y,0,c);let b=g===r?n:s;b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3}let p=new de;p.setAttribute("position",new Gt(h,3)),p.setAttribute("color",new Gt(f,3));let m=new Pn({vertexColors:!0,toneMapped:!1});super(p,m),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},$p=class extends Bi{constructor(t=10,e=16,n=8,s=64,r=4473924,l=8947848){r=new Lt(r),l=new Lt(l);let c=[],h=[];if(e>1)for(let m=0;m<e;m++){let g=m/e*(Math.PI*2),v=Math.sin(g)*t,y=Math.cos(g)*t;c.push(0,0,0),c.push(v,0,y);let b=m&1?r:l;h.push(b.r,b.g,b.b),h.push(b.r,b.g,b.b)}for(let m=0;m<n;m++){let g=m&1?r:l,v=t-t/n*m;for(let y=0;y<s;y++){let b=y/s*(Math.PI*2),S=Math.sin(b)*v,x=Math.cos(b)*v;c.push(S,0,x),h.push(g.r,g.g,g.b),b=(y+1)/s*(Math.PI*2),S=Math.sin(b)*v,x=Math.cos(b)*v,c.push(S,0,x),h.push(g.r,g.g,g.b)}}let f=new de;f.setAttribute("position",new Gt(c,3)),f.setAttribute("color",new Gt(h,3));let p=new Pn({vertexColors:!0,toneMapped:!1});super(f,p),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},gM=new O,$d=new O,_M=new O,tm=class extends Oe{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let s=new de;s.setAttribute("position",new Gt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));let r=new Pn({fog:!1,toneMapped:!1});this.lightPlane=new ms(s,r),this.add(this.lightPlane),s=new de,s.setAttribute("position",new Gt([0,0,0,0,0,1],3)),this.targetLine=new ms(s,r),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),gM.setFromMatrixPosition(this.light.matrixWorld),$d.setFromMatrixPosition(this.light.target.matrixWorld),_M.subVectors($d,gM),this.lightPlane.lookAt($d),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($d),this.targetLine.scale.z=_M.length()}},tp=new O,hn=new Qr,em=class extends Bi{constructor(t){let e=new de,n=new Pn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],r=[],l={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(y,b){h(y),h(b)}function h(y){s.push(0,0,0),r.push(0,0,0),l[y]===void 0&&(l[y]=[]),l[y].push(s.length/3-1)}e.setAttribute("position",new Gt(s,3)),e.setAttribute("color",new Gt(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update();let f=new Lt(16755200),p=new Lt(16711680),m=new Lt(43775),g=new Lt(16777215),v=new Lt(3355443);this.setColors(f,p,m,g,v)}setColors(t,e,n,s,r){let c=this.geometry.getAttribute("color");return c.setXYZ(0,t.r,t.g,t.b),c.setXYZ(1,t.r,t.g,t.b),c.setXYZ(2,t.r,t.g,t.b),c.setXYZ(3,t.r,t.g,t.b),c.setXYZ(4,t.r,t.g,t.b),c.setXYZ(5,t.r,t.g,t.b),c.setXYZ(6,t.r,t.g,t.b),c.setXYZ(7,t.r,t.g,t.b),c.setXYZ(8,t.r,t.g,t.b),c.setXYZ(9,t.r,t.g,t.b),c.setXYZ(10,t.r,t.g,t.b),c.setXYZ(11,t.r,t.g,t.b),c.setXYZ(12,t.r,t.g,t.b),c.setXYZ(13,t.r,t.g,t.b),c.setXYZ(14,t.r,t.g,t.b),c.setXYZ(15,t.r,t.g,t.b),c.setXYZ(16,t.r,t.g,t.b),c.setXYZ(17,t.r,t.g,t.b),c.setXYZ(18,t.r,t.g,t.b),c.setXYZ(19,t.r,t.g,t.b),c.setXYZ(20,t.r,t.g,t.b),c.setXYZ(21,t.r,t.g,t.b),c.setXYZ(22,t.r,t.g,t.b),c.setXYZ(23,t.r,t.g,t.b),c.setXYZ(24,e.r,e.g,e.b),c.setXYZ(25,e.r,e.g,e.b),c.setXYZ(26,e.r,e.g,e.b),c.setXYZ(27,e.r,e.g,e.b),c.setXYZ(28,e.r,e.g,e.b),c.setXYZ(29,e.r,e.g,e.b),c.setXYZ(30,e.r,e.g,e.b),c.setXYZ(31,e.r,e.g,e.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,s.r,s.g,s.b),c.setXYZ(39,s.r,s.g,s.b),c.setXYZ(40,r.r,r.g,r.b),c.setXYZ(41,r.r,r.g,r.b),c.setXYZ(42,r.r,r.g,r.b),c.setXYZ(43,r.r,r.g,r.b),c.setXYZ(44,r.r,r.g,r.b),c.setXYZ(45,r.r,r.g,r.b),c.setXYZ(46,r.r,r.g,r.b),c.setXYZ(47,r.r,r.g,r.b),c.setXYZ(48,r.r,r.g,r.b),c.setXYZ(49,r.r,r.g,r.b),c.needsUpdate=!0,this}update(){let t=this.geometry,e=this.pointMap,n=1,s=1,r,l;if(hn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,l=0;else if(this.camera.coordinateSystem===_i)r=-1,l=1;else if(this.camera.coordinateSystem===Yr)r=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);pn("c",e,t,hn,0,0,r),pn("t",e,t,hn,0,0,l),pn("n1",e,t,hn,-n,-s,r),pn("n2",e,t,hn,n,-s,r),pn("n3",e,t,hn,-n,s,r),pn("n4",e,t,hn,n,s,r),pn("f1",e,t,hn,-n,-s,l),pn("f2",e,t,hn,n,-s,l),pn("f3",e,t,hn,-n,s,l),pn("f4",e,t,hn,n,s,l),pn("u1",e,t,hn,n*.7,s*1.1,r),pn("u2",e,t,hn,-n*.7,s*1.1,r),pn("u3",e,t,hn,0,s*2,r),pn("cf1",e,t,hn,-n,0,l),pn("cf2",e,t,hn,n,0,l),pn("cf3",e,t,hn,0,-s,l),pn("cf4",e,t,hn,0,s,l),pn("cn1",e,t,hn,-n,0,r),pn("cn2",e,t,hn,n,0,r),pn("cn3",e,t,hn,0,-s,r),pn("cn4",e,t,hn,0,s,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function pn(i,t,e,n,s,r,l){tp.set(s,r,l).unproject(n);let c=t[i];if(c!==void 0){let h=e.getAttribute("position");for(let f=0,p=c.length;f<p;f++)h.setXYZ(c[f],tp.x,tp.y,tp.z)}}var ep=new bn,nm=class extends Bi{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new de;r.setIndex(new He(n,1)),r.setAttribute("position",new He(s,3)),super(r,new Pn({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&ep.setFromObject(this.object),ep.isEmpty())return;let t=ep.min,e=ep.max,n=this.geometry.attributes.position,s=n.array;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},im=class extends Bi{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new de;r.setIndex(new He(n,1)),r.setAttribute("position",new Gt(s,3)),super(r,new Pn({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){let e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},sm=class extends ms{constructor(t,e=1,n=16776960){let s=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new de;l.setAttribute("position",new Gt(r,3)),l.computeBoundingSphere(),super(l,new Pn({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;let c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],h=new de;h.setAttribute("position",new Gt(c,3)),h.computeBoundingSphere(),this.add(new rn(h,new ps({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){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(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},vM=new O,np,r_,am=class extends Oe{constructor(t=new O(0,0,1),e=new O(0,0,0),n=1,s=16776960,r=n*.2,l=r*.2){super(),this.type="ArrowHelper",np===void 0&&(np=new de,np.setAttribute("position",new Gt([0,0,0,0,1,0],3)),r_=new zl(.5,1,5,1),r_.translate(0,-.5,0)),this.position.copy(e),this.line=new ms(np,new Pn({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new rn(r_,new ps({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,l)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{vM.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(vM,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},rm=class extends Bi{constructor(t=1){let e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new de;s.setAttribute("position",new Gt(e,3)),s.setAttribute("color",new Gt(n,3));let r=new Pn({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(t,e,n){let s=new Lt,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(n),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},om=class{constructor(){this.type="ShapePath",this.color=new Lt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new so,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,s){return this.currentPath.quadraticCurveTo(t,e,n,s),this}bezierCurveTo(t,e,n,s,r,l){return this.currentPath.bezierCurveTo(t,e,n,s,r,l),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(x){let E=[];for(let T=0,A=x.length;T<A;T++){let N=x[T],D=new Ds;D.curves=N.curves,E.push(D)}return E}function n(x,E){let T=E.length,A=!1;for(let N=T-1,D=0;D<T;N=D++){let L=E[N],F=E[D],C=F.x-L.x,w=F.y-L.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(L=E[D],C=-C,F=E[N],w=-w),x.y<L.y||x.y>F.y)continue;if(x.y===L.y){if(x.x===L.x)return!0}else{let z=w*(x.x-L.x)-C*(x.y-L.y);if(z===0)return!0;if(z<0)continue;A=!A}}else{if(x.y!==L.y)continue;if(F.x<=x.x&&x.x<=L.x||L.x<=x.x&&x.x<=F.x)return!0}}return A}let s=Qi.isClockWise,r=this.subPaths;if(r.length===0)return[];let l,c,h,f=[];if(r.length===1)return c=r[0],h=new Ds,h.curves=c.curves,f.push(h),f;let p=!s(r[0].getPoints());p=t?!p:p;let m=[],g=[],v=[],y=0,b;g[y]=void 0,v[y]=[];for(let x=0,E=r.length;x<E;x++)c=r[x],b=c.getPoints(),l=s(b),l=t?!l:l,l?(!p&&g[y]&&y++,g[y]={s:new Ds,p:b},g[y].s.curves=c.curves,p&&y++,v[y]=[]):v[y].push({h:c,p:b[0]});if(!g[0])return e(r);if(g.length>1){let x=!1,E=0;for(let T=0,A=g.length;T<A;T++)m[T]=[];for(let T=0,A=g.length;T<A;T++){let N=v[T];for(let D=0;D<N.length;D++){let L=N[D],F=!0;for(let C=0;C<g.length;C++)n(L.p,g[C].p)&&(T!==C&&E++,F?(F=!1,m[C].push(L)):x=!0);F&&m[T].push(L)}}E>0&&x===!1&&(v=m)}let S;for(let x=0,E=g.length;x<E;x++){h=g[x].s,f.push(h),S=v[x];for(let T=0,A=S.length;T<A;T++)h.holes.push(S[T].h)}return f}},lm=class extends Oi{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){if(t===void 0){wt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}};function dR(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function pR(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function mR(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function Nm(i,t,e,n){let s=gR(n);switch(e){case Am:return i*t;case Hh:return i*t/s.components*s.byteLength;case uc:return i*t/s.components*s.byteLength;case ar:return i*t*2/s.components*s.byteLength;case Gh:return i*t*2/s.components*s.byteLength;case Cm:return i*t*3/s.components*s.byteLength;case Un:return i*t*4/s.components*s.byteLength;case kh:return i*t*4/s.components*s.byteLength;case hc:case fc:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case dc:case pc:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case Xh:case Yh:return Math.max(i,16)*Math.max(t,8)/4;case Wh:case qh:return Math.max(i,8)*Math.max(t,8)/2;case Zh:case jh:case Kh:case Qh:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case Jh:case $h:case tf:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case ef:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case nf:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case sf:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case af:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case rf:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case of:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case lf:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case cf:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case uf:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case hf:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case ff:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case df:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case pf:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case mf:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case gf:case _f:case vf:return Math.ceil(i/4)*Math.ceil(t/4)*16;case xf:case yf:return Math.ceil(i/4)*Math.ceil(t/4)*8;case Sf:case Mf:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function gR(i){switch(i){case Gn:case Mm:return{byteLength:1,components:1};case ho:case bm:case Ss:return{byteLength:2,components:1};case zh:case Vh:return{byteLength:2,components:4};case Fi:case Fh:case Qn:return{byteLength:4,components:1};case Em:case Tm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}var cm=class{static contain(t,e){return dR(t,e)}static cover(t,e){return pR(t,e)}static fill(t){return mR(t)}static getByteLength(t,e,n,s){return Nm(t,e,n,s)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}}));typeof window<"u"&&(window.__THREE__?wt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182");function kb(){let i=null,t=!1,e=null,n=null;function s(r,l){e(r,l),n=i.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(s),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){i=r}}}function _R(i){let t=new WeakMap;function e(c,h){let f=c.array,p=c.usage,m=f.byteLength,g=i.createBuffer();i.bindBuffer(h,g),i.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=i.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=i.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=i.HALF_FLOAT:v=i.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=i.SHORT;else if(f instanceof Uint32Array)v=i.UNSIGNED_INT;else if(f instanceof Int32Array)v=i.INT;else if(f instanceof Int8Array)v=i.BYTE;else if(f instanceof Uint8Array)v=i.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:g,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:m}}function n(c,h,f){let p=h.array,m=h.updateRanges;if(i.bindBuffer(f,c),m.length===0)i.bufferSubData(f,0,p);else{m.sort((v,y)=>v.start-y.start);let g=0;for(let v=1;v<m.length;v++){let y=m[g],b=m[v];b.start<=y.start+y.count+1?y.count=Math.max(y.count,b.start+b.count-y.start):(++g,m[g]=b)}m.length=g+1;for(let v=0,y=m.length;v<y;v++){let b=m[v];i.bufferSubData(f,b.start*p.BYTES_PER_ELEMENT,p,b.start,b.count)}h.clearUpdateRanges()}h.onUploadCallback()}function s(c){return c.isInterleavedBufferAttribute&&(c=c.data),t.get(c)}function r(c){c.isInterleavedBufferAttribute&&(c=c.data);let h=t.get(c);h&&(i.deleteBuffer(h.buffer),t.delete(c))}function l(c,h){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){let p=t.get(c);(!p||p.version<c.version)&&t.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}let f=t.get(c);if(f===void 0)t.set(c,e(c,h));else if(f.version<c.version){if(f.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(f.buffer,c,h),f.version=c.version}}return{get:s,remove:r,update:l}}var vR=`#ifdef USE_ALPHAHASH
51
+ `},s=new Ja(5,5,5),r=new ci({name:"CubemapFromEquirect",uniforms:po(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ti,blending:vs});r.uniforms.tEquirect.value=e;let l=new rn(s,r),c=e.minFilter;return e.minFilter===ys&&(e.minFilter=Je),new Mu(1,10,this).update(t,l),e.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(t,e=!0,n=!0,s=!0){let r=t.getRenderTarget();for(let l=0;l<6;l++)t.setRenderTarget(this,l),t.clear(e,n,s);t.setRenderTarget(r)}},oa=class extends Oe{constructor(){super(),this.isGroup=!0,this.type="Group"}},oC={type:"move"},to=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new oa,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 oa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new O,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new O),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new oa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new O,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new O),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let s=null,r=null,l=null,c=this._targetRay,h=this._grip,f=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(f&&t.hand){l=!0;for(let b of t.hand.values()){let S=e.getJointPose(b,n),x=this._getHandJoint(f,b);S!==null&&(x.matrix.fromArray(S.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=S.radius),x.visible=S!==null}let p=f.joints["index-finger-tip"],m=f.joints["thumb-tip"],g=p.position.distanceTo(m.position),v=.02,y=.005;f.inputState.pinching&&g>v+y?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&g<=v-y&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else h!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(h.matrix.fromArray(r.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,r.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(r.linearVelocity)):h.hasLinearVelocity=!1,r.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(r.angularVelocity)):h.hasAngularVelocity=!1));c!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(oC)))}return c!==null&&(c.visible=s!==null),h!==null&&(h.visible=r!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new oa;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},bu=class i{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Lt(t),this.density=e}clone(){return new i(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},Eu=class i{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Lt(t),this.near=e,this.far=n}clone(){return new i(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},eo=class extends Oe{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 xi,this.environmentIntensity=1,this.environmentRotation=new xi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},no=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Cl,this.updateRanges=[],this.version=0,this.uuid=Li()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[n+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Li()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Li()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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}}},ri=new O,Qa=class i{constructor(t,e,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.applyMatrix4(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.applyNormalMatrix(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ri.fromBufferAttribute(this,e),ri.transformDirection(t),this.setXYZ(e,ri.x,ri.y,ri.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=oi(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ve(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=ve(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=oi(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=oi(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=oi(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=oi(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=ve(e,this.array),n=ve(n,this.array),s=ve(s,this.array),r=ve(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(t===void 0){wl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return new He(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new i(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){wl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Il=class extends En{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Lt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},fl,au=new O,dl=new O,pl=new O,ml=new ft,ru=new ft,pb=new ue,Dd=new O,ou=new O,Ud=new O,DS=new ft,W0=new ft,US=new ft,Tu=class extends Oe{constructor(t=new Il){if(super(),this.isSprite=!0,this.type="Sprite",fl===void 0){fl=new de;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new no(e,5);fl.setIndex([0,1,2,0,2,3]),fl.setAttribute("position",new Qa(n,3,0,!1)),fl.setAttribute("uv",new Qa(n,2,3,!1))}this.geometry=fl,this.material=t,this.center=new ft(.5,.5),this.count=1}raycast(t,e){t.camera===null&&Qt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),dl.setFromMatrixScale(this.matrixWorld),pb.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),pl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&dl.multiplyScalar(-pl.z);let n=this.material.rotation,s,r;n!==0&&(r=Math.cos(n),s=Math.sin(n));let l=this.center;Pd(Dd.set(-.5,-.5,0),pl,l,dl,s,r),Pd(ou.set(.5,-.5,0),pl,l,dl,s,r),Pd(Ud.set(.5,.5,0),pl,l,dl,s,r),DS.set(0,0),W0.set(1,0),US.set(1,1);let c=t.ray.intersectTriangle(Dd,ou,Ud,!1,au);if(c===null&&(Pd(ou.set(-.5,.5,0),pl,l,dl,s,r),W0.set(0,1),c=t.ray.intersectTriangle(Dd,Ud,ou,!1,au),c===null))return;let h=t.ray.origin.distanceTo(au);h<t.near||h>t.far||e.push({distance:h,point:au.clone(),uv:us.getInterpolation(au,Dd,ou,Ud,DS,W0,US,new ft),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};function Pd(i,t,e,n,s,r){ml.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(ru.x=r*ml.x-s*ml.y,ru.y=s*ml.x+r*ml.y):ru.copy(ml),i.copy(t),i.x+=ru.x,i.y+=ru.y,i.applyMatrix4(pb)}var Id=new O,PS=new O,Au=class extends Oe{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let n=0,s=e.length;n<s;n++){let r=e[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);let s=this.levels,r;for(r=0;r<s.length&&!(e<s[r].distance);r++);return s.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){let e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){let s=e.splice(n,1);return this.remove(s[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){let e=this.levels;if(e.length>0){let n,s;for(n=1,s=e.length;n<s;n++){let r=e[n].distance;if(e[n].object.visible&&(r-=r*e[n].hysteresis),t<r)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Id.setFromMatrixPosition(this.matrixWorld);let s=t.ray.origin.distanceTo(Id);this.getObjectForDistance(s).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){Id.setFromMatrixPosition(t.matrixWorld),PS.setFromMatrixPosition(this.matrixWorld);let n=Id.distanceTo(PS)/t.zoom;e[0].object.visible=!0;let s,r;for(s=1,r=e.length;s<r;s++){let l=e[s].distance;if(e[s].object.visible&&(l-=l*e[s].hysteresis),n>=l)e[s-1].object.visible=!1,e[s].object.visible=!0;else break}for(this._currentLevel=s-1;s<r;s++)e[s].object.visible=!1}}toJSON(t){let e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];let n=this.levels;for(let s=0,r=n.length;s<r;s++){let l=n[s];e.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return e}},IS=new O,LS=new qe,OS=new qe,lC=new O,BS=new ue,Ld=new O,X0=new yn,FS=new ue,q0=new ua,Cu=class extends rn{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ip,this.bindMatrix=new ue,this.bindMatrixInverse=new ue,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;this.boundingBox===null&&(this.boundingBox=new bn),this.boundingBox.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Ld),this.boundingBox.expandByPoint(Ld)}computeBoundingSphere(){let t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new yn),this.boundingSphere.makeEmpty();let e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Ld),this.boundingSphere.expandByPoint(Ld)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){let n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),X0.copy(this.boundingSphere),X0.applyMatrix4(s),t.ray.intersectsSphere(X0)!==!1&&(FS.copy(s).invert(),q0.copy(t.ray).applyMatrix4(FS),!(this.boundingBox!==null&&q0.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,q0)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let t=new qe,e=this.geometry.attributes.skinWeight;for(let n=0,s=e.count;n<s;n++){t.fromBufferAttribute(e,n);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===ip?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===G_?this.bindMatrixInverse.copy(this.bindMatrix).invert():wt("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){let n=this.skeleton,s=this.geometry;LS.fromBufferAttribute(s.attributes.skinIndex,t),OS.fromBufferAttribute(s.attributes.skinWeight,t),IS.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let l=OS.getComponent(r);if(l!==0){let c=LS.getComponent(r);BS.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),e.addScaledVector(lC.copy(IS).applyMatrix4(BS),l)}}return e.applyMatrix4(this.bindMatrixInverse)}},Ll=class extends Oe{constructor(){super(),this.isBone=!0,this.type="Bone"}},vi=class extends mn{constructor(t=null,e=1,n=1,s,r,l,c,h,f=dn,p=dn,m,g){super(null,l,c,h,f,p,s,r,m,g),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},zS=new ue,cC=new ue,Ru=class i{constructor(t=[],e=[]){this.uuid=Li(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){wt("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new ue)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let n=new ue;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let t=this.bones,e=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,l=t.length;r<l;r++){let c=t[r]?t[r].matrixWorld:cC;zS.multiplyMatrices(c,e[r]),zS.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new i(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let n=new vi(e,t,t,Un,Qn);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){let s=this.bones[e];if(s.name===t)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,s=t.bones.length;n<s;n++){let r=t.bones[n],l=e[r];l===void 0&&(wt("Skeleton: No bone found with UUID:",r),l=new Ll),this.bones.push(l),this.boneInverses.push(new ue().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,n=this.boneInverses;for(let s=0,r=e.length;s<r;s++){let l=e[s];t.bones.push(l.uuid);let c=n[s];t.boneInverses.push(c.toArray())}return t}},ha=class extends He{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},gl=new ue,VS=new ue,Od=[],HS=new bn,uC=new ue,lu=new rn,cu=new yn,wu=class extends rn{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new ha(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,uC)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new bn),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,gl),HS.copy(t.boundingBox).applyMatrix4(gl),this.boundingBox.union(HS)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new yn),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,gl),cu.copy(t.boundingSphere).applyMatrix4(gl),this.boundingSphere.union(cu)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){let n=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,l=t*r+1;for(let c=0;c<n.length;c++)n[c]=s[l+c]}raycast(t,e){let n=this.matrixWorld,s=this.count;if(lu.geometry=this.geometry,lu.material=this.material,lu.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cu.copy(this.boundingSphere),cu.applyMatrix4(n),t.ray.intersectsSphere(cu)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,gl),VS.multiplyMatrices(n,gl),lu.matrixWorld=VS,lu.raycast(t,Od);for(let l=0,c=Od.length;l<c;l++){let h=Od[l];h.instanceId=r,h.object=this,e.push(h)}Od.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new ha(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){let n=e.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new vi(new Float32Array(s*this.count),s,this.count,Hh,Qn));let r=this.morphTexture.source.data.data,l=0;for(let f=0;f<n.length;f++)l+=n[f];let c=this.geometry.morphTargetsRelative?1:1-l,h=s*t;r[h]=c,r.set(n,h+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Y0=new O,hC=new O,fC=new pe,cs=class{constructor(t=new O(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,s){return this.normal.set(t,e,n),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let s=Y0.subVectors(n,e).cross(hC.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let n=t.delta(Y0),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||fC.getNormalMatrix(t),s=this.coplanarPoint(Y0).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Br=new yn,dC=new ft(.5,.5),Bd=new O,fa=class{constructor(t=new cs,e=new cs,n=new cs,s=new cs,r=new cs,l=new cs){this.planes=[t,e,n,s,r,l]}set(t,e,n,s,r,l){let c=this.planes;return c[0].copy(t),c[1].copy(e),c[2].copy(n),c[3].copy(s),c[4].copy(r),c[5].copy(l),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=_i,n=!1){let s=this.planes,r=t.elements,l=r[0],c=r[1],h=r[2],f=r[3],p=r[4],m=r[5],g=r[6],v=r[7],y=r[8],b=r[9],S=r[10],x=r[11],E=r[12],T=r[13],A=r[14],N=r[15];if(s[0].setComponents(f-l,v-p,x-y,N-E).normalize(),s[1].setComponents(f+l,v+p,x+y,N+E).normalize(),s[2].setComponents(f+c,v+m,x+b,N+T).normalize(),s[3].setComponents(f-c,v-m,x-b,N-T).normalize(),n)s[4].setComponents(h,g,S,A).normalize(),s[5].setComponents(f-h,v-g,x-S,N-A).normalize();else if(s[4].setComponents(f-h,v-g,x-S,N-A).normalize(),e===_i)s[5].setComponents(f+h,v+g,x+S,N+A).normalize();else if(e===Zr)s[5].setComponents(h,g,S,A).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Br.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Br.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Br)}intersectsSprite(t){Br.center.set(0,0,0);let e=dC.distanceTo(t.center);return Br.radius=.7071067811865476+e,Br.applyMatrix4(t.matrixWorld),this.intersectsSphere(Br)}intersectsSphere(t){let e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let n=0;n<6;n++){let s=e[n];if(Bd.x=s.normal.x>0?t.max.x:t.min.x,Bd.y=s.normal.y>0?t.max.y:t.min.y,Bd.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Bd)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ws=new ue,Ns=new fa,Nu=class i{constructor(){this.coordinateSystem=_i}intersectsObject(t,e){if(!e.isArrayCamera||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsObject(t))return!0}return!1}intersectsSprite(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsSprite(t))return!0}return!1}intersectsSphere(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsSphere(t))return!0}return!1}intersectsBox(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.intersectsBox(t))return!0}return!1}containsPoint(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){let s=e.cameras[n];if(ws.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),Ns.setFromProjectionMatrix(ws,s.coordinateSystem,s.reversedDepth),Ns.containsPoint(t))return!0}return!1}clone(){return new i}};function Z0(i,t){return i-t}function pC(i,t){return i.z-t.z}function mC(i,t){return t.z-i.z}var o_=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,s){let r=this.pool,l=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let c=r[this.index];l.push(c),this.index++,c.start=t,c.count=e,c.z=n,c.index=s}reset(){this.list.length=0,this.index=0}},mi=new ue,gC=new Lt(1,1,1),GS=new fa,_C=new Nu,Fd=new bn,Fr=new yn,uu=new O,kS=new O,vC=new O,j0=new o_,Kn=new rn,zd=[];function xC(i,t,e=0){let n=t.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==t.array.constructor){let s=i.count;for(let r=0;r<s;r++)for(let l=0;l<n;l++)t.setComponent(r+e,l,i.getComponent(r,l))}else t.array.set(i.array,e*n);t.needsUpdate=!0}function zr(i,t){if(i.constructor!==t.constructor){let e=Math.min(i.length,t.length);for(let n=0;n<e;n++)t[n]=i[n]}else{let e=Math.min(i.length,t.length);t.set(new i.constructor(i.buffer,0,e))}}var Du=class extends rn{constructor(t,e,n=e*2,s){super(new de,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=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),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 t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);let e=new Float32Array(t*t*4),n=new vi(e,t,t,Un,Qn);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Uint32Array(t*t),n=new vi(e,t,t,uc,Fi);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);let e=new Float32Array(t*t*4).fill(1),n=new vi(e,t,t,Un,Qn);n.colorSpace=be.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){let e=this.geometry,n=this._maxVertexCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in t.attributes){let l=t.getAttribute(r),{array:c,itemSize:h,normalized:f}=l,p=new c.constructor(n*h),m=new He(p,h,f);e.setAttribute(r,m)}if(t.getIndex()!==null){let r=n>65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new He(r,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let s=t.getAttribute(n),r=e.getAttribute(n);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bn);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,mi),this.getBoundingBoxAt(r,Fd).applyMatrix4(mi),t.union(Fd)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yn);let t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,s=e.length;n<s;n++){if(e[n].active===!1)continue;let r=e[n].geometryIndex;this.getMatrixAt(n,mi),this.getBoundingSphereAt(r,Fr).applyMatrix4(mi),t.union(Fr)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");let n={visible:!0,active:!0,geometryIndex:t},s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Z0),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=n):(s=this._instanceInfo.length,this._instanceInfo.push(n));let r=this._matricesTexture;mi.identity().toArray(r.image.data,s*16),r.needsUpdate=!0;let l=this._colorsTexture;return l&&(gC.toArray(l.image.data,s*4),l.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);let s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=e===-1?t.getAttribute("position").count:e;let l=t.getIndex();if(l!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=n===-1?l.count:n),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Z0),h=this._availableGeometryIds.shift(),r[h]=s):(h=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(h,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,h}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let n=this.geometry,s=n.getIndex()!==null,r=n.getIndex(),l=e.getIndex(),c=this._geometryInfo[t];if(s&&l.count>c.reservedIndexCount||e.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let h=c.vertexStart,f=c.reservedVertexCount;c.vertexCount=e.getAttribute("position").count;for(let p in n.attributes){let m=e.getAttribute(p),g=n.getAttribute(p);xC(m,g,h);let v=m.itemSize;for(let y=m.count,b=f;y<b;y++){let S=h+y;for(let x=0;x<v;x++)g.setComponent(S,x,0)}g.needsUpdate=!0,g.addUpdateRange(h*v,f*v)}if(s){let p=c.indexStart,m=c.reservedIndexCount;c.indexCount=e.getIndex().count;for(let g=0;g<l.count;g++)r.setX(p+g,h+l.getX(g));for(let g=l.count,v=m;g<v;g++)r.setX(p+g,h);r.needsUpdate=!0,r.addUpdateRange(p,c.reservedIndexCount)}return c.start=s?c.indexStart:c.vertexStart,c.count=s?c.indexCount:c.vertexCount,c.boundingBox=null,e.boundingBox!==null&&(c.boundingBox=e.boundingBox.clone()),c.boundingSphere=null,e.boundingSphere!==null&&(c.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){let e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;let n=this._instanceInfo;for(let s=0,r=n.length;s<r;s++)n[s].active&&n[s].geometryIndex===t&&this.deleteInstance(s);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0,n=this._geometryInfo,s=n.map((l,c)=>c).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),r=this.geometry;for(let l=0,c=n.length;l<c;l++){let h=s[l],f=n[h];if(f.active!==!1){if(r.index!==null){if(f.indexStart!==e){let{indexStart:p,vertexStart:m,reservedIndexCount:g}=f,v=r.index,y=v.array,b=t-m;for(let S=p;S<p+g;S++)y[S]=y[S]+b;v.array.copyWithin(e,p,p+g),v.addUpdateRange(e,g),v.needsUpdate=!0,f.indexStart=e}e+=f.reservedIndexCount}if(f.vertexStart!==t){let{vertexStart:p,reservedVertexCount:m}=f,g=r.attributes;for(let v in g){let y=g[v],{array:b,itemSize:S}=y;b.copyWithin(t*S,p*S,(p+m)*S),y.addUpdateRange(t*S,m*S),y.needsUpdate=!0}f.vertexStart=t}t+=f.reservedVertexCount,f.start=r.index?f.indexStart:f.vertexStart,this._nextIndexStart=r.index?f.indexStart+f.reservedIndexCount:0,this._nextVertexStart=f.vertexStart+f.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingBox===null){let r=new bn,l=n.index,c=n.attributes.position;for(let h=s.start,f=s.start+s.count;h<f;h++){let p=h;l&&(p=l.getX(p)),r.expandByPoint(uu.fromBufferAttribute(c,p))}s.boundingBox=r}return e.copy(s.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;let n=this.geometry,s=this._geometryInfo[t];if(s.boundingSphere===null){let r=new yn;this.getBoundingBoxAt(t,Fd),Fd.getCenter(r.center);let l=n.index,c=n.attributes.position,h=0;for(let f=s.start,p=s.start+s.count;f<p;f++){let m=f;l&&(m=l.getX(m)),uu.fromBufferAttribute(c,m),h=Math.max(h,r.center.distanceToSquared(uu))}r.radius=Math.sqrt(h),s.boundingSphere=r}return e.copy(s.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);let n=this._matricesTexture,s=this._matricesTexture.image.data;return e.toArray(s,t*16),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,t*16)}setColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,t*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,t*4)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e?this:(this._instanceInfo[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);let n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){let e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Z0);e[e.length-1]===n.length-1;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);let s=new Int32Array(t),r=new Int32Array(t);zr(this._multiDrawCounts,s),zr(this._multiDrawStarts,r),this._multiDrawCounts=s,this._multiDrawStarts=r,this._maxInstanceCount=t;let l=this._indirectTexture,c=this._matricesTexture,h=this._colorsTexture;l.dispose(),this._initIndirectTexture(),zr(l.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),zr(c.image.data,this._matricesTexture.image.data),h&&(h.dispose(),this._initColorsTexture(),zr(h.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){let n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new de,this._initializeGeometry(r));let l=this.geometry;r.index&&zr(r.index.array,l.index.array);for(let c in r.attributes)zr(r.attributes[c].array,l.attributes[c].array)}raycast(t,e){let n=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,l=this.geometry;Kn.material=this.material,Kn.geometry.index=l.index,Kn.geometry.attributes=l.attributes,Kn.geometry.boundingBox===null&&(Kn.geometry.boundingBox=new bn),Kn.geometry.boundingSphere===null&&(Kn.geometry.boundingSphere=new yn);for(let c=0,h=n.length;c<h;c++){if(!n[c].visible||!n[c].active)continue;let f=n[c].geometryIndex,p=s[f];Kn.geometry.setDrawRange(p.start,p.count),this.getMatrixAt(c,Kn.matrixWorld).premultiply(r),this.getBoundingBoxAt(f,Kn.geometry.boundingBox),this.getBoundingSphereAt(f,Kn.geometry.boundingSphere),Kn.raycast(t,zd);for(let m=0,g=zd.length;m<g;m++){let v=zd[m];v.object=this,v.batchId=c,e.push(v)}zd.length=0}Kn.material=null,Kn.geometry.index=null,Kn.geometry.attributes={},Kn.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._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(t,e,n,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let l=s.getIndex(),c=l===null?1:l.array.BYTES_PER_ELEMENT,h=this._instanceInfo,f=this._multiDrawStarts,p=this._multiDrawCounts,m=this._geometryInfo,g=this.perObjectFrustumCulled,v=this._indirectTexture,y=v.image.data,b=n.isArrayCamera?_C:GS;g&&!n.isArrayCamera&&(mi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),GS.setFromProjectionMatrix(mi,n.coordinateSystem,n.reversedDepth));let S=0;if(this.sortObjects){mi.copy(this.matrixWorld).invert(),uu.setFromMatrixPosition(n.matrixWorld).applyMatrix4(mi),kS.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(mi);for(let T=0,A=h.length;T<A;T++)if(h[T].visible&&h[T].active){let N=h[T].geometryIndex;this.getMatrixAt(T,mi),this.getBoundingSphereAt(N,Fr).applyMatrix4(mi);let D=!1;if(g&&(D=!b.intersectsSphere(Fr,n)),!D){let L=m[N],F=vC.subVectors(Fr.center,uu).dot(kS);j0.push(L.start,L.count,F,T)}}let x=j0.list,E=this.customSort;E===null?x.sort(r.transparent?mC:pC):E.call(this,x,n);for(let T=0,A=x.length;T<A;T++){let N=x[T];f[S]=N.start*c,p[S]=N.count,y[S]=N.index,S++}j0.reset()}else for(let x=0,E=h.length;x<E;x++)if(h[x].visible&&h[x].active){let T=h[x].geometryIndex,A=!1;if(g&&(this.getMatrixAt(x,mi),this.getBoundingSphereAt(T,Fr).applyMatrix4(mi),A=!b.intersectsSphere(Fr,n)),!A){let N=m[T];f[S]=N.start*c,p[S]=N.count,y[S]=x,S++}}v.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(t,e,n,s,r,l){this.onBeforeRender(t,null,s,r,l)}},Pn=class extends En{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Lt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},pp=new O,mp=new O,WS=new ue,hu=new ua,Vd=new yn,J0=new O,XS=new O,ms=class extends Oe{constructor(t=new de,e=new Pn){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let s=1,r=e.count;s<r;s++)pp.fromBufferAttribute(e,s-1),mp.fromBufferAttribute(e,s),n[s]=n[s-1],n[s]+=pp.distanceTo(mp);t.setAttribute("lineDistance",new Gt(n,1))}else wt("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vd.copy(n.boundingSphere),Vd.applyMatrix4(s),Vd.radius+=r,t.ray.intersectsSphere(Vd)===!1)return;WS.copy(s).invert(),hu.copy(t.ray).applyMatrix4(WS);let c=r/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,f=this.isLineSegments?2:1,p=n.index,g=n.attributes.position;if(p!==null){let v=Math.max(0,l.start),y=Math.min(p.count,l.start+l.count);for(let b=v,S=y-1;b<S;b+=f){let x=p.getX(b),E=p.getX(b+1),T=Hd(this,t,hu,h,x,E,b);T&&e.push(T)}if(this.isLineLoop){let b=p.getX(y-1),S=p.getX(v),x=Hd(this,t,hu,h,b,S,y-1);x&&e.push(x)}}else{let v=Math.max(0,l.start),y=Math.min(g.count,l.start+l.count);for(let b=v,S=y-1;b<S;b+=f){let x=Hd(this,t,hu,h,b,b+1,b);x&&e.push(x)}if(this.isLineLoop){let b=Hd(this,t,hu,h,y-1,v,y-1);b&&e.push(b)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}};function Hd(i,t,e,n,s,r,l){let c=i.geometry.attributes.position;if(pp.fromBufferAttribute(c,s),mp.fromBufferAttribute(c,r),e.distanceSqToSegment(pp,mp,J0,XS)>n)return;J0.applyMatrix4(i.matrixWorld);let f=t.ray.origin.distanceTo(J0);if(!(f<t.near||f>t.far))return{distance:f,point:XS.clone().applyMatrix4(i.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:i}}var qS=new O,YS=new O,Bi=class extends ms{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let s=0,r=e.count;s<r;s+=2)qS.fromBufferAttribute(e,s),YS.fromBufferAttribute(e,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+qS.distanceTo(YS);t.setAttribute("lineDistance",new Gt(n,1))}else wt("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Uu=class extends ms{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}},Ol=class extends En{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Lt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},ZS=new ue,l_=new ua,Gd=new yn,kd=new O,Pu=class extends Oe{constructor(t=new de,e=new Ol){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){let n=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Gd.copy(n.boundingSphere),Gd.applyMatrix4(s),Gd.radius+=r,t.ray.intersectsSphere(Gd)===!1)return;ZS.copy(s).invert(),l_.copy(t.ray).applyMatrix4(ZS);let c=r/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,f=n.index,m=n.attributes.position;if(f!==null){let g=Math.max(0,l.start),v=Math.min(f.count,l.start+l.count);for(let y=g,b=v;y<b;y++){let S=f.getX(y);kd.fromBufferAttribute(m,S),jS(kd,S,h,s,t,e,this)}}else{let g=Math.max(0,l.start),v=Math.min(m.count,l.start+l.count);for(let y=g,b=v;y<b;y++)kd.fromBufferAttribute(m,y),jS(kd,y,h,s,t,e,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,l=s.length;r<l;r++){let c=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=r}}}}};function jS(i,t,e,n,s,r,l){let c=l_.distanceSqToPoint(i);if(c<e){let h=new O;l_.closestPointToPoint(i,h),h.applyMatrix4(n);let f=s.ray.origin.distanceTo(h);if(f<s.near||f>s.far)return;r.push({distance:f,distanceToRay:Math.sqrt(c),point:h,index:t,face:null,faceIndex:null,barycoord:null,object:l})}}var Iu=class extends mn{constructor(t,e,n,s,r=Je,l=Je,c,h,f){super(t,e,n,s,r,l,c,h,f),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let p=this;function m(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=t.requestVideoFrameCallback(m)}"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(m))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},gp=class extends Iu{constructor(t,e,n,s,r,l,c,h){super({},t,e,n,s,r,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},_p=class extends mn{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=dn,this.minFilter=dn,this.generateMipmaps=!1,this.needsUpdate=!0}},io=class extends mn{constructor(t,e,n,s,r,l,c,h,f,p,m,g){super(null,l,c,h,f,p,s,r,m,g),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}},vp=class extends io{constructor(t,e,n,s,r,l){super(t,e,n,r,l),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=li,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},xp=class extends io{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,xs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},yp=class extends mn{constructor(t,e,n,s,r,l,c,h,f){super(t,e,n,s,r,l,c,h,f),this.isCanvasTexture=!0,this.needsUpdate=!0}},da=class extends mn{constructor(t,e,n=Fi,s,r,l,c=dn,h=dn,f,p=ds,m=1){if(p!==ds&&p!==va)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let g={width:t,height:e,depth:m};super(g,s,r,l,c,h,p,n,f),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new hs(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Lu=class extends da{constructor(t,e=Fi,n=xs,s,r,l=dn,c=dn,h,f=ds){let p={width:t,height:t,depth:1},m=[p,p,p,p,p,p];super(t,t,e,n,s,r,l,c,h,f),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},Bl=class extends mn{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},Ou=class i extends de{constructor(t=1,e=1,n=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:n,radialSegments:s,heightSegments:r},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),s=Math.max(3,Math.floor(s)),r=Math.max(1,Math.floor(r));let l=[],c=[],h=[],f=[],p=e/2,m=Math.PI/2*t,g=e,v=2*m+g,y=n*2+r,b=s+1,S=new O,x=new O;for(let E=0;E<=y;E++){let T=0,A=0,N=0,D=0;if(E<=n){let C=E/n,w=C*Math.PI/2;A=-p-t*Math.cos(w),N=t*Math.sin(w),D=-t*Math.cos(w),T=C*m}else if(E<=n+r){let C=(E-n)/r;A=-p+C*e,N=t,D=0,T=m+C*g}else{let C=(E-n-r)/n,w=C*Math.PI/2;A=p+t*Math.sin(w),N=t*Math.cos(w),D=t*Math.sin(w),T=m+g+C*m}let L=Math.max(0,Math.min(1,T/v)),F=0;E===0?F=.5/s:E===y&&(F=-.5/s);for(let C=0;C<=s;C++){let w=C/s,z=w*Math.PI*2,Y=Math.sin(z),G=Math.cos(z);x.x=-N*G,x.y=A,x.z=N*Y,c.push(x.x,x.y,x.z),S.set(-N*G,D,N*Y),S.normalize(),h.push(S.x,S.y,S.z),f.push(w+F,L)}if(E>0){let C=(E-1)*b;for(let w=0;w<s;w++){let z=C+w,Y=C+w+1,G=E*b+w,j=E*b+w+1;l.push(z,Y,G),l.push(Y,j,G)}}}this.setIndex(l),this.setAttribute("position",new Gt(c,3)),this.setAttribute("normal",new Gt(h,3)),this.setAttribute("uv",new Gt(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},Bu=class i extends de{constructor(t=1,e=32,n=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:s},e=Math.max(3,e);let r=[],l=[],c=[],h=[],f=new O,p=new ft;l.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(let m=0,g=3;m<=e;m++,g+=3){let v=n+m/e*s;f.x=t*Math.cos(v),f.y=t*Math.sin(v),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(l[g]/t+1)/2,p.y=(l[g+1]/t+1)/2,h.push(p.x,p.y)}for(let m=1;m<=e;m++)r.push(m,m+1,0);this.setIndex(r),this.setAttribute("position",new Gt(l,3)),this.setAttribute("normal",new Gt(c,3)),this.setAttribute("uv",new Gt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Fl=class i extends de{constructor(t=1,e=1,n=1,s=32,r=1,l=!1,c=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:s,heightSegments:r,openEnded:l,thetaStart:c,thetaLength:h};let f=this;s=Math.floor(s),r=Math.floor(r);let p=[],m=[],g=[],v=[],y=0,b=[],S=n/2,x=0;E(),l===!1&&(t>0&&T(!0),e>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Gt(m,3)),this.setAttribute("normal",new Gt(g,3)),this.setAttribute("uv",new Gt(v,2));function E(){let A=new O,N=new O,D=0,L=(e-t)/n;for(let F=0;F<=r;F++){let C=[],w=F/r,z=w*(e-t)+t;for(let Y=0;Y<=s;Y++){let G=Y/s,j=G*h+c,nt=Math.sin(j),J=Math.cos(j);N.x=z*nt,N.y=-w*n+S,N.z=z*J,m.push(N.x,N.y,N.z),A.set(nt,L,J).normalize(),g.push(A.x,A.y,A.z),v.push(G,1-w),C.push(y++)}b.push(C)}for(let F=0;F<s;F++)for(let C=0;C<r;C++){let w=b[C][F],z=b[C+1][F],Y=b[C+1][F+1],G=b[C][F+1];(t>0||C!==0)&&(p.push(w,z,G),D+=3),(e>0||C!==r-1)&&(p.push(z,Y,G),D+=3)}f.addGroup(x,D,0),x+=D}function T(A){let N=y,D=new ft,L=new O,F=0,C=A===!0?t:e,w=A===!0?1:-1;for(let Y=1;Y<=s;Y++)m.push(0,S*w,0),g.push(0,w,0),v.push(.5,.5),y++;let z=y;for(let Y=0;Y<=s;Y++){let j=Y/s*h+c,nt=Math.cos(j),J=Math.sin(j);L.x=C*J,L.y=S*w,L.z=C*nt,m.push(L.x,L.y,L.z),g.push(0,w,0),D.x=nt*.5+.5,D.y=J*.5*w+.5,v.push(D.x,D.y),y++}for(let Y=0;Y<s;Y++){let G=N+Y,j=z+Y;A===!0?p.push(j,j+1,G):p.push(j+1,j,G),F+=3}f.addGroup(x,F,A===!0?1:2),x+=F}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},zl=class i extends Fl{constructor(t=1,e=1,n=32,s=1,r=!1,l=0,c=Math.PI*2){super(0,t,e,n,s,r,l,c),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:s,openEnded:r,thetaStart:l,thetaLength:c}}static fromJSON(t){return new i(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},pa=class i extends de{constructor(t=[],e=[],n=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:s};let r=[],l=[];c(s),f(n),p(),this.setAttribute("position",new Gt(r,3)),this.setAttribute("normal",new Gt(r.slice(),3)),this.setAttribute("uv",new Gt(l,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function c(E){let T=new O,A=new O,N=new O;for(let D=0;D<e.length;D+=3)v(e[D+0],T),v(e[D+1],A),v(e[D+2],N),h(T,A,N,E)}function h(E,T,A,N){let D=N+1,L=[];for(let F=0;F<=D;F++){L[F]=[];let C=E.clone().lerp(A,F/D),w=T.clone().lerp(A,F/D),z=D-F;for(let Y=0;Y<=z;Y++)Y===0&&F===D?L[F][Y]=C:L[F][Y]=C.clone().lerp(w,Y/z)}for(let F=0;F<D;F++)for(let C=0;C<2*(D-F)-1;C++){let w=Math.floor(C/2);C%2===0?(g(L[F][w+1]),g(L[F+1][w]),g(L[F][w])):(g(L[F][w+1]),g(L[F+1][w+1]),g(L[F+1][w]))}}function f(E){let T=new O;for(let A=0;A<r.length;A+=3)T.x=r[A+0],T.y=r[A+1],T.z=r[A+2],T.normalize().multiplyScalar(E),r[A+0]=T.x,r[A+1]=T.y,r[A+2]=T.z}function p(){let E=new O;for(let T=0;T<r.length;T+=3){E.x=r[T+0],E.y=r[T+1],E.z=r[T+2];let A=S(E)/2/Math.PI+.5,N=x(E)/Math.PI+.5;l.push(A,1-N)}y(),m()}function m(){for(let E=0;E<l.length;E+=6){let T=l[E+0],A=l[E+2],N=l[E+4],D=Math.max(T,A,N),L=Math.min(T,A,N);D>.9&&L<.1&&(T<.2&&(l[E+0]+=1),A<.2&&(l[E+2]+=1),N<.2&&(l[E+4]+=1))}}function g(E){r.push(E.x,E.y,E.z)}function v(E,T){let A=E*3;T.x=t[A+0],T.y=t[A+1],T.z=t[A+2]}function y(){let E=new O,T=new O,A=new O,N=new O,D=new ft,L=new ft,F=new ft;for(let C=0,w=0;C<r.length;C+=9,w+=6){E.set(r[C+0],r[C+1],r[C+2]),T.set(r[C+3],r[C+4],r[C+5]),A.set(r[C+6],r[C+7],r[C+8]),D.set(l[w+0],l[w+1]),L.set(l[w+2],l[w+3]),F.set(l[w+4],l[w+5]),N.copy(E).add(T).add(A).divideScalar(3);let z=S(N);b(D,w+0,E,z),b(L,w+2,T,z),b(F,w+4,A,z)}}function b(E,T,A,N){N<0&&E.x===1&&(l[T]=E.x-1),A.x===0&&A.z===0&&(l[T]=N/2/Math.PI+.5)}function S(E){return Math.atan2(E.z,-E.x)}function x(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.vertices,t.indices,t.radius,t.detail)}},Fu=class i extends pa{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],l=[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(r,l,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},Wd=new O,Xd=new O,K0=new O,qd=new us,zu=class extends de{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){let s=Math.pow(10,4),r=Math.cos(Yr*e),l=t.getIndex(),c=t.getAttribute("position"),h=l?l.count:c.count,f=[0,0,0],p=["a","b","c"],m=new Array(3),g={},v=[];for(let y=0;y<h;y+=3){l?(f[0]=l.getX(y),f[1]=l.getX(y+1),f[2]=l.getX(y+2)):(f[0]=y,f[1]=y+1,f[2]=y+2);let{a:b,b:S,c:x}=qd;if(b.fromBufferAttribute(c,f[0]),S.fromBufferAttribute(c,f[1]),x.fromBufferAttribute(c,f[2]),qd.getNormal(K0),m[0]=`${Math.round(b.x*s)},${Math.round(b.y*s)},${Math.round(b.z*s)}`,m[1]=`${Math.round(S.x*s)},${Math.round(S.y*s)},${Math.round(S.z*s)}`,m[2]=`${Math.round(x.x*s)},${Math.round(x.y*s)},${Math.round(x.z*s)}`,!(m[0]===m[1]||m[1]===m[2]||m[2]===m[0]))for(let E=0;E<3;E++){let T=(E+1)%3,A=m[E],N=m[T],D=qd[p[E]],L=qd[p[T]],F=`${A}_${N}`,C=`${N}_${A}`;C in g&&g[C]?(K0.dot(g[C].normal)<=r&&(v.push(D.x,D.y,D.z),v.push(L.x,L.y,L.z)),g[C]=null):F in g||(g[F]={index0:f[E],index1:f[T],normal:K0.clone()})}}for(let y in g)if(g[y]){let{index0:b,index1:S}=g[y];Wd.fromBufferAttribute(c,b),Xd.fromBufferAttribute(c,S),v.push(Wd.x,Wd.y,Wd.z),v.push(Xd.x,Xd.y,Xd.z)}this.setAttribute("position",new Gt(v,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}},yi=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){wt("Curve: .getPoint() not implemented.")}getPointAt(t,e){let n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],n,s=this.getPoint(0),r=0;e.push(0);for(let l=1;l<=t;l++)n=this.getPoint(l/t),r+=n.distanceTo(s),e.push(r),s=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let n=this.getLengths(),s=0,r=n.length,l;e?l=e:l=t*n[r-1];let c=0,h=r-1,f;for(;c<=h;)if(s=Math.floor(c+(h-c)/2),f=n[s]-l,f<0)c=s+1;else if(f>0)h=s-1;else{h=s;break}if(s=h,n[s]===l)return s/(r-1);let p=n[s],g=n[s+1]-p,v=(l-p)/g;return(s+v)/(r-1)}getTangent(t,e){let s=t-1e-4,r=t+1e-4;s<0&&(s=0),r>1&&(r=1);let l=this.getPoint(s),c=this.getPoint(r),h=e||(l.isVector2?new ft:new O);return h.copy(c).sub(l).normalize(),h}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){let n=new O,s=[],r=[],l=[],c=new O,h=new ue;for(let v=0;v<=t;v++){let y=v/t;s[v]=this.getTangentAt(y,new O)}r[0]=new O,l[0]=new O;let f=Number.MAX_VALUE,p=Math.abs(s[0].x),m=Math.abs(s[0].y),g=Math.abs(s[0].z);p<=f&&(f=p,n.set(1,0,0)),m<=f&&(f=m,n.set(0,1,0)),g<=f&&n.set(0,0,1),c.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],c),l[0].crossVectors(s[0],r[0]);for(let v=1;v<=t;v++){if(r[v]=r[v-1].clone(),l[v]=l[v-1].clone(),c.crossVectors(s[v-1],s[v]),c.length()>Number.EPSILON){c.normalize();let y=Math.acos(le(s[v-1].dot(s[v]),-1,1));r[v].applyMatrix4(h.makeRotationAxis(c,y))}l[v].crossVectors(s[v],r[v])}if(e===!0){let v=Math.acos(le(r[0].dot(r[t]),-1,1));v/=t,s[0].dot(c.crossVectors(r[0],r[t]))>0&&(v=-v);for(let y=1;y<=t;y++)r[y].applyMatrix4(h.makeRotationAxis(s[y],v*y)),l[y].crossVectors(s[y],r[y])}return{tangents:s,normals:r,binormals:l}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},so=class extends yi{constructor(t=0,e=0,n=1,s=1,r=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(t,e=new ft){let n=e,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,l=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(l?r=0:r=s),this.aClockwise===!0&&!l&&(r===s?r=-s:r=r-s);let c=this.aStartAngle+t*r,h=this.aX+this.xRadius*Math.cos(c),f=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){let p=Math.cos(this.aRotation),m=Math.sin(this.aRotation),g=h-this.aX,v=f-this.aY;h=g*p-v*m+this.aX,f=g*m+v*p+this.aY}return n.set(h,f)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},Vu=class extends so{constructor(t,e,n,s,r,l){super(t,e,n,n,s,r,l),this.isArcCurve=!0,this.type="ArcCurve"}};function av(){let i=0,t=0,e=0,n=0;function s(r,l,c,h){i=r,t=c,e=-3*r+3*l-2*c-h,n=2*r-2*l+c+h}return{initCatmullRom:function(r,l,c,h,f){s(l,c,f*(c-r),f*(h-l))},initNonuniformCatmullRom:function(r,l,c,h,f,p,m){let g=(l-r)/f-(c-r)/(f+p)+(c-l)/p,v=(c-l)/p-(h-l)/(p+m)+(h-c)/m;g*=p,v*=p,s(l,c,g,v)},calc:function(r){let l=r*r,c=l*r;return i+t*r+e*l+n*c}}}var Yd=new O,Q0=new av,$0=new av,t_=new av,Hu=class extends yi{constructor(t=[],e=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=s}getPoint(t,e=new O){let n=e,s=this.points,r=s.length,l=(r-(this.closed?0:1))*t,c=Math.floor(l),h=l-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/r)+1)*r:h===0&&c===r-1&&(c=r-2,h=1);let f,p;this.closed||c>0?f=s[(c-1)%r]:(Yd.subVectors(s[0],s[1]).add(s[0]),f=Yd);let m=s[c%r],g=s[(c+1)%r];if(this.closed||c+2<r?p=s[(c+2)%r]:(Yd.subVectors(s[r-1],s[r-2]).add(s[r-1]),p=Yd),this.curveType==="centripetal"||this.curveType==="chordal"){let v=this.curveType==="chordal"?.5:.25,y=Math.pow(f.distanceToSquared(m),v),b=Math.pow(m.distanceToSquared(g),v),S=Math.pow(g.distanceToSquared(p),v);b<1e-4&&(b=1),y<1e-4&&(y=b),S<1e-4&&(S=b),Q0.initNonuniformCatmullRom(f.x,m.x,g.x,p.x,y,b,S),$0.initNonuniformCatmullRom(f.y,m.y,g.y,p.y,y,b,S),t_.initNonuniformCatmullRom(f.z,m.z,g.z,p.z,y,b,S)}else this.curveType==="catmullrom"&&(Q0.initCatmullRom(f.x,m.x,g.x,p.x,this.tension),$0.initCatmullRom(f.y,m.y,g.y,p.y,this.tension),t_.initCatmullRom(f.z,m.z,g.z,p.z,this.tension));return n.set(Q0.calc(h),$0.calc(h),t_.calc(h)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new O().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function JS(i,t,e,n,s){let r=(n-t)*.5,l=(s-e)*.5,c=i*i,h=i*c;return(2*e-2*n+r+l)*h+(-3*e+3*n-2*r-l)*c+r*i+e}function yC(i,t){let e=1-i;return e*e*t}function SC(i,t){return 2*(1-i)*i*t}function MC(i,t){return i*i*t}function gu(i,t,e,n){return yC(i,t)+SC(i,e)+MC(i,n)}function bC(i,t){let e=1-i;return e*e*e*t}function EC(i,t){let e=1-i;return 3*e*e*i*t}function TC(i,t){return 3*(1-i)*i*i*t}function AC(i,t){return i*i*i*t}function _u(i,t,e,n,s){return bC(i,t)+EC(i,e)+TC(i,n)+AC(i,s)}var Vl=class extends yi{constructor(t=new ft,e=new ft,n=new ft,s=new ft){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new ft){let n=e,s=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(_u(t,s.x,r.x,l.x,c.x),_u(t,s.y,r.y,l.y,c.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Gu=class extends yi{constructor(t=new O,e=new O,n=new O,s=new O){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new O){let n=e,s=this.v0,r=this.v1,l=this.v2,c=this.v3;return n.set(_u(t,s.x,r.x,l.x,c.x),_u(t,s.y,r.y,l.y,c.y),_u(t,s.z,r.z,l.z,c.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Hl=class extends yi{constructor(t=new ft,e=new ft){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ft){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new ft){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},ku=class extends yi{constructor(t=new O,e=new O){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new O){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new O){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Gl=class extends yi{constructor(t=new ft,e=new ft,n=new ft){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ft){let n=e,s=this.v0,r=this.v1,l=this.v2;return n.set(gu(t,s.x,r.x,l.x),gu(t,s.y,r.y,l.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},kl=class extends yi{constructor(t=new O,e=new O,n=new O){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new O){let n=e,s=this.v0,r=this.v1,l=this.v2;return n.set(gu(t,s.x,r.x,l.x),gu(t,s.y,r.y,l.y),gu(t,s.z,r.z,l.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Wl=class extends yi{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new ft){let n=e,s=this.points,r=(s.length-1)*t,l=Math.floor(r),c=r-l,h=s[l===0?l:l-1],f=s[l],p=s[l>s.length-2?s.length-1:l+1],m=s[l>s.length-3?s.length-1:l+2];return n.set(JS(c,h.x,f.x,p.x,m.x),JS(c,h.y,f.y,p.y,m.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new ft().fromArray(s))}return this}},Sp=Object.freeze({__proto__:null,ArcCurve:Vu,CatmullRomCurve3:Hu,CubicBezierCurve:Vl,CubicBezierCurve3:Gu,EllipseCurve:so,LineCurve:Hl,LineCurve3:ku,QuadraticBezierCurve:Gl,QuadraticBezierCurve3:kl,SplineCurve:Wl}),Wu=class extends yi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Sp[n](e,t))}return this}getPoint(t,e){let n=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=n){let l=s[r]-n,c=this.curves[r],h=c.getLength(),f=h===0?0:1-l/h;return c.getPointAt(f,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let n=0,s=this.curves.length;n<s;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],n;for(let s=0,r=this.curves;s<r.length;s++){let l=r[s],c=l.isEllipseCurve?t*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?t*l.points.length:t,h=l.getPoints(c);for(let f=0;f<h.length;f++){let p=h[f];n&&n.equals(p)||(e.push(p),n=p)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(new Sp[s.type]().fromJSON(s))}return this}},ao=class extends Wu{constructor(t){super(),this.type="Path",this.currentPoint=new ft,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let n=new Hl(this.currentPoint.clone(),new ft(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,s){let r=new Gl(this.currentPoint.clone(),new ft(t,e),new ft(n,s));return this.curves.push(r),this.currentPoint.set(n,s),this}bezierCurveTo(t,e,n,s,r,l){let c=new Vl(this.currentPoint.clone(),new ft(t,e),new ft(n,s),new ft(r,l));return this.curves.push(c),this.currentPoint.set(r,l),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),n=new Wl(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,s,r,l){let c=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(t+c,e+h,n,s,r,l),this}absarc(t,e,n,s,r,l){return this.absellipse(t,e,n,n,s,r,l),this}ellipse(t,e,n,s,r,l,c,h){let f=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(t+f,e+p,n,s,r,l,c,h),this}absellipse(t,e,n,s,r,l,c,h){let f=new so(t,e,n,s,r,l,c,h);if(this.curves.length>0){let m=f.getPoint(0);m.equals(this.currentPoint)||this.lineTo(m.x,m.y)}this.curves.push(f);let p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},Ds=class extends ao{constructor(t){super(t),this.uuid=Li(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,s=this.holes.length;n<s;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(new ao().fromJSON(s))}return this}};function CC(i,t,e=2){let n=t&&t.length,s=n?t[0]*e:i.length,r=mb(i,0,s,e,!0),l=[];if(!r||r.next===r.prev)return l;let c,h,f;if(n&&(r=UC(i,t,r,e)),i.length>80*e){c=i[0],h=i[1];let p=c,m=h;for(let g=e;g<s;g+=e){let v=i[g],y=i[g+1];v<c&&(c=v),y<h&&(h=y),v>p&&(p=v),y>m&&(m=y)}f=Math.max(p-c,m-h),f=f!==0?32767/f:0}return Xu(r,l,e,c,h,f,0),l}function mb(i,t,e,n,s){let r;if(s===kC(i,t,e,n)>0)for(let l=t;l<e;l+=n)r=KS(l/n|0,i[l],i[l+1],r);else for(let l=e-n;l>=t;l-=n)r=KS(l/n|0,i[l],i[l+1],r);return r&&Xl(r,r.next)&&(Yu(r),r=r.next),r}function ro(i,t){if(!i)return i;t||(t=i);let e=i,n;do if(n=!1,!e.steiner&&(Xl(e,e.next)||an(e.prev,e,e.next)===0)){if(Yu(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Xu(i,t,e,n,s,r,l){if(!i)return;!l&&r&&BC(i,n,s,r);let c=i;for(;i.prev!==i.next;){let h=i.prev,f=i.next;if(r?wC(i,n,s,r):RC(i)){t.push(h.i,i.i,f.i),Yu(i),i=f.next,c=f.next;continue}if(i=f,i===c){l?l===1?(i=NC(ro(i),t),Xu(i,t,e,n,s,r,2)):l===2&&DC(i,t,e,n,s,r):Xu(ro(i),t,e,n,s,r,1);break}}}function RC(i){let t=i.prev,e=i,n=i.next;if(an(t,e,n)>=0)return!1;let s=t.x,r=e.x,l=n.x,c=t.y,h=e.y,f=n.y,p=Math.min(s,r,l),m=Math.min(c,h,f),g=Math.max(s,r,l),v=Math.max(c,h,f),y=n.next;for(;y!==t;){if(y.x>=p&&y.x<=g&&y.y>=m&&y.y<=v&&du(s,c,r,h,l,f,y.x,y.y)&&an(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function wC(i,t,e,n){let s=i.prev,r=i,l=i.next;if(an(s,r,l)>=0)return!1;let c=s.x,h=r.x,f=l.x,p=s.y,m=r.y,g=l.y,v=Math.min(c,h,f),y=Math.min(p,m,g),b=Math.max(c,h,f),S=Math.max(p,m,g),x=c_(v,y,t,e,n),E=c_(b,S,t,e,n),T=i.prevZ,A=i.nextZ;for(;T&&T.z>=x&&A&&A.z<=E;){if(T.x>=v&&T.x<=b&&T.y>=y&&T.y<=S&&T!==s&&T!==l&&du(c,p,h,m,f,g,T.x,T.y)&&an(T.prev,T,T.next)>=0||(T=T.prevZ,A.x>=v&&A.x<=b&&A.y>=y&&A.y<=S&&A!==s&&A!==l&&du(c,p,h,m,f,g,A.x,A.y)&&an(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;T&&T.z>=x;){if(T.x>=v&&T.x<=b&&T.y>=y&&T.y<=S&&T!==s&&T!==l&&du(c,p,h,m,f,g,T.x,T.y)&&an(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;A&&A.z<=E;){if(A.x>=v&&A.x<=b&&A.y>=y&&A.y<=S&&A!==s&&A!==l&&du(c,p,h,m,f,g,A.x,A.y)&&an(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function NC(i,t){let e=i;do{let n=e.prev,s=e.next.next;!Xl(n,s)&&_b(n,e,e.next,s)&&qu(n,s)&&qu(s,n)&&(t.push(n.i,e.i,s.i),Yu(e),Yu(e.next),e=i=s),e=e.next}while(e!==i);return ro(e)}function DC(i,t,e,n,s,r){let l=i;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&VC(l,c)){let h=vb(l,c);l=ro(l,l.next),h=ro(h,h.next),Xu(l,t,e,n,s,r,0),Xu(h,t,e,n,s,r,0);return}c=c.next}l=l.next}while(l!==i)}function UC(i,t,e,n){let s=[];for(let r=0,l=t.length;r<l;r++){let c=t[r]*n,h=r<l-1?t[r+1]*n:i.length,f=mb(i,c,h,n,!1);f===f.next&&(f.steiner=!0),s.push(zC(f))}s.sort(PC);for(let r=0;r<s.length;r++)e=IC(s[r],e);return e}function PC(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=n-s}return e}function IC(i,t){let e=LC(i,t);if(!e)return t;let n=vb(e,i);return ro(n,n.next),ro(e,e.next)}function LC(i,t){let e=t,n=i.x,s=i.y,r=-1/0,l;if(Xl(i,e))return e;do{if(Xl(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let m=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(m<=n&&m>r&&(r=m,l=e.x<e.next.x?e:e.next,m===n))return l}e=e.next}while(e!==t);if(!l)return null;let c=l,h=l.x,f=l.y,p=1/0;e=l;do{if(n>=e.x&&e.x>=h&&n!==e.x&&gb(s<f?n:r,s,h,f,s<f?r:n,s,e.x,e.y)){let m=Math.abs(s-e.y)/(n-e.x);qu(e,i)&&(m<p||m===p&&(e.x>l.x||e.x===l.x&&OC(l,e)))&&(l=e,p=m)}e=e.next}while(e!==c);return l}function OC(i,t){return an(i.prev,i,t.prev)<0&&an(t.next,i,i.next)<0}function BC(i,t,e,n){let s=i;do s.z===0&&(s.z=c_(s.x,s.y,t,e,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,FC(s)}function FC(i){let t,e=1;do{let n=i,s;i=null;let r=null;for(t=0;n;){t++;let l=n,c=0;for(let f=0;f<e&&(c++,l=l.nextZ,!!l);f++);let h=e;for(;c>0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(s=n,n=n.nextZ,c--):(s=l,l=l.nextZ,h--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;n=l}r.nextZ=null,e*=2}while(t>1);return i}function c_(i,t,e,n,s){return i=(i-e)*s|0,t=(t-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function zC(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function gb(i,t,e,n,s,r,l,c){return(s-l)*(t-c)>=(i-l)*(r-c)&&(i-l)*(n-c)>=(e-l)*(t-c)&&(e-l)*(r-c)>=(s-l)*(n-c)}function du(i,t,e,n,s,r,l,c){return!(i===l&&t===c)&&gb(i,t,e,n,s,r,l,c)}function VC(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!HC(i,t)&&(qu(i,t)&&qu(t,i)&&GC(i,t)&&(an(i.prev,i,t.prev)||an(i,t.prev,t))||Xl(i,t)&&an(i.prev,i,i.next)>0&&an(t.prev,t,t.next)>0)}function an(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xl(i,t){return i.x===t.x&&i.y===t.y}function _b(i,t,e,n){let s=jd(an(i,t,e)),r=jd(an(i,t,n)),l=jd(an(e,n,i)),c=jd(an(e,n,t));return!!(s!==r&&l!==c||s===0&&Zd(i,e,t)||r===0&&Zd(i,n,t)||l===0&&Zd(e,i,n)||c===0&&Zd(e,t,n))}function Zd(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function jd(i){return i>0?1:i<0?-1:0}function HC(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&_b(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function qu(i,t){return an(i.prev,i,i.next)<0?an(i,t,i.next)>=0&&an(i,i.prev,t)>=0:an(i,t,i.prev)<0||an(i,i.next,t)<0}function GC(i,t){let e=i,n=!1,s=(i.x+t.x)/2,r=(i.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&s<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==i);return n}function vb(i,t){let e=u_(i.i,i.x,i.y),n=u_(t.i,t.x,t.y),s=i.next,r=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function KS(i,t,e,n){let s=u_(i,t,e);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Yu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function u_(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kC(i,t,e,n){let s=0;for(let r=t,l=e-n;r<e;r+=n)s+=(i[l]-i[r])*(i[r+1]+i[l+1]),l=r;return s}var h_=class{static triangulate(t,e,n=2){return CC(t,e,n)}},Qi=class i{static area(t){let e=t.length,n=0;for(let s=e-1,r=0;r<e;s=r++)n+=t[s].x*t[r].y-t[r].x*t[s].y;return n*.5}static isClockWise(t){return i.area(t)<0}static triangulateShape(t,e){let n=[],s=[],r=[];QS(t),$S(n,t);let l=t.length;e.forEach(QS);for(let h=0;h<e.length;h++)s.push(l),l+=e[h].length,$S(n,e[h]);let c=h_.triangulate(n,s);for(let h=0;h<c.length;h+=3)r.push(c.slice(h,h+3));return r}};function QS(i){let t=i.length;t>2&&i[t-1].equals(i[0])&&i.pop()}function $S(i,t){for(let e=0;e<t.length;e++)i.push(t[e].x),i.push(t[e].y)}var Zu=class i extends de{constructor(t=new Ds([new ft(.5,.5),new ft(-.5,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let n=this,s=[],r=[];for(let c=0,h=t.length;c<h;c++){let f=t[c];l(f)}this.setAttribute("position",new Gt(s,3)),this.setAttribute("uv",new Gt(r,2)),this.computeVertexNormals();function l(c){let h=[],f=e.curveSegments!==void 0?e.curveSegments:12,p=e.steps!==void 0?e.steps:1,m=e.depth!==void 0?e.depth:1,g=e.bevelEnabled!==void 0?e.bevelEnabled:!0,v=e.bevelThickness!==void 0?e.bevelThickness:.2,y=e.bevelSize!==void 0?e.bevelSize:v-.1,b=e.bevelOffset!==void 0?e.bevelOffset:0,S=e.bevelSegments!==void 0?e.bevelSegments:3,x=e.extrudePath,E=e.UVGenerator!==void 0?e.UVGenerator:WC,T,A=!1,N,D,L,F;if(x){T=x.getSpacedPoints(p),A=!0,g=!1;let ct=x.isCatmullRomCurve3?x.closed:!1;N=x.computeFrenetFrames(p,ct),D=new O,L=new O,F=new O}g||(S=0,v=0,y=0,b=0);let C=c.extractPoints(f),w=C.shape,z=C.holes;if(!Qi.isClockWise(w)){w=w.reverse();for(let ct=0,gt=z.length;ct<gt;ct++){let lt=z[ct];Qi.isClockWise(lt)&&(z[ct]=lt.reverse())}}function G(ct){let lt=10000000000000001e-36,Nt=ct[0];for(let B=1;B<=ct.length;B++){let Zt=B%ct.length,Dt=ct[Zt],se=Dt.x-Nt.x,Mt=Dt.y-Nt.y,I=se*se+Mt*Mt,R=Math.max(Math.abs(Dt.x),Math.abs(Dt.y),Math.abs(Nt.x),Math.abs(Nt.y)),k=lt*R*R;if(I<=k){ct.splice(Zt,1),B--;continue}Nt=Dt}}G(w),z.forEach(G);let j=z.length,nt=w;for(let ct=0;ct<j;ct++){let gt=z[ct];w=w.concat(gt)}function J(ct,gt,lt){return gt||Qt("ExtrudeGeometry: vec does not exist"),ct.clone().addScaledVector(gt,lt)}let et=w.length;function rt(ct,gt,lt){let Nt,B,Zt,Dt=ct.x-gt.x,se=ct.y-gt.y,Mt=lt.x-ct.x,I=lt.y-ct.y,R=Dt*Dt+se*se,k=Dt*I-se*Mt;if(Math.abs(k)>Number.EPSILON){let it=Math.sqrt(R),ht=Math.sqrt(Mt*Mt+I*I),st=gt.x-se/it,jt=gt.y+Dt/it,Et=lt.x-I/ht,Wt=lt.y+Mt/ht,Kt=((Et-st)*I-(Wt-jt)*Mt)/(Dt*I-se*Mt);Nt=st+Dt*Kt-ct.x,B=jt+se*Kt-ct.y;let pt=Nt*Nt+B*B;if(pt<=2)return new ft(Nt,B);Zt=Math.sqrt(pt/2)}else{let it=!1;Dt>Number.EPSILON?Mt>Number.EPSILON&&(it=!0):Dt<-Number.EPSILON?Mt<-Number.EPSILON&&(it=!0):Math.sign(se)===Math.sign(I)&&(it=!0),it?(Nt=-se,B=Dt,Zt=Math.sqrt(R)):(Nt=Dt,B=se,Zt=Math.sqrt(R/2))}return new ft(Nt/Zt,B/Zt)}let St=[];for(let ct=0,gt=nt.length,lt=gt-1,Nt=ct+1;ct<gt;ct++,lt++,Nt++)lt===gt&&(lt=0),Nt===gt&&(Nt=0),St[ct]=rt(nt[ct],nt[lt],nt[Nt]);let bt=[],mt,kt=St.concat();for(let ct=0,gt=j;ct<gt;ct++){let lt=z[ct];mt=[];for(let Nt=0,B=lt.length,Zt=B-1,Dt=Nt+1;Nt<B;Nt++,Zt++,Dt++)Zt===B&&(Zt=0),Dt===B&&(Dt=0),mt[Nt]=rt(lt[Nt],lt[Zt],lt[Dt]);bt.push(mt),kt=kt.concat(mt)}let $t;if(S===0)$t=Qi.triangulateShape(nt,z);else{let ct=[],gt=[];for(let lt=0;lt<S;lt++){let Nt=lt/S,B=v*Math.cos(Nt*Math.PI/2),Zt=y*Math.sin(Nt*Math.PI/2)+b;for(let Dt=0,se=nt.length;Dt<se;Dt++){let Mt=J(nt[Dt],St[Dt],Zt);ie(Mt.x,Mt.y,-B),Nt===0&&ct.push(Mt)}for(let Dt=0,se=j;Dt<se;Dt++){let Mt=z[Dt];mt=bt[Dt];let I=[];for(let R=0,k=Mt.length;R<k;R++){let it=J(Mt[R],mt[R],Zt);ie(it.x,it.y,-B),Nt===0&&I.push(it)}Nt===0&&gt.push(I)}}$t=Qi.triangulateShape(ct,gt)}let re=$t.length,Ce=y+b;for(let ct=0;ct<et;ct++){let gt=g?J(w[ct],kt[ct],Ce):w[ct];A?(L.copy(N.normals[0]).multiplyScalar(gt.x),D.copy(N.binormals[0]).multiplyScalar(gt.y),F.copy(T[0]).add(L).add(D),ie(F.x,F.y,F.z)):ie(gt.x,gt.y,0)}for(let ct=1;ct<=p;ct++)for(let gt=0;gt<et;gt++){let lt=g?J(w[gt],kt[gt],Ce):w[gt];A?(L.copy(N.normals[ct]).multiplyScalar(lt.x),D.copy(N.binormals[ct]).multiplyScalar(lt.y),F.copy(T[ct]).add(L).add(D),ie(F.x,F.y,F.z)):ie(lt.x,lt.y,m/p*ct)}for(let ct=S-1;ct>=0;ct--){let gt=ct/S,lt=v*Math.cos(gt*Math.PI/2),Nt=y*Math.sin(gt*Math.PI/2)+b;for(let B=0,Zt=nt.length;B<Zt;B++){let Dt=J(nt[B],St[B],Nt);ie(Dt.x,Dt.y,m+lt)}for(let B=0,Zt=z.length;B<Zt;B++){let Dt=z[B];mt=bt[B];for(let se=0,Mt=Dt.length;se<Mt;se++){let I=J(Dt[se],mt[se],Nt);A?ie(I.x,I.y+T[p-1].y,T[p-1].x+lt):ie(I.x,I.y,m+lt)}}}at(),dt();function at(){let ct=s.length/3;if(g){let gt=0,lt=et*gt;for(let Nt=0;Nt<re;Nt++){let B=$t[Nt];Ft(B[2]+lt,B[1]+lt,B[0]+lt)}gt=p+S*2,lt=et*gt;for(let Nt=0;Nt<re;Nt++){let B=$t[Nt];Ft(B[0]+lt,B[1]+lt,B[2]+lt)}}else{for(let gt=0;gt<re;gt++){let lt=$t[gt];Ft(lt[2],lt[1],lt[0])}for(let gt=0;gt<re;gt++){let lt=$t[gt];Ft(lt[0]+et*p,lt[1]+et*p,lt[2]+et*p)}}n.addGroup(ct,s.length/3-ct,0)}function dt(){let ct=s.length/3,gt=0;Vt(nt,gt),gt+=nt.length;for(let lt=0,Nt=z.length;lt<Nt;lt++){let B=z[lt];Vt(B,gt),gt+=B.length}n.addGroup(ct,s.length/3-ct,1)}function Vt(ct,gt){let lt=ct.length;for(;--lt>=0;){let Nt=lt,B=lt-1;B<0&&(B=ct.length-1);for(let Zt=0,Dt=p+S*2;Zt<Dt;Zt++){let se=et*Zt,Mt=et*(Zt+1),I=gt+Nt+se,R=gt+B+se,k=gt+B+Mt,it=gt+Nt+Mt;ye(I,R,k,it)}}}function ie(ct,gt,lt){h.push(ct),h.push(gt),h.push(lt)}function Ft(ct,gt,lt){Re(ct),Re(gt),Re(lt);let Nt=s.length/3,B=E.generateTopUV(n,s,Nt-3,Nt-2,Nt-1);ce(B[0]),ce(B[1]),ce(B[2])}function ye(ct,gt,lt,Nt){Re(ct),Re(gt),Re(Nt),Re(gt),Re(lt),Re(Nt);let B=s.length/3,Zt=E.generateSideWallUV(n,s,B-6,B-3,B-2,B-1);ce(Zt[0]),ce(Zt[1]),ce(Zt[3]),ce(Zt[1]),ce(Zt[2]),ce(Zt[3])}function Re(ct){s.push(h[ct*3+0]),s.push(h[ct*3+1]),s.push(h[ct*3+2])}function ce(ct){r.push(ct.x),r.push(ct.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return XC(e,n,t)}static fromJSON(t,e){let n=[];for(let r=0,l=t.shapes.length;r<l;r++){let c=e[t.shapes[r]];n.push(c)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Sp[s.type]().fromJSON(s)),new i(n,t.options)}},WC={generateTopUV:function(i,t,e,n,s){let r=t[e*3],l=t[e*3+1],c=t[n*3],h=t[n*3+1],f=t[s*3],p=t[s*3+1];return[new ft(r,l),new ft(c,h),new ft(f,p)]},generateSideWallUV:function(i,t,e,n,s,r){let l=t[e*3],c=t[e*3+1],h=t[e*3+2],f=t[n*3],p=t[n*3+1],m=t[n*3+2],g=t[s*3],v=t[s*3+1],y=t[s*3+2],b=t[r*3],S=t[r*3+1],x=t[r*3+2];return Math.abs(c-p)<Math.abs(l-f)?[new ft(l,1-h),new ft(f,1-m),new ft(g,1-y),new ft(b,1-x)]:[new ft(c,1-h),new ft(p,1-m),new ft(v,1-y),new ft(S,1-x)]}};function XC(i,t,e){if(e.shapes=[],Array.isArray(i))for(let n=0,s=i.length;n<s;n++){let r=i[n];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var ju=class i extends pa{constructor(t=1,e=0){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[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,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},Ju=class i extends de{constructor(t=[new ft(0,-.5),new ft(.5,0),new ft(0,.5)],e=12,n=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:s},e=Math.floor(e),s=le(s,0,Math.PI*2);let r=[],l=[],c=[],h=[],f=[],p=1/e,m=new O,g=new ft,v=new O,y=new O,b=new O,S=0,x=0;for(let E=0;E<=t.length-1;E++)switch(E){case 0:S=t[E+1].x-t[E].x,x=t[E+1].y-t[E].y,v.x=x*1,v.y=-S,v.z=x*0,b.copy(v),v.normalize(),h.push(v.x,v.y,v.z);break;case t.length-1:h.push(b.x,b.y,b.z);break;default:S=t[E+1].x-t[E].x,x=t[E+1].y-t[E].y,v.x=x*1,v.y=-S,v.z=x*0,y.copy(v),v.x+=b.x,v.y+=b.y,v.z+=b.z,v.normalize(),h.push(v.x,v.y,v.z),b.copy(y)}for(let E=0;E<=e;E++){let T=n+E*p*s,A=Math.sin(T),N=Math.cos(T);for(let D=0;D<=t.length-1;D++){m.x=t[D].x*A,m.y=t[D].y,m.z=t[D].x*N,l.push(m.x,m.y,m.z),g.x=E/e,g.y=D/(t.length-1),c.push(g.x,g.y);let L=h[3*D+0]*A,F=h[3*D+1],C=h[3*D+0]*N;f.push(L,F,C)}}for(let E=0;E<e;E++)for(let T=0;T<t.length-1;T++){let A=T+E*t.length,N=A,D=A+t.length,L=A+t.length+1,F=A+1;r.push(N,D,F),r.push(L,F,D)}this.setIndex(r),this.setAttribute("position",new Gt(l,3)),this.setAttribute("uv",new Gt(c,2)),this.setAttribute("normal",new Gt(f,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.points,t.segments,t.phiStart,t.phiLength)}},ql=class i extends pa{constructor(t=1,e=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,s,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},oo=class i extends de{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};let r=t/2,l=e/2,c=Math.floor(n),h=Math.floor(s),f=c+1,p=h+1,m=t/c,g=e/h,v=[],y=[],b=[],S=[];for(let x=0;x<p;x++){let E=x*g-l;for(let T=0;T<f;T++){let A=T*m-r;y.push(A,-E,0),b.push(0,0,1),S.push(T/c),S.push(1-x/h)}}for(let x=0;x<h;x++)for(let E=0;E<c;E++){let T=E+f*x,A=E+f*(x+1),N=E+1+f*(x+1),D=E+1+f*x;v.push(T,A,D),v.push(A,N,D)}this.setIndex(v),this.setAttribute("position",new Gt(y,3)),this.setAttribute("normal",new Gt(b,3)),this.setAttribute("uv",new Gt(S,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}},Ku=class i extends de{constructor(t=.5,e=1,n=32,s=1,r=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:s,thetaStart:r,thetaLength:l},n=Math.max(3,n),s=Math.max(1,s);let c=[],h=[],f=[],p=[],m=t,g=(e-t)/s,v=new O,y=new ft;for(let b=0;b<=s;b++){for(let S=0;S<=n;S++){let x=r+S/n*l;v.x=m*Math.cos(x),v.y=m*Math.sin(x),h.push(v.x,v.y,v.z),f.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,p.push(y.x,y.y)}m+=g}for(let b=0;b<s;b++){let S=b*(n+1);for(let x=0;x<n;x++){let E=x+S,T=E,A=E+n+1,N=E+n+2,D=E+1;c.push(T,A,D),c.push(A,N,D)}}this.setIndex(c),this.setAttribute("position",new Gt(h,3)),this.setAttribute("normal",new Gt(f,3)),this.setAttribute("uv",new Gt(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Qu=class i extends de{constructor(t=new Ds([new ft(0,.5),new ft(-.5,-.5),new ft(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let n=[],s=[],r=[],l=[],c=0,h=0;if(Array.isArray(t)===!1)f(t);else for(let p=0;p<t.length;p++)f(t[p]),this.addGroup(c,h,p),c+=h,h=0;this.setIndex(n),this.setAttribute("position",new Gt(s,3)),this.setAttribute("normal",new Gt(r,3)),this.setAttribute("uv",new Gt(l,2));function f(p){let m=s.length/3,g=p.extractPoints(e),v=g.shape,y=g.holes;Qi.isClockWise(v)===!1&&(v=v.reverse());for(let S=0,x=y.length;S<x;S++){let E=y[S];Qi.isClockWise(E)===!0&&(y[S]=E.reverse())}let b=Qi.triangulateShape(v,y);for(let S=0,x=y.length;S<x;S++){let E=y[S];v=v.concat(E)}for(let S=0,x=v.length;S<x;S++){let E=v[S];s.push(E.x,E.y,0),r.push(0,0,1),l.push(E.x,E.y)}for(let S=0,x=b.length;S<x;S++){let E=b[S],T=E[0]+m,A=E[1]+m,N=E[2]+m;n.push(T,A,N),h+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return qC(e,t)}static fromJSON(t,e){let n=[];for(let s=0,r=t.shapes.length;s<r;s++){let l=e[t.shapes[s]];n.push(l)}return new i(n,t.curveSegments)}};function qC(i,t){if(t.shapes=[],Array.isArray(i))for(let e=0,n=i.length;e<n;e++){let s=i[e];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t}var Yl=class i extends de{constructor(t=1,e=32,n=16,s=0,r=Math.PI*2,l=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:s,phiLength:r,thetaStart:l,thetaLength:c},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));let h=Math.min(l+c,Math.PI),f=0,p=[],m=new O,g=new O,v=[],y=[],b=[],S=[];for(let x=0;x<=n;x++){let E=[],T=x/n,A=0;x===0&&l===0?A=.5/e:x===n&&h===Math.PI&&(A=-.5/e);for(let N=0;N<=e;N++){let D=N/e;m.x=-t*Math.cos(s+D*r)*Math.sin(l+T*c),m.y=t*Math.cos(l+T*c),m.z=t*Math.sin(s+D*r)*Math.sin(l+T*c),y.push(m.x,m.y,m.z),g.copy(m).normalize(),b.push(g.x,g.y,g.z),S.push(D+A,1-T),E.push(f++)}p.push(E)}for(let x=0;x<n;x++)for(let E=0;E<e;E++){let T=p[x][E+1],A=p[x][E],N=p[x+1][E],D=p[x+1][E+1];(x!==0||l>0)&&v.push(T,A,D),(x!==n-1||h<Math.PI)&&v.push(A,N,D)}this.setIndex(v),this.setAttribute("position",new Gt(y,3)),this.setAttribute("normal",new Gt(b,3)),this.setAttribute("uv",new Gt(S,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},$u=class i extends pa{constructor(t=1,e=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,s,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new i(t.radius,t.detail)}},th=class i extends de{constructor(t=1,e=.4,n=12,s=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:s,arc:r},n=Math.floor(n),s=Math.floor(s);let l=[],c=[],h=[],f=[],p=new O,m=new O,g=new O;for(let v=0;v<=n;v++)for(let y=0;y<=s;y++){let b=y/s*r,S=v/n*Math.PI*2;m.x=(t+e*Math.cos(S))*Math.cos(b),m.y=(t+e*Math.cos(S))*Math.sin(b),m.z=e*Math.sin(S),c.push(m.x,m.y,m.z),p.x=t*Math.cos(b),p.y=t*Math.sin(b),g.subVectors(m,p).normalize(),h.push(g.x,g.y,g.z),f.push(y/s),f.push(v/n)}for(let v=1;v<=n;v++)for(let y=1;y<=s;y++){let b=(s+1)*v+y-1,S=(s+1)*(v-1)+y-1,x=(s+1)*(v-1)+y,E=(s+1)*v+y;l.push(b,S,E),l.push(S,x,E)}this.setIndex(l),this.setAttribute("position",new Gt(c,3)),this.setAttribute("normal",new Gt(h,3)),this.setAttribute("uv",new Gt(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},eh=class i extends de{constructor(t=1,e=.4,n=64,s=8,r=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:s,p:r,q:l},n=Math.floor(n),s=Math.floor(s);let c=[],h=[],f=[],p=[],m=new O,g=new O,v=new O,y=new O,b=new O,S=new O,x=new O;for(let T=0;T<=n;++T){let A=T/n*r*Math.PI*2;E(A,r,l,t,v),E(A+.01,r,l,t,y),S.subVectors(y,v),x.addVectors(y,v),b.crossVectors(S,x),x.crossVectors(b,S),b.normalize(),x.normalize();for(let N=0;N<=s;++N){let D=N/s*Math.PI*2,L=-e*Math.cos(D),F=e*Math.sin(D);m.x=v.x+(L*x.x+F*b.x),m.y=v.y+(L*x.y+F*b.y),m.z=v.z+(L*x.z+F*b.z),h.push(m.x,m.y,m.z),g.subVectors(m,v).normalize(),f.push(g.x,g.y,g.z),p.push(T/n),p.push(N/s)}}for(let T=1;T<=n;T++)for(let A=1;A<=s;A++){let N=(s+1)*(T-1)+(A-1),D=(s+1)*T+(A-1),L=(s+1)*T+A,F=(s+1)*(T-1)+A;c.push(N,D,F),c.push(D,L,F)}this.setIndex(c),this.setAttribute("position",new Gt(h,3)),this.setAttribute("normal",new Gt(f,3)),this.setAttribute("uv",new Gt(p,2));function E(T,A,N,D,L){let F=Math.cos(T),C=Math.sin(T),w=N/A*T,z=Math.cos(w);L.x=D*(2+z)*.5*F,L.y=D*(2+z)*C*.5,L.z=D*Math.sin(w)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},nh=class i extends de{constructor(t=new kl(new O(-1,-1,0),new O(-1,1,0),new O(1,1,0)),e=64,n=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:s,closed:r};let l=t.computeFrenetFrames(e,r);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;let c=new O,h=new O,f=new ft,p=new O,m=[],g=[],v=[],y=[];b(),this.setIndex(y),this.setAttribute("position",new Gt(m,3)),this.setAttribute("normal",new Gt(g,3)),this.setAttribute("uv",new Gt(v,2));function b(){for(let T=0;T<e;T++)S(T);S(r===!1?e:0),E(),x()}function S(T){p=t.getPointAt(T/e,p);let A=l.normals[T],N=l.binormals[T];for(let D=0;D<=s;D++){let L=D/s*Math.PI*2,F=Math.sin(L),C=-Math.cos(L);h.x=C*A.x+F*N.x,h.y=C*A.y+F*N.y,h.z=C*A.z+F*N.z,h.normalize(),g.push(h.x,h.y,h.z),c.x=p.x+n*h.x,c.y=p.y+n*h.y,c.z=p.z+n*h.z,m.push(c.x,c.y,c.z)}}function x(){for(let T=1;T<=e;T++)for(let A=1;A<=s;A++){let N=(s+1)*(T-1)+(A-1),D=(s+1)*T+(A-1),L=(s+1)*T+A,F=(s+1)*(T-1)+A;y.push(N,D,F),y.push(D,L,F)}}function E(){for(let T=0;T<=e;T++)for(let A=0;A<=s;A++)f.x=T/e,f.y=A/s,v.push(f.x,f.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new i(new Sp[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},ih=class extends de{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){let e=[],n=new Set,s=new O,r=new O;if(t.index!==null){let l=t.attributes.position,c=t.index,h=t.groups;h.length===0&&(h=[{start:0,count:c.count,materialIndex:0}]);for(let f=0,p=h.length;f<p;++f){let m=h[f],g=m.start,v=m.count;for(let y=g,b=g+v;y<b;y+=3)for(let S=0;S<3;S++){let x=c.getX(y+S),E=c.getX(y+(S+1)%3);s.fromBufferAttribute(l,x),r.fromBufferAttribute(l,E),tM(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}}else{let l=t.attributes.position;for(let c=0,h=l.count/3;c<h;c++)for(let f=0;f<3;f++){let p=3*c+f,m=3*c+(f+1)%3;s.fromBufferAttribute(l,p),r.fromBufferAttribute(l,m),tM(s,r,n)===!0&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Gt(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}};function tM(i,t,e){let n=`${i.x},${i.y},${i.z}-${t.x},${t.y},${t.z}`,s=`${t.x},${t.y},${t.z}-${i.x},${i.y},${i.z}`;return e.has(n)===!0||e.has(s)===!0?!1:(e.add(n),e.add(s),!0)}var eM=Object.freeze({__proto__:null,BoxGeometry:Ja,CapsuleGeometry:Ou,CircleGeometry:Bu,ConeGeometry:zl,CylinderGeometry:Fl,DodecahedronGeometry:Fu,EdgesGeometry:zu,ExtrudeGeometry:Zu,IcosahedronGeometry:ju,LatheGeometry:Ju,OctahedronGeometry:ql,PlaneGeometry:oo,PolyhedronGeometry:pa,RingGeometry:Ku,ShapeGeometry:Qu,SphereGeometry:Yl,TetrahedronGeometry:$u,TorusGeometry:th,TorusKnotGeometry:eh,TubeGeometry:nh,WireframeGeometry:ih}),sh=class extends En{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Lt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},Zl=class extends ci{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},jl=class extends En{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Lt(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 Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(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 xi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},ah=class extends jl{constructor(t){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 ft(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return le(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Lt(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 Lt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Lt(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(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}},rh=class extends En{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Lt(16777215),this.specular=new Lt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xi,this.combine=ac,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},oh=class extends En{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Lt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},lh=class extends En{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}},ch=class extends En{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xi,this.combine=ac,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},Jl=class extends En{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=q_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Kl=class extends En{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},uh=class extends En{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Lt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xa,this.normalScale=new ft(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(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}},hh=class extends Pn{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}};function qr(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function xb(i){function t(s,r){return i[s]-i[r]}let e=i.length,n=new Array(e);for(let s=0;s!==e;++s)n[s]=s;return n.sort(t),n}function f_(i,t,e){let n=i.length,s=new i.constructor(n);for(let r=0,l=0;l!==n;++r){let c=e[r]*t;for(let h=0;h!==t;++h)s[l++]=i[c+h]}return s}function rv(i,t,e,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];if(r===void 0)return;let l=r[n];if(l!==void 0)if(Array.isArray(l))do l=r[n],l!==void 0&&(t.push(r.time),e.push(...l)),r=i[s++];while(r!==void 0);else if(l.toArray!==void 0)do l=r[n],l!==void 0&&(t.push(r.time),l.toArray(e,e.length)),r=i[s++];while(r!==void 0);else do l=r[n],l!==void 0&&(t.push(r.time),e.push(l)),r=i[s++];while(r!==void 0)}function YC(i,t,e,n,s=30){let r=i.clone();r.name=t;let l=[];for(let h=0;h<r.tracks.length;++h){let f=r.tracks[h],p=f.getValueSize(),m=[],g=[];for(let v=0;v<f.times.length;++v){let y=f.times[v]*s;if(!(y<e||y>=n)){m.push(f.times[v]);for(let b=0;b<p;++b)g.push(f.values[v*p+b])}}m.length!==0&&(f.times=qr(m,f.times.constructor),f.values=qr(g,f.values.constructor),l.push(f))}r.tracks=l;let c=1/0;for(let h=0;h<r.tracks.length;++h)c>r.tracks[h].times[0]&&(c=r.tracks[h].times[0]);for(let h=0;h<r.tracks.length;++h)r.tracks[h].shift(-1*c);return r.resetDuration(),r}function ZC(i,t=0,e=i,n=30){n<=0&&(n=30);let s=e.tracks.length,r=t/n;for(let l=0;l<s;++l){let c=e.tracks[l],h=c.ValueTypeName;if(h==="bool"||h==="string")continue;let f=i.tracks.find(function(x){return x.name===c.name&&x.ValueTypeName===h});if(f===void 0)continue;let p=0,m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);let g=0,v=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);let y=c.times.length-1,b;if(r<=c.times[0]){let x=p,E=m-p;b=c.values.slice(x,E)}else if(r>=c.times[y]){let x=y*m+p,E=x+m-p;b=c.values.slice(x,E)}else{let x=c.createInterpolant(),E=p,T=m-p;x.evaluate(r),b=x.resultBuffer.slice(E,T)}h==="quaternion"&&new Vn().fromArray(b).normalize().conjugate().toArray(b);let S=f.times.length;for(let x=0;x<S;++x){let E=x*v+g;if(h==="quaternion")Vn.multiplyQuaternionsFlat(f.values,E,b,0,f.values,E);else{let T=v-g*2;for(let A=0;A<T;++A)f.values[E+A]-=b[A]}}}return i.blendMode=Rm,i}var Mp=class{static convertArray(t,e){return qr(t,e)}static isTypedArray(t){return lb(t)}static getKeyframeOrder(t){return xb(t)}static sortedArray(t,e,n){return f_(t,e,n)}static flattenJSON(t,e,n,s){rv(t,e,n,s)}static subclip(t,e,n,s,r=30){return YC(t,e,n,s,r)}static makeClipAdditive(t,e=0,n=t,s=30){return ZC(t,e,n,s)}},$a=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];t:{e:{let l;n:{i:if(!(t<s)){for(let c=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=s,s=e[++n],t<s)break e}l=e.length;break n}if(!(t>=r)){let c=e[1];t<c&&(n=2,r=c);for(let h=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(s=r,r=e[--n-1],t>=r)break e}l=n,n=0;break n}break t}for(;n<l;){let c=n+l>>>1;t<e[c]?l=c:n=c+1}if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let l=0;l!==s;++l)e[l]=n[r+l];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},fh=class extends $a{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Xa,endingEnd:Xa}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,l=t+1,c=s[r],h=s[l];if(c===void 0)switch(this.getSettings_().endingStart){case qa:r=t,c=2*e-n;break;case Tl:r=s.length-2,c=e+s[r]-s[r+1];break;default:r=t,c=n}if(h===void 0)switch(this.getSettings_().endingEnd){case qa:l=t,h=2*n-e;break;case Tl:l=1,h=n+s[1]-s[0];break;default:l=t-1,h=e}let f=(n-e)*.5,p=this.valueSize;this._weightPrev=f/(e-c),this._weightNext=f/(h-n),this._offsetPrev=r*p,this._offsetNext=l*p}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=t*c,f=h-c,p=this._offsetPrev,m=this._offsetNext,g=this._weightPrev,v=this._weightNext,y=(n-e)/(s-e),b=y*y,S=b*y,x=-g*S+2*g*b-g*y,E=(1+g)*S+(-1.5-2*g)*b+(-.5+g)*y+1,T=(-1-v)*S+(1.5+v)*b+.5*y,A=v*S-v*b;for(let N=0;N!==c;++N)r[N]=x*l[p+N]+E*l[f+N]+T*l[h+N]+A*l[m+N];return r}},Ql=class extends $a{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=t*c,f=h-c,p=(n-e)/(s-e),m=1-p;for(let g=0;g!==c;++g)r[g]=l[f+g]*m+l[h+g]*p;return r}},dh=class extends $a{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},ui=class{constructor(t,e,n,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=qr(e,this.TimeBufferType),this.values=qr(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:qr(t.times,Array),values:qr(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new dh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ql(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new fh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case El:e=this.InterpolantFactoryMethodDiscrete;break;case yu:e=this.InterpolantFactoryMethodLinear;break;case pu:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return wt("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return El;case this.InterpolantFactoryMethodLinear:return yu;case this.InterpolantFactoryMethodSmooth:return pu}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t}return this}trim(t,e){let n=this.times,s=n.length,r=0,l=s-1;for(;r!==s&&n[r]<t;)++r;for(;l!==-1&&n[l]>e;)--l;if(++l,r!==0||l!==s){r>=l&&(l=Math.max(l,1),r=l-1);let c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(Qt("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Qt("KeyframeTrack: Track is empty.",this),t=!1);let l=null;for(let c=0;c!==r;c++){let h=n[c];if(typeof h=="number"&&isNaN(h)){Qt("KeyframeTrack: Time is not a valid number.",this,c,h),t=!1;break}if(l!==null&&l>h){Qt("KeyframeTrack: Out of order keys.",this,c,h,l),t=!1;break}l=h}if(s!==void 0&&lb(s))for(let c=0,h=s.length;c!==h;++c){let f=s[c];if(isNaN(f)){Qt("KeyframeTrack: Value is not a valid number.",this,c,f),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===pu,r=t.length-1,l=1;for(let c=1;c<r;++c){let h=!1,f=t[c],p=t[c+1];if(f!==p&&(c!==1||f!==t[0]))if(s)h=!0;else{let m=c*n,g=m-n,v=m+n;for(let y=0;y!==n;++y){let b=e[m+y];if(b!==e[g+y]||b!==e[v+y]){h=!0;break}}}if(h){if(c!==l){t[l]=t[c];let m=c*n,g=l*n;for(let v=0;v!==n;++v)e[g+v]=e[m+v]}++l}}if(r>0){t[l]=t[r];for(let c=r*n,h=l*n,f=0;f!==n;++f)e[h+f]=e[c+f];++l}return l!==t.length?(this.times=t.slice(0,l),this.values=e.slice(0,l*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};ui.prototype.ValueTypeName="";ui.prototype.TimeBufferType=Float32Array;ui.prototype.ValueBufferType=Float32Array;ui.prototype.DefaultInterpolation=yu;var Ls=class extends ui{constructor(t,e,n){super(t,e,n)}};Ls.prototype.ValueTypeName="bool";Ls.prototype.ValueBufferType=Array;Ls.prototype.DefaultInterpolation=El;Ls.prototype.InterpolantFactoryMethodLinear=void 0;Ls.prototype.InterpolantFactoryMethodSmooth=void 0;var $l=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};$l.prototype.ValueTypeName="color";var tr=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};tr.prototype.ValueTypeName="number";var ph=class extends $a{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-e)/(s-e),f=t*c;for(let p=f+c;f!==p;f+=4)Vn.slerpFlat(r,0,l,f-c,l,f,h);return r}},er=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new ph(this.times,this.values,this.getValueSize(),t)}};er.prototype.ValueTypeName="quaternion";er.prototype.InterpolantFactoryMethodSmooth=void 0;var Os=class extends ui{constructor(t,e,n){super(t,e,n)}};Os.prototype.ValueTypeName="string";Os.prototype.ValueBufferType=Array;Os.prototype.DefaultInterpolation=El;Os.prototype.InterpolantFactoryMethodLinear=void 0;Os.prototype.InterpolantFactoryMethodSmooth=void 0;var nr=class extends ui{constructor(t,e,n,s){super(t,e,n,s)}};nr.prototype.ValueTypeName="vector";var ir=class{constructor(t="",e=-1,n=[],s=bf){this.name=t,this.tracks=n,this.duration=e,this.blendMode=s,this.uuid=Li(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],n=t.tracks,s=1/(t.fps||1);for(let l=0,c=n.length;l!==c;++l)e.push(JC(n[l]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],n=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let r=0,l=n.length;r!==l;++r)e.push(ui.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(t,e,n,s){let r=e.length,l=[];for(let c=0;c<r;c++){let h=[],f=[];h.push((c+r-1)%r,c,(c+1)%r),f.push(0,1,0);let p=xb(h);h=f_(h,1,p),f=f_(f,1,p),!s&&h[0]===0&&(h.push(r),f.push(f[0])),l.push(new tr(".morphTargetInfluences["+e[c].name+"]",h,f).scale(1/n))}return new this(t,-1,l)}static findByName(t,e){let n=t;if(!Array.isArray(t)){let s=t;n=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===e)return n[s];return null}static CreateClipsFromMorphTargetSequences(t,e,n){let s={},r=/^([\w-]*?)([\d]+)$/;for(let c=0,h=t.length;c<h;c++){let f=t[c],p=f.name.match(r);if(p&&p.length>1){let m=p[1],g=s[m];g||(s[m]=g=[]),g.push(f)}}let l=[];for(let c in s)l.push(this.CreateFromMorphTargetSequence(c,s[c],e,n));return l}static parseAnimation(t,e){if(wt("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return Qt("AnimationClip: No animation in JSONLoader data."),null;let n=function(m,g,v,y,b){if(v.length!==0){let S=[],x=[];rv(v,S,x,y),S.length!==0&&b.push(new m(g,S,x))}},s=[],r=t.name||"default",l=t.fps||30,c=t.blendMode,h=t.length||-1,f=t.hierarchy||[];for(let m=0;m<f.length;m++){let g=f[m].keys;if(!(!g||g.length===0))if(g[0].morphTargets){let v={},y;for(y=0;y<g.length;y++)if(g[y].morphTargets)for(let b=0;b<g[y].morphTargets.length;b++)v[g[y].morphTargets[b]]=-1;for(let b in v){let S=[],x=[];for(let E=0;E!==g[y].morphTargets.length;++E){let T=g[y];S.push(T.time),x.push(T.morphTarget===b?1:0)}s.push(new tr(".morphTargetInfluence["+b+"]",S,x))}h=v.length*l}else{let v=".bones["+e[m].name+"]";n(nr,v+".position",g,"pos",s),n(er,v+".quaternion",g,"rot",s),n(nr,v+".scale",g,"scl",s)}}return s.length===0?null:new this(r,h,s,c)}resetDuration(){let t=this.tracks,e=0;for(let n=0,s=t.length;n!==s;++n){let r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let n=0;n<this.tracks.length;n++)t.push(this.tracks[n].clone());let e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}};function jC(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return tr;case"vector":case"vector2":case"vector3":case"vector4":return nr;case"color":return $l;case"quaternion":return er;case"bool":case"boolean":return Ls;case"string":return Os}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function JC(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=jC(i.type);if(i.times===void 0){let e=[],n=[];rv(i.keys,e,n,"value"),i.times=e,i.values=n}return t.parse!==void 0?t.parse(i):new t(i.name,i.times,i.values,i.interpolation)}var fs={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(this.files[i]=t)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},tc=class{constructor(t,e,n){let s=this,r=!1,l=0,c=0,h,f=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(p){c++,r===!1&&s.onStart!==void 0&&s.onStart(p,l,c),r=!0},this.itemEnd=function(p){l++,s.onProgress!==void 0&&s.onProgress(p,l,c),l===c&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(p){s.onError!==void 0&&s.onError(p)},this.resolveURL=function(p){return h?h(p):p},this.setURLModifier=function(p){return h=p,this},this.addHandler=function(p,m){return f.push(p,m),this},this.removeHandler=function(p){let m=f.indexOf(p);return m!==-1&&f.splice(m,2),this},this.getHandler=function(p){for(let m=0,g=f.length;m<g;m+=2){let v=f[m],y=f[m+1];if(v.global&&(v.lastIndex=0),v.test(p))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},ov=new tc,Hn=class{constructor(t){this.manager=t!==void 0?t:ov,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let n=this;return new Promise(function(s,r){n.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};Hn.DEFAULT_MATERIAL_NAME="__DEFAULT";var aa={},d_=class extends Error{constructor(t,e){super(t),this.response=e}},$i=class extends Hn{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=fs.get(`file:${t}`);if(r!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(aa[t]!==void 0){aa[t].push({onLoad:e,onProgress:n,onError:s});return}aa[t]=[],aa[t].push({onLoad:e,onProgress:n,onError:s});let l=new Request(t,{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}),c=this.mimeType,h=this.responseType;fetch(l).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&wt("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;let p=aa[t],m=f.body.getReader(),g=f.headers.get("X-File-Size")||f.headers.get("Content-Length"),v=g?parseInt(g):0,y=v!==0,b=0,S=new ReadableStream({start(x){E();function E(){m.read().then(({done:T,value:A})=>{if(T)x.close();else{b+=A.byteLength;let N=new ProgressEvent("progress",{lengthComputable:y,loaded:b,total:v});for(let D=0,L=p.length;D<L;D++){let F=p[D];F.onProgress&&F.onProgress(N)}x.enqueue(A),E()}},T=>{x.error(T)})}}});return new Response(S)}else throw new d_(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return f.json();default:if(c==="")return f.text();{let m=/charset="?([^;"\s]*)"?/i.exec(c),g=m&&m[1]?m[1].toLowerCase():void 0,v=new TextDecoder(g);return f.arrayBuffer().then(y=>v.decode(y))}}}).then(f=>{fs.add(`file:${t}`,f);let p=aa[t];delete aa[t];for(let m=0,g=p.length;m<g;m++){let v=p[m];v.onLoad&&v.onLoad(f)}}).catch(f=>{let p=aa[t];if(p===void 0)throw this.manager.itemError(t),f;delete aa[t];for(let m=0,g=p.length;m<g;m++){let v=p[m];v.onError&&v.onError(f)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},bp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e=[];for(let n=0;n<t.length;n++){let s=ir.parse(t[n]);e.push(s)}return e}},Ep=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=[],c=new io,h=new $i(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(r.withCredentials);let f=0;function p(m){h.load(t[m],function(g){let v=r.parse(g,!0);l[m]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},f+=1,f===6&&(v.mipmapCount===1&&(c.minFilter=Je),c.image=l,c.format=v.format,c.needsUpdate=!0,e&&e(c))},n,s)}if(Array.isArray(t))for(let m=0,g=t.length;m<g;++m)p(m);else h.load(t,function(m){let g=r.parse(m,!0);if(g.isCubemap){let v=g.mipmaps.length/g.mipmapCount;for(let y=0;y<v;y++){l[y]={mipmaps:[]};for(let b=0;b<g.mipmapCount;b++)l[y].mipmaps.push(g.mipmaps[y*g.mipmapCount+b]),l[y].format=g.format,l[y].width=g.width,l[y].height=g.height}c.image=l}else c.image.width=g.width,c.image.height=g.height,c.mipmaps=g.mipmaps;g.mipmapCount===1&&(c.minFilter=Je),c.format=g.format,c.needsUpdate=!0,e&&e(c)},n,s);return c}},_l=new WeakMap,sr=class extends Hn{constructor(t){super(t)}load(t,e,n,s){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,l=fs.get(`image:${t}`);if(l!==void 0){if(l.complete===!0)r.manager.itemStart(t),setTimeout(function(){e&&e(l),r.manager.itemEnd(t)},0);else{let m=_l.get(l);m===void 0&&(m=[],_l.set(l,m)),m.push({onLoad:e,onError:s})}return l}let c=Rl("img");function h(){p(),e&&e(this);let m=_l.get(this)||[];for(let g=0;g<m.length;g++){let v=m[g];v.onLoad&&v.onLoad(this)}_l.delete(this),r.manager.itemEnd(t)}function f(m){p(),s&&s(m),fs.remove(`image:${t}`);let g=_l.get(this)||[];for(let v=0;v<g.length;v++){let y=g[v];y.onError&&y.onError(m)}_l.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function p(){c.removeEventListener("load",h,!1),c.removeEventListener("error",f,!1)}return c.addEventListener("load",h,!1),c.addEventListener("error",f,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),fs.add(`image:${t}`,c),r.manager.itemStart(t),c.src=t,c}},Tp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=new Ka;r.colorSpace=Dn;let l=new sr(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let c=0;function h(f){l.load(t[f],function(p){r.images[f]=p,c++,c===6&&(r.needsUpdate=!0,e&&e(r))},void 0,s)}for(let f=0;f<t.length;++f)h(f);return r}},Ap=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new vi,c=new $i(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(r.withCredentials),c.load(t,function(h){let f;try{f=r.parse(h)}catch(p){if(s!==void 0)s(p);else{p(p);return}}f.image!==void 0?l.image=f.image:f.data!==void 0&&(l.image.width=f.width,l.image.height=f.height,l.image.data=f.data),l.wrapS=f.wrapS!==void 0?f.wrapS:li,l.wrapT=f.wrapT!==void 0?f.wrapT:li,l.magFilter=f.magFilter!==void 0?f.magFilter:Je,l.minFilter=f.minFilter!==void 0?f.minFilter:Je,l.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.colorSpace!==void 0&&(l.colorSpace=f.colorSpace),f.flipY!==void 0&&(l.flipY=f.flipY),f.format!==void 0&&(l.format=f.format),f.type!==void 0&&(l.type=f.type),f.mipmaps!==void 0&&(l.mipmaps=f.mipmaps,l.minFilter=ys),f.mipmapCount===1&&(l.minFilter=Je),f.generateMipmaps!==void 0&&(l.generateMipmaps=f.generateMipmaps),l.needsUpdate=!0,e&&e(l,f)},n,s),l}},Cp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=new mn,l=new sr(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(t,function(c){r.image=c,r.needsUpdate=!0,e!==void 0&&e(r)},n,s),r}},gs=class extends Oe{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Lt(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}},mh=class extends gs{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Lt(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}toJSON(t){let e=super.toJSON(t);return e.object.groundColor=this.groundColor.getHex(),e}},e_=new ue,nM=new O,iM=new O,gh=class{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ft(512,512),this.mapType=Gn,this.map=null,this.mapPass=null,this.matrix=new ue,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fa,this._frameExtents=new ft(1,1),this._viewportCount=1,this._viewports=[new qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,n=this.matrix;nM.setFromMatrixPosition(t.matrixWorld),e.position.copy(nM),iM.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(iM),e.updateMatrixWorld(),e_.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e_,e.coordinateSystem,e.reversedDepth),e.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e_)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}},p_=class extends gh{constructor(){super(new fn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){let e=this.camera,n=Jr*2*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;(n!==e.fov||s!==e.aspect||r!==e.far)&&(e.fov=n,e.aspect=s,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}},_h=class extends gs{constructor(t,e,n=0,s=Math.PI/3,r=0,l=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.target=new Oe,this.distance=n,this.angle=s,this.penumbra=r,this.decay=l,this.map=null,this.shadow=new p_}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}},m_=class extends gh{constructor(){super(new fn(90,1,.5,500)),this.isPointLightShadow=!0}},vh=class extends gs{constructor(t,e,n=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=s,this.shadow=new m_}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}},Bs=class extends $r{constructor(t=-1,e=1,n=1,s=-1,r=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,this.far=l,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,s,r,l){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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,l=n+t,c=s+e,h=s-e;if(this.view!==null&&this.view.enabled){let f=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=f*this.view.offsetX,l=r+f*this.view.width,c-=p*this.view.offsetY,h=c-p*this.view.height}this.projectionMatrix.makeOrthographic(r,l,c,h,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},g_=class extends gh{constructor(){super(new Bs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},xh=class extends gs{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Oe.DEFAULT_UP),this.updateMatrix(),this.target=new Oe,this.shadow=new g_}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}},yh=class extends gs{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}},Sh=class extends gs{constructor(t,e,n=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){let e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}},ec=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new O)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){let n=t.x,s=t.y,r=t.z,l=this.coefficients;return e.copy(l[0]).multiplyScalar(.282095),e.addScaledVector(l[1],.488603*s),e.addScaledVector(l[2],.488603*r),e.addScaledVector(l[3],.488603*n),e.addScaledVector(l[4],1.092548*(n*s)),e.addScaledVector(l[5],1.092548*(s*r)),e.addScaledVector(l[6],.315392*(3*r*r-1)),e.addScaledVector(l[7],1.092548*(n*r)),e.addScaledVector(l[8],.546274*(n*n-s*s)),e}getIrradianceAt(t,e){let n=t.x,s=t.y,r=t.z,l=this.coefficients;return e.copy(l[0]).multiplyScalar(.886227),e.addScaledVector(l[1],2*.511664*s),e.addScaledVector(l[2],2*.511664*r),e.addScaledVector(l[3],2*.511664*n),e.addScaledVector(l[4],2*.429043*n*s),e.addScaledVector(l[5],2*.429043*s*r),e.addScaledVector(l[6],.743125*r*r-.247708),e.addScaledVector(l[7],2*.429043*n*r),e.addScaledVector(l[8],.429043*(n*n-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].fromArray(t,e+s*3);return this}toArray(t=[],e=0){let n=this.coefficients;for(let s=0;s<9;s++)n[s].toArray(t,e+s*3);return t}static getBasisAt(t,e){let n=t.x,s=t.y,r=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*s,e[5]=1.092548*s*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-s*s)}},Mh=class extends gs{constructor(t=new ec,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}toJSON(t){let e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}},bh=class i extends Hn{constructor(t){super(t),this.textures={}}load(t,e,n,s){let r=this,l=new $i(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e=this.textures;function n(r){return e[r]===void 0&&wt("MaterialLoader: Undefined texture",r),e[r]}let s=this.createMaterialFromType(t.type);if(t.uuid!==void 0&&(s.uuid=t.uuid),t.name!==void 0&&(s.name=t.name),t.color!==void 0&&s.color!==void 0&&s.color.setHex(t.color),t.roughness!==void 0&&(s.roughness=t.roughness),t.metalness!==void 0&&(s.metalness=t.metalness),t.sheen!==void 0&&(s.sheen=t.sheen),t.sheenColor!==void 0&&(s.sheenColor=new Lt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(s.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&s.emissive!==void 0&&s.emissive.setHex(t.emissive),t.specular!==void 0&&s.specular!==void 0&&s.specular.setHex(t.specular),t.specularIntensity!==void 0&&(s.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&s.specularColor!==void 0&&s.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(s.shininess=t.shininess),t.clearcoat!==void 0&&(s.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(s.dispersion=t.dispersion),t.iridescence!==void 0&&(s.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(s.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(s.transmission=t.transmission),t.thickness!==void 0&&(s.thickness=t.thickness),t.attenuationDistance!==void 0&&(s.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&s.attenuationColor!==void 0&&s.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(s.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(s.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(s.fog=t.fog),t.flatShading!==void 0&&(s.flatShading=t.flatShading),t.blending!==void 0&&(s.blending=t.blending),t.combine!==void 0&&(s.combine=t.combine),t.side!==void 0&&(s.side=t.side),t.shadowSide!==void 0&&(s.shadowSide=t.shadowSide),t.opacity!==void 0&&(s.opacity=t.opacity),t.transparent!==void 0&&(s.transparent=t.transparent),t.alphaTest!==void 0&&(s.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(s.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(s.depthFunc=t.depthFunc),t.depthTest!==void 0&&(s.depthTest=t.depthTest),t.depthWrite!==void 0&&(s.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(s.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(s.blendSrc=t.blendSrc),t.blendDst!==void 0&&(s.blendDst=t.blendDst),t.blendEquation!==void 0&&(s.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(s.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(s.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(s.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&s.blendColor!==void 0&&s.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(s.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(s.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(s.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(s.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(s.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(s.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(s.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(s.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(s.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(s.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(s.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(s.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(s.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(s.rotation=t.rotation),t.linewidth!==void 0&&(s.linewidth=t.linewidth),t.dashSize!==void 0&&(s.dashSize=t.dashSize),t.gapSize!==void 0&&(s.gapSize=t.gapSize),t.scale!==void 0&&(s.scale=t.scale),t.polygonOffset!==void 0&&(s.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(s.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(s.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(s.dithering=t.dithering),t.alphaToCoverage!==void 0&&(s.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(s.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(s.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(s.allowOverride=t.allowOverride),t.visible!==void 0&&(s.visible=t.visible),t.toneMapped!==void 0&&(s.toneMapped=t.toneMapped),t.userData!==void 0&&(s.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?s.vertexColors=t.vertexColors>0:s.vertexColors=t.vertexColors),t.uniforms!==void 0)for(let r in t.uniforms){let l=t.uniforms[r];switch(s.uniforms[r]={},l.type){case"t":s.uniforms[r].value=n(l.value);break;case"c":s.uniforms[r].value=new Lt().setHex(l.value);break;case"v2":s.uniforms[r].value=new ft().fromArray(l.value);break;case"v3":s.uniforms[r].value=new O().fromArray(l.value);break;case"v4":s.uniforms[r].value=new qe().fromArray(l.value);break;case"m3":s.uniforms[r].value=new pe().fromArray(l.value);break;case"m4":s.uniforms[r].value=new ue().fromArray(l.value);break;default:s.uniforms[r].value=l.value}}if(t.defines!==void 0&&(s.defines=t.defines),t.vertexShader!==void 0&&(s.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(s.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(s.glslVersion=t.glslVersion),t.extensions!==void 0)for(let r in t.extensions)s.extensions[r]=t.extensions[r];if(t.lights!==void 0&&(s.lights=t.lights),t.clipping!==void 0&&(s.clipping=t.clipping),t.size!==void 0&&(s.size=t.size),t.sizeAttenuation!==void 0&&(s.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(s.map=n(t.map)),t.matcap!==void 0&&(s.matcap=n(t.matcap)),t.alphaMap!==void 0&&(s.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(s.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(s.bumpScale=t.bumpScale),t.normalMap!==void 0&&(s.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(s.normalMapType=t.normalMapType),t.normalScale!==void 0){let r=t.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new ft().fromArray(r)}return t.displacementMap!==void 0&&(s.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(s.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(s.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(s.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(s.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(s.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(s.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(s.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(s.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(s.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(s.envMap=n(t.envMap)),t.envMapRotation!==void 0&&s.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(s.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(s.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(s.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(s.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(s.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(s.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(s.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(s.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(s.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new ft().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(s.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(s.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(s.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(s.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(s.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=n(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return i.createMaterialFromType(t)}static createMaterialFromType(t){let e={ShadowMaterial:sh,SpriteMaterial:Il,RawShaderMaterial:Zl,ShaderMaterial:ci,PointsMaterial:Ol,MeshPhysicalMaterial:ah,MeshStandardMaterial:jl,MeshPhongMaterial:rh,MeshToonMaterial:oh,MeshNormalMaterial:lh,MeshLambertMaterial:ch,MeshDepthMaterial:Jl,MeshDistanceMaterial:Kl,MeshBasicMaterial:ps,MeshMatcapMaterial:uh,LineDashedMaterial:hh,LineBasicMaterial:Pn,Material:En};return new e[t]}},nc=class{static extractUrlBase(t){let e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}},Eh=class extends de{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}},Th=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(r.manager);l.setPath(r.path),l.setRequestHeader(r.requestHeader),l.setWithCredentials(r.withCredentials),l.load(t,function(c){try{e(r.parse(JSON.parse(c)))}catch(h){s?s(h):Qt(h),r.manager.itemError(t)}},n,s)}parse(t){let e={},n={};function s(v,y){if(e[y]!==void 0)return e[y];let S=v.interleavedBuffers[y],x=r(v,S.buffer),E=yl(S.type,x),T=new no(E,S.stride);return T.uuid=S.uuid,e[y]=T,T}function r(v,y){if(n[y]!==void 0)return n[y];let S=v.arrayBuffers[y],x=new Uint32Array(S).buffer;return n[y]=x,x}let l=t.isInstancedBufferGeometry?new Eh:new de,c=t.data.index;if(c!==void 0){let v=yl(c.type,c.array);l.setIndex(new He(v,1))}let h=t.data.attributes;for(let v in h){let y=h[v],b;if(y.isInterleavedBufferAttribute){let S=s(t.data,y.data);b=new Qa(S,y.itemSize,y.offset,y.normalized)}else{let S=yl(y.type,y.array),x=y.isInstancedBufferAttribute?ha:He;b=new x(S,y.itemSize,y.normalized)}y.name!==void 0&&(b.name=y.name),y.usage!==void 0&&b.setUsage(y.usage),l.setAttribute(v,b)}let f=t.data.morphAttributes;if(f)for(let v in f){let y=f[v],b=[];for(let S=0,x=y.length;S<x;S++){let E=y[S],T;if(E.isInterleavedBufferAttribute){let A=s(t.data,E.data);T=new Qa(A,E.itemSize,E.offset,E.normalized)}else{let A=yl(E.type,E.array);T=new He(A,E.itemSize,E.normalized)}E.name!==void 0&&(T.name=E.name),b.push(T)}l.morphAttributes[v]=b}t.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);let m=t.data.groups||t.data.drawcalls||t.data.offsets;if(m!==void 0)for(let v=0,y=m.length;v!==y;++v){let b=m[v];l.addGroup(b.start,b.count,b.materialIndex)}let g=t.data.boundingSphere;return g!==void 0&&(l.boundingSphere=new yn().fromJSON(g)),t.name&&(l.name=t.name),t.userData&&(l.userData=t.userData),l}},Rp=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=this.path===""?nc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||l;let c=new $i(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(t,function(h){let f=null;try{f=JSON.parse(h)}catch(m){s!==void 0&&s(m),m("ObjectLoader: Can't parse "+t+".",m.message);return}let p=f.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){s!==void 0&&s(new Error("THREE.ObjectLoader: Can't load "+t)),Qt("ObjectLoader: Can't load "+t);return}r.parse(f,e)},n,s)}async loadAsync(t,e){let n=this,s=this.path===""?nc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;let r=new $i(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let l=await r.loadAsync(t,e),c=JSON.parse(l),h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(c)}parse(t,e){let n=this.parseAnimations(t.animations),s=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,s),l=this.parseImages(t.images,function(){e!==void 0&&e(f)}),c=this.parseTextures(t.textures,l),h=this.parseMaterials(t.materials,c),f=this.parseObject(t.object,r,h,c,n),p=this.parseSkeletons(t.skeletons,f);if(this.bindSkeletons(f,p),this.bindLightTargets(f),e!==void 0){let m=!1;for(let g in l)if(l[g].data instanceof HTMLImageElement){m=!0;break}m===!1&&e(f)}return f}async parseAsync(t){let e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),l=this.parseTextures(t.textures,r),c=this.parseMaterials(t.materials,l),h=this.parseObject(t.object,s,c,l,e),f=this.parseSkeletons(t.skeletons,h);return this.bindSkeletons(h,f),this.bindLightTargets(h),h}parseShapes(t){let e={};if(t!==void 0)for(let n=0,s=t.length;n<s;n++){let r=new Ds().fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){let n={},s={};if(e.traverse(function(r){r.isBone&&(s[r.uuid]=r)}),t!==void 0)for(let r=0,l=t.length;r<l;r++){let c=new Ru().fromJSON(t[r],s);n[c.uuid]=c}return n}parseGeometries(t,e){let n={};if(t!==void 0){let s=new Th;for(let r=0,l=t.length;r<l;r++){let c,h=t[r];switch(h.type){case"BufferGeometry":case"InstancedBufferGeometry":c=s.parse(h);break;default:h.type in eM?c=eM[h.type].fromJSON(h,e):wt(`ObjectLoader: Unsupported geometry type "${h.type}"`)}c.uuid=h.uuid,h.name!==void 0&&(c.name=h.name),h.userData!==void 0&&(c.userData=h.userData),n[h.uuid]=c}}return n}parseMaterials(t,e){let n={},s={};if(t!==void 0){let r=new bh;r.setTextures(e);for(let l=0,c=t.length;l<c;l++){let h=t[l];n[h.uuid]===void 0&&(n[h.uuid]=r.parse(h)),s[h.uuid]=n[h.uuid]}}return s}parseAnimations(t){let e={};if(t!==void 0)for(let n=0;n<t.length;n++){let s=t[n],r=ir.parse(s);e[r.uuid]=r}return e}parseImages(t,e){let n=this,s={},r;function l(h){return n.manager.itemStart(h),r.load(h,function(){n.manager.itemEnd(h)},void 0,function(){n.manager.itemError(h),n.manager.itemEnd(h)})}function c(h){if(typeof h=="string"){let f=h,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:n.resourcePath+f;return l(p)}else return h.data?{data:yl(h.type,h.data),width:h.width,height:h.height}:null}if(t!==void 0&&t.length>0){let h=new tc(e);r=new sr(h),r.setCrossOrigin(this.crossOrigin);for(let f=0,p=t.length;f<p;f++){let m=t[f],g=m.url;if(Array.isArray(g)){let v=[];for(let y=0,b=g.length;y<b;y++){let S=g[y],x=c(S);x!==null&&(x instanceof HTMLImageElement?v.push(x):v.push(new vi(x.data,x.width,x.height)))}s[m.uuid]=new hs(v)}else{let v=c(m.url);s[m.uuid]=new hs(v)}}}return s}async parseImagesAsync(t){let e=this,n={},s;async function r(l){if(typeof l=="string"){let c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:e.resourcePath+c;return await s.loadAsync(h)}else return l.data?{data:yl(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){s=new sr(this.manager),s.setCrossOrigin(this.crossOrigin);for(let l=0,c=t.length;l<c;l++){let h=t[l],f=h.url;if(Array.isArray(f)){let p=[];for(let m=0,g=f.length;m<g;m++){let v=f[m],y=await r(v);y!==null&&(y instanceof HTMLImageElement?p.push(y):p.push(new vi(y.data,y.width,y.height)))}n[h.uuid]=new hs(p)}else{let p=await r(h.url);n[h.uuid]=new hs(p)}}}return n}parseTextures(t,e){function n(r,l){return typeof r=="number"?r:(wt("ObjectLoader.parseTexture: Constant should be in numeric form.",r),l[r])}let s={};if(t!==void 0)for(let r=0,l=t.length;r<l;r++){let c=t[r];c.image===void 0&&wt('ObjectLoader: No "image" specified for',c.uuid),e[c.image]===void 0&&wt("ObjectLoader: Undefined image",c.image);let h=e[c.image],f=h.data,p;Array.isArray(f)?(p=new Ka,f.length===6&&(p.needsUpdate=!0)):(f&&f.data?p=new vi:p=new mn,f&&(p.needsUpdate=!0)),p.source=h,p.uuid=c.uuid,c.name!==void 0&&(p.name=c.name),c.mapping!==void 0&&(p.mapping=n(c.mapping,KC)),c.channel!==void 0&&(p.channel=c.channel),c.offset!==void 0&&p.offset.fromArray(c.offset),c.repeat!==void 0&&p.repeat.fromArray(c.repeat),c.center!==void 0&&p.center.fromArray(c.center),c.rotation!==void 0&&(p.rotation=c.rotation),c.wrap!==void 0&&(p.wrapS=n(c.wrap[0],sM),p.wrapT=n(c.wrap[1],sM)),c.format!==void 0&&(p.format=c.format),c.internalFormat!==void 0&&(p.internalFormat=c.internalFormat),c.type!==void 0&&(p.type=c.type),c.colorSpace!==void 0&&(p.colorSpace=c.colorSpace),c.minFilter!==void 0&&(p.minFilter=n(c.minFilter,aM)),c.magFilter!==void 0&&(p.magFilter=n(c.magFilter,aM)),c.anisotropy!==void 0&&(p.anisotropy=c.anisotropy),c.flipY!==void 0&&(p.flipY=c.flipY),c.generateMipmaps!==void 0&&(p.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(p.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(p.compareFunction=c.compareFunction),c.userData!==void 0&&(p.userData=c.userData),s[c.uuid]=p}return s}parseObject(t,e,n,s,r){let l;function c(g){return e[g]===void 0&&wt("ObjectLoader: Undefined geometry",g),e[g]}function h(g){if(g!==void 0){if(Array.isArray(g)){let v=[];for(let y=0,b=g.length;y<b;y++){let S=g[y];n[S]===void 0&&wt("ObjectLoader: Undefined material",S),v.push(n[S])}return v}return n[g]===void 0&&wt("ObjectLoader: Undefined material",g),n[g]}}function f(g){return s[g]===void 0&&wt("ObjectLoader: Undefined texture",g),s[g]}let p,m;switch(t.type){case"Scene":l=new eo,t.background!==void 0&&(Number.isInteger(t.background)?l.background=new Lt(t.background):l.background=f(t.background)),t.environment!==void 0&&(l.environment=f(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?l.fog=new Eu(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(l.fog=new bu(t.fog.color,t.fog.density)),t.fog.name!==""&&(l.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(l.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(l.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&l.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":l=new fn(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(l.focus=t.focus),t.zoom!==void 0&&(l.zoom=t.zoom),t.filmGauge!==void 0&&(l.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(l.filmOffset=t.filmOffset),t.view!==void 0&&(l.view=Object.assign({},t.view));break;case"OrthographicCamera":l=new Bs(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(l.zoom=t.zoom),t.view!==void 0&&(l.view=Object.assign({},t.view));break;case"AmbientLight":l=new yh(t.color,t.intensity);break;case"DirectionalLight":l=new xh(t.color,t.intensity),l.target=t.target||"";break;case"PointLight":l=new vh(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":l=new Sh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":l=new _h(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),l.target=t.target||"";break;case"HemisphereLight":l=new mh(t.color,t.groundColor,t.intensity);break;case"LightProbe":let g=new ec().fromArray(t.sh);l=new Mh(g,t.intensity);break;case"SkinnedMesh":p=c(t.geometry),m=h(t.material),l=new Cu(p,m),t.bindMode!==void 0&&(l.bindMode=t.bindMode),t.bindMatrix!==void 0&&l.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(l.skeleton=t.skeleton);break;case"Mesh":p=c(t.geometry),m=h(t.material),l=new rn(p,m);break;case"InstancedMesh":p=c(t.geometry),m=h(t.material);let v=t.count,y=t.instanceMatrix,b=t.instanceColor;l=new wu(p,m,v),l.instanceMatrix=new ha(new Float32Array(y.array),16),b!==void 0&&(l.instanceColor=new ha(new Float32Array(b.array),b.itemSize));break;case"BatchedMesh":p=c(t.geometry),m=h(t.material),l=new Du(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,m),l.geometry=p,l.perObjectFrustumCulled=t.perObjectFrustumCulled,l.sortObjects=t.sortObjects,l._drawRanges=t.drawRanges,l._reservedRanges=t.reservedRanges,l._geometryInfo=t.geometryInfo.map(S=>{let x=null,E=null;return S.boundingBox!==void 0&&(x=new bn().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(E=new yn().fromJSON(S.boundingSphere)),{...S,boundingBox:x,boundingSphere:E}}),l._instanceInfo=t.instanceInfo,l._availableInstanceIds=t._availableInstanceIds,l._availableGeometryIds=t._availableGeometryIds,l._nextIndexStart=t.nextIndexStart,l._nextVertexStart=t.nextVertexStart,l._geometryCount=t.geometryCount,l._maxInstanceCount=t.maxInstanceCount,l._maxVertexCount=t.maxVertexCount,l._maxIndexCount=t.maxIndexCount,l._geometryInitialized=t.geometryInitialized,l._matricesTexture=f(t.matricesTexture.uuid),l._indirectTexture=f(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(l._colorsTexture=f(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(l.boundingSphere=new yn().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(l.boundingBox=new bn().fromJSON(t.boundingBox));break;case"LOD":l=new Au;break;case"Line":l=new ms(c(t.geometry),h(t.material));break;case"LineLoop":l=new Uu(c(t.geometry),h(t.material));break;case"LineSegments":l=new Bi(c(t.geometry),h(t.material));break;case"PointCloud":case"Points":l=new Pu(c(t.geometry),h(t.material));break;case"Sprite":l=new Tu(h(t.material));break;case"Group":l=new oa;break;case"Bone":l=new Ll;break;default:l=new Oe}if(l.uuid=t.uuid,t.name!==void 0&&(l.name=t.name),t.matrix!==void 0?(l.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=t.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(t.position!==void 0&&l.position.fromArray(t.position),t.rotation!==void 0&&l.rotation.fromArray(t.rotation),t.quaternion!==void 0&&l.quaternion.fromArray(t.quaternion),t.scale!==void 0&&l.scale.fromArray(t.scale)),t.up!==void 0&&l.up.fromArray(t.up),t.castShadow!==void 0&&(l.castShadow=t.castShadow),t.receiveShadow!==void 0&&(l.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(l.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(l.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(l.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(l.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(l.visible=t.visible),t.frustumCulled!==void 0&&(l.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(l.renderOrder=t.renderOrder),t.userData!==void 0&&(l.userData=t.userData),t.layers!==void 0&&(l.layers.mask=t.layers),t.children!==void 0){let g=t.children;for(let v=0;v<g.length;v++)l.add(this.parseObject(g[v],e,n,s,r))}if(t.animations!==void 0){let g=t.animations;for(let v=0;v<g.length;v++){let y=g[v];l.animations.push(r[y])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(l.autoUpdate=t.autoUpdate);let g=t.levels;for(let v=0;v<g.length;v++){let y=g[v],b=l.getObjectByProperty("uuid",y.object);b!==void 0&&l.addLevel(b,y.distance,y.hysteresis)}}return l}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let s=e[n.skeleton];s===void 0?wt("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(s,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){let n=e.target,s=t.getObjectByProperty("uuid",n);s!==void 0?e.target=s:e.target=new Oe}})}},KC={UVMapping:Bh,CubeReflectionMapping:xs,CubeRefractionMapping:_a,EquirectangularReflectionMapping:oc,EquirectangularRefractionMapping:lc,CubeUVReflectionMapping:co},sM={RepeatWrapping:Ml,ClampToEdgeWrapping:li,MirroredRepeatWrapping:bl},aM={NearestFilter:dn,NearestMipmapNearestFilter:Sm,NearestMipmapLinearFilter:uo,LinearFilter:Je,LinearMipmapNearestFilter:cc,LinearMipmapLinearFilter:ys},n_=new WeakMap,wp=class extends Hn{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&wt("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&wt("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,l=fs.get(`image-bitmap:${t}`);if(l!==void 0){if(r.manager.itemStart(t),l.then){l.then(f=>{if(n_.has(l)===!0)s&&s(n_.get(l)),r.manager.itemError(t),r.manager.itemEnd(t);else return e&&e(f),r.manager.itemEnd(t),f});return}return setTimeout(function(){e&&e(l),r.manager.itemEnd(t)},0),l}let c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let h=fetch(t,c).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(f){return fs.add(`image-bitmap:${t}`,f),e&&e(f),r.manager.itemEnd(t),f}).catch(function(f){s&&s(f),n_.set(h,f),fs.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});fs.add(`image-bitmap:${t}`,h),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},Jd,ic=class{static getContext(){return Jd===void 0&&(Jd=new(window.AudioContext||window.webkitAudioContext)),Jd}static setContext(t){Jd=t}},Np=class extends Hn{constructor(t){super(t)}load(t,e,n,s){let r=this,l=new $i(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(h){try{let f=h.slice(0);ic.getContext().decodeAudioData(f,function(m){e(m)}).catch(c)}catch(f){c(f)}},n,s);function c(h){s?s(h):Qt(h),r.manager.itemError(t)}}},rM=new ue,oM=new ue,Vr=new ue,Dp=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fn,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(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Vr.copy(t.projectionMatrix);let s=e.eyeSep/2,r=s*e.near/e.focus,l=e.near*Math.tan(Yr*e.fov*.5)/e.zoom,c,h;oM.elements[12]=-s,rM.elements[12]=s,c=-l*e.aspect+r,h=l*e.aspect+r,Vr.elements[0]=2*e.near/(h-c),Vr.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(Vr),c=-l*e.aspect-r,h=l*e.aspect-r,Vr.elements[0]=2*e.near/(h-c),Vr.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(Vr)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(oM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(rM)}},Ah=class extends fn{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}},lo=class{constructor(t=!0){this.autoStart=t,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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},Hr=new O,i_=new Vn,QC=new O,Gr=new O,kr=new O,Up=class extends Oe{constructor(){super(),this.type="AudioListener",this.context=ic.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new lo}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(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Hr,i_,QC),Gr.set(0,0,-1).applyQuaternion(i_),kr.set(0,1,0).applyQuaternion(i_),e.positionX){let n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Hr.x,n),e.positionY.linearRampToValueAtTime(Hr.y,n),e.positionZ.linearRampToValueAtTime(Hr.z,n),e.forwardX.linearRampToValueAtTime(Gr.x,n),e.forwardY.linearRampToValueAtTime(Gr.y,n),e.forwardZ.linearRampToValueAtTime(Gr.z,n),e.upX.linearRampToValueAtTime(kr.x,n),e.upY.linearRampToValueAtTime(kr.y,n),e.upZ.linearRampToValueAtTime(kr.z,n)}else e.setPosition(Hr.x,Hr.y,Hr.z),e.setOrientation(Gr.x,Gr.y,Gr.z,kr.x,kr.y,kr.z)}},Ch=class extends Oe{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){wt("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){wt("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(t=0){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);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 t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);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(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,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(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this.playbackRate=t,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?(wt("Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){wt("Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),t.sourceType!=="buffer"?(wt("Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}},Wr=new O,lM=new Vn,$C=new O,Xr=new O,Pp=class extends Ch{constructor(t){super(t),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(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Wr,lM,$C),Xr.set(0,0,1).applyQuaternion(lM);let e=this.panner;if(e.positionX){let n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Wr.x,n),e.positionY.linearRampToValueAtTime(Wr.y,n),e.positionZ.linearRampToValueAtTime(Wr.z,n),e.orientationX.linearRampToValueAtTime(Xr.x,n),e.orientationY.linearRampToValueAtTime(Xr.y,n),e.orientationZ.linearRampToValueAtTime(Xr.z,n)}else e.setPosition(Wr.x,Wr.y,Wr.z),e.setOrientation(Xr.x,Xr.y,Xr.z)}},Ip=class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0,e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}},Rh=class{constructor(t,e,n){this.binding=t,this.valueSize=n;let s,r,l;switch(e){case"quaternion":s=this._slerp,r=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:s=this._lerp,r=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let n=this.buffer,s=this.valueSize,r=t*s+s,l=this.cumulativeWeight;if(l===0){for(let c=0;c!==s;++c)n[r+c]=n[c];l=e}else{l+=e;let c=e/l;this._mixBufferRegion(n,r,0,c,s)}this.cumulativeWeight=l}accumulateAdditive(t){let e=this.buffer,n=this.valueSize,s=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,s,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,n=this.buffer,s=t*e+e,r=this.cumulativeWeight,l=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let h=e*this._origIndex;this._mixBufferRegion(n,s,h,1-r,e)}l>0&&this._mixBufferRegionAdditive(n,s,this._addIndex*e,1,e);for(let h=e,f=e+e;h!==f;++h)if(n[h]!==n[h+e]){c.setValue(n,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,n=this.valueSize,s=n*this._origIndex;t.getValue(e,s);for(let r=n,l=s;r!==l;++r)e[r]=e[s+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,s,r){if(s>=.5)for(let l=0;l!==r;++l)t[e+l]=t[n+l]}_slerp(t,e,n,s){Vn.slerpFlat(t,e,t,e,t,n,s)}_slerpAdditive(t,e,n,s,r){let l=this._workIndex*r;Vn.multiplyQuaternionsFlat(t,l,t,e,t,n),Vn.slerpFlat(t,e,t,e,t,l,s)}_lerp(t,e,n,s,r){let l=1-s;for(let c=0;c!==r;++c){let h=e+c;t[h]=t[h]*l+t[n+c]*s}}_lerpAdditive(t,e,n,s,r){for(let l=0;l!==r;++l){let c=e+l;t[c]=t[c]+t[n+l]*s}}},lv="\\[\\]\\.:\\/",tR=new RegExp("["+lv+"]","g"),cv="[^"+lv+"]",eR="[^"+lv.replace("\\.","")+"]",nR=/((?:WC+[\/:])*)/.source.replace("WC",cv),iR=/(WCOD+)?/.source.replace("WCOD",eR),sR=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",cv),aR=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",cv),rR=new RegExp("^"+nR+iR+sR+aR+"$"),oR=["material","materials","bones","map"],__=class{constructor(t,e,n){let s=n||Ge.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ge=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(tR,"")}static parseTrackName(t){let e=rR.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);oR.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let l=0;l<r.length;l++){let c=r[l];if(c.name===e||c.uuid===e)return c;let h=n(c.children);if(h)return h}return null},s=n(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)t[e++]=n[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){wt("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let f=e.objectIndex;switch(n){case"materials":if(!t.material){Qt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){Qt("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){Qt("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let p=0;p<t.length;p++)if(t[p].name===f){f=p;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){Qt("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){Qt("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){Qt("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(f!==void 0){if(t[f]===void 0){Qt("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[f]}}let l=t[s];if(l===void 0){let f=e.nodeName;Qt("PropertyBinding: Trying to update property for track: "+f+"."+s+" but it wasn't found.",t);return}let c=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?c=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){Qt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){Qt("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}h=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(h=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=s;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Ge.Composite=__;Ge.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ge.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ge.prototype.GetterByBindingType=[Ge.prototype._getValue_direct,Ge.prototype._getValue_array,Ge.prototype._getValue_arrayElement,Ge.prototype._getValue_toArray];Ge.prototype.SetterByBindingTypeAndVersioning=[[Ge.prototype._setValue_direct,Ge.prototype._setValue_direct_setNeedsUpdate,Ge.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_array,Ge.prototype._setValue_array_setNeedsUpdate,Ge.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_arrayElement,Ge.prototype._setValue_arrayElement_setNeedsUpdate,Ge.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ge.prototype._setValue_fromArray,Ge.prototype._setValue_fromArray_setNeedsUpdate,Ge.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Lp=class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Li(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let t={};this._indicesByUUID=t;for(let n=0,s=arguments.length;n!==s;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){let t=this._objects,e=this._indicesByUUID,n=this._paths,s=this._parsedPaths,r=this._bindings,l=r.length,c,h=t.length,f=this.nCachedObjects_;for(let p=0,m=arguments.length;p!==m;++p){let g=arguments[p],v=g.uuid,y=e[v];if(y===void 0){y=h++,e[v]=y,t.push(g);for(let b=0,S=l;b!==S;++b)r[b].push(new Ge(g,n[b],s[b]))}else if(y<f){c=t[y];let b=--f,S=t[b];e[S.uuid]=y,t[y]=S,e[v]=b,t[b]=g;for(let x=0,E=l;x!==E;++x){let T=r[x],A=T[b],N=T[y];T[y]=A,N===void 0&&(N=new Ge(g,n[x],s[x])),T[b]=N}}else t[y]!==c&&Qt("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_;for(let l=0,c=arguments.length;l!==c;++l){let h=arguments[l],f=h.uuid,p=e[f];if(p!==void 0&&p>=r){let m=r++,g=t[m];e[g.uuid]=p,t[p]=g,e[f]=m,t[m]=h;for(let v=0,y=s;v!==y;++v){let b=n[v],S=b[m],x=b[p];b[p]=S,b[m]=x}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,s=n.length,r=this.nCachedObjects_,l=t.length;for(let c=0,h=arguments.length;c!==h;++c){let f=arguments[c],p=f.uuid,m=e[p];if(m!==void 0)if(delete e[p],m<r){let g=--r,v=t[g],y=--l,b=t[y];e[v.uuid]=m,t[m]=v,e[b.uuid]=g,t[g]=b,t.pop();for(let S=0,x=s;S!==x;++S){let E=n[S],T=E[g],A=E[y];E[m]=T,E[g]=A,E.pop()}}else{let g=--l,v=t[g];g>0&&(e[v.uuid]=m),t[m]=v,t.pop();for(let y=0,b=s;y!==b;++y){let S=n[y];S[m]=S[g],S.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let n=this._bindingsIndicesByPath,s=n[t],r=this._bindings;if(s!==void 0)return r[s];let l=this._paths,c=this._parsedPaths,h=this._objects,f=h.length,p=this.nCachedObjects_,m=new Array(f);s=r.length,n[t]=s,l.push(t),c.push(e),r.push(m);for(let g=p,v=h.length;g!==v;++g){let y=h[g];m[g]=new Ge(y,t,e)}return m}unsubscribe_(t){let e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){let s=this._paths,r=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],f=t[c];e[f]=n,l[n]=h,l.pop(),r[n]=r[c],r.pop(),s[n]=s[c],s.pop()}}},wh=class{constructor(t,e,n=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=s;let r=e.tracks,l=r.length,c=new Array(l),h={endingStart:Xa,endingEnd:Xa};for(let f=0;f!==l;++f){let p=r[f].createInterpolant(null);c[f]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=W_,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(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),n===!0){let s=this._clip.duration,r=t._clip.duration,l=r/s,c=s/r;t.warp(1,l,e),this.warp(c,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){let t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){let s=this._mixer,r=s.time,l=this.timeScale,c=this._timeScaleInterpolant;c===null&&(c=s._lendControlInterpolant(),this._timeScaleInterpolant=c);let h=c.parameterPositions,f=c.sampleValues;return h[0]=r,h[1]=r+n,f[0]=t/l,f[1]=e/l,this}stopWarping(){let t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,s){if(!this.enabled){this._updateWeight(t);return}let r=this._startTime;if(r!==null){let h=(t-r)*n;h<0||n===0?e=0:(this._startTime=null,e=n*h)}e*=this._updateTimeScale(t);let l=this._updateTime(e),c=this._updateWeight(t);if(c>0){let h=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Rm:for(let p=0,m=h.length;p!==m;++p)h[p].evaluate(l),f[p].accumulateAdditive(c);break;case bf:default:for(let p=0,m=h.length;p!==m;++p)h[p].evaluate(l),f[p].accumulate(s,c)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let n=this._weightInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let s=n.evaluate(t)[0];e*=s,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,n=this.loop,s=this.time+t,r=this._loopCount,l=n===X_;if(t===0)return r===-1?s:l&&(r&1)===1?e-s:s;if(n===k_){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(r===-1&&(t>=0?(r=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),s>=e||s<0){let c=Math.floor(s/e);s-=e*c,r+=Math.abs(c);let h=this.repetitions-r;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(h===1){let f=t<0;this._setEndings(f,!f,l)}else this._setEndings(!1,!1,l);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=s;if(l&&(r&1)===1)return e-s}return s}_setEndings(t,e,n){let s=this._interpolantSettings;n?(s.endingStart=qa,s.endingEnd=qa):(t?s.endingStart=this.zeroSlopeAtStart?qa:Xa:s.endingStart=Tl,e?s.endingEnd=this.zeroSlopeAtEnd?qa:Xa:s.endingEnd=Tl)}_scheduleFading(t,e,n){let s=this._mixer,r=s.time,l=this._weightInterpolant;l===null&&(l=s._lendControlInterpolant(),this._weightInterpolant=l);let c=l.parameterPositions,h=l.sampleValues;return c[0]=r,h[0]=e,c[1]=r+t,h[1]=n,this}},lR=new Float32Array(1),Op=class extends Oi{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let n=t._localRoot||this._root,s=t._clip.tracks,r=s.length,l=t._propertyBindings,c=t._interpolants,h=n.uuid,f=this._bindingsByRootAndName,p=f[h];p===void 0&&(p={},f[h]=p);for(let m=0;m!==r;++m){let g=s[m],v=g.name,y=p[v];if(y!==void 0)++y.referenceCount,l[m]=y;else{if(y=l[m],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,h,v));continue}let b=e&&e._propertyBindings[m].binding.parsedPath;y=new Rh(Ge.create(n,v,b),g.ValueTypeName,g.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,h,v),l[m]=y}c[m].resultBuffer=y.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){let n=(t._localRoot||this._root).uuid,s=t._clip.uuid,r=this._actionsByClip[s];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,s,n)}let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){let s=this._actions,r=this._actionsByClip,l=r[e];if(l===void 0)l={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=l;else{let c=l.knownActions;t._byClipCacheIndex=c.length,c.push(t)}t._cacheIndex=s.length,s.push(t),l.actionByRoot[n]=t}_removeInactiveAction(t){let e=this._actions,n=e[e.length-1],s=t._cacheIndex;n._cacheIndex=s,e[s]=n,e.pop(),t._cacheIndex=null;let r=t._clip.uuid,l=this._actionsByClip,c=l[r],h=c.knownActions,f=h[h.length-1],p=t._byClipCacheIndex;f._byClipCacheIndex=p,h[p]=f,h.pop(),t._byClipCacheIndex=null;let m=c.actionByRoot,g=(t._localRoot||this._root).uuid;delete m[g],h.length===0&&delete l[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let n=0,s=e.length;n!==s;++n){let r=e[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(t){let e=this._actions,n=t._cacheIndex,s=this._nActiveActions++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){let e=this._actions,n=t._cacheIndex,s=--this._nActiveActions,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){let s=this._bindingsByRootAndName,r=this._bindings,l=s[e];l===void 0&&(l={},s[e]=l),l[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){let e=this._bindings,n=t.binding,s=n.rootNode.uuid,r=n.path,l=this._bindingsByRootAndName,c=l[s],h=e[e.length-1],f=t._cacheIndex;h._cacheIndex=f,e[f]=h,e.pop(),delete c[r],Object.keys(c).length===0&&delete l[s]}_lendBinding(t){let e=this._bindings,n=t._cacheIndex,s=this._nActiveBindings++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){let e=this._bindings,n=t._cacheIndex,s=--this._nActiveBindings,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return n===void 0&&(n=new Ql(new Float32Array(2),new Float32Array(2),1,lR),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){let e=this._controlInterpolants,n=t.__cacheIndex,s=--this._nActiveControlInterpolants,r=e[s];t.__cacheIndex=s,e[s]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){let s=e||this._root,r=s.uuid,l=typeof t=="string"?ir.findByName(s,t):t,c=l!==null?l.uuid:t,h=this._actionsByClip[c],f=null;if(n===void 0&&(l!==null?n=l.blendMode:n=bf),h!==void 0){let m=h.actionByRoot[r];if(m!==void 0&&m.blendMode===n)return m;f=h.knownActions[0],l===null&&(l=f._clip)}if(l===null)return null;let p=new wh(this,l,e,n);return this._bindAction(p,f),this._addInactiveAction(p,c,r),p}existingAction(t,e){let n=e||this._root,s=n.uuid,r=typeof t=="string"?ir.findByName(n,t):t,l=r?r.uuid:t,c=this._actionsByClip[l];return c!==void 0&&c.actionByRoot[s]||null}stopAllAction(){let t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;let e=this._actions,n=this._nActiveActions,s=this.time+=t,r=Math.sign(t),l=this._accuIndex^=1;for(let f=0;f!==n;++f)e[f]._update(s,t,r,l);let c=this._bindings,h=this._nActiveBindings;for(let f=0;f!==h;++f)c[f].apply(l);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,n=t.uuid,s=this._actionsByClip,r=s[n];if(r!==void 0){let l=r.knownActions;for(let c=0,h=l.length;c!==h;++c){let f=l[c];this._deactivateAction(f);let p=f._cacheIndex,m=e[e.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,m._cacheIndex=p,e[p]=m,e.pop(),this._removeInactiveBindingsForAction(f)}delete s[n]}}uncacheRoot(t){let e=t.uuid,n=this._actionsByClip;for(let l in n){let c=n[l].actionByRoot,h=c[e];h!==void 0&&(this._deactivateAction(h),this._removeInactiveAction(h))}let s=this._bindingsByRootAndName,r=s[e];if(r!==void 0)for(let l in r){let c=r[l];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(t,e){let n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}},Bp=class extends Nl{constructor(t=1,e=1,n=1,s={}){super(t,e,s),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Qr(null,t,e,n),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}},Fp=class i{constructor(t){this.value=t}clone(){return new i(this.value.clone===void 0?this.value:this.value.clone())}},cR=0,zp=class extends Oi{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:cR++}),this.name="",this.usage=Cl,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){let e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;let e=t.uniforms;this.uniforms.length=0;for(let n=0,s=e.length;n<s;n++){let r=Array.isArray(e[n])?e[n]:[e[n]];for(let l=0;l<r.length;l++)this.uniforms.push(r[l].clone())}return this}clone(){return new this.constructor().copy(this)}},Vp=class extends no{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},Hp=class{constructor(t,e,n,s,r,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=s,this.count=r,this.normalized=l,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},cM=new ue,sc=class{constructor(t,e,n=0,s=1/0){this.ray=new ua(t,e),this.near=n,this.far=s,this.camera=null,this.layers=new Is,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):Qt("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return cM.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cM),this}intersectObject(t,e=!0,n=[]){return v_(t,this,n,e),n.sort(uM),n}intersectObjects(t,e=!0,n=[]){for(let s=0,r=t.length;s<r;s++)v_(t[s],this,n,e);return n.sort(uM),n}};function uM(i,t){return i.distance-t.distance}function v_(i,t,e,n){let s=!0;if(i.layers.test(t.layers)&&i.raycast(t,e)===!1&&(s=!1),s===!0&&n===!0){let r=i.children;for(let l=0,c=r.length;l<c;l++)v_(r[l],t,e,!0)}}var Gp=class{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(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=uR.bind(this),t.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(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function uR(){this._document.hidden===!1&&this.reset()}var kp=class{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=le(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(le(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},Wp=class{constructor(t=1,e=0,n=0){this.radius=t,this.theta=e,this.y=n}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}},Xp=class i{constructor(t,e,n,s){i.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,s){let r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=s,this}},hM=new ft,qp=class{constructor(t=new ft(1/0,1/0),e=new ft(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=hM.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,hM).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},fM=new O,Kd=new O,vl=new O,xl=new O,s_=new O,hR=new O,fR=new O,Yp=class{constructor(t=new O,e=new O){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){fM.subVectors(t,this.start),Kd.subVectors(this.end,this.start);let n=Kd.dot(Kd),r=Kd.dot(fM)/n;return e&&(r=le(r,0,1)),r}closestPointToPoint(t,e,n){let s=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=hR,n=fR){let s=10000000000000001e-32,r,l,c=this.start,h=t.start,f=this.end,p=t.end;vl.subVectors(f,c),xl.subVectors(p,h),s_.subVectors(c,h);let m=vl.dot(vl),g=xl.dot(xl),v=xl.dot(s_);if(m<=s&&g<=s)return e.copy(c),n.copy(h),e.sub(n),e.dot(e);if(m<=s)r=0,l=v/g,l=le(l,0,1);else{let y=vl.dot(s_);if(g<=s)l=0,r=le(-y/m,0,1);else{let b=vl.dot(xl),S=m*g-b*b;S!==0?r=le((b*v-y*g)/S,0,1):r=0,l=(b*r+v)/g,l<0?(l=0,r=le(-y/m,0,1)):l>1&&(l=1,r=le((b-y)/m,0,1))}}return e.copy(c).add(vl.multiplyScalar(r)),n.copy(h).add(xl.multiplyScalar(l)),e.sub(n),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},dM=new O,Zp=class extends Oe{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";let n=new de,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 l=0,c=1,h=32;l<h;l++,c++){let f=l/h*Math.PI*2,p=c/h*Math.PI*2;s.push(Math.cos(f),Math.sin(f),1,Math.cos(p),Math.sin(p),1)}n.setAttribute("position",new Gt(s,3));let r=new Pn({fog:!1,toneMapped:!1});this.cone=new Bi(n,r),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);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),dM.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(dM),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},ka=new O,Qd=new ue,a_=new ue,jp=class extends Bi{constructor(t){let e=yb(t),n=new de,s=[],r=[];for(let f=0;f<e.length;f++){let p=e[f];p.parent&&p.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new Gt(s,3)),n.setAttribute("color",new Gt(r,3));let l=new Pn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;let c=new Lt(255),h=new Lt(65280);this.setColors(c,h)}updateMatrixWorld(t){let e=this.bones,n=this.geometry,s=n.getAttribute("position");a_.copy(this.root.matrixWorld).invert();for(let r=0,l=0;r<e.length;r++){let c=e[r];c.parent&&c.parent.isBone&&(Qd.multiplyMatrices(a_,c.matrixWorld),ka.setFromMatrixPosition(Qd),s.setXYZ(l,ka.x,ka.y,ka.z),Qd.multiplyMatrices(a_,c.parent.matrixWorld),ka.setFromMatrixPosition(Qd),s.setXYZ(l+1,ka.x,ka.y,ka.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){let s=this.geometry.getAttribute("color");for(let r=0;r<s.count;r+=2)s.setXYZ(r,t.r,t.g,t.b),s.setXYZ(r+1,e.r,e.g,e.b);return s.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};function yb(i){let t=[];i.isBone===!0&&t.push(i);for(let e=0;e<i.children.length;e++)t.push(...yb(i.children[e]));return t}var Jp=class extends rn{constructor(t,e,n){let s=new Yl(e,4,2),r=new ps({wireframe:!0,fog:!1,toneMapped:!1});super(s,r),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},dR=new O,pM=new Lt,mM=new Lt,Kp=class extends Oe{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";let s=new ql(e);s.rotateY(Math.PI*.5),this.material=new ps({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let r=s.getAttribute("position"),l=new Float32Array(r.count*3);s.setAttribute("color",new He(l,3)),this.add(new rn(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let e=t.geometry.getAttribute("color");pM.copy(this.light.color),mM.copy(this.light.groundColor);for(let n=0,s=e.count;n<s;n++){let r=n<s/2?pM:mM;e.setXYZ(n,r.r,r.g,r.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(dR.setFromMatrixPosition(this.light.matrixWorld).negate())}},Qp=class extends Bi{constructor(t=10,e=10,n=4473924,s=8947848){n=new Lt(n),s=new Lt(s);let r=e/2,l=t/e,c=t/2,h=[],f=[];for(let g=0,v=0,y=-c;g<=e;g++,y+=l){h.push(-c,0,y,c,0,y),h.push(y,0,-c,y,0,c);let b=g===r?n:s;b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3}let p=new de;p.setAttribute("position",new Gt(h,3)),p.setAttribute("color",new Gt(f,3));let m=new Pn({vertexColors:!0,toneMapped:!1});super(p,m),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},$p=class extends Bi{constructor(t=10,e=16,n=8,s=64,r=4473924,l=8947848){r=new Lt(r),l=new Lt(l);let c=[],h=[];if(e>1)for(let m=0;m<e;m++){let g=m/e*(Math.PI*2),v=Math.sin(g)*t,y=Math.cos(g)*t;c.push(0,0,0),c.push(v,0,y);let b=m&1?r:l;h.push(b.r,b.g,b.b),h.push(b.r,b.g,b.b)}for(let m=0;m<n;m++){let g=m&1?r:l,v=t-t/n*m;for(let y=0;y<s;y++){let b=y/s*(Math.PI*2),S=Math.sin(b)*v,x=Math.cos(b)*v;c.push(S,0,x),h.push(g.r,g.g,g.b),b=(y+1)/s*(Math.PI*2),S=Math.sin(b)*v,x=Math.cos(b)*v,c.push(S,0,x),h.push(g.r,g.g,g.b)}}let f=new de;f.setAttribute("position",new Gt(c,3)),f.setAttribute("color",new Gt(h,3));let p=new Pn({vertexColors:!0,toneMapped:!1});super(f,p),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},gM=new O,$d=new O,_M=new O,tm=class extends Oe{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let s=new de;s.setAttribute("position",new Gt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));let r=new Pn({fog:!1,toneMapped:!1});this.lightPlane=new ms(s,r),this.add(this.lightPlane),s=new de,s.setAttribute("position",new Gt([0,0,0,0,0,1],3)),this.targetLine=new ms(s,r),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),gM.setFromMatrixPosition(this.light.matrixWorld),$d.setFromMatrixPosition(this.light.target.matrixWorld),_M.subVectors($d,gM),this.lightPlane.lookAt($d),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($d),this.targetLine.scale.z=_M.length()}},tp=new O,hn=new $r,em=class extends Bi{constructor(t){let e=new de,n=new Pn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],r=[],l={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(y,b){h(y),h(b)}function h(y){s.push(0,0,0),r.push(0,0,0),l[y]===void 0&&(l[y]=[]),l[y].push(s.length/3-1)}e.setAttribute("position",new Gt(s,3)),e.setAttribute("color",new Gt(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update();let f=new Lt(16755200),p=new Lt(16711680),m=new Lt(43775),g=new Lt(16777215),v=new Lt(3355443);this.setColors(f,p,m,g,v)}setColors(t,e,n,s,r){let c=this.geometry.getAttribute("color");return c.setXYZ(0,t.r,t.g,t.b),c.setXYZ(1,t.r,t.g,t.b),c.setXYZ(2,t.r,t.g,t.b),c.setXYZ(3,t.r,t.g,t.b),c.setXYZ(4,t.r,t.g,t.b),c.setXYZ(5,t.r,t.g,t.b),c.setXYZ(6,t.r,t.g,t.b),c.setXYZ(7,t.r,t.g,t.b),c.setXYZ(8,t.r,t.g,t.b),c.setXYZ(9,t.r,t.g,t.b),c.setXYZ(10,t.r,t.g,t.b),c.setXYZ(11,t.r,t.g,t.b),c.setXYZ(12,t.r,t.g,t.b),c.setXYZ(13,t.r,t.g,t.b),c.setXYZ(14,t.r,t.g,t.b),c.setXYZ(15,t.r,t.g,t.b),c.setXYZ(16,t.r,t.g,t.b),c.setXYZ(17,t.r,t.g,t.b),c.setXYZ(18,t.r,t.g,t.b),c.setXYZ(19,t.r,t.g,t.b),c.setXYZ(20,t.r,t.g,t.b),c.setXYZ(21,t.r,t.g,t.b),c.setXYZ(22,t.r,t.g,t.b),c.setXYZ(23,t.r,t.g,t.b),c.setXYZ(24,e.r,e.g,e.b),c.setXYZ(25,e.r,e.g,e.b),c.setXYZ(26,e.r,e.g,e.b),c.setXYZ(27,e.r,e.g,e.b),c.setXYZ(28,e.r,e.g,e.b),c.setXYZ(29,e.r,e.g,e.b),c.setXYZ(30,e.r,e.g,e.b),c.setXYZ(31,e.r,e.g,e.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,s.r,s.g,s.b),c.setXYZ(39,s.r,s.g,s.b),c.setXYZ(40,r.r,r.g,r.b),c.setXYZ(41,r.r,r.g,r.b),c.setXYZ(42,r.r,r.g,r.b),c.setXYZ(43,r.r,r.g,r.b),c.setXYZ(44,r.r,r.g,r.b),c.setXYZ(45,r.r,r.g,r.b),c.setXYZ(46,r.r,r.g,r.b),c.setXYZ(47,r.r,r.g,r.b),c.setXYZ(48,r.r,r.g,r.b),c.setXYZ(49,r.r,r.g,r.b),c.needsUpdate=!0,this}update(){let t=this.geometry,e=this.pointMap,n=1,s=1,r,l;if(hn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,l=0;else if(this.camera.coordinateSystem===_i)r=-1,l=1;else if(this.camera.coordinateSystem===Zr)r=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);pn("c",e,t,hn,0,0,r),pn("t",e,t,hn,0,0,l),pn("n1",e,t,hn,-n,-s,r),pn("n2",e,t,hn,n,-s,r),pn("n3",e,t,hn,-n,s,r),pn("n4",e,t,hn,n,s,r),pn("f1",e,t,hn,-n,-s,l),pn("f2",e,t,hn,n,-s,l),pn("f3",e,t,hn,-n,s,l),pn("f4",e,t,hn,n,s,l),pn("u1",e,t,hn,n*.7,s*1.1,r),pn("u2",e,t,hn,-n*.7,s*1.1,r),pn("u3",e,t,hn,0,s*2,r),pn("cf1",e,t,hn,-n,0,l),pn("cf2",e,t,hn,n,0,l),pn("cf3",e,t,hn,0,-s,l),pn("cf4",e,t,hn,0,s,l),pn("cn1",e,t,hn,-n,0,r),pn("cn2",e,t,hn,n,0,r),pn("cn3",e,t,hn,0,-s,r),pn("cn4",e,t,hn,0,s,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function pn(i,t,e,n,s,r,l){tp.set(s,r,l).unproject(n);let c=t[i];if(c!==void 0){let h=e.getAttribute("position");for(let f=0,p=c.length;f<p;f++)h.setXYZ(c[f],tp.x,tp.y,tp.z)}}var ep=new bn,nm=class extends Bi{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new de;r.setIndex(new He(n,1)),r.setAttribute("position",new He(s,3)),super(r,new Pn({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&ep.setFromObject(this.object),ep.isEmpty())return;let t=ep.min,e=ep.max,n=this.geometry.attributes.position,s=n.array;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},im=class extends Bi{constructor(t,e=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new de;r.setIndex(new He(n,1)),r.setAttribute("position",new Gt(s,3)),super(r,new Pn({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){let e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},sm=class extends ms{constructor(t,e=1,n=16776960){let s=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new de;l.setAttribute("position",new Gt(r,3)),l.computeBoundingSphere(),super(l,new Pn({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;let c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],h=new de;h.setAttribute("position",new Gt(c,3)),h.computeBoundingSphere(),this.add(new rn(h,new ps({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){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(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},vM=new O,np,r_,am=class extends Oe{constructor(t=new O(0,0,1),e=new O(0,0,0),n=1,s=16776960,r=n*.2,l=r*.2){super(),this.type="ArrowHelper",np===void 0&&(np=new de,np.setAttribute("position",new Gt([0,0,0,0,1,0],3)),r_=new zl(.5,1,5,1),r_.translate(0,-.5,0)),this.position.copy(e),this.line=new ms(np,new Pn({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new rn(r_,new ps({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,l)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{vM.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(vM,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},rm=class extends Bi{constructor(t=1){let e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new de;s.setAttribute("position",new Gt(e,3)),s.setAttribute("color",new Gt(n,3));let r=new Pn({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(t,e,n){let s=new Lt,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(n),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},om=class{constructor(){this.type="ShapePath",this.color=new Lt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new ao,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,s){return this.currentPath.quadraticCurveTo(t,e,n,s),this}bezierCurveTo(t,e,n,s,r,l){return this.currentPath.bezierCurveTo(t,e,n,s,r,l),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(x){let E=[];for(let T=0,A=x.length;T<A;T++){let N=x[T],D=new Ds;D.curves=N.curves,E.push(D)}return E}function n(x,E){let T=E.length,A=!1;for(let N=T-1,D=0;D<T;N=D++){let L=E[N],F=E[D],C=F.x-L.x,w=F.y-L.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(L=E[D],C=-C,F=E[N],w=-w),x.y<L.y||x.y>F.y)continue;if(x.y===L.y){if(x.x===L.x)return!0}else{let z=w*(x.x-L.x)-C*(x.y-L.y);if(z===0)return!0;if(z<0)continue;A=!A}}else{if(x.y!==L.y)continue;if(F.x<=x.x&&x.x<=L.x||L.x<=x.x&&x.x<=F.x)return!0}}return A}let s=Qi.isClockWise,r=this.subPaths;if(r.length===0)return[];let l,c,h,f=[];if(r.length===1)return c=r[0],h=new Ds,h.curves=c.curves,f.push(h),f;let p=!s(r[0].getPoints());p=t?!p:p;let m=[],g=[],v=[],y=0,b;g[y]=void 0,v[y]=[];for(let x=0,E=r.length;x<E;x++)c=r[x],b=c.getPoints(),l=s(b),l=t?!l:l,l?(!p&&g[y]&&y++,g[y]={s:new Ds,p:b},g[y].s.curves=c.curves,p&&y++,v[y]=[]):v[y].push({h:c,p:b[0]});if(!g[0])return e(r);if(g.length>1){let x=!1,E=0;for(let T=0,A=g.length;T<A;T++)m[T]=[];for(let T=0,A=g.length;T<A;T++){let N=v[T];for(let D=0;D<N.length;D++){let L=N[D],F=!0;for(let C=0;C<g.length;C++)n(L.p,g[C].p)&&(T!==C&&E++,F?(F=!1,m[C].push(L)):x=!0);F&&m[T].push(L)}}E>0&&x===!1&&(v=m)}let S;for(let x=0,E=g.length;x<E;x++){h=g[x].s,f.push(h),S=v[x];for(let T=0,A=S.length;T<A;T++)h.holes.push(S[T].h)}return f}},lm=class extends Oi{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){if(t===void 0){wt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}};function pR(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function mR(i,t){let e=i.image&&i.image.width?i.image.width/i.image.height:1;return e>t?(i.repeat.x=t/e,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=e/t,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function gR(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function Nm(i,t,e,n){let s=_R(n);switch(e){case Am:return i*t;case Hh:return i*t/s.components*s.byteLength;case uc:return i*t/s.components*s.byteLength;case rr:return i*t*2/s.components*s.byteLength;case Gh:return i*t*2/s.components*s.byteLength;case Cm:return i*t*3/s.components*s.byteLength;case Un:return i*t*4/s.components*s.byteLength;case kh:return i*t*4/s.components*s.byteLength;case hc:case fc:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case dc:case pc:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case Xh:case Yh:return Math.max(i,16)*Math.max(t,8)/4;case Wh:case qh:return Math.max(i,8)*Math.max(t,8)/2;case Zh:case jh:case Kh:case Qh:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case Jh:case $h:case tf:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case ef:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case nf:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case sf:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case af:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case rf:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case of:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case lf:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case cf:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case uf:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case hf:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case ff:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case df:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case pf:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case mf:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case gf:case _f:case vf:return Math.ceil(i/4)*Math.ceil(t/4)*16;case xf:case yf:return Math.ceil(i/4)*Math.ceil(t/4)*8;case Sf:case Mf:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function _R(i){switch(i){case Gn:case Mm:return{byteLength:1,components:1};case ho:case bm:case Ss:return{byteLength:2,components:1};case zh:case Vh:return{byteLength:2,components:4};case Fi:case Fh:case Qn:return{byteLength:4,components:1};case Em:case Tm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}var cm=class{static contain(t,e){return pR(t,e)}static cover(t,e){return mR(t,e)}static fill(t){return gR(t)}static getByteLength(t,e,n,s){return Nm(t,e,n,s)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}}));typeof window<"u"&&(window.__THREE__?wt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182");function kb(){let i=null,t=!1,e=null,n=null;function s(r,l){e(r,l),n=i.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(s),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){i=r}}}function vR(i){let t=new WeakMap;function e(c,h){let f=c.array,p=c.usage,m=f.byteLength,g=i.createBuffer();i.bindBuffer(h,g),i.bufferData(h,f,p),c.onUploadCallback();let v;if(f instanceof Float32Array)v=i.FLOAT;else if(typeof Float16Array<"u"&&f instanceof Float16Array)v=i.HALF_FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?v=i.HALF_FLOAT:v=i.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=i.SHORT;else if(f instanceof Uint32Array)v=i.UNSIGNED_INT;else if(f instanceof Int32Array)v=i.INT;else if(f instanceof Int8Array)v=i.BYTE;else if(f instanceof Uint8Array)v=i.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:g,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:m}}function n(c,h,f){let p=h.array,m=h.updateRanges;if(i.bindBuffer(f,c),m.length===0)i.bufferSubData(f,0,p);else{m.sort((v,y)=>v.start-y.start);let g=0;for(let v=1;v<m.length;v++){let y=m[g],b=m[v];b.start<=y.start+y.count+1?y.count=Math.max(y.count,b.start+b.count-y.start):(++g,m[g]=b)}m.length=g+1;for(let v=0,y=m.length;v<y;v++){let b=m[v];i.bufferSubData(f,b.start*p.BYTES_PER_ELEMENT,p,b.start,b.count)}h.clearUpdateRanges()}h.onUploadCallback()}function s(c){return c.isInterleavedBufferAttribute&&(c=c.data),t.get(c)}function r(c){c.isInterleavedBufferAttribute&&(c=c.data);let h=t.get(c);h&&(i.deleteBuffer(h.buffer),t.delete(c))}function l(c,h){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){let p=t.get(c);(!p||p.version<c.version)&&t.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}let f=t.get(c);if(f===void 0)t.set(c,e(c,h));else if(f.version<c.version){if(f.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(f.buffer,c,h),f.version=c.version}}return{get:s,remove:r,update:l}}var xR=`#ifdef USE_ALPHAHASH
52
52
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
53
- #endif`,xR=`#ifdef USE_ALPHAHASH
53
+ #endif`,yR=`#ifdef USE_ALPHAHASH
54
54
  const float ALPHA_HASH_SCALE = 0.05;
55
55
  float hash2D( vec2 value ) {
56
56
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -85,20 +85,20 @@ No matching component was found for:
85
85
  : cases.z;
86
86
  return clamp( threshold , 1.0e-6, 1.0 );
87
87
  }
88
- #endif`,yR=`#ifdef USE_ALPHAMAP
89
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
90
88
  #endif`,SR=`#ifdef USE_ALPHAMAP
89
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
90
+ #endif`,MR=`#ifdef USE_ALPHAMAP
91
91
  uniform sampler2D alphaMap;
92
- #endif`,MR=`#ifdef USE_ALPHATEST
92
+ #endif`,bR=`#ifdef USE_ALPHATEST
93
93
  #ifdef ALPHA_TO_COVERAGE
94
94
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
95
95
  if ( diffuseColor.a == 0.0 ) discard;
96
96
  #else
97
97
  if ( diffuseColor.a < alphaTest ) discard;
98
98
  #endif
99
- #endif`,bR=`#ifdef USE_ALPHATEST
99
+ #endif`,ER=`#ifdef USE_ALPHATEST
100
100
  uniform float alphaTest;
101
- #endif`,ER=`#ifdef USE_AOMAP
101
+ #endif`,TR=`#ifdef USE_AOMAP
102
102
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
103
103
  reflectedLight.indirectDiffuse *= ambientOcclusion;
104
104
  #if defined( USE_CLEARCOAT )
@@ -111,10 +111,10 @@ No matching component was found for:
111
111
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
112
112
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
113
113
  #endif
114
- #endif`,TR=`#ifdef USE_AOMAP
114
+ #endif`,AR=`#ifdef USE_AOMAP
115
115
  uniform sampler2D aoMap;
116
116
  uniform float aoMapIntensity;
117
- #endif`,AR=`#ifdef USE_BATCHING
117
+ #endif`,CR=`#ifdef USE_BATCHING
118
118
  #if ! defined( GL_ANGLE_multi_draw )
119
119
  #define gl_DrawID _gl_DrawID
120
120
  uniform int _gl_DrawID;
@@ -148,15 +148,15 @@ No matching component was found for:
148
148
  int y = j / size;
149
149
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
150
150
  }
151
- #endif`,CR=`#ifdef USE_BATCHING
151
+ #endif`,RR=`#ifdef USE_BATCHING
152
152
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
153
- #endif`,RR=`vec3 transformed = vec3( position );
153
+ #endif`,wR=`vec3 transformed = vec3( position );
154
154
  #ifdef USE_ALPHAHASH
155
155
  vPosition = vec3( position );
156
- #endif`,wR=`vec3 objectNormal = vec3( normal );
156
+ #endif`,NR=`vec3 objectNormal = vec3( normal );
157
157
  #ifdef USE_TANGENT
158
158
  vec3 objectTangent = vec3( tangent.xyz );
159
- #endif`,NR=`float G_BlinnPhong_Implicit( ) {
159
+ #endif`,DR=`float G_BlinnPhong_Implicit( ) {
160
160
  return 0.25;
161
161
  }
162
162
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -170,7 +170,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
170
170
  float G = G_BlinnPhong_Implicit( );
171
171
  float D = D_BlinnPhong( shininess, dotNH );
172
172
  return F * ( G * D );
173
- } // validated`,DR=`#ifdef USE_IRIDESCENCE
173
+ } // validated`,UR=`#ifdef USE_IRIDESCENCE
174
174
  const mat3 XYZ_TO_REC709 = mat3(
175
175
  3.2404542, -0.9692660, 0.0556434,
176
176
  -1.5371385, 1.8760108, -0.2040259,
@@ -233,7 +233,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
233
233
  }
234
234
  return max( I, vec3( 0.0 ) );
235
235
  }
236
- #endif`,UR=`#ifdef USE_BUMPMAP
236
+ #endif`,PR=`#ifdef USE_BUMPMAP
237
237
  uniform sampler2D bumpMap;
238
238
  uniform float bumpScale;
239
239
  vec2 dHdxy_fwd() {
@@ -254,7 +254,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
254
254
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
255
255
  return normalize( abs( fDet ) * surf_norm - vGrad );
256
256
  }
257
- #endif`,PR=`#if NUM_CLIPPING_PLANES > 0
257
+ #endif`,IR=`#if NUM_CLIPPING_PLANES > 0
258
258
  vec4 plane;
259
259
  #ifdef ALPHA_TO_COVERAGE
260
260
  float distanceToPlane, distanceGradient;
@@ -300,26 +300,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
300
300
  if ( clipped ) discard;
301
301
  #endif
302
302
  #endif
303
- #endif`,IR=`#if NUM_CLIPPING_PLANES > 0
304
- varying vec3 vClipPosition;
305
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
306
303
  #endif`,LR=`#if NUM_CLIPPING_PLANES > 0
307
304
  varying vec3 vClipPosition;
305
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
308
306
  #endif`,OR=`#if NUM_CLIPPING_PLANES > 0
307
+ varying vec3 vClipPosition;
308
+ #endif`,BR=`#if NUM_CLIPPING_PLANES > 0
309
309
  vClipPosition = - mvPosition.xyz;
310
- #endif`,BR=`#if defined( USE_COLOR_ALPHA )
310
+ #endif`,FR=`#if defined( USE_COLOR_ALPHA )
311
311
  diffuseColor *= vColor;
312
312
  #elif defined( USE_COLOR )
313
313
  diffuseColor.rgb *= vColor;
314
- #endif`,FR=`#if defined( USE_COLOR_ALPHA )
314
+ #endif`,zR=`#if defined( USE_COLOR_ALPHA )
315
315
  varying vec4 vColor;
316
316
  #elif defined( USE_COLOR )
317
317
  varying vec3 vColor;
318
- #endif`,zR=`#if defined( USE_COLOR_ALPHA )
318
+ #endif`,VR=`#if defined( USE_COLOR_ALPHA )
319
319
  varying vec4 vColor;
320
320
  #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
321
321
  varying vec3 vColor;
322
- #endif`,VR=`#if defined( USE_COLOR_ALPHA )
322
+ #endif`,HR=`#if defined( USE_COLOR_ALPHA )
323
323
  vColor = vec4( 1.0 );
324
324
  #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
325
325
  vColor = vec3( 1.0 );
@@ -333,7 +333,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
333
333
  #ifdef USE_BATCHING_COLOR
334
334
  vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
335
335
  vColor.xyz *= batchingColor.xyz;
336
- #endif`,HR=`#define PI 3.141592653589793
336
+ #endif`,GR=`#define PI 3.141592653589793
337
337
  #define PI2 6.283185307179586
338
338
  #define PI_HALF 1.5707963267948966
339
339
  #define RECIPROCAL_PI 0.3183098861837907
@@ -400,7 +400,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
400
400
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
401
401
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
402
402
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
403
- } // validated`,GR=`#ifdef ENVMAP_TYPE_CUBE_UV
403
+ } // validated`,kR=`#ifdef ENVMAP_TYPE_CUBE_UV
404
404
  #define cubeUV_minMipLevel 4.0
405
405
  #define cubeUV_minTileSize 16.0
406
406
  float getFace( vec3 direction ) {
@@ -493,7 +493,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
493
493
  return vec4( mix( color0, color1, mipF ), 1.0 );
494
494
  }
495
495
  }
496
- #endif`,kR=`vec3 transformedNormal = objectNormal;
496
+ #endif`,WR=`vec3 transformedNormal = objectNormal;
497
497
  #ifdef USE_TANGENT
498
498
  vec3 transformedTangent = objectTangent;
499
499
  #endif
@@ -522,21 +522,21 @@ transformedNormal = normalMatrix * transformedNormal;
522
522
  #ifdef FLIP_SIDED
523
523
  transformedTangent = - transformedTangent;
524
524
  #endif
525
- #endif`,WR=`#ifdef USE_DISPLACEMENTMAP
525
+ #endif`,XR=`#ifdef USE_DISPLACEMENTMAP
526
526
  uniform sampler2D displacementMap;
527
527
  uniform float displacementScale;
528
528
  uniform float displacementBias;
529
- #endif`,XR=`#ifdef USE_DISPLACEMENTMAP
529
+ #endif`,qR=`#ifdef USE_DISPLACEMENTMAP
530
530
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
531
- #endif`,qR=`#ifdef USE_EMISSIVEMAP
531
+ #endif`,YR=`#ifdef USE_EMISSIVEMAP
532
532
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
533
533
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
534
534
  emissiveColor = sRGBTransferEOTF( emissiveColor );
535
535
  #endif
536
536
  totalEmissiveRadiance *= emissiveColor.rgb;
537
- #endif`,YR=`#ifdef USE_EMISSIVEMAP
537
+ #endif`,ZR=`#ifdef USE_EMISSIVEMAP
538
538
  uniform sampler2D emissiveMap;
539
- #endif`,ZR="gl_FragColor = linearToOutputTexel( gl_FragColor );",jR=`vec4 LinearTransferOETF( in vec4 value ) {
539
+ #endif`,jR="gl_FragColor = linearToOutputTexel( gl_FragColor );",JR=`vec4 LinearTransferOETF( in vec4 value ) {
540
540
  return value;
541
541
  }
542
542
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -544,7 +544,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
544
544
  }
545
545
  vec4 sRGBTransferOETF( in vec4 value ) {
546
546
  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 );
547
- }`,JR=`#ifdef USE_ENVMAP
547
+ }`,KR=`#ifdef USE_ENVMAP
548
548
  #ifdef ENV_WORLDPOS
549
549
  vec3 cameraToFrag;
550
550
  if ( isOrthographic ) {
@@ -573,7 +573,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
573
573
  #elif defined( ENVMAP_BLENDING_ADD )
574
574
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
575
575
  #endif
576
- #endif`,KR=`#ifdef USE_ENVMAP
576
+ #endif`,QR=`#ifdef USE_ENVMAP
577
577
  uniform float envMapIntensity;
578
578
  uniform float flipEnvMap;
579
579
  uniform mat3 envMapRotation;
@@ -582,7 +582,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
582
582
  #else
583
583
  uniform sampler2D envMap;
584
584
  #endif
585
- #endif`,QR=`#ifdef USE_ENVMAP
585
+ #endif`,$R=`#ifdef USE_ENVMAP
586
586
  uniform float reflectivity;
587
587
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
588
588
  #define ENV_WORLDPOS
@@ -593,7 +593,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
593
593
  #else
594
594
  varying vec3 vReflect;
595
595
  #endif
596
- #endif`,$R=`#ifdef USE_ENVMAP
596
+ #endif`,tw=`#ifdef USE_ENVMAP
597
597
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
598
598
  #define ENV_WORLDPOS
599
599
  #endif
@@ -604,7 +604,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
604
604
  varying vec3 vReflect;
605
605
  uniform float refractionRatio;
606
606
  #endif
607
- #endif`,tw=`#ifdef USE_ENVMAP
607
+ #endif`,ew=`#ifdef USE_ENVMAP
608
608
  #ifdef ENV_WORLDPOS
609
609
  vWorldPosition = worldPosition.xyz;
610
610
  #else
@@ -621,18 +621,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
621
621
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
622
622
  #endif
623
623
  #endif
624
- #endif`,ew=`#ifdef USE_FOG
625
- vFogDepth = - mvPosition.z;
626
624
  #endif`,nw=`#ifdef USE_FOG
627
- varying float vFogDepth;
625
+ vFogDepth = - mvPosition.z;
628
626
  #endif`,iw=`#ifdef USE_FOG
627
+ varying float vFogDepth;
628
+ #endif`,sw=`#ifdef USE_FOG
629
629
  #ifdef FOG_EXP2
630
630
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
631
631
  #else
632
632
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
633
633
  #endif
634
634
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
635
- #endif`,sw=`#ifdef USE_FOG
635
+ #endif`,aw=`#ifdef USE_FOG
636
636
  uniform vec3 fogColor;
637
637
  varying float vFogDepth;
638
638
  #ifdef FOG_EXP2
@@ -641,7 +641,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
641
641
  uniform float fogNear;
642
642
  uniform float fogFar;
643
643
  #endif
644
- #endif`,aw=`#ifdef USE_GRADIENTMAP
644
+ #endif`,rw=`#ifdef USE_GRADIENTMAP
645
645
  uniform sampler2D gradientMap;
646
646
  #endif
647
647
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -653,12 +653,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
653
653
  vec2 fw = fwidth( coord ) * 0.5;
654
654
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
655
655
  #endif
656
- }`,rw=`#ifdef USE_LIGHTMAP
656
+ }`,ow=`#ifdef USE_LIGHTMAP
657
657
  uniform sampler2D lightMap;
658
658
  uniform float lightMapIntensity;
659
- #endif`,ow=`LambertMaterial material;
659
+ #endif`,lw=`LambertMaterial material;
660
660
  material.diffuseColor = diffuseColor.rgb;
661
- material.specularStrength = specularStrength;`,lw=`varying vec3 vViewPosition;
661
+ material.specularStrength = specularStrength;`,cw=`varying vec3 vViewPosition;
662
662
  struct LambertMaterial {
663
663
  vec3 diffuseColor;
664
664
  float specularStrength;
@@ -672,7 +672,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
672
672
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
673
673
  }
674
674
  #define RE_Direct RE_Direct_Lambert
675
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,cw=`uniform bool receiveShadow;
675
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,uw=`uniform bool receiveShadow;
676
676
  uniform vec3 ambientLightColor;
677
677
  #if defined( USE_LIGHT_PROBES )
678
678
  uniform vec3 lightProbe[ 9 ];
@@ -788,7 +788,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
788
788
  vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
789
789
  return irradiance;
790
790
  }
791
- #endif`,uw=`#ifdef USE_ENVMAP
791
+ #endif`,hw=`#ifdef USE_ENVMAP
792
792
  vec3 getIBLIrradiance( const in vec3 normal ) {
793
793
  #ifdef ENVMAP_TYPE_CUBE_UV
794
794
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -821,8 +821,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
821
821
  #endif
822
822
  }
823
823
  #endif
824
- #endif`,hw=`ToonMaterial material;
825
- material.diffuseColor = diffuseColor.rgb;`,fw=`varying vec3 vViewPosition;
824
+ #endif`,fw=`ToonMaterial material;
825
+ material.diffuseColor = diffuseColor.rgb;`,dw=`varying vec3 vViewPosition;
826
826
  struct ToonMaterial {
827
827
  vec3 diffuseColor;
828
828
  };
@@ -834,11 +834,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
834
834
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
835
835
  }
836
836
  #define RE_Direct RE_Direct_Toon
837
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dw=`BlinnPhongMaterial material;
837
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,pw=`BlinnPhongMaterial material;
838
838
  material.diffuseColor = diffuseColor.rgb;
839
839
  material.specularColor = specular;
840
840
  material.specularShininess = shininess;
841
- material.specularStrength = specularStrength;`,pw=`varying vec3 vViewPosition;
841
+ material.specularStrength = specularStrength;`,mw=`varying vec3 vViewPosition;
842
842
  struct BlinnPhongMaterial {
843
843
  vec3 diffuseColor;
844
844
  vec3 specularColor;
@@ -855,7 +855,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
855
855
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
856
856
  }
857
857
  #define RE_Direct RE_Direct_BlinnPhong
858
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,mw=`PhysicalMaterial material;
858
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,gw=`PhysicalMaterial material;
859
859
  material.diffuseColor = diffuseColor.rgb;
860
860
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
861
861
  material.metalness = metalnessFactor;
@@ -945,7 +945,7 @@ material.roughness = min( material.roughness, 1.0 );
945
945
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
946
946
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
947
947
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
948
- #endif`,gw=`uniform sampler2D dfgLUT;
948
+ #endif`,_w=`uniform sampler2D dfgLUT;
949
949
  struct PhysicalMaterial {
950
950
  vec3 diffuseColor;
951
951
  vec3 diffuseContribution;
@@ -1293,7 +1293,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1293
1293
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1294
1294
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1295
1295
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1296
- }`,_w=`
1296
+ }`,vw=`
1297
1297
  vec3 geometryPosition = - vViewPosition;
1298
1298
  vec3 geometryNormal = normal;
1299
1299
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
1410
1410
  #if defined( RE_IndirectSpecular )
1411
1411
  vec3 radiance = vec3( 0.0 );
1412
1412
  vec3 clearcoatRadiance = vec3( 0.0 );
1413
- #endif`,vw=`#if defined( RE_IndirectDiffuse )
1413
+ #endif`,xw=`#if defined( RE_IndirectDiffuse )
1414
1414
  #ifdef USE_LIGHTMAP
1415
1415
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1416
1416
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1429,32 +1429,32 @@ IncidentLight directLight;
1429
1429
  #ifdef USE_CLEARCOAT
1430
1430
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1431
1431
  #endif
1432
- #endif`,xw=`#if defined( RE_IndirectDiffuse )
1432
+ #endif`,yw=`#if defined( RE_IndirectDiffuse )
1433
1433
  RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1434
1434
  #endif
1435
1435
  #if defined( RE_IndirectSpecular )
1436
1436
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1437
- #endif`,yw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1438
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1439
1437
  #endif`,Sw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1438
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1439
+ #endif`,Mw=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1440
1440
  uniform float logDepthBufFC;
1441
1441
  varying float vFragDepth;
1442
1442
  varying float vIsPerspective;
1443
- #endif`,Mw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1443
+ #endif`,bw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1444
1444
  varying float vFragDepth;
1445
1445
  varying float vIsPerspective;
1446
- #endif`,bw=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1446
+ #endif`,Ew=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1447
1447
  vFragDepth = 1.0 + gl_Position.w;
1448
1448
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1449
- #endif`,Ew=`#ifdef USE_MAP
1449
+ #endif`,Tw=`#ifdef USE_MAP
1450
1450
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1451
1451
  #ifdef DECODE_VIDEO_TEXTURE
1452
1452
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1453
1453
  #endif
1454
1454
  diffuseColor *= sampledDiffuseColor;
1455
- #endif`,Tw=`#ifdef USE_MAP
1455
+ #endif`,Aw=`#ifdef USE_MAP
1456
1456
  uniform sampler2D map;
1457
- #endif`,Aw=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1457
+ #endif`,Cw=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1458
1458
  #if defined( USE_POINTS_UV )
1459
1459
  vec2 uv = vUv;
1460
1460
  #else
@@ -1466,7 +1466,7 @@ IncidentLight directLight;
1466
1466
  #endif
1467
1467
  #ifdef USE_ALPHAMAP
1468
1468
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1469
- #endif`,Cw=`#if defined( USE_POINTS_UV )
1469
+ #endif`,Rw=`#if defined( USE_POINTS_UV )
1470
1470
  varying vec2 vUv;
1471
1471
  #else
1472
1472
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1478,19 +1478,19 @@ IncidentLight directLight;
1478
1478
  #endif
1479
1479
  #ifdef USE_ALPHAMAP
1480
1480
  uniform sampler2D alphaMap;
1481
- #endif`,Rw=`float metalnessFactor = metalness;
1481
+ #endif`,ww=`float metalnessFactor = metalness;
1482
1482
  #ifdef USE_METALNESSMAP
1483
1483
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1484
1484
  metalnessFactor *= texelMetalness.b;
1485
- #endif`,ww=`#ifdef USE_METALNESSMAP
1485
+ #endif`,Nw=`#ifdef USE_METALNESSMAP
1486
1486
  uniform sampler2D metalnessMap;
1487
- #endif`,Nw=`#ifdef USE_INSTANCING_MORPH
1487
+ #endif`,Dw=`#ifdef USE_INSTANCING_MORPH
1488
1488
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1489
1489
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1490
1490
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1491
1491
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1492
1492
  }
1493
- #endif`,Dw=`#if defined( USE_MORPHCOLORS )
1493
+ #endif`,Uw=`#if defined( USE_MORPHCOLORS )
1494
1494
  vColor *= morphTargetBaseInfluence;
1495
1495
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1496
1496
  #if defined( USE_COLOR_ALPHA )
@@ -1499,12 +1499,12 @@ IncidentLight directLight;
1499
1499
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1500
1500
  #endif
1501
1501
  }
1502
- #endif`,Uw=`#ifdef USE_MORPHNORMALS
1502
+ #endif`,Pw=`#ifdef USE_MORPHNORMALS
1503
1503
  objectNormal *= morphTargetBaseInfluence;
1504
1504
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1505
1505
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1506
1506
  }
1507
- #endif`,Pw=`#ifdef USE_MORPHTARGETS
1507
+ #endif`,Iw=`#ifdef USE_MORPHTARGETS
1508
1508
  #ifndef USE_INSTANCING_MORPH
1509
1509
  uniform float morphTargetBaseInfluence;
1510
1510
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1518,12 +1518,12 @@ IncidentLight directLight;
1518
1518
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1519
1519
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1520
1520
  }
1521
- #endif`,Iw=`#ifdef USE_MORPHTARGETS
1521
+ #endif`,Lw=`#ifdef USE_MORPHTARGETS
1522
1522
  transformed *= morphTargetBaseInfluence;
1523
1523
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1524
1524
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1525
1525
  }
1526
- #endif`,Lw=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1526
+ #endif`,Ow=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1527
1527
  #ifdef FLAT_SHADED
1528
1528
  vec3 fdx = dFdx( vViewPosition );
1529
1529
  vec3 fdy = dFdy( vViewPosition );
@@ -1564,7 +1564,7 @@ IncidentLight directLight;
1564
1564
  tbn2[1] *= faceDirection;
1565
1565
  #endif
1566
1566
  #endif
1567
- vec3 nonPerturbedNormal = normal;`,Ow=`#ifdef USE_NORMALMAP_OBJECTSPACE
1567
+ vec3 nonPerturbedNormal = normal;`,Bw=`#ifdef USE_NORMALMAP_OBJECTSPACE
1568
1568
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1569
1569
  #ifdef FLIP_SIDED
1570
1570
  normal = - normal;
@@ -1579,25 +1579,25 @@ vec3 nonPerturbedNormal = normal;`,Ow=`#ifdef USE_NORMALMAP_OBJECTSPACE
1579
1579
  normal = normalize( tbn * mapN );
1580
1580
  #elif defined( USE_BUMPMAP )
1581
1581
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1582
- #endif`,Bw=`#ifndef FLAT_SHADED
1582
+ #endif`,Fw=`#ifndef FLAT_SHADED
1583
1583
  varying vec3 vNormal;
1584
1584
  #ifdef USE_TANGENT
1585
1585
  varying vec3 vTangent;
1586
1586
  varying vec3 vBitangent;
1587
1587
  #endif
1588
- #endif`,Fw=`#ifndef FLAT_SHADED
1588
+ #endif`,zw=`#ifndef FLAT_SHADED
1589
1589
  varying vec3 vNormal;
1590
1590
  #ifdef USE_TANGENT
1591
1591
  varying vec3 vTangent;
1592
1592
  varying vec3 vBitangent;
1593
1593
  #endif
1594
- #endif`,zw=`#ifndef FLAT_SHADED
1594
+ #endif`,Vw=`#ifndef FLAT_SHADED
1595
1595
  vNormal = normalize( transformedNormal );
1596
1596
  #ifdef USE_TANGENT
1597
1597
  vTangent = normalize( transformedTangent );
1598
1598
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1599
1599
  #endif
1600
- #endif`,Vw=`#ifdef USE_NORMALMAP
1600
+ #endif`,Hw=`#ifdef USE_NORMALMAP
1601
1601
  uniform sampler2D normalMap;
1602
1602
  uniform vec2 normalScale;
1603
1603
  #endif
@@ -1619,13 +1619,13 @@ vec3 nonPerturbedNormal = normal;`,Ow=`#ifdef USE_NORMALMAP_OBJECTSPACE
1619
1619
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1620
1620
  return mat3( T * scale, B * scale, N );
1621
1621
  }
1622
- #endif`,Hw=`#ifdef USE_CLEARCOAT
1622
+ #endif`,Gw=`#ifdef USE_CLEARCOAT
1623
1623
  vec3 clearcoatNormal = nonPerturbedNormal;
1624
- #endif`,Gw=`#ifdef USE_CLEARCOAT_NORMALMAP
1624
+ #endif`,kw=`#ifdef USE_CLEARCOAT_NORMALMAP
1625
1625
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1626
1626
  clearcoatMapN.xy *= clearcoatNormalScale;
1627
1627
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1628
- #endif`,kw=`#ifdef USE_CLEARCOATMAP
1628
+ #endif`,Ww=`#ifdef USE_CLEARCOATMAP
1629
1629
  uniform sampler2D clearcoatMap;
1630
1630
  #endif
1631
1631
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1634,18 +1634,18 @@ vec3 nonPerturbedNormal = normal;`,Ow=`#ifdef USE_NORMALMAP_OBJECTSPACE
1634
1634
  #endif
1635
1635
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1636
1636
  uniform sampler2D clearcoatRoughnessMap;
1637
- #endif`,Ww=`#ifdef USE_IRIDESCENCEMAP
1637
+ #endif`,Xw=`#ifdef USE_IRIDESCENCEMAP
1638
1638
  uniform sampler2D iridescenceMap;
1639
1639
  #endif
1640
1640
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1641
1641
  uniform sampler2D iridescenceThicknessMap;
1642
- #endif`,Xw=`#ifdef OPAQUE
1642
+ #endif`,qw=`#ifdef OPAQUE
1643
1643
  diffuseColor.a = 1.0;
1644
1644
  #endif
1645
1645
  #ifdef USE_TRANSMISSION
1646
1646
  diffuseColor.a *= material.transmissionAlpha;
1647
1647
  #endif
1648
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,qw=`vec3 packNormalToRGB( const in vec3 normal ) {
1648
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Yw=`vec3 packNormalToRGB( const in vec3 normal ) {
1649
1649
  return normalize( normal ) * 0.5 + 0.5;
1650
1650
  }
1651
1651
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1714,9 +1714,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
1714
1714
  }
1715
1715
  float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1716
1716
  return ( near * far ) / ( ( far - near ) * depth - far );
1717
- }`,Yw=`#ifdef PREMULTIPLIED_ALPHA
1717
+ }`,Zw=`#ifdef PREMULTIPLIED_ALPHA
1718
1718
  gl_FragColor.rgb *= gl_FragColor.a;
1719
- #endif`,Zw=`vec4 mvPosition = vec4( transformed, 1.0 );
1719
+ #endif`,jw=`vec4 mvPosition = vec4( transformed, 1.0 );
1720
1720
  #ifdef USE_BATCHING
1721
1721
  mvPosition = batchingMatrix * mvPosition;
1722
1722
  #endif
@@ -1724,22 +1724,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1724
1724
  mvPosition = instanceMatrix * mvPosition;
1725
1725
  #endif
1726
1726
  mvPosition = modelViewMatrix * mvPosition;
1727
- gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
1727
+ gl_Position = projectionMatrix * mvPosition;`,Jw=`#ifdef DITHERING
1728
1728
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1729
- #endif`,Jw=`#ifdef DITHERING
1729
+ #endif`,Kw=`#ifdef DITHERING
1730
1730
  vec3 dithering( vec3 color ) {
1731
1731
  float grid_position = rand( gl_FragCoord.xy );
1732
1732
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1733
1733
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1734
1734
  return color + dither_shift_RGB;
1735
1735
  }
1736
- #endif`,Kw=`float roughnessFactor = roughness;
1736
+ #endif`,Qw=`float roughnessFactor = roughness;
1737
1737
  #ifdef USE_ROUGHNESSMAP
1738
1738
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1739
1739
  roughnessFactor *= texelRoughness.g;
1740
- #endif`,Qw=`#ifdef USE_ROUGHNESSMAP
1740
+ #endif`,$w=`#ifdef USE_ROUGHNESSMAP
1741
1741
  uniform sampler2D roughnessMap;
1742
- #endif`,$w=`#if NUM_SPOT_LIGHT_COORDS > 0
1742
+ #endif`,t2=`#if NUM_SPOT_LIGHT_COORDS > 0
1743
1743
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1744
1744
  #endif
1745
1745
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1921,7 +1921,7 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
1921
1921
  }
1922
1922
  #endif
1923
1923
  #endif
1924
- #endif`,t2=`#if NUM_SPOT_LIGHT_COORDS > 0
1924
+ #endif`,e2=`#if NUM_SPOT_LIGHT_COORDS > 0
1925
1925
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1926
1926
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1927
1927
  #endif
@@ -1962,7 +1962,7 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
1962
1962
  };
1963
1963
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1964
1964
  #endif
1965
- #endif`,e2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1965
+ #endif`,n2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1966
1966
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1967
1967
  vec4 shadowWorldPosition;
1968
1968
  #endif
@@ -1994,7 +1994,7 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
1994
1994
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1995
1995
  }
1996
1996
  #pragma unroll_loop_end
1997
- #endif`,n2=`float getShadowMask() {
1997
+ #endif`,i2=`float getShadowMask() {
1998
1998
  float shadow = 1.0;
1999
1999
  #ifdef USE_SHADOWMAP
2000
2000
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2026,12 +2026,12 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
2026
2026
  #endif
2027
2027
  #endif
2028
2028
  return shadow;
2029
- }`,i2=`#ifdef USE_SKINNING
2029
+ }`,s2=`#ifdef USE_SKINNING
2030
2030
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2031
2031
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2032
2032
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2033
2033
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2034
- #endif`,s2=`#ifdef USE_SKINNING
2034
+ #endif`,a2=`#ifdef USE_SKINNING
2035
2035
  uniform mat4 bindMatrix;
2036
2036
  uniform mat4 bindMatrixInverse;
2037
2037
  uniform highp sampler2D boneTexture;
@@ -2046,7 +2046,7 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
2046
2046
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2047
2047
  return mat4( v1, v2, v3, v4 );
2048
2048
  }
2049
- #endif`,a2=`#ifdef USE_SKINNING
2049
+ #endif`,r2=`#ifdef USE_SKINNING
2050
2050
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2051
2051
  vec4 skinned = vec4( 0.0 );
2052
2052
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2054,7 +2054,7 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
2054
2054
  skinned += boneMatZ * skinVertex * skinWeight.z;
2055
2055
  skinned += boneMatW * skinVertex * skinWeight.w;
2056
2056
  transformed = ( bindMatrixInverse * skinned ).xyz;
2057
- #endif`,r2=`#ifdef USE_SKINNING
2057
+ #endif`,o2=`#ifdef USE_SKINNING
2058
2058
  mat4 skinMatrix = mat4( 0.0 );
2059
2059
  skinMatrix += skinWeight.x * boneMatX;
2060
2060
  skinMatrix += skinWeight.y * boneMatY;
@@ -2065,17 +2065,17 @@ gl_Position = projectionMatrix * mvPosition;`,jw=`#ifdef DITHERING
2065
2065
  #ifdef USE_TANGENT
2066
2066
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2067
2067
  #endif
2068
- #endif`,o2=`float specularStrength;
2068
+ #endif`,l2=`float specularStrength;
2069
2069
  #ifdef USE_SPECULARMAP
2070
2070
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2071
2071
  specularStrength = texelSpecular.r;
2072
2072
  #else
2073
2073
  specularStrength = 1.0;
2074
- #endif`,l2=`#ifdef USE_SPECULARMAP
2074
+ #endif`,c2=`#ifdef USE_SPECULARMAP
2075
2075
  uniform sampler2D specularMap;
2076
- #endif`,c2=`#if defined( TONE_MAPPING )
2076
+ #endif`,u2=`#if defined( TONE_MAPPING )
2077
2077
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2078
- #endif`,u2=`#ifndef saturate
2078
+ #endif`,h2=`#ifndef saturate
2079
2079
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2080
2080
  #endif
2081
2081
  uniform float toneMappingExposure;
@@ -2172,7 +2172,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2172
2172
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2173
2173
  return mix( color, vec3( newPeak ), g );
2174
2174
  }
2175
- vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISSION
2175
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,f2=`#ifdef USE_TRANSMISSION
2176
2176
  material.transmission = transmission;
2177
2177
  material.transmissionAlpha = 1.0;
2178
2178
  material.thickness = thickness;
@@ -2193,7 +2193,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2193
2193
  material.attenuationColor, material.attenuationDistance );
2194
2194
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2195
2195
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2196
- #endif`,f2=`#ifdef USE_TRANSMISSION
2196
+ #endif`,d2=`#ifdef USE_TRANSMISSION
2197
2197
  uniform float transmission;
2198
2198
  uniform float thickness;
2199
2199
  uniform float attenuationDistance;
@@ -2319,7 +2319,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2319
2319
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2320
2320
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2321
2321
  }
2322
- #endif`,d2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2322
+ #endif`,p2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2323
2323
  varying vec2 vUv;
2324
2324
  #endif
2325
2325
  #ifdef USE_MAP
@@ -2389,7 +2389,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2389
2389
  #ifdef USE_THICKNESSMAP
2390
2390
  uniform mat3 thicknessMapTransform;
2391
2391
  varying vec2 vThicknessMapUv;
2392
- #endif`,p2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2392
+ #endif`,m2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2393
2393
  varying vec2 vUv;
2394
2394
  #endif
2395
2395
  #ifdef USE_MAP
@@ -2483,7 +2483,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2483
2483
  #ifdef USE_THICKNESSMAP
2484
2484
  uniform mat3 thicknessMapTransform;
2485
2485
  varying vec2 vThicknessMapUv;
2486
- #endif`,m2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2486
+ #endif`,g2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2487
2487
  vUv = vec3( uv, 1 ).xy;
2488
2488
  #endif
2489
2489
  #ifdef USE_MAP
@@ -2554,7 +2554,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2554
2554
  #endif
2555
2555
  #ifdef USE_THICKNESSMAP
2556
2556
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2557
- #endif`,g2=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2557
+ #endif`,_2=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2558
2558
  vec4 worldPosition = vec4( transformed, 1.0 );
2559
2559
  #ifdef USE_BATCHING
2560
2560
  worldPosition = batchingMatrix * worldPosition;
@@ -2563,12 +2563,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,h2=`#ifdef USE_TRANSMISS
2563
2563
  worldPosition = instanceMatrix * worldPosition;
2564
2564
  #endif
2565
2565
  worldPosition = modelMatrix * worldPosition;
2566
- #endif`,_2=`varying vec2 vUv;
2566
+ #endif`,v2=`varying vec2 vUv;
2567
2567
  uniform mat3 uvTransform;
2568
2568
  void main() {
2569
2569
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2570
2570
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2571
- }`,v2=`uniform sampler2D t2D;
2571
+ }`,x2=`uniform sampler2D t2D;
2572
2572
  uniform float backgroundIntensity;
2573
2573
  varying vec2 vUv;
2574
2574
  void main() {
@@ -2580,14 +2580,14 @@ void main() {
2580
2580
  gl_FragColor = texColor;
2581
2581
  #include <tonemapping_fragment>
2582
2582
  #include <colorspace_fragment>
2583
- }`,x2=`varying vec3 vWorldDirection;
2583
+ }`,y2=`varying vec3 vWorldDirection;
2584
2584
  #include <common>
2585
2585
  void main() {
2586
2586
  vWorldDirection = transformDirection( position, modelMatrix );
2587
2587
  #include <begin_vertex>
2588
2588
  #include <project_vertex>
2589
2589
  gl_Position.z = gl_Position.w;
2590
- }`,y2=`#ifdef ENVMAP_TYPE_CUBE
2590
+ }`,S2=`#ifdef ENVMAP_TYPE_CUBE
2591
2591
  uniform samplerCube envMap;
2592
2592
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2593
2593
  uniform sampler2D envMap;
@@ -2610,14 +2610,14 @@ void main() {
2610
2610
  gl_FragColor = texColor;
2611
2611
  #include <tonemapping_fragment>
2612
2612
  #include <colorspace_fragment>
2613
- }`,S2=`varying vec3 vWorldDirection;
2613
+ }`,M2=`varying vec3 vWorldDirection;
2614
2614
  #include <common>
2615
2615
  void main() {
2616
2616
  vWorldDirection = transformDirection( position, modelMatrix );
2617
2617
  #include <begin_vertex>
2618
2618
  #include <project_vertex>
2619
2619
  gl_Position.z = gl_Position.w;
2620
- }`,M2=`uniform samplerCube tCube;
2620
+ }`,b2=`uniform samplerCube tCube;
2621
2621
  uniform float tFlip;
2622
2622
  uniform float opacity;
2623
2623
  varying vec3 vWorldDirection;
@@ -2627,7 +2627,7 @@ void main() {
2627
2627
  gl_FragColor.a *= opacity;
2628
2628
  #include <tonemapping_fragment>
2629
2629
  #include <colorspace_fragment>
2630
- }`,b2=`#include <common>
2630
+ }`,E2=`#include <common>
2631
2631
  #include <batching_pars_vertex>
2632
2632
  #include <uv_pars_vertex>
2633
2633
  #include <displacementmap_pars_vertex>
@@ -2654,7 +2654,7 @@ void main() {
2654
2654
  #include <logdepthbuf_vertex>
2655
2655
  #include <clipping_planes_vertex>
2656
2656
  vHighPrecisionZW = gl_Position.zw;
2657
- }`,E2=`#if DEPTH_PACKING == 3200
2657
+ }`,T2=`#if DEPTH_PACKING == 3200
2658
2658
  uniform float opacity;
2659
2659
  #endif
2660
2660
  #include <common>
@@ -2692,7 +2692,7 @@ void main() {
2692
2692
  #elif DEPTH_PACKING == 3203
2693
2693
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2694
2694
  #endif
2695
- }`,T2=`#define DISTANCE
2695
+ }`,A2=`#define DISTANCE
2696
2696
  varying vec3 vWorldPosition;
2697
2697
  #include <common>
2698
2698
  #include <batching_pars_vertex>
@@ -2719,7 +2719,7 @@ void main() {
2719
2719
  #include <worldpos_vertex>
2720
2720
  #include <clipping_planes_vertex>
2721
2721
  vWorldPosition = worldPosition.xyz;
2722
- }`,A2=`#define DISTANCE
2722
+ }`,C2=`#define DISTANCE
2723
2723
  uniform vec3 referencePosition;
2724
2724
  uniform float nearDistance;
2725
2725
  uniform float farDistance;
@@ -2742,13 +2742,13 @@ void main () {
2742
2742
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2743
2743
  dist = saturate( dist );
2744
2744
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2745
- }`,C2=`varying vec3 vWorldDirection;
2745
+ }`,R2=`varying vec3 vWorldDirection;
2746
2746
  #include <common>
2747
2747
  void main() {
2748
2748
  vWorldDirection = transformDirection( position, modelMatrix );
2749
2749
  #include <begin_vertex>
2750
2750
  #include <project_vertex>
2751
- }`,R2=`uniform sampler2D tEquirect;
2751
+ }`,w2=`uniform sampler2D tEquirect;
2752
2752
  varying vec3 vWorldDirection;
2753
2753
  #include <common>
2754
2754
  void main() {
@@ -2757,7 +2757,7 @@ void main() {
2757
2757
  gl_FragColor = texture2D( tEquirect, sampleUV );
2758
2758
  #include <tonemapping_fragment>
2759
2759
  #include <colorspace_fragment>
2760
- }`,w2=`uniform float scale;
2760
+ }`,N2=`uniform float scale;
2761
2761
  attribute float lineDistance;
2762
2762
  varying float vLineDistance;
2763
2763
  #include <common>
@@ -2779,7 +2779,7 @@ void main() {
2779
2779
  #include <logdepthbuf_vertex>
2780
2780
  #include <clipping_planes_vertex>
2781
2781
  #include <fog_vertex>
2782
- }`,N2=`uniform vec3 diffuse;
2782
+ }`,D2=`uniform vec3 diffuse;
2783
2783
  uniform float opacity;
2784
2784
  uniform float dashSize;
2785
2785
  uniform float totalSize;
@@ -2807,7 +2807,7 @@ void main() {
2807
2807
  #include <colorspace_fragment>
2808
2808
  #include <fog_fragment>
2809
2809
  #include <premultiplied_alpha_fragment>
2810
- }`,D2=`#include <common>
2810
+ }`,U2=`#include <common>
2811
2811
  #include <batching_pars_vertex>
2812
2812
  #include <uv_pars_vertex>
2813
2813
  #include <envmap_pars_vertex>
@@ -2839,7 +2839,7 @@ void main() {
2839
2839
  #include <worldpos_vertex>
2840
2840
  #include <envmap_vertex>
2841
2841
  #include <fog_vertex>
2842
- }`,U2=`uniform vec3 diffuse;
2842
+ }`,P2=`uniform vec3 diffuse;
2843
2843
  uniform float opacity;
2844
2844
  #ifndef FLAT_SHADED
2845
2845
  varying vec3 vNormal;
@@ -2887,7 +2887,7 @@ void main() {
2887
2887
  #include <fog_fragment>
2888
2888
  #include <premultiplied_alpha_fragment>
2889
2889
  #include <dithering_fragment>
2890
- }`,P2=`#define LAMBERT
2890
+ }`,I2=`#define LAMBERT
2891
2891
  varying vec3 vViewPosition;
2892
2892
  #include <common>
2893
2893
  #include <batching_pars_vertex>
@@ -2926,7 +2926,7 @@ void main() {
2926
2926
  #include <envmap_vertex>
2927
2927
  #include <shadowmap_vertex>
2928
2928
  #include <fog_vertex>
2929
- }`,I2=`#define LAMBERT
2929
+ }`,L2=`#define LAMBERT
2930
2930
  uniform vec3 diffuse;
2931
2931
  uniform vec3 emissive;
2932
2932
  uniform float opacity;
@@ -2982,7 +2982,7 @@ void main() {
2982
2982
  #include <fog_fragment>
2983
2983
  #include <premultiplied_alpha_fragment>
2984
2984
  #include <dithering_fragment>
2985
- }`,L2=`#define MATCAP
2985
+ }`,O2=`#define MATCAP
2986
2986
  varying vec3 vViewPosition;
2987
2987
  #include <common>
2988
2988
  #include <batching_pars_vertex>
@@ -3016,7 +3016,7 @@ void main() {
3016
3016
  #include <clipping_planes_vertex>
3017
3017
  #include <fog_vertex>
3018
3018
  vViewPosition = - mvPosition.xyz;
3019
- }`,O2=`#define MATCAP
3019
+ }`,B2=`#define MATCAP
3020
3020
  uniform vec3 diffuse;
3021
3021
  uniform float opacity;
3022
3022
  uniform sampler2D matcap;
@@ -3062,7 +3062,7 @@ void main() {
3062
3062
  #include <fog_fragment>
3063
3063
  #include <premultiplied_alpha_fragment>
3064
3064
  #include <dithering_fragment>
3065
- }`,B2=`#define NORMAL
3065
+ }`,F2=`#define NORMAL
3066
3066
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3067
3067
  varying vec3 vViewPosition;
3068
3068
  #endif
@@ -3095,7 +3095,7 @@ void main() {
3095
3095
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3096
3096
  vViewPosition = - mvPosition.xyz;
3097
3097
  #endif
3098
- }`,F2=`#define NORMAL
3098
+ }`,z2=`#define NORMAL
3099
3099
  uniform float opacity;
3100
3100
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3101
3101
  varying vec3 vViewPosition;
@@ -3116,7 +3116,7 @@ void main() {
3116
3116
  #ifdef OPAQUE
3117
3117
  gl_FragColor.a = 1.0;
3118
3118
  #endif
3119
- }`,z2=`#define PHONG
3119
+ }`,V2=`#define PHONG
3120
3120
  varying vec3 vViewPosition;
3121
3121
  #include <common>
3122
3122
  #include <batching_pars_vertex>
@@ -3155,7 +3155,7 @@ void main() {
3155
3155
  #include <envmap_vertex>
3156
3156
  #include <shadowmap_vertex>
3157
3157
  #include <fog_vertex>
3158
- }`,V2=`#define PHONG
3158
+ }`,H2=`#define PHONG
3159
3159
  uniform vec3 diffuse;
3160
3160
  uniform vec3 emissive;
3161
3161
  uniform vec3 specular;
@@ -3213,7 +3213,7 @@ void main() {
3213
3213
  #include <fog_fragment>
3214
3214
  #include <premultiplied_alpha_fragment>
3215
3215
  #include <dithering_fragment>
3216
- }`,H2=`#define STANDARD
3216
+ }`,G2=`#define STANDARD
3217
3217
  varying vec3 vViewPosition;
3218
3218
  #ifdef USE_TRANSMISSION
3219
3219
  varying vec3 vWorldPosition;
@@ -3256,7 +3256,7 @@ void main() {
3256
3256
  #ifdef USE_TRANSMISSION
3257
3257
  vWorldPosition = worldPosition.xyz;
3258
3258
  #endif
3259
- }`,G2=`#define STANDARD
3259
+ }`,k2=`#define STANDARD
3260
3260
  #ifdef PHYSICAL
3261
3261
  #define IOR
3262
3262
  #define USE_SPECULAR
@@ -3381,7 +3381,7 @@ void main() {
3381
3381
  #include <fog_fragment>
3382
3382
  #include <premultiplied_alpha_fragment>
3383
3383
  #include <dithering_fragment>
3384
- }`,k2=`#define TOON
3384
+ }`,W2=`#define TOON
3385
3385
  varying vec3 vViewPosition;
3386
3386
  #include <common>
3387
3387
  #include <batching_pars_vertex>
@@ -3418,7 +3418,7 @@ void main() {
3418
3418
  #include <worldpos_vertex>
3419
3419
  #include <shadowmap_vertex>
3420
3420
  #include <fog_vertex>
3421
- }`,W2=`#define TOON
3421
+ }`,X2=`#define TOON
3422
3422
  uniform vec3 diffuse;
3423
3423
  uniform vec3 emissive;
3424
3424
  uniform float opacity;
@@ -3470,7 +3470,7 @@ void main() {
3470
3470
  #include <fog_fragment>
3471
3471
  #include <premultiplied_alpha_fragment>
3472
3472
  #include <dithering_fragment>
3473
- }`,X2=`uniform float size;
3473
+ }`,q2=`uniform float size;
3474
3474
  uniform float scale;
3475
3475
  #include <common>
3476
3476
  #include <color_pars_vertex>
@@ -3501,7 +3501,7 @@ void main() {
3501
3501
  #include <clipping_planes_vertex>
3502
3502
  #include <worldpos_vertex>
3503
3503
  #include <fog_vertex>
3504
- }`,q2=`uniform vec3 diffuse;
3504
+ }`,Y2=`uniform vec3 diffuse;
3505
3505
  uniform float opacity;
3506
3506
  #include <common>
3507
3507
  #include <color_pars_fragment>
@@ -3526,7 +3526,7 @@ void main() {
3526
3526
  #include <colorspace_fragment>
3527
3527
  #include <fog_fragment>
3528
3528
  #include <premultiplied_alpha_fragment>
3529
- }`,Y2=`#include <common>
3529
+ }`,Z2=`#include <common>
3530
3530
  #include <batching_pars_vertex>
3531
3531
  #include <fog_pars_vertex>
3532
3532
  #include <morphtarget_pars_vertex>
@@ -3549,7 +3549,7 @@ void main() {
3549
3549
  #include <worldpos_vertex>
3550
3550
  #include <shadowmap_vertex>
3551
3551
  #include <fog_vertex>
3552
- }`,Z2=`uniform vec3 color;
3552
+ }`,j2=`uniform vec3 color;
3553
3553
  uniform float opacity;
3554
3554
  #include <common>
3555
3555
  #include <fog_pars_fragment>
@@ -3564,7 +3564,7 @@ void main() {
3564
3564
  #include <tonemapping_fragment>
3565
3565
  #include <colorspace_fragment>
3566
3566
  #include <fog_fragment>
3567
- }`,j2=`uniform float rotation;
3567
+ }`,J2=`uniform float rotation;
3568
3568
  uniform vec2 center;
3569
3569
  #include <common>
3570
3570
  #include <uv_pars_vertex>
@@ -3588,7 +3588,7 @@ void main() {
3588
3588
  #include <logdepthbuf_vertex>
3589
3589
  #include <clipping_planes_vertex>
3590
3590
  #include <fog_vertex>
3591
- }`,J2=`uniform vec3 diffuse;
3591
+ }`,K2=`uniform vec3 diffuse;
3592
3592
  uniform float opacity;
3593
3593
  #include <common>
3594
3594
  #include <uv_pars_fragment>
@@ -3613,7 +3613,7 @@ void main() {
3613
3613
  #include <tonemapping_fragment>
3614
3614
  #include <colorspace_fragment>
3615
3615
  #include <fog_fragment>
3616
- }`,xe={alphahash_fragment:vR,alphahash_pars_fragment:xR,alphamap_fragment:yR,alphamap_pars_fragment:SR,alphatest_fragment:MR,alphatest_pars_fragment:bR,aomap_fragment:ER,aomap_pars_fragment:TR,batching_pars_vertex:AR,batching_vertex:CR,begin_vertex:RR,beginnormal_vertex:wR,bsdfs:NR,iridescence_fragment:DR,bumpmap_pars_fragment:UR,clipping_planes_fragment:PR,clipping_planes_pars_fragment:IR,clipping_planes_pars_vertex:LR,clipping_planes_vertex:OR,color_fragment:BR,color_pars_fragment:FR,color_pars_vertex:zR,color_vertex:VR,common:HR,cube_uv_reflection_fragment:GR,defaultnormal_vertex:kR,displacementmap_pars_vertex:WR,displacementmap_vertex:XR,emissivemap_fragment:qR,emissivemap_pars_fragment:YR,colorspace_fragment:ZR,colorspace_pars_fragment:jR,envmap_fragment:JR,envmap_common_pars_fragment:KR,envmap_pars_fragment:QR,envmap_pars_vertex:$R,envmap_physical_pars_fragment:uw,envmap_vertex:tw,fog_vertex:ew,fog_pars_vertex:nw,fog_fragment:iw,fog_pars_fragment:sw,gradientmap_pars_fragment:aw,lightmap_pars_fragment:rw,lights_lambert_fragment:ow,lights_lambert_pars_fragment:lw,lights_pars_begin:cw,lights_toon_fragment:hw,lights_toon_pars_fragment:fw,lights_phong_fragment:dw,lights_phong_pars_fragment:pw,lights_physical_fragment:mw,lights_physical_pars_fragment:gw,lights_fragment_begin:_w,lights_fragment_maps:vw,lights_fragment_end:xw,logdepthbuf_fragment:yw,logdepthbuf_pars_fragment:Sw,logdepthbuf_pars_vertex:Mw,logdepthbuf_vertex:bw,map_fragment:Ew,map_pars_fragment:Tw,map_particle_fragment:Aw,map_particle_pars_fragment:Cw,metalnessmap_fragment:Rw,metalnessmap_pars_fragment:ww,morphinstance_vertex:Nw,morphcolor_vertex:Dw,morphnormal_vertex:Uw,morphtarget_pars_vertex:Pw,morphtarget_vertex:Iw,normal_fragment_begin:Lw,normal_fragment_maps:Ow,normal_pars_fragment:Bw,normal_pars_vertex:Fw,normal_vertex:zw,normalmap_pars_fragment:Vw,clearcoat_normal_fragment_begin:Hw,clearcoat_normal_fragment_maps:Gw,clearcoat_pars_fragment:kw,iridescence_pars_fragment:Ww,opaque_fragment:Xw,packing:qw,premultiplied_alpha_fragment:Yw,project_vertex:Zw,dithering_fragment:jw,dithering_pars_fragment:Jw,roughnessmap_fragment:Kw,roughnessmap_pars_fragment:Qw,shadowmap_pars_fragment:$w,shadowmap_pars_vertex:t2,shadowmap_vertex:e2,shadowmask_pars_fragment:n2,skinbase_vertex:i2,skinning_pars_vertex:s2,skinning_vertex:a2,skinnormal_vertex:r2,specularmap_fragment:o2,specularmap_pars_fragment:l2,tonemapping_fragment:c2,tonemapping_pars_fragment:u2,transmission_fragment:h2,transmission_pars_fragment:f2,uv_pars_fragment:d2,uv_pars_vertex:p2,uv_vertex:m2,worldpos_vertex:g2,background_vert:_2,background_frag:v2,backgroundCube_vert:x2,backgroundCube_frag:y2,cube_vert:S2,cube_frag:M2,depth_vert:b2,depth_frag:E2,distance_vert:T2,distance_frag:A2,equirect_vert:C2,equirect_frag:R2,linedashed_vert:w2,linedashed_frag:N2,meshbasic_vert:D2,meshbasic_frag:U2,meshlambert_vert:P2,meshlambert_frag:I2,meshmatcap_vert:L2,meshmatcap_frag:O2,meshnormal_vert:B2,meshnormal_frag:F2,meshphong_vert:z2,meshphong_frag:V2,meshphysical_vert:H2,meshphysical_frag:G2,meshtoon_vert:k2,meshtoon_frag:W2,points_vert:X2,points_frag:q2,shadow_vert:Y2,shadow_frag:Z2,sprite_vert:j2,sprite_frag:J2},It={common:{diffuse:{value:new Lt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pe},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pe}},envmap:{envMap:{value:null},envMapRotation:{value:new pe},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 pe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pe},normalScale:{value:new ft(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Lt(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 Lt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0},uvTransform:{value:new pe}},sprite:{diffuse:{value:new Lt(16777215)},opacity:{value:1},center:{value:new ft(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pe},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0}}},Ms={basic:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.fog]),vertexShader:xe.meshbasic_vert,fragmentShader:xe.meshbasic_frag},lambert:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.fog,It.lights,{emissive:{value:new Lt(0)}}]),vertexShader:xe.meshlambert_vert,fragmentShader:xe.meshlambert_frag},phong:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.fog,It.lights,{emissive:{value:new Lt(0)},specular:{value:new Lt(1118481)},shininess:{value:30}}]),vertexShader:xe.meshphong_vert,fragmentShader:xe.meshphong_frag},standard:{uniforms:ei([It.common,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.roughnessmap,It.metalnessmap,It.fog,It.lights,{emissive:{value:new Lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag},toon:{uniforms:ei([It.common,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.gradientmap,It.fog,It.lights,{emissive:{value:new Lt(0)}}]),vertexShader:xe.meshtoon_vert,fragmentShader:xe.meshtoon_frag},matcap:{uniforms:ei([It.common,It.bumpmap,It.normalmap,It.displacementmap,It.fog,{matcap:{value:null}}]),vertexShader:xe.meshmatcap_vert,fragmentShader:xe.meshmatcap_frag},points:{uniforms:ei([It.points,It.fog]),vertexShader:xe.points_vert,fragmentShader:xe.points_frag},dashed:{uniforms:ei([It.common,It.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xe.linedashed_vert,fragmentShader:xe.linedashed_frag},depth:{uniforms:ei([It.common,It.displacementmap]),vertexShader:xe.depth_vert,fragmentShader:xe.depth_frag},normal:{uniforms:ei([It.common,It.bumpmap,It.normalmap,It.displacementmap,{opacity:{value:1}}]),vertexShader:xe.meshnormal_vert,fragmentShader:xe.meshnormal_frag},sprite:{uniforms:ei([It.sprite,It.fog]),vertexShader:xe.sprite_vert,fragmentShader:xe.sprite_frag},background:{uniforms:{uvTransform:{value:new pe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xe.background_vert,fragmentShader:xe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pe}},vertexShader:xe.backgroundCube_vert,fragmentShader:xe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xe.cube_vert,fragmentShader:xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xe.equirect_vert,fragmentShader:xe.equirect_frag},distance:{uniforms:ei([It.common,It.displacementmap,{referencePosition:{value:new O},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xe.distance_vert,fragmentShader:xe.distance_frag},shadow:{uniforms:ei([It.lights,It.fog,{color:{value:new Lt(0)},opacity:{value:1}}]),vertexShader:xe.shadow_vert,fragmentShader:xe.shadow_frag}};Ms.physical={uniforms:ei([Ms.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pe},clearcoatNormalScale:{value:new ft(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pe},sheen:{value:0},sheenColor:{value:new Lt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pe},transmissionSamplerSize:{value:new ft},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pe},attenuationDistance:{value:0},attenuationColor:{value:new Lt(0)},specularColor:{value:new Lt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pe},anisotropyVector:{value:new ft},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pe}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag};var Dm={r:0,b:0,g:0},mo=new xi,K2=new ue;function Q2(i,t,e,n,s,r,l){let c=new Lt(0),h=r===!0?0:1,f,p,m=null,g=0,v=null;function y(T){let A=T.isScene===!0?T.background:null;return A&&A.isTexture&&(A=(T.backgroundBlurriness>0?e:t).get(A)),A}function b(T){let A=!1,N=y(T);N===null?x(c,h):N&&N.isColor&&(x(N,1),A=!0);let D=i.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,l):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,l),(i.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(T,A){let N=y(A);N&&(N.isCubeTexture||N.mapping===co)?(p===void 0&&(p=new rn(new ja(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:po(Ms.backgroundCube.uniforms),vertexShader:Ms.backgroundCube.vertexShader,fragmentShader:Ms.backgroundCube.fragmentShader,side:ti,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(D,L,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(p)),mo.copy(A.backgroundRotation),mo.x*=-1,mo.y*=-1,mo.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(mo.y*=-1,mo.z*=-1),p.material.uniforms.envMap.value=N,p.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(K2.makeRotationFromEuler(mo)),p.material.toneMapped=be.getTransfer(N.colorSpace)!==Ve,(m!==N||g!==N.version||v!==i.toneMapping)&&(p.material.needsUpdate=!0,m=N,g=N.version,v=i.toneMapping),p.layers.enableAll(),T.unshift(p,p.geometry,p.material,0,0,null)):N&&N.isTexture&&(f===void 0&&(f=new rn(new ro(2,2),new ci({name:"BackgroundMaterial",uniforms:po(Ms.background.uniforms),vertexShader:Ms.background.vertexShader,fragmentShader:Ms.background.fragmentShader,side:Us,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(f)),f.material.uniforms.t2D.value=N,f.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,f.material.toneMapped=be.getTransfer(N.colorSpace)!==Ve,N.matrixAutoUpdate===!0&&N.updateMatrix(),f.material.uniforms.uvTransform.value.copy(N.matrix),(m!==N||g!==N.version||v!==i.toneMapping)&&(f.material.needsUpdate=!0,m=N,g=N.version,v=i.toneMapping),f.layers.enableAll(),T.unshift(f,f.geometry,f.material,0,0,null))}function x(T,A){T.getRGB(Dm,iv(i)),n.buffers.color.setClear(Dm.r,Dm.g,Dm.b,A,l)}function E(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0)}return{getClearColor:function(){return c},setClearColor:function(T,A=1){c.set(T),h=A,x(c,h)},getClearAlpha:function(){return h},setClearAlpha:function(T){h=T,x(c,h)},render:b,addToRenderList:S,dispose:E}}function $2(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=g(null),r=s,l=!1;function c(w,z,Y,G,j){let nt=!1,J=m(G,Y,z);r!==J&&(r=J,f(r.object)),nt=v(w,G,Y,j),nt&&y(w,G,Y,j),j!==null&&t.update(j,i.ELEMENT_ARRAY_BUFFER),(nt||l)&&(l=!1,A(w,z,Y,G),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function h(){return i.createVertexArray()}function f(w){return i.bindVertexArray(w)}function p(w){return i.deleteVertexArray(w)}function m(w,z,Y){let G=Y.wireframe===!0,j=n[w.id];j===void 0&&(j={},n[w.id]=j);let nt=j[z.id];nt===void 0&&(nt={},j[z.id]=nt);let J=nt[G];return J===void 0&&(J=g(h()),nt[G]=J),J}function g(w){let z=[],Y=[],G=[];for(let j=0;j<e;j++)z[j]=0,Y[j]=0,G[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:Y,attributeDivisors:G,object:w,attributes:{},index:null}}function v(w,z,Y,G){let j=r.attributes,nt=z.attributes,J=0,et=Y.getAttributes();for(let rt in et)if(et[rt].location>=0){let bt=j[rt],mt=nt[rt];if(mt===void 0&&(rt==="instanceMatrix"&&w.instanceMatrix&&(mt=w.instanceMatrix),rt==="instanceColor"&&w.instanceColor&&(mt=w.instanceColor)),bt===void 0||bt.attribute!==mt||mt&&bt.data!==mt.data)return!0;J++}return r.attributesNum!==J||r.index!==G}function y(w,z,Y,G){let j={},nt=z.attributes,J=0,et=Y.getAttributes();for(let rt in et)if(et[rt].location>=0){let bt=nt[rt];bt===void 0&&(rt==="instanceMatrix"&&w.instanceMatrix&&(bt=w.instanceMatrix),rt==="instanceColor"&&w.instanceColor&&(bt=w.instanceColor));let mt={};mt.attribute=bt,bt&&bt.data&&(mt.data=bt.data),j[rt]=mt,J++}r.attributes=j,r.attributesNum=J,r.index=G}function b(){let w=r.newAttributes;for(let z=0,Y=w.length;z<Y;z++)w[z]=0}function S(w){x(w,0)}function x(w,z){let Y=r.newAttributes,G=r.enabledAttributes,j=r.attributeDivisors;Y[w]=1,G[w]===0&&(i.enableVertexAttribArray(w),G[w]=1),j[w]!==z&&(i.vertexAttribDivisor(w,z),j[w]=z)}function E(){let w=r.newAttributes,z=r.enabledAttributes;for(let Y=0,G=z.length;Y<G;Y++)z[Y]!==w[Y]&&(i.disableVertexAttribArray(Y),z[Y]=0)}function T(w,z,Y,G,j,nt,J){J===!0?i.vertexAttribIPointer(w,z,Y,j,nt):i.vertexAttribPointer(w,z,Y,G,j,nt)}function A(w,z,Y,G){b();let j=G.attributes,nt=Y.getAttributes(),J=z.defaultAttributeValues;for(let et in nt){let rt=nt[et];if(rt.location>=0){let St=j[et];if(St===void 0&&(et==="instanceMatrix"&&w.instanceMatrix&&(St=w.instanceMatrix),et==="instanceColor"&&w.instanceColor&&(St=w.instanceColor)),St!==void 0){let bt=St.normalized,mt=St.itemSize,kt=t.get(St);if(kt===void 0)continue;let $t=kt.buffer,re=kt.type,Ce=kt.bytesPerElement,at=re===i.INT||re===i.UNSIGNED_INT||St.gpuType===Fh;if(St.isInterleavedBufferAttribute){let dt=St.data,Vt=dt.stride,ie=St.offset;if(dt.isInstancedInterleavedBuffer){for(let Ft=0;Ft<rt.locationSize;Ft++)x(rt.location+Ft,dt.meshPerAttribute);w.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=dt.meshPerAttribute*dt.count)}else for(let Ft=0;Ft<rt.locationSize;Ft++)S(rt.location+Ft);i.bindBuffer(i.ARRAY_BUFFER,$t);for(let Ft=0;Ft<rt.locationSize;Ft++)T(rt.location+Ft,mt/rt.locationSize,re,bt,Vt*Ce,(ie+mt/rt.locationSize*Ft)*Ce,at)}else{if(St.isInstancedBufferAttribute){for(let dt=0;dt<rt.locationSize;dt++)x(rt.location+dt,St.meshPerAttribute);w.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=St.meshPerAttribute*St.count)}else for(let dt=0;dt<rt.locationSize;dt++)S(rt.location+dt);i.bindBuffer(i.ARRAY_BUFFER,$t);for(let dt=0;dt<rt.locationSize;dt++)T(rt.location+dt,mt/rt.locationSize,re,bt,mt*Ce,mt/rt.locationSize*dt*Ce,at)}}else if(J!==void 0){let bt=J[et];if(bt!==void 0)switch(bt.length){case 2:i.vertexAttrib2fv(rt.location,bt);break;case 3:i.vertexAttrib3fv(rt.location,bt);break;case 4:i.vertexAttrib4fv(rt.location,bt);break;default:i.vertexAttrib1fv(rt.location,bt)}}}}E()}function N(){F();for(let w in n){let z=n[w];for(let Y in z){let G=z[Y];for(let j in G)p(G[j].object),delete G[j];delete z[Y]}delete n[w]}}function D(w){if(n[w.id]===void 0)return;let z=n[w.id];for(let Y in z){let G=z[Y];for(let j in G)p(G[j].object),delete G[j];delete z[Y]}delete n[w.id]}function L(w){for(let z in n){let Y=n[z];if(Y[w.id]===void 0)continue;let G=Y[w.id];for(let j in G)p(G[j].object),delete G[j];delete Y[w.id]}}function F(){C(),l=!0,r!==s&&(r=s,f(r.object))}function C(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:c,reset:F,resetDefaultState:C,dispose:N,releaseStatesOfGeometry:D,releaseStatesOfProgram:L,initAttributes:b,enableAttribute:S,disableUnusedAttributes:E}}function t3(i,t,e){let n;function s(f){n=f}function r(f,p){i.drawArrays(n,f,p),e.update(p,n,1)}function l(f,p,m){m!==0&&(i.drawArraysInstanced(n,f,p,m),e.update(p,n,m))}function c(f,p,m){if(m===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,f,0,p,0,m);let v=0;for(let y=0;y<m;y++)v+=p[y];e.update(v,n,1)}function h(f,p,m,g){if(m===0)return;let v=t.get("WEBGL_multi_draw");if(v===null)for(let y=0;y<f.length;y++)l(f[y],p[y],g[y]);else{v.multiDrawArraysInstancedWEBGL(n,f,0,p,0,g,0,m);let y=0;for(let b=0;b<m;b++)y+=p[b]*g[b];e.update(y,n,1)}}this.setMode=s,this.render=r,this.renderInstances=l,this.renderMultiDraw=c,this.renderMultiDrawInstances=h}function e3(i,t,e,n){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let L=t.get("EXT_texture_filter_anisotropic");s=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function l(L){return!(L!==Un&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(L){let F=L===Ss&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(L!==Gn&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Qn&&!F)}function h(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=e.precision!==void 0?e.precision:"highp",p=h(f);p!==f&&(wt("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let m=e.logarithmicDepthBuffer===!0,g=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),v=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),x=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),A=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),N=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:m,reversedDepthBuffer:g,maxTextures:v,maxVertexTextures:y,maxTextureSize:b,maxCubemapSize:S,maxAttributes:x,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:A,maxSamples:N,samples:D}}function n3(i){let t=this,e=null,n=0,s=!1,r=!1,l=new cs,c=new pe,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(m,g){let v=m.length!==0||g||n!==0||s;return s=g,n=m.length,v},this.beginShadows=function(){r=!0,p(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(m,g){e=p(m,g,0)},this.setState=function(m,g,v){let y=m.clippingPlanes,b=m.clipIntersection,S=m.clipShadows,x=i.get(m);if(!s||y===null||y.length===0||r&&!S)r?p(null):f();else{let E=r?0:n,T=E*4,A=x.clippingState||null;h.value=A,A=p(y,g,T,v);for(let N=0;N!==T;++N)A[N]=e[N];x.clippingState=A,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=E}};function f(){h.value!==e&&(h.value=e,h.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function p(m,g,v,y){let b=m!==null?m.length:0,S=null;if(b!==0){if(S=h.value,y!==!0||S===null){let x=v+b*4,E=g.matrixWorldInverse;c.getNormalMatrix(E),(S===null||S.length<x)&&(S=new Float32Array(x));for(let T=0,A=v;T!==b;++T,A+=4)l.copy(m[T]).applyMatrix4(E,c),l.normal.toArray(S,A),S[A+3]=l.constant}h.value=S,h.needsUpdate=!0}return t.numPlanes=b,t.numIntersection=0,S}}function i3(i){let t=new WeakMap;function e(l,c){return c===oc?l.mapping=xs:c===lc&&(l.mapping=ga),l}function n(l){if(l&&l.isTexture){let c=l.mapping;if(c===oc||c===lc)if(t.has(l)){let h=t.get(l).texture;return e(h,l.mapping)}else{let h=l.image;if(h&&h.height>0){let f=new Pl(h.height);return f.fromEquirectangularTexture(i,l),t.set(l,f),l.addEventListener("dispose",s),e(f.texture,l.mapping)}else return null}}return l}function s(l){let c=l.target;c.removeEventListener("dispose",s);let h=t.get(c);h!==void 0&&(t.delete(c),h.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}var rr=4,Sb=[.125,.215,.35,.446,.526,.582],_o=20,s3=256,Af=new Bs,Mb=new Lt,uv=null,hv=0,fv=0,dv=!1,a3=new O,wf=class{constructor(t){this._renderer=t,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(t,e=0,n=.1,s=100,r={}){let{size:l=256,position:c=a3}=r;uv=this._renderer.getRenderTarget(),hv=this._renderer.getActiveCubeFace(),fv=this._renderer.getActiveMipmapLevel(),dv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(l);let h=this._allocateTargets();return h.depthBuffer=!0,this._sceneToCubeUV(t,n,s,h,c),e>0&&this._blur(h,0,0,e),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Tb(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Eb(),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(t){this._lodMax=Math.floor(Math.log2(t)),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 t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(uv,hv,fv),this._renderer.xr.enabled=dv,t.scissorTest=!1,mc(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===xs||t.mapping===ga?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),uv=this._renderer.getRenderTarget(),hv=this._renderer.getActiveCubeFace(),fv=this._renderer.getActiveMipmapLevel(),dv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Je,minFilter:Je,generateMipmaps:!1,type:Ss,format:Un,colorSpace:Ps,depthBuffer:!1},s=bb(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=bb(t,e,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=r3(r)),this._blurMaterial=l3(r,t,e),this._ggxMaterial=o3(r,t,e)}return s}_compileMaterial(t){let e=new rn(new de,t);this._renderer.compile(e,Af)}_sceneToCubeUV(t,e,n,s,r){let h=new fn(90,1,e,n),f=[1,-1,1,1,1,1],p=[1,1,1,-1,-1,-1],m=this._renderer,g=m.autoClear,v=m.toneMapping;m.getClearColor(Mb),m.toneMapping=Si,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(s),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new rn(new ja,new ps({name:"PMREM.Background",side:ti,depthWrite:!1,depthTest:!1})));let b=this._backgroundBox,S=b.material,x=!1,E=t.background;E?E.isColor&&(S.color.copy(E),t.background=null,x=!0):(S.color.copy(Mb),x=!0);for(let T=0;T<6;T++){let A=T%3;A===0?(h.up.set(0,f[T],0),h.position.set(r.x,r.y,r.z),h.lookAt(r.x+p[T],r.y,r.z)):A===1?(h.up.set(0,0,f[T]),h.position.set(r.x,r.y,r.z),h.lookAt(r.x,r.y+p[T],r.z)):(h.up.set(0,f[T],0),h.position.set(r.x,r.y,r.z),h.lookAt(r.x,r.y,r.z+p[T]));let N=this._cubeSize;mc(s,A*N,T>2?N:0,N,N),m.setRenderTarget(s),x&&m.render(b,h),m.render(t,h)}m.toneMapping=v,m.autoClear=g,t.background=E}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===xs||t.mapping===ga;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Tb()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Eb());let r=s?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=r;let c=r.uniforms;c.envMap.value=t;let h=this._cubeSize;mc(e,0,0,3*h,2*h),n.setRenderTarget(e),n.render(l,Af)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(t,r-1,r);e.autoClear=n}_applyGGXFilter(t,e,n){let s=this._renderer,r=this._pingPongRenderTarget,l=this._ggxMaterial,c=this._lodMeshes[n];c.material=l;let h=l.uniforms,f=n/(this._lodMeshes.length-1),p=e/(this._lodMeshes.length-1),m=Math.sqrt(f*f-p*p),g=0+f*1.25,v=m*g,{_lodMax:y}=this,b=this._sizeLods[n],S=3*b*(n>y-rr?n-y+rr:0),x=4*(this._cubeSize-b);h.envMap.value=t.texture,h.roughness.value=v,h.mipInt.value=y-e,mc(r,S,x,3*b,2*b),s.setRenderTarget(r),s.render(c,Af),h.envMap.value=r.texture,h.roughness.value=0,h.mipInt.value=y-n,mc(t,S,x,3*b,2*b),s.setRenderTarget(t),s.render(c,Af)}_blur(t,e,n,s,r){let l=this._pingPongRenderTarget;this._halfBlur(t,l,e,n,s,"latitudinal",r),this._halfBlur(l,t,n,n,s,"longitudinal",r)}_halfBlur(t,e,n,s,r,l,c){let h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&Qt("blur direction must be either latitudinal or longitudinal!");let p=3,m=this._lodMeshes[s];m.material=f;let g=f.uniforms,v=this._sizeLods[n]-1,y=isFinite(r)?Math.PI/(2*v):2*Math.PI/(2*_o-1),b=r/y,S=isFinite(r)?1+Math.floor(p*b):_o;S>_o&&wt(`sigmaRadians, ${r}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${_o}`);let x=[],E=0;for(let L=0;L<_o;++L){let F=L/b,C=Math.exp(-F*F/2);x.push(C),L===0?E+=C:L<S&&(E+=2*C)}for(let L=0;L<x.length;L++)x[L]=x[L]/E;g.envMap.value=t.texture,g.samples.value=S,g.weights.value=x,g.latitudinal.value=l==="latitudinal",c&&(g.poleAxis.value=c);let{_lodMax:T}=this;g.dTheta.value=y,g.mipInt.value=T-n;let A=this._sizeLods[s],N=3*A*(s>T-rr?s-T+rr:0),D=4*(this._cubeSize-A);mc(e,N,D,3*A,2*A),h.setRenderTarget(e),h.render(m,Af)}};function r3(i){let t=[],e=[],n=[],s=i,r=i-rr+1+Sb.length;for(let l=0;l<r;l++){let c=Math.pow(2,s);t.push(c);let h=1/c;l>i-rr?h=Sb[l-i+rr-1]:l===0&&(h=0),e.push(h);let f=1/(c-2),p=-f,m=1+f,g=[p,p,m,p,m,m,p,p,m,m,p,m],v=6,y=6,b=3,S=2,x=1,E=new Float32Array(b*y*v),T=new Float32Array(S*y*v),A=new Float32Array(x*y*v);for(let D=0;D<v;D++){let L=D%3*2/3-1,F=D>2?0:-1,C=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];E.set(C,b*y*D),T.set(g,S*y*D);let w=[D,D,D,D,D,D];A.set(w,x*y*D)}let N=new de;N.setAttribute("position",new He(E,b)),N.setAttribute("uv",new He(T,S)),N.setAttribute("faceIndex",new He(A,x)),n.push(new rn(N,null)),s>rr&&s--}return{lodMeshes:n,sizeLods:t,sigmas:e}}function bb(i,t,e){let n=new $n(i,t,e);return n.texture.mapping=co,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function mc(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function o3(i,t,e){return new ci({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:s3,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Pm(),fragmentShader:`
3616
+ }`,xe={alphahash_fragment:xR,alphahash_pars_fragment:yR,alphamap_fragment:SR,alphamap_pars_fragment:MR,alphatest_fragment:bR,alphatest_pars_fragment:ER,aomap_fragment:TR,aomap_pars_fragment:AR,batching_pars_vertex:CR,batching_vertex:RR,begin_vertex:wR,beginnormal_vertex:NR,bsdfs:DR,iridescence_fragment:UR,bumpmap_pars_fragment:PR,clipping_planes_fragment:IR,clipping_planes_pars_fragment:LR,clipping_planes_pars_vertex:OR,clipping_planes_vertex:BR,color_fragment:FR,color_pars_fragment:zR,color_pars_vertex:VR,color_vertex:HR,common:GR,cube_uv_reflection_fragment:kR,defaultnormal_vertex:WR,displacementmap_pars_vertex:XR,displacementmap_vertex:qR,emissivemap_fragment:YR,emissivemap_pars_fragment:ZR,colorspace_fragment:jR,colorspace_pars_fragment:JR,envmap_fragment:KR,envmap_common_pars_fragment:QR,envmap_pars_fragment:$R,envmap_pars_vertex:tw,envmap_physical_pars_fragment:hw,envmap_vertex:ew,fog_vertex:nw,fog_pars_vertex:iw,fog_fragment:sw,fog_pars_fragment:aw,gradientmap_pars_fragment:rw,lightmap_pars_fragment:ow,lights_lambert_fragment:lw,lights_lambert_pars_fragment:cw,lights_pars_begin:uw,lights_toon_fragment:fw,lights_toon_pars_fragment:dw,lights_phong_fragment:pw,lights_phong_pars_fragment:mw,lights_physical_fragment:gw,lights_physical_pars_fragment:_w,lights_fragment_begin:vw,lights_fragment_maps:xw,lights_fragment_end:yw,logdepthbuf_fragment:Sw,logdepthbuf_pars_fragment:Mw,logdepthbuf_pars_vertex:bw,logdepthbuf_vertex:Ew,map_fragment:Tw,map_pars_fragment:Aw,map_particle_fragment:Cw,map_particle_pars_fragment:Rw,metalnessmap_fragment:ww,metalnessmap_pars_fragment:Nw,morphinstance_vertex:Dw,morphcolor_vertex:Uw,morphnormal_vertex:Pw,morphtarget_pars_vertex:Iw,morphtarget_vertex:Lw,normal_fragment_begin:Ow,normal_fragment_maps:Bw,normal_pars_fragment:Fw,normal_pars_vertex:zw,normal_vertex:Vw,normalmap_pars_fragment:Hw,clearcoat_normal_fragment_begin:Gw,clearcoat_normal_fragment_maps:kw,clearcoat_pars_fragment:Ww,iridescence_pars_fragment:Xw,opaque_fragment:qw,packing:Yw,premultiplied_alpha_fragment:Zw,project_vertex:jw,dithering_fragment:Jw,dithering_pars_fragment:Kw,roughnessmap_fragment:Qw,roughnessmap_pars_fragment:$w,shadowmap_pars_fragment:t2,shadowmap_pars_vertex:e2,shadowmap_vertex:n2,shadowmask_pars_fragment:i2,skinbase_vertex:s2,skinning_pars_vertex:a2,skinning_vertex:r2,skinnormal_vertex:o2,specularmap_fragment:l2,specularmap_pars_fragment:c2,tonemapping_fragment:u2,tonemapping_pars_fragment:h2,transmission_fragment:f2,transmission_pars_fragment:d2,uv_pars_fragment:p2,uv_pars_vertex:m2,uv_vertex:g2,worldpos_vertex:_2,background_vert:v2,background_frag:x2,backgroundCube_vert:y2,backgroundCube_frag:S2,cube_vert:M2,cube_frag:b2,depth_vert:E2,depth_frag:T2,distance_vert:A2,distance_frag:C2,equirect_vert:R2,equirect_frag:w2,linedashed_vert:N2,linedashed_frag:D2,meshbasic_vert:U2,meshbasic_frag:P2,meshlambert_vert:I2,meshlambert_frag:L2,meshmatcap_vert:O2,meshmatcap_frag:B2,meshnormal_vert:F2,meshnormal_frag:z2,meshphong_vert:V2,meshphong_frag:H2,meshphysical_vert:G2,meshphysical_frag:k2,meshtoon_vert:W2,meshtoon_frag:X2,points_vert:q2,points_frag:Y2,shadow_vert:Z2,shadow_frag:j2,sprite_vert:J2,sprite_frag:K2},It={common:{diffuse:{value:new Lt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pe},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pe}},envmap:{envMap:{value:null},envMapRotation:{value:new pe},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 pe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pe},normalScale:{value:new ft(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Lt(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 Lt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0},uvTransform:{value:new pe}},sprite:{diffuse:{value:new Lt(16777215)},opacity:{value:1},center:{value:new ft(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pe},alphaMap:{value:null},alphaMapTransform:{value:new pe},alphaTest:{value:0}}},Ms={basic:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.fog]),vertexShader:xe.meshbasic_vert,fragmentShader:xe.meshbasic_frag},lambert:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.fog,It.lights,{emissive:{value:new Lt(0)}}]),vertexShader:xe.meshlambert_vert,fragmentShader:xe.meshlambert_frag},phong:{uniforms:ei([It.common,It.specularmap,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.fog,It.lights,{emissive:{value:new Lt(0)},specular:{value:new Lt(1118481)},shininess:{value:30}}]),vertexShader:xe.meshphong_vert,fragmentShader:xe.meshphong_frag},standard:{uniforms:ei([It.common,It.envmap,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.roughnessmap,It.metalnessmap,It.fog,It.lights,{emissive:{value:new Lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag},toon:{uniforms:ei([It.common,It.aomap,It.lightmap,It.emissivemap,It.bumpmap,It.normalmap,It.displacementmap,It.gradientmap,It.fog,It.lights,{emissive:{value:new Lt(0)}}]),vertexShader:xe.meshtoon_vert,fragmentShader:xe.meshtoon_frag},matcap:{uniforms:ei([It.common,It.bumpmap,It.normalmap,It.displacementmap,It.fog,{matcap:{value:null}}]),vertexShader:xe.meshmatcap_vert,fragmentShader:xe.meshmatcap_frag},points:{uniforms:ei([It.points,It.fog]),vertexShader:xe.points_vert,fragmentShader:xe.points_frag},dashed:{uniforms:ei([It.common,It.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xe.linedashed_vert,fragmentShader:xe.linedashed_frag},depth:{uniforms:ei([It.common,It.displacementmap]),vertexShader:xe.depth_vert,fragmentShader:xe.depth_frag},normal:{uniforms:ei([It.common,It.bumpmap,It.normalmap,It.displacementmap,{opacity:{value:1}}]),vertexShader:xe.meshnormal_vert,fragmentShader:xe.meshnormal_frag},sprite:{uniforms:ei([It.sprite,It.fog]),vertexShader:xe.sprite_vert,fragmentShader:xe.sprite_frag},background:{uniforms:{uvTransform:{value:new pe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xe.background_vert,fragmentShader:xe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pe}},vertexShader:xe.backgroundCube_vert,fragmentShader:xe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xe.cube_vert,fragmentShader:xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xe.equirect_vert,fragmentShader:xe.equirect_frag},distance:{uniforms:ei([It.common,It.displacementmap,{referencePosition:{value:new O},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xe.distance_vert,fragmentShader:xe.distance_frag},shadow:{uniforms:ei([It.lights,It.fog,{color:{value:new Lt(0)},opacity:{value:1}}]),vertexShader:xe.shadow_vert,fragmentShader:xe.shadow_frag}};Ms.physical={uniforms:ei([Ms.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pe},clearcoatNormalScale:{value:new ft(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pe},sheen:{value:0},sheenColor:{value:new Lt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pe},transmissionSamplerSize:{value:new ft},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pe},attenuationDistance:{value:0},attenuationColor:{value:new Lt(0)},specularColor:{value:new Lt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pe},anisotropyVector:{value:new ft},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pe}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag};var Dm={r:0,b:0,g:0},mo=new xi,Q2=new ue;function $2(i,t,e,n,s,r,l){let c=new Lt(0),h=r===!0?0:1,f,p,m=null,g=0,v=null;function y(T){let A=T.isScene===!0?T.background:null;return A&&A.isTexture&&(A=(T.backgroundBlurriness>0?e:t).get(A)),A}function b(T){let A=!1,N=y(T);N===null?x(c,h):N&&N.isColor&&(x(N,1),A=!0);let D=i.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,l):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,l),(i.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function S(T,A){let N=y(A);N&&(N.isCubeTexture||N.mapping===co)?(p===void 0&&(p=new rn(new Ja(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:po(Ms.backgroundCube.uniforms),vertexShader:Ms.backgroundCube.vertexShader,fragmentShader:Ms.backgroundCube.fragmentShader,side:ti,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(D,L,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(p)),mo.copy(A.backgroundRotation),mo.x*=-1,mo.y*=-1,mo.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(mo.y*=-1,mo.z*=-1),p.material.uniforms.envMap.value=N,p.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(Q2.makeRotationFromEuler(mo)),p.material.toneMapped=be.getTransfer(N.colorSpace)!==Ve,(m!==N||g!==N.version||v!==i.toneMapping)&&(p.material.needsUpdate=!0,m=N,g=N.version,v=i.toneMapping),p.layers.enableAll(),T.unshift(p,p.geometry,p.material,0,0,null)):N&&N.isTexture&&(f===void 0&&(f=new rn(new oo(2,2),new ci({name:"BackgroundMaterial",uniforms:po(Ms.background.uniforms),vertexShader:Ms.background.vertexShader,fragmentShader:Ms.background.fragmentShader,side:Us,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(f)),f.material.uniforms.t2D.value=N,f.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,f.material.toneMapped=be.getTransfer(N.colorSpace)!==Ve,N.matrixAutoUpdate===!0&&N.updateMatrix(),f.material.uniforms.uvTransform.value.copy(N.matrix),(m!==N||g!==N.version||v!==i.toneMapping)&&(f.material.needsUpdate=!0,m=N,g=N.version,v=i.toneMapping),f.layers.enableAll(),T.unshift(f,f.geometry,f.material,0,0,null))}function x(T,A){T.getRGB(Dm,iv(i)),n.buffers.color.setClear(Dm.r,Dm.g,Dm.b,A,l)}function E(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0)}return{getClearColor:function(){return c},setClearColor:function(T,A=1){c.set(T),h=A,x(c,h)},getClearAlpha:function(){return h},setClearAlpha:function(T){h=T,x(c,h)},render:b,addToRenderList:S,dispose:E}}function t3(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=g(null),r=s,l=!1;function c(w,z,Y,G,j){let nt=!1,J=m(G,Y,z);r!==J&&(r=J,f(r.object)),nt=v(w,G,Y,j),nt&&y(w,G,Y,j),j!==null&&t.update(j,i.ELEMENT_ARRAY_BUFFER),(nt||l)&&(l=!1,A(w,z,Y,G),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function h(){return i.createVertexArray()}function f(w){return i.bindVertexArray(w)}function p(w){return i.deleteVertexArray(w)}function m(w,z,Y){let G=Y.wireframe===!0,j=n[w.id];j===void 0&&(j={},n[w.id]=j);let nt=j[z.id];nt===void 0&&(nt={},j[z.id]=nt);let J=nt[G];return J===void 0&&(J=g(h()),nt[G]=J),J}function g(w){let z=[],Y=[],G=[];for(let j=0;j<e;j++)z[j]=0,Y[j]=0,G[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:Y,attributeDivisors:G,object:w,attributes:{},index:null}}function v(w,z,Y,G){let j=r.attributes,nt=z.attributes,J=0,et=Y.getAttributes();for(let rt in et)if(et[rt].location>=0){let bt=j[rt],mt=nt[rt];if(mt===void 0&&(rt==="instanceMatrix"&&w.instanceMatrix&&(mt=w.instanceMatrix),rt==="instanceColor"&&w.instanceColor&&(mt=w.instanceColor)),bt===void 0||bt.attribute!==mt||mt&&bt.data!==mt.data)return!0;J++}return r.attributesNum!==J||r.index!==G}function y(w,z,Y,G){let j={},nt=z.attributes,J=0,et=Y.getAttributes();for(let rt in et)if(et[rt].location>=0){let bt=nt[rt];bt===void 0&&(rt==="instanceMatrix"&&w.instanceMatrix&&(bt=w.instanceMatrix),rt==="instanceColor"&&w.instanceColor&&(bt=w.instanceColor));let mt={};mt.attribute=bt,bt&&bt.data&&(mt.data=bt.data),j[rt]=mt,J++}r.attributes=j,r.attributesNum=J,r.index=G}function b(){let w=r.newAttributes;for(let z=0,Y=w.length;z<Y;z++)w[z]=0}function S(w){x(w,0)}function x(w,z){let Y=r.newAttributes,G=r.enabledAttributes,j=r.attributeDivisors;Y[w]=1,G[w]===0&&(i.enableVertexAttribArray(w),G[w]=1),j[w]!==z&&(i.vertexAttribDivisor(w,z),j[w]=z)}function E(){let w=r.newAttributes,z=r.enabledAttributes;for(let Y=0,G=z.length;Y<G;Y++)z[Y]!==w[Y]&&(i.disableVertexAttribArray(Y),z[Y]=0)}function T(w,z,Y,G,j,nt,J){J===!0?i.vertexAttribIPointer(w,z,Y,j,nt):i.vertexAttribPointer(w,z,Y,G,j,nt)}function A(w,z,Y,G){b();let j=G.attributes,nt=Y.getAttributes(),J=z.defaultAttributeValues;for(let et in nt){let rt=nt[et];if(rt.location>=0){let St=j[et];if(St===void 0&&(et==="instanceMatrix"&&w.instanceMatrix&&(St=w.instanceMatrix),et==="instanceColor"&&w.instanceColor&&(St=w.instanceColor)),St!==void 0){let bt=St.normalized,mt=St.itemSize,kt=t.get(St);if(kt===void 0)continue;let $t=kt.buffer,re=kt.type,Ce=kt.bytesPerElement,at=re===i.INT||re===i.UNSIGNED_INT||St.gpuType===Fh;if(St.isInterleavedBufferAttribute){let dt=St.data,Vt=dt.stride,ie=St.offset;if(dt.isInstancedInterleavedBuffer){for(let Ft=0;Ft<rt.locationSize;Ft++)x(rt.location+Ft,dt.meshPerAttribute);w.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=dt.meshPerAttribute*dt.count)}else for(let Ft=0;Ft<rt.locationSize;Ft++)S(rt.location+Ft);i.bindBuffer(i.ARRAY_BUFFER,$t);for(let Ft=0;Ft<rt.locationSize;Ft++)T(rt.location+Ft,mt/rt.locationSize,re,bt,Vt*Ce,(ie+mt/rt.locationSize*Ft)*Ce,at)}else{if(St.isInstancedBufferAttribute){for(let dt=0;dt<rt.locationSize;dt++)x(rt.location+dt,St.meshPerAttribute);w.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=St.meshPerAttribute*St.count)}else for(let dt=0;dt<rt.locationSize;dt++)S(rt.location+dt);i.bindBuffer(i.ARRAY_BUFFER,$t);for(let dt=0;dt<rt.locationSize;dt++)T(rt.location+dt,mt/rt.locationSize,re,bt,mt*Ce,mt/rt.locationSize*dt*Ce,at)}}else if(J!==void 0){let bt=J[et];if(bt!==void 0)switch(bt.length){case 2:i.vertexAttrib2fv(rt.location,bt);break;case 3:i.vertexAttrib3fv(rt.location,bt);break;case 4:i.vertexAttrib4fv(rt.location,bt);break;default:i.vertexAttrib1fv(rt.location,bt)}}}}E()}function N(){F();for(let w in n){let z=n[w];for(let Y in z){let G=z[Y];for(let j in G)p(G[j].object),delete G[j];delete z[Y]}delete n[w]}}function D(w){if(n[w.id]===void 0)return;let z=n[w.id];for(let Y in z){let G=z[Y];for(let j in G)p(G[j].object),delete G[j];delete z[Y]}delete n[w.id]}function L(w){for(let z in n){let Y=n[z];if(Y[w.id]===void 0)continue;let G=Y[w.id];for(let j in G)p(G[j].object),delete G[j];delete Y[w.id]}}function F(){C(),l=!0,r!==s&&(r=s,f(r.object))}function C(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:c,reset:F,resetDefaultState:C,dispose:N,releaseStatesOfGeometry:D,releaseStatesOfProgram:L,initAttributes:b,enableAttribute:S,disableUnusedAttributes:E}}function e3(i,t,e){let n;function s(f){n=f}function r(f,p){i.drawArrays(n,f,p),e.update(p,n,1)}function l(f,p,m){m!==0&&(i.drawArraysInstanced(n,f,p,m),e.update(p,n,m))}function c(f,p,m){if(m===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,f,0,p,0,m);let v=0;for(let y=0;y<m;y++)v+=p[y];e.update(v,n,1)}function h(f,p,m,g){if(m===0)return;let v=t.get("WEBGL_multi_draw");if(v===null)for(let y=0;y<f.length;y++)l(f[y],p[y],g[y]);else{v.multiDrawArraysInstancedWEBGL(n,f,0,p,0,g,0,m);let y=0;for(let b=0;b<m;b++)y+=p[b]*g[b];e.update(y,n,1)}}this.setMode=s,this.render=r,this.renderInstances=l,this.renderMultiDraw=c,this.renderMultiDrawInstances=h}function n3(i,t,e,n){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let L=t.get("EXT_texture_filter_anisotropic");s=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function l(L){return!(L!==Un&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(L){let F=L===Ss&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(L!==Gn&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Qn&&!F)}function h(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=e.precision!==void 0?e.precision:"highp",p=h(f);p!==f&&(wt("WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let m=e.logarithmicDepthBuffer===!0,g=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),v=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),x=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),A=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),N=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:m,reversedDepthBuffer:g,maxTextures:v,maxVertexTextures:y,maxTextureSize:b,maxCubemapSize:S,maxAttributes:x,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:A,maxSamples:N,samples:D}}function i3(i){let t=this,e=null,n=0,s=!1,r=!1,l=new cs,c=new pe,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(m,g){let v=m.length!==0||g||n!==0||s;return s=g,n=m.length,v},this.beginShadows=function(){r=!0,p(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(m,g){e=p(m,g,0)},this.setState=function(m,g,v){let y=m.clippingPlanes,b=m.clipIntersection,S=m.clipShadows,x=i.get(m);if(!s||y===null||y.length===0||r&&!S)r?p(null):f();else{let E=r?0:n,T=E*4,A=x.clippingState||null;h.value=A,A=p(y,g,T,v);for(let N=0;N!==T;++N)A[N]=e[N];x.clippingState=A,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=E}};function f(){h.value!==e&&(h.value=e,h.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function p(m,g,v,y){let b=m!==null?m.length:0,S=null;if(b!==0){if(S=h.value,y!==!0||S===null){let x=v+b*4,E=g.matrixWorldInverse;c.getNormalMatrix(E),(S===null||S.length<x)&&(S=new Float32Array(x));for(let T=0,A=v;T!==b;++T,A+=4)l.copy(m[T]).applyMatrix4(E,c),l.normal.toArray(S,A),S[A+3]=l.constant}h.value=S,h.needsUpdate=!0}return t.numPlanes=b,t.numIntersection=0,S}}function s3(i){let t=new WeakMap;function e(l,c){return c===oc?l.mapping=xs:c===lc&&(l.mapping=_a),l}function n(l){if(l&&l.isTexture){let c=l.mapping;if(c===oc||c===lc)if(t.has(l)){let h=t.get(l).texture;return e(h,l.mapping)}else{let h=l.image;if(h&&h.height>0){let f=new Pl(h.height);return f.fromEquirectangularTexture(i,l),t.set(l,f),l.addEventListener("dispose",s),e(f.texture,l.mapping)}else return null}}return l}function s(l){let c=l.target;c.removeEventListener("dispose",s);let h=t.get(c);h!==void 0&&(t.delete(c),h.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}var or=4,Sb=[.125,.215,.35,.446,.526,.582],_o=20,a3=256,Af=new Bs,Mb=new Lt,uv=null,hv=0,fv=0,dv=!1,r3=new O,wf=class{constructor(t){this._renderer=t,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(t,e=0,n=.1,s=100,r={}){let{size:l=256,position:c=r3}=r;uv=this._renderer.getRenderTarget(),hv=this._renderer.getActiveCubeFace(),fv=this._renderer.getActiveMipmapLevel(),dv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(l);let h=this._allocateTargets();return h.depthBuffer=!0,this._sceneToCubeUV(t,n,s,h,c),e>0&&this._blur(h,0,0,e),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Tb(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Eb(),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(t){this._lodMax=Math.floor(Math.log2(t)),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 t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(uv,hv,fv),this._renderer.xr.enabled=dv,t.scissorTest=!1,mc(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===xs||t.mapping===_a?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),uv=this._renderer.getRenderTarget(),hv=this._renderer.getActiveCubeFace(),fv=this._renderer.getActiveMipmapLevel(),dv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Je,minFilter:Je,generateMipmaps:!1,type:Ss,format:Un,colorSpace:Ps,depthBuffer:!1},s=bb(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=bb(t,e,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=o3(r)),this._blurMaterial=c3(r,t,e),this._ggxMaterial=l3(r,t,e)}return s}_compileMaterial(t){let e=new rn(new de,t);this._renderer.compile(e,Af)}_sceneToCubeUV(t,e,n,s,r){let h=new fn(90,1,e,n),f=[1,-1,1,1,1,1],p=[1,1,1,-1,-1,-1],m=this._renderer,g=m.autoClear,v=m.toneMapping;m.getClearColor(Mb),m.toneMapping=Si,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(s),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new rn(new Ja,new ps({name:"PMREM.Background",side:ti,depthWrite:!1,depthTest:!1})));let b=this._backgroundBox,S=b.material,x=!1,E=t.background;E?E.isColor&&(S.color.copy(E),t.background=null,x=!0):(S.color.copy(Mb),x=!0);for(let T=0;T<6;T++){let A=T%3;A===0?(h.up.set(0,f[T],0),h.position.set(r.x,r.y,r.z),h.lookAt(r.x+p[T],r.y,r.z)):A===1?(h.up.set(0,0,f[T]),h.position.set(r.x,r.y,r.z),h.lookAt(r.x,r.y+p[T],r.z)):(h.up.set(0,f[T],0),h.position.set(r.x,r.y,r.z),h.lookAt(r.x,r.y,r.z+p[T]));let N=this._cubeSize;mc(s,A*N,T>2?N:0,N,N),m.setRenderTarget(s),x&&m.render(b,h),m.render(t,h)}m.toneMapping=v,m.autoClear=g,t.background=E}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===xs||t.mapping===_a;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Tb()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Eb());let r=s?this._cubemapMaterial:this._equirectMaterial,l=this._lodMeshes[0];l.material=r;let c=r.uniforms;c.envMap.value=t;let h=this._cubeSize;mc(e,0,0,3*h,2*h),n.setRenderTarget(e),n.render(l,Af)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(t,r-1,r);e.autoClear=n}_applyGGXFilter(t,e,n){let s=this._renderer,r=this._pingPongRenderTarget,l=this._ggxMaterial,c=this._lodMeshes[n];c.material=l;let h=l.uniforms,f=n/(this._lodMeshes.length-1),p=e/(this._lodMeshes.length-1),m=Math.sqrt(f*f-p*p),g=0+f*1.25,v=m*g,{_lodMax:y}=this,b=this._sizeLods[n],S=3*b*(n>y-or?n-y+or:0),x=4*(this._cubeSize-b);h.envMap.value=t.texture,h.roughness.value=v,h.mipInt.value=y-e,mc(r,S,x,3*b,2*b),s.setRenderTarget(r),s.render(c,Af),h.envMap.value=r.texture,h.roughness.value=0,h.mipInt.value=y-n,mc(t,S,x,3*b,2*b),s.setRenderTarget(t),s.render(c,Af)}_blur(t,e,n,s,r){let l=this._pingPongRenderTarget;this._halfBlur(t,l,e,n,s,"latitudinal",r),this._halfBlur(l,t,n,n,s,"longitudinal",r)}_halfBlur(t,e,n,s,r,l,c){let h=this._renderer,f=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&Qt("blur direction must be either latitudinal or longitudinal!");let p=3,m=this._lodMeshes[s];m.material=f;let g=f.uniforms,v=this._sizeLods[n]-1,y=isFinite(r)?Math.PI/(2*v):2*Math.PI/(2*_o-1),b=r/y,S=isFinite(r)?1+Math.floor(p*b):_o;S>_o&&wt(`sigmaRadians, ${r}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${_o}`);let x=[],E=0;for(let L=0;L<_o;++L){let F=L/b,C=Math.exp(-F*F/2);x.push(C),L===0?E+=C:L<S&&(E+=2*C)}for(let L=0;L<x.length;L++)x[L]=x[L]/E;g.envMap.value=t.texture,g.samples.value=S,g.weights.value=x,g.latitudinal.value=l==="latitudinal",c&&(g.poleAxis.value=c);let{_lodMax:T}=this;g.dTheta.value=y,g.mipInt.value=T-n;let A=this._sizeLods[s],N=3*A*(s>T-or?s-T+or:0),D=4*(this._cubeSize-A);mc(e,N,D,3*A,2*A),h.setRenderTarget(e),h.render(m,Af)}};function o3(i){let t=[],e=[],n=[],s=i,r=i-or+1+Sb.length;for(let l=0;l<r;l++){let c=Math.pow(2,s);t.push(c);let h=1/c;l>i-or?h=Sb[l-i+or-1]:l===0&&(h=0),e.push(h);let f=1/(c-2),p=-f,m=1+f,g=[p,p,m,p,m,m,p,p,m,m,p,m],v=6,y=6,b=3,S=2,x=1,E=new Float32Array(b*y*v),T=new Float32Array(S*y*v),A=new Float32Array(x*y*v);for(let D=0;D<v;D++){let L=D%3*2/3-1,F=D>2?0:-1,C=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];E.set(C,b*y*D),T.set(g,S*y*D);let w=[D,D,D,D,D,D];A.set(w,x*y*D)}let N=new de;N.setAttribute("position",new He(E,b)),N.setAttribute("uv",new He(T,S)),N.setAttribute("faceIndex",new He(A,x)),n.push(new rn(N,null)),s>or&&s--}return{lodMeshes:n,sizeLods:t,sigmas:e}}function bb(i,t,e){let n=new $n(i,t,e);return n.texture.mapping=co,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function mc(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function l3(i,t,e){return new ci({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:a3,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Pm(),fragmentShader:`
3617
3617
 
3618
3618
  precision highp float;
3619
3619
  precision highp int;
@@ -3721,7 +3721,7 @@ void main() {
3721
3721
 
3722
3722
  gl_FragColor = vec4(prefilteredColor, 1.0);
3723
3723
  }
3724
- `,blending:vs,depthTest:!1,depthWrite:!1})}function l3(i,t,e){let n=new Float32Array(_o),s=new O(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:_o,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Pm(),fragmentShader:`
3724
+ `,blending:vs,depthTest:!1,depthWrite:!1})}function c3(i,t,e){let n=new Float32Array(_o),s=new O(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:_o,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Pm(),fragmentShader:`
3725
3725
 
3726
3726
  precision mediump float;
3727
3727
  precision mediump int;
@@ -3871,7 +3871,7 @@ void main() {
3871
3871
  gl_Position = vec4( position, 1.0 );
3872
3872
 
3873
3873
  }
3874
- `}function c3(i){let t=new WeakMap,e=null;function n(c){if(c&&c.isTexture){let h=c.mapping,f=h===oc||h===lc,p=h===xs||h===ga;if(f||p){let m=t.get(c),g=m!==void 0?m.texture.pmremVersion:0;if(c.isRenderTargetTexture&&c.pmremVersion!==g)return e===null&&(e=new wf(i)),m=f?e.fromEquirectangular(c,m):e.fromCubemap(c,m),m.texture.pmremVersion=c.pmremVersion,t.set(c,m),m.texture;if(m!==void 0)return m.texture;{let v=c.image;return f&&v&&v.height>0||p&&v&&s(v)?(e===null&&(e=new wf(i)),m=f?e.fromEquirectangular(c):e.fromCubemap(c),m.texture.pmremVersion=c.pmremVersion,t.set(c,m),c.addEventListener("dispose",r),m.texture):null}}}return c}function s(c){let h=0,f=6;for(let p=0;p<f;p++)c[p]!==void 0&&h++;return h===f}function r(c){let h=c.target;h.removeEventListener("dispose",r);let f=t.get(h);f!==void 0&&(t.delete(h),f.dispose())}function l(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:l}}function u3(i){let t={};function e(n){if(t[n]!==void 0)return t[n];let s=i.getExtension(n);return t[n]=s,s}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){let s=e(n);return s===null&&Zr("WebGLRenderer: "+n+" extension not supported."),s}}}function h3(i,t,e,n){let s={},r=new WeakMap;function l(m){let g=m.target;g.index!==null&&t.remove(g.index);for(let y in g.attributes)t.remove(g.attributes[y]);g.removeEventListener("dispose",l),delete s[g.id];let v=r.get(g);v&&(t.remove(v),r.delete(g)),n.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,e.memory.geometries--}function c(m,g){return s[g.id]===!0||(g.addEventListener("dispose",l),s[g.id]=!0,e.memory.geometries++),g}function h(m){let g=m.attributes;for(let v in g)t.update(g[v],i.ARRAY_BUFFER)}function f(m){let g=[],v=m.index,y=m.attributes.position,b=0;if(v!==null){let E=v.array;b=v.version;for(let T=0,A=E.length;T<A;T+=3){let N=E[T+0],D=E[T+1],L=E[T+2];g.push(N,D,D,L,L,N)}}else if(y!==void 0){let E=y.array;b=y.version;for(let T=0,A=E.length/3-1;T<A;T+=3){let N=T+0,D=T+1,L=T+2;g.push(N,D,D,L,L,N)}}else return;let S=new(tv(g)?Ul:Dl)(g,1);S.version=b;let x=r.get(m);x&&t.remove(x),r.set(m,S)}function p(m){let g=r.get(m);if(g){let v=m.index;v!==null&&g.version<v.version&&f(m)}else f(m);return r.get(m)}return{get:c,update:h,getWireframeAttribute:p}}function f3(i,t,e){let n;function s(g){n=g}let r,l;function c(g){r=g.type,l=g.bytesPerElement}function h(g,v){i.drawElements(n,v,r,g*l),e.update(v,n,1)}function f(g,v,y){y!==0&&(i.drawElementsInstanced(n,v,r,g*l,y),e.update(v,n,y))}function p(g,v,y){if(y===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,v,0,r,g,0,y);let S=0;for(let x=0;x<y;x++)S+=v[x];e.update(S,n,1)}function m(g,v,y,b){if(y===0)return;let S=t.get("WEBGL_multi_draw");if(S===null)for(let x=0;x<g.length;x++)f(g[x]/l,v[x],b[x]);else{S.multiDrawElementsInstancedWEBGL(n,v,0,r,g,0,b,0,y);let x=0;for(let E=0;E<y;E++)x+=v[E]*b[E];e.update(x,n,1)}}this.setMode=s,this.setIndex=c,this.render=h,this.renderInstances=f,this.renderMultiDraw=p,this.renderMultiDrawInstances=m}function d3(i){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,l,c){switch(e.calls++,l){case i.TRIANGLES:e.triangles+=c*(r/3);break;case i.LINES:e.lines+=c*(r/2);break;case i.LINE_STRIP:e.lines+=c*(r-1);break;case i.LINE_LOOP:e.lines+=c*r;break;case i.POINTS:e.points+=c*r;break;default:Qt("WebGLInfo: Unknown draw mode:",l);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:n}}function p3(i,t,e){let n=new WeakMap,s=new qe;function r(l,c,h){let f=l.morphTargetInfluences,p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,m=p!==void 0?p.length:0,g=n.get(c);if(g===void 0||g.count!==m){let C=function(){L.dispose(),n.delete(c),c.removeEventListener("dispose",C)};g!==void 0&&g.texture.dispose();let v=c.morphAttributes.position!==void 0,y=c.morphAttributes.normal!==void 0,b=c.morphAttributes.color!==void 0,S=c.morphAttributes.position||[],x=c.morphAttributes.normal||[],E=c.morphAttributes.color||[],T=0;v===!0&&(T=1),y===!0&&(T=2),b===!0&&(T=3);let A=c.attributes.position.count*T,N=1;A>t.maxTextureSize&&(N=Math.ceil(A/t.maxTextureSize),A=t.maxTextureSize);let D=new Float32Array(A*N*4*m),L=new Jr(D,A,N,m);L.type=Qn,L.needsUpdate=!0;let F=T*4;for(let w=0;w<m;w++){let z=S[w],Y=x[w],G=E[w],j=A*N*4*w;for(let nt=0;nt<z.count;nt++){let J=nt*F;v===!0&&(s.fromBufferAttribute(z,nt),D[j+J+0]=s.x,D[j+J+1]=s.y,D[j+J+2]=s.z,D[j+J+3]=0),y===!0&&(s.fromBufferAttribute(Y,nt),D[j+J+4]=s.x,D[j+J+5]=s.y,D[j+J+6]=s.z,D[j+J+7]=0),b===!0&&(s.fromBufferAttribute(G,nt),D[j+J+8]=s.x,D[j+J+9]=s.y,D[j+J+10]=s.z,D[j+J+11]=G.itemSize===4?s.w:1)}}g={count:m,texture:L,size:new ft(A,N)},n.set(c,g),c.addEventListener("dispose",C)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)h.getUniforms().setValue(i,"morphTexture",l.morphTexture,e);else{let v=0;for(let b=0;b<f.length;b++)v+=f[b];let y=c.morphTargetsRelative?1:1-v;h.getUniforms().setValue(i,"morphTargetBaseInfluence",y),h.getUniforms().setValue(i,"morphTargetInfluences",f)}h.getUniforms().setValue(i,"morphTargetsTexture",g.texture,e),h.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}return{update:r}}function m3(i,t,e,n){let s=new WeakMap;function r(h){let f=n.render.frame,p=h.geometry,m=t.get(h,p);if(s.get(m)!==f&&(t.update(m),s.set(m,f)),h.isInstancedMesh&&(h.hasEventListener("dispose",c)===!1&&h.addEventListener("dispose",c),s.get(h)!==f&&(e.update(h.instanceMatrix,i.ARRAY_BUFFER),h.instanceColor!==null&&e.update(h.instanceColor,i.ARRAY_BUFFER),s.set(h,f))),h.isSkinnedMesh){let g=h.skeleton;s.get(g)!==f&&(g.update(),s.set(g,f))}return m}function l(){s=new WeakMap}function c(h){let f=h.target;f.removeEventListener("dispose",c),e.remove(f.instanceMatrix),f.instanceColor!==null&&e.remove(f.instanceColor)}return{update:r,dispose:l}}var g3={[mm]:"LINEAR_TONE_MAPPING",[gm]:"REINHARD_TONE_MAPPING",[_m]:"CINEON_TONE_MAPPING",[rc]:"ACES_FILMIC_TONE_MAPPING",[xm]:"AGX_TONE_MAPPING",[ym]:"NEUTRAL_TONE_MAPPING",[vm]:"CUSTOM_TONE_MAPPING"};function _3(i,t,e,n,s){let r=new $n(t,e,{type:i,depthBuffer:n,stencilBuffer:s}),l=new $n(t,e,{type:Ss,depthBuffer:!1,stencilBuffer:!1}),c=new de;c.setAttribute("position",new Gt([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new Gt([0,2,0,0,2,0],2));let h=new Zl({uniforms:{tDiffuse:{value:null}},vertexShader:`
3874
+ `}function u3(i){let t=new WeakMap,e=null;function n(c){if(c&&c.isTexture){let h=c.mapping,f=h===oc||h===lc,p=h===xs||h===_a;if(f||p){let m=t.get(c),g=m!==void 0?m.texture.pmremVersion:0;if(c.isRenderTargetTexture&&c.pmremVersion!==g)return e===null&&(e=new wf(i)),m=f?e.fromEquirectangular(c,m):e.fromCubemap(c,m),m.texture.pmremVersion=c.pmremVersion,t.set(c,m),m.texture;if(m!==void 0)return m.texture;{let v=c.image;return f&&v&&v.height>0||p&&v&&s(v)?(e===null&&(e=new wf(i)),m=f?e.fromEquirectangular(c):e.fromCubemap(c),m.texture.pmremVersion=c.pmremVersion,t.set(c,m),c.addEventListener("dispose",r),m.texture):null}}}return c}function s(c){let h=0,f=6;for(let p=0;p<f;p++)c[p]!==void 0&&h++;return h===f}function r(c){let h=c.target;h.removeEventListener("dispose",r);let f=t.get(h);f!==void 0&&(t.delete(h),f.dispose())}function l(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:l}}function h3(i){let t={};function e(n){if(t[n]!==void 0)return t[n];let s=i.getExtension(n);return t[n]=s,s}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){let s=e(n);return s===null&&jr("WebGLRenderer: "+n+" extension not supported."),s}}}function f3(i,t,e,n){let s={},r=new WeakMap;function l(m){let g=m.target;g.index!==null&&t.remove(g.index);for(let y in g.attributes)t.remove(g.attributes[y]);g.removeEventListener("dispose",l),delete s[g.id];let v=r.get(g);v&&(t.remove(v),r.delete(g)),n.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,e.memory.geometries--}function c(m,g){return s[g.id]===!0||(g.addEventListener("dispose",l),s[g.id]=!0,e.memory.geometries++),g}function h(m){let g=m.attributes;for(let v in g)t.update(g[v],i.ARRAY_BUFFER)}function f(m){let g=[],v=m.index,y=m.attributes.position,b=0;if(v!==null){let E=v.array;b=v.version;for(let T=0,A=E.length;T<A;T+=3){let N=E[T+0],D=E[T+1],L=E[T+2];g.push(N,D,D,L,L,N)}}else if(y!==void 0){let E=y.array;b=y.version;for(let T=0,A=E.length/3-1;T<A;T+=3){let N=T+0,D=T+1,L=T+2;g.push(N,D,D,L,L,N)}}else return;let S=new(tv(g)?Ul:Dl)(g,1);S.version=b;let x=r.get(m);x&&t.remove(x),r.set(m,S)}function p(m){let g=r.get(m);if(g){let v=m.index;v!==null&&g.version<v.version&&f(m)}else f(m);return r.get(m)}return{get:c,update:h,getWireframeAttribute:p}}function d3(i,t,e){let n;function s(g){n=g}let r,l;function c(g){r=g.type,l=g.bytesPerElement}function h(g,v){i.drawElements(n,v,r,g*l),e.update(v,n,1)}function f(g,v,y){y!==0&&(i.drawElementsInstanced(n,v,r,g*l,y),e.update(v,n,y))}function p(g,v,y){if(y===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,v,0,r,g,0,y);let S=0;for(let x=0;x<y;x++)S+=v[x];e.update(S,n,1)}function m(g,v,y,b){if(y===0)return;let S=t.get("WEBGL_multi_draw");if(S===null)for(let x=0;x<g.length;x++)f(g[x]/l,v[x],b[x]);else{S.multiDrawElementsInstancedWEBGL(n,v,0,r,g,0,b,0,y);let x=0;for(let E=0;E<y;E++)x+=v[E]*b[E];e.update(x,n,1)}}this.setMode=s,this.setIndex=c,this.render=h,this.renderInstances=f,this.renderMultiDraw=p,this.renderMultiDrawInstances=m}function p3(i){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,l,c){switch(e.calls++,l){case i.TRIANGLES:e.triangles+=c*(r/3);break;case i.LINES:e.lines+=c*(r/2);break;case i.LINE_STRIP:e.lines+=c*(r-1);break;case i.LINE_LOOP:e.lines+=c*r;break;case i.POINTS:e.points+=c*r;break;default:Qt("WebGLInfo: Unknown draw mode:",l);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:n}}function m3(i,t,e){let n=new WeakMap,s=new qe;function r(l,c,h){let f=l.morphTargetInfluences,p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,m=p!==void 0?p.length:0,g=n.get(c);if(g===void 0||g.count!==m){let C=function(){L.dispose(),n.delete(c),c.removeEventListener("dispose",C)};g!==void 0&&g.texture.dispose();let v=c.morphAttributes.position!==void 0,y=c.morphAttributes.normal!==void 0,b=c.morphAttributes.color!==void 0,S=c.morphAttributes.position||[],x=c.morphAttributes.normal||[],E=c.morphAttributes.color||[],T=0;v===!0&&(T=1),y===!0&&(T=2),b===!0&&(T=3);let A=c.attributes.position.count*T,N=1;A>t.maxTextureSize&&(N=Math.ceil(A/t.maxTextureSize),A=t.maxTextureSize);let D=new Float32Array(A*N*4*m),L=new Kr(D,A,N,m);L.type=Qn,L.needsUpdate=!0;let F=T*4;for(let w=0;w<m;w++){let z=S[w],Y=x[w],G=E[w],j=A*N*4*w;for(let nt=0;nt<z.count;nt++){let J=nt*F;v===!0&&(s.fromBufferAttribute(z,nt),D[j+J+0]=s.x,D[j+J+1]=s.y,D[j+J+2]=s.z,D[j+J+3]=0),y===!0&&(s.fromBufferAttribute(Y,nt),D[j+J+4]=s.x,D[j+J+5]=s.y,D[j+J+6]=s.z,D[j+J+7]=0),b===!0&&(s.fromBufferAttribute(G,nt),D[j+J+8]=s.x,D[j+J+9]=s.y,D[j+J+10]=s.z,D[j+J+11]=G.itemSize===4?s.w:1)}}g={count:m,texture:L,size:new ft(A,N)},n.set(c,g),c.addEventListener("dispose",C)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)h.getUniforms().setValue(i,"morphTexture",l.morphTexture,e);else{let v=0;for(let b=0;b<f.length;b++)v+=f[b];let y=c.morphTargetsRelative?1:1-v;h.getUniforms().setValue(i,"morphTargetBaseInfluence",y),h.getUniforms().setValue(i,"morphTargetInfluences",f)}h.getUniforms().setValue(i,"morphTargetsTexture",g.texture,e),h.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}return{update:r}}function g3(i,t,e,n){let s=new WeakMap;function r(h){let f=n.render.frame,p=h.geometry,m=t.get(h,p);if(s.get(m)!==f&&(t.update(m),s.set(m,f)),h.isInstancedMesh&&(h.hasEventListener("dispose",c)===!1&&h.addEventListener("dispose",c),s.get(h)!==f&&(e.update(h.instanceMatrix,i.ARRAY_BUFFER),h.instanceColor!==null&&e.update(h.instanceColor,i.ARRAY_BUFFER),s.set(h,f))),h.isSkinnedMesh){let g=h.skeleton;s.get(g)!==f&&(g.update(),s.set(g,f))}return m}function l(){s=new WeakMap}function c(h){let f=h.target;f.removeEventListener("dispose",c),e.remove(f.instanceMatrix),f.instanceColor!==null&&e.remove(f.instanceColor)}return{update:r,dispose:l}}var _3={[mm]:"LINEAR_TONE_MAPPING",[gm]:"REINHARD_TONE_MAPPING",[_m]:"CINEON_TONE_MAPPING",[rc]:"ACES_FILMIC_TONE_MAPPING",[xm]:"AGX_TONE_MAPPING",[ym]:"NEUTRAL_TONE_MAPPING",[vm]:"CUSTOM_TONE_MAPPING"};function v3(i,t,e,n,s){let r=new $n(t,e,{type:i,depthBuffer:n,stencilBuffer:s}),l=new $n(t,e,{type:Ss,depthBuffer:!1,stencilBuffer:!1}),c=new de;c.setAttribute("position",new Gt([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new Gt([0,2,0,0,2,0],2));let h=new Zl({uniforms:{tDiffuse:{value:null}},vertexShader:`
3875
3875
  precision highp float;
3876
3876
 
3877
3877
  uniform mat4 modelViewMatrix;
@@ -3917,17 +3917,17 @@ void main() {
3917
3917
  #ifdef SRGB_TRANSFER
3918
3918
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
3919
3919
  #endif
3920
- }`,depthTest:!1,depthWrite:!1}),f=new rn(c,h),p=new Bs(-1,1,1,-1,0,1),m=null,g=null,v=!1,y,b=null,S=[],x=!1;this.setSize=function(E,T){r.setSize(E,T),l.setSize(E,T);for(let A=0;A<S.length;A++){let N=S[A];N.setSize&&N.setSize(E,T)}},this.setEffects=function(E){S=E,x=S.length>0&&S[0].isRenderPass===!0;let T=r.width,A=r.height;for(let N=0;N<S.length;N++){let D=S[N];D.setSize&&D.setSize(T,A)}},this.begin=function(E,T){if(v||E.toneMapping===Si&&S.length===0)return!1;if(b=T,T!==null){let A=T.width,N=T.height;(r.width!==A||r.height!==N)&&this.setSize(A,N)}return x===!1&&E.setRenderTarget(r),y=E.toneMapping,E.toneMapping=Si,!0},this.hasRenderPass=function(){return x},this.end=function(E,T){E.toneMapping=y,v=!0;let A=r,N=l;for(let D=0;D<S.length;D++){let L=S[D];if(L.enabled!==!1&&(L.render(E,N,A,T),L.needsSwap!==!1)){let F=A;A=N,N=F}}if(m!==E.outputColorSpace||g!==E.toneMapping){m=E.outputColorSpace,g=E.toneMapping,h.defines={},be.getTransfer(m)===Ve&&(h.defines.SRGB_TRANSFER="");let D=g3[g];D&&(h.defines[D]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=A.texture,E.setRenderTarget(b),E.render(f,p),b=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){r.dispose(),l.dispose(),c.dispose(),h.dispose()}}var Wb=new mn,gv=new da(1,1),Xb=new Jr,qb=new Kr,Yb=new Ja,Ab=[],Cb=[],Rb=new Float32Array(16),wb=new Float32Array(9),Nb=new Float32Array(4);function _c(i,t,e){let n=i[0];if(n<=0||n>0)return i;let s=t*e,r=Ab[s];if(r===void 0&&(r=new Float32Array(s),Ab[s]=r),t!==0){n.toArray(r,0);for(let l=1,c=0;l!==t;++l)c+=e,i[l].toArray(r,c)}return r}function Tn(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function An(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function Im(i,t){let e=Cb[t];e===void 0&&(e=new Int32Array(t),Cb[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function v3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function x3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2fv(this.addr,t),An(e,t)}}function y3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Tn(e,t))return;i.uniform3fv(this.addr,t),An(e,t)}}function S3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4fv(this.addr,t),An(e,t)}}function M3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;Nb.set(n),i.uniformMatrix2fv(this.addr,!1,Nb),An(e,n)}}function b3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;wb.set(n),i.uniformMatrix3fv(this.addr,!1,wb),An(e,n)}}function E3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;Rb.set(n),i.uniformMatrix4fv(this.addr,!1,Rb),An(e,n)}}function T3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function A3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2iv(this.addr,t),An(e,t)}}function C3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Tn(e,t))return;i.uniform3iv(this.addr,t),An(e,t)}}function R3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4iv(this.addr,t),An(e,t)}}function w3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function N3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2uiv(this.addr,t),An(e,t)}}function D3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Tn(e,t))return;i.uniform3uiv(this.addr,t),An(e,t)}}function U3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4uiv(this.addr,t),An(e,t)}}function P3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(gv.compareFunction=e.isReversedDepthBuffer()?Tf:Ef,r=gv):r=Wb,e.setTexture2D(t||r,s)}function I3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture3D(t||qb,s)}function L3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTextureCube(t||Yb,s)}function O3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture2DArray(t||Xb,s)}function B3(i){switch(i){case 5126:return v3;case 35664:return x3;case 35665:return y3;case 35666:return S3;case 35674:return M3;case 35675:return b3;case 35676:return E3;case 5124:case 35670:return T3;case 35667:case 35671:return A3;case 35668:case 35672:return C3;case 35669:case 35673:return R3;case 5125:return w3;case 36294:return N3;case 36295:return D3;case 36296:return U3;case 35678:case 36198:case 36298:case 36306:case 35682:return P3;case 35679:case 36299:case 36307:return I3;case 35680:case 36300:case 36308:case 36293:return L3;case 36289:case 36303:case 36311:case 36292:return O3}}function F3(i,t){i.uniform1fv(this.addr,t)}function z3(i,t){let e=_c(t,this.size,2);i.uniform2fv(this.addr,e)}function V3(i,t){let e=_c(t,this.size,3);i.uniform3fv(this.addr,e)}function H3(i,t){let e=_c(t,this.size,4);i.uniform4fv(this.addr,e)}function G3(i,t){let e=_c(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function k3(i,t){let e=_c(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function W3(i,t){let e=_c(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function X3(i,t){i.uniform1iv(this.addr,t)}function q3(i,t){i.uniform2iv(this.addr,t)}function Y3(i,t){i.uniform3iv(this.addr,t)}function Z3(i,t){i.uniform4iv(this.addr,t)}function j3(i,t){i.uniform1uiv(this.addr,t)}function J3(i,t){i.uniform2uiv(this.addr,t)}function K3(i,t){i.uniform3uiv(this.addr,t)}function Q3(i,t){i.uniform4uiv(this.addr,t)}function $3(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));let l;this.type===i.SAMPLER_2D_SHADOW?l=gv:l=Wb;for(let c=0;c!==s;++c)e.setTexture2D(t[c]||l,r[c])}function tN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTexture3D(t[l]||qb,r[l])}function eN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTextureCube(t[l]||Yb,r[l])}function nN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTexture2DArray(t[l]||Xb,r[l])}function iN(i){switch(i){case 5126:return F3;case 35664:return z3;case 35665:return V3;case 35666:return H3;case 35674:return G3;case 35675:return k3;case 35676:return W3;case 5124:case 35670:return X3;case 35667:case 35671:return q3;case 35668:case 35672:return Y3;case 35669:case 35673:return Z3;case 5125:return j3;case 36294:return J3;case 36295:return K3;case 36296:return Q3;case 35678:case 36198:case 36298:case 36306:case 35682:return $3;case 35679:case 36299:case 36307:return tN;case 35680:case 36300:case 36308:case 36293:return eN;case 36289:case 36303:case 36311:case 36292:return nN}}var _v=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=B3(e.type)}},vv=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=iN(e.type)}},xv=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){let s=this.seq;for(let r=0,l=s.length;r!==l;++r){let c=s[r];c.setValue(t,e[c.id],n)}}},pv=/(\w+)(\])?(\[|\.)?/g;function Db(i,t){i.seq.push(t),i.map[t.id]=t}function sN(i,t,e){let n=i.name,s=n.length;for(pv.lastIndex=0;;){let r=pv.exec(n),l=pv.lastIndex,c=r[1],h=r[2]==="]",f=r[3];if(h&&(c=c|0),f===void 0||f==="["&&l+2===s){Db(e,f===void 0?new _v(c,i,t):new vv(c,i,t));break}else{let m=e.map[c];m===void 0&&(m=new xv(c),Db(e,m)),e=m}}}var gc=class{constructor(t,e){this.seq=[],this.map={};let n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let l=0;l<n;++l){let c=t.getActiveUniform(e,l),h=t.getUniformLocation(e,c.name);sN(c,h,this)}let s=[],r=[];for(let l of this.seq)l.type===t.SAMPLER_2D_SHADOW||l.type===t.SAMPLER_CUBE_SHADOW||l.type===t.SAMPLER_2D_ARRAY_SHADOW?s.push(l):r.push(l);s.length>0&&(this.seq=s.concat(r))}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,l=e.length;r!==l;++r){let c=e[r],h=n[c.id];h.needsUpdate!==!1&&c.setValue(t,h.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let l=t[s];l.id in e&&n.push(l)}return n}};function Ub(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var aN=37297,rN=0;function oN(i,t){let e=i.split(`
3920
+ }`,depthTest:!1,depthWrite:!1}),f=new rn(c,h),p=new Bs(-1,1,1,-1,0,1),m=null,g=null,v=!1,y,b=null,S=[],x=!1;this.setSize=function(E,T){r.setSize(E,T),l.setSize(E,T);for(let A=0;A<S.length;A++){let N=S[A];N.setSize&&N.setSize(E,T)}},this.setEffects=function(E){S=E,x=S.length>0&&S[0].isRenderPass===!0;let T=r.width,A=r.height;for(let N=0;N<S.length;N++){let D=S[N];D.setSize&&D.setSize(T,A)}},this.begin=function(E,T){if(v||E.toneMapping===Si&&S.length===0)return!1;if(b=T,T!==null){let A=T.width,N=T.height;(r.width!==A||r.height!==N)&&this.setSize(A,N)}return x===!1&&E.setRenderTarget(r),y=E.toneMapping,E.toneMapping=Si,!0},this.hasRenderPass=function(){return x},this.end=function(E,T){E.toneMapping=y,v=!0;let A=r,N=l;for(let D=0;D<S.length;D++){let L=S[D];if(L.enabled!==!1&&(L.render(E,N,A,T),L.needsSwap!==!1)){let F=A;A=N,N=F}}if(m!==E.outputColorSpace||g!==E.toneMapping){m=E.outputColorSpace,g=E.toneMapping,h.defines={},be.getTransfer(m)===Ve&&(h.defines.SRGB_TRANSFER="");let D=_3[g];D&&(h.defines[D]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=A.texture,E.setRenderTarget(b),E.render(f,p),b=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){r.dispose(),l.dispose(),c.dispose(),h.dispose()}}var Wb=new mn,gv=new da(1,1),Xb=new Kr,qb=new Qr,Yb=new Ka,Ab=[],Cb=[],Rb=new Float32Array(16),wb=new Float32Array(9),Nb=new Float32Array(4);function _c(i,t,e){let n=i[0];if(n<=0||n>0)return i;let s=t*e,r=Ab[s];if(r===void 0&&(r=new Float32Array(s),Ab[s]=r),t!==0){n.toArray(r,0);for(let l=1,c=0;l!==t;++l)c+=e,i[l].toArray(r,c)}return r}function Tn(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function An(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function Im(i,t){let e=Cb[t];e===void 0&&(e=new Int32Array(t),Cb[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function x3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function y3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2fv(this.addr,t),An(e,t)}}function S3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Tn(e,t))return;i.uniform3fv(this.addr,t),An(e,t)}}function M3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4fv(this.addr,t),An(e,t)}}function b3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;Nb.set(n),i.uniformMatrix2fv(this.addr,!1,Nb),An(e,n)}}function E3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;wb.set(n),i.uniformMatrix3fv(this.addr,!1,wb),An(e,n)}}function T3(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Tn(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),An(e,t)}else{if(Tn(e,n))return;Rb.set(n),i.uniformMatrix4fv(this.addr,!1,Rb),An(e,n)}}function A3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function C3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2iv(this.addr,t),An(e,t)}}function R3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Tn(e,t))return;i.uniform3iv(this.addr,t),An(e,t)}}function w3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4iv(this.addr,t),An(e,t)}}function N3(i,t){let e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function D3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Tn(e,t))return;i.uniform2uiv(this.addr,t),An(e,t)}}function U3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Tn(e,t))return;i.uniform3uiv(this.addr,t),An(e,t)}}function P3(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Tn(e,t))return;i.uniform4uiv(this.addr,t),An(e,t)}}function I3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(gv.compareFunction=e.isReversedDepthBuffer()?Tf:Ef,r=gv):r=Wb,e.setTexture2D(t||r,s)}function L3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture3D(t||qb,s)}function O3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTextureCube(t||Yb,s)}function B3(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture2DArray(t||Xb,s)}function F3(i){switch(i){case 5126:return x3;case 35664:return y3;case 35665:return S3;case 35666:return M3;case 35674:return b3;case 35675:return E3;case 35676:return T3;case 5124:case 35670:return A3;case 35667:case 35671:return C3;case 35668:case 35672:return R3;case 35669:case 35673:return w3;case 5125:return N3;case 36294:return D3;case 36295:return U3;case 36296:return P3;case 35678:case 36198:case 36298:case 36306:case 35682:return I3;case 35679:case 36299:case 36307:return L3;case 35680:case 36300:case 36308:case 36293:return O3;case 36289:case 36303:case 36311:case 36292:return B3}}function z3(i,t){i.uniform1fv(this.addr,t)}function V3(i,t){let e=_c(t,this.size,2);i.uniform2fv(this.addr,e)}function H3(i,t){let e=_c(t,this.size,3);i.uniform3fv(this.addr,e)}function G3(i,t){let e=_c(t,this.size,4);i.uniform4fv(this.addr,e)}function k3(i,t){let e=_c(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function W3(i,t){let e=_c(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function X3(i,t){let e=_c(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function q3(i,t){i.uniform1iv(this.addr,t)}function Y3(i,t){i.uniform2iv(this.addr,t)}function Z3(i,t){i.uniform3iv(this.addr,t)}function j3(i,t){i.uniform4iv(this.addr,t)}function J3(i,t){i.uniform1uiv(this.addr,t)}function K3(i,t){i.uniform2uiv(this.addr,t)}function Q3(i,t){i.uniform3uiv(this.addr,t)}function $3(i,t){i.uniform4uiv(this.addr,t)}function tN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));let l;this.type===i.SAMPLER_2D_SHADOW?l=gv:l=Wb;for(let c=0;c!==s;++c)e.setTexture2D(t[c]||l,r[c])}function eN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTexture3D(t[l]||qb,r[l])}function nN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTextureCube(t[l]||Yb,r[l])}function iN(i,t,e){let n=this.cache,s=t.length,r=Im(e,s);Tn(n,r)||(i.uniform1iv(this.addr,r),An(n,r));for(let l=0;l!==s;++l)e.setTexture2DArray(t[l]||Xb,r[l])}function sN(i){switch(i){case 5126:return z3;case 35664:return V3;case 35665:return H3;case 35666:return G3;case 35674:return k3;case 35675:return W3;case 35676:return X3;case 5124:case 35670:return q3;case 35667:case 35671:return Y3;case 35668:case 35672:return Z3;case 35669:case 35673:return j3;case 5125:return J3;case 36294:return K3;case 36295:return Q3;case 36296:return $3;case 35678:case 36198:case 36298:case 36306:case 35682:return tN;case 35679:case 36299:case 36307:return eN;case 35680:case 36300:case 36308:case 36293:return nN;case 36289:case 36303:case 36311:case 36292:return iN}}var _v=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=F3(e.type)}},vv=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=sN(e.type)}},xv=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){let s=this.seq;for(let r=0,l=s.length;r!==l;++r){let c=s[r];c.setValue(t,e[c.id],n)}}},pv=/(\w+)(\])?(\[|\.)?/g;function Db(i,t){i.seq.push(t),i.map[t.id]=t}function aN(i,t,e){let n=i.name,s=n.length;for(pv.lastIndex=0;;){let r=pv.exec(n),l=pv.lastIndex,c=r[1],h=r[2]==="]",f=r[3];if(h&&(c=c|0),f===void 0||f==="["&&l+2===s){Db(e,f===void 0?new _v(c,i,t):new vv(c,i,t));break}else{let m=e.map[c];m===void 0&&(m=new xv(c),Db(e,m)),e=m}}}var gc=class{constructor(t,e){this.seq=[],this.map={};let n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let l=0;l<n;++l){let c=t.getActiveUniform(e,l),h=t.getUniformLocation(e,c.name);aN(c,h,this)}let s=[],r=[];for(let l of this.seq)l.type===t.SAMPLER_2D_SHADOW||l.type===t.SAMPLER_CUBE_SHADOW||l.type===t.SAMPLER_2D_ARRAY_SHADOW?s.push(l):r.push(l);s.length>0&&(this.seq=s.concat(r))}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,l=e.length;r!==l;++r){let c=e[r],h=n[c.id];h.needsUpdate!==!1&&c.setValue(t,h.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let l=t[s];l.id in e&&n.push(l)}return n}};function Ub(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var rN=37297,oN=0;function lN(i,t){let e=i.split(`
3921
3921
  `),n=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let l=s;l<r;l++){let c=l+1;n.push(`${c===t?">":" "} ${c}: ${e[l]}`)}return n.join(`
3922
- `)}var Pb=new pe;function lN(i){be._getMatrix(Pb,be.workingColorSpace,i);let t=`mat3( ${Pb.elements.map(e=>e.toFixed(4))} )`;switch(be.getTransfer(i)){case Al:return[t,"LinearTransferOETF"];case Ve:return[t,"sRGBTransferOETF"];default:return wt("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Ib(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),r=(i.getShaderInfoLog(t)||"").trim();if(n&&r==="")return"";let l=/ERROR: 0:(\d+)/.exec(r);if(l){let c=parseInt(l[1]);return e.toUpperCase()+`
3922
+ `)}var Pb=new pe;function cN(i){be._getMatrix(Pb,be.workingColorSpace,i);let t=`mat3( ${Pb.elements.map(e=>e.toFixed(4))} )`;switch(be.getTransfer(i)){case Al:return[t,"LinearTransferOETF"];case Ve:return[t,"sRGBTransferOETF"];default:return wt("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Ib(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),r=(i.getShaderInfoLog(t)||"").trim();if(n&&r==="")return"";let l=/ERROR: 0:(\d+)/.exec(r);if(l){let c=parseInt(l[1]);return e.toUpperCase()+`
3923
3923
 
3924
3924
  `+r+`
3925
3925
 
3926
- `+oN(i.getShaderSource(t),c)}else return r}function cN(i,t){let e=lN(t);return[`vec4 ${i}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
3927
- `)}var uN={[mm]:"Linear",[gm]:"Reinhard",[_m]:"Cineon",[rc]:"ACESFilmic",[xm]:"AgX",[ym]:"Neutral",[vm]:"Custom"};function hN(i,t){let e=uN[t];return e===void 0?(wt("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var Um=new O;function fN(){be.getLuminanceCoefficients(Um);let i=Um.x.toFixed(4),t=Um.y.toFixed(4),e=Um.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(`
3928
- `)}function dN(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Rf).join(`
3929
- `)}function pN(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
3930
- `)}function mN(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(t,s),l=r.name,c=1;r.type===i.FLOAT_MAT2&&(c=2),r.type===i.FLOAT_MAT3&&(c=3),r.type===i.FLOAT_MAT4&&(c=4),e[l]={type:r.type,location:i.getAttribLocation(t,l),locationSize:c}}return e}function Rf(i){return i!==""}function Lb(i,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ob(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var gN=/^[ \t]*#include +<([\w\d./]+)>/gm;function yv(i){return i.replace(gN,vN)}var _N=new Map;function vN(i,t){let e=xe[t];if(e===void 0){let n=_N.get(t);if(n!==void 0)e=xe[n],wt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return yv(e)}var xN=/#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 Bb(i){return i.replace(xN,yN)}function yN(i,t,e,n){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Fb(i){let t=`precision ${i.precision} float;
3926
+ `+lN(i.getShaderSource(t),c)}else return r}function uN(i,t){let e=cN(t);return[`vec4 ${i}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
3927
+ `)}var hN={[mm]:"Linear",[gm]:"Reinhard",[_m]:"Cineon",[rc]:"ACESFilmic",[xm]:"AgX",[ym]:"Neutral",[vm]:"Custom"};function fN(i,t){let e=hN[t];return e===void 0?(wt("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var Um=new O;function dN(){be.getLuminanceCoefficients(Um);let i=Um.x.toFixed(4),t=Um.y.toFixed(4),e=Um.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(`
3928
+ `)}function pN(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Rf).join(`
3929
+ `)}function mN(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
3930
+ `)}function gN(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(t,s),l=r.name,c=1;r.type===i.FLOAT_MAT2&&(c=2),r.type===i.FLOAT_MAT3&&(c=3),r.type===i.FLOAT_MAT4&&(c=4),e[l]={type:r.type,location:i.getAttribLocation(t,l),locationSize:c}}return e}function Rf(i){return i!==""}function Lb(i,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ob(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var _N=/^[ \t]*#include +<([\w\d./]+)>/gm;function yv(i){return i.replace(_N,xN)}var vN=new Map;function xN(i,t){let e=xe[t];if(e===void 0){let n=vN.get(t);if(n!==void 0)e=xe[n],wt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return yv(e)}var yN=/#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 Bb(i){return i.replace(yN,SN)}function SN(i,t,e,n){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Fb(i){let t=`precision ${i.precision} float;
3931
3931
  precision ${i.precision} int;
3932
3932
  precision ${i.precision} sampler2D;
3933
3933
  precision ${i.precision} samplerCube;
@@ -3947,14 +3947,14 @@ void main() {
3947
3947
  `;return i.precision==="highp"?t+=`
3948
3948
  #define HIGH_PRECISION`:i.precision==="mediump"?t+=`
3949
3949
  #define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=`
3950
- #define LOW_PRECISION`),t}var SN={[sr]:"SHADOWMAP_TYPE_PCF",[ma]:"SHADOWMAP_TYPE_VSM"};function MN(i){return SN[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var bN={[xs]:"ENVMAP_TYPE_CUBE",[ga]:"ENVMAP_TYPE_CUBE",[co]:"ENVMAP_TYPE_CUBE_UV"};function EN(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":bN[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var TN={[ga]:"ENVMAP_MODE_REFRACTION"};function AN(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":TN[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var CN={[ac]:"ENVMAP_BLENDING_MULTIPLY",[V_]:"ENVMAP_BLENDING_MIX",[H_]:"ENVMAP_BLENDING_ADD"};function RN(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":CN[i.combine]||"ENVMAP_BLENDING_NONE"}function wN(i){let t=i.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function NN(i,t,e,n){let s=i.getContext(),r=e.defines,l=e.vertexShader,c=e.fragmentShader,h=MN(e),f=EN(e),p=AN(e),m=RN(e),g=wN(e),v=dN(e),y=pN(r),b=s.createProgram(),S,x,E=e.glslVersion?"#version "+e.glslVersion+`
3950
+ #define LOW_PRECISION`),t}var MN={[ar]:"SHADOWMAP_TYPE_PCF",[ga]:"SHADOWMAP_TYPE_VSM"};function bN(i){return MN[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var EN={[xs]:"ENVMAP_TYPE_CUBE",[_a]:"ENVMAP_TYPE_CUBE",[co]:"ENVMAP_TYPE_CUBE_UV"};function TN(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":EN[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var AN={[_a]:"ENVMAP_MODE_REFRACTION"};function CN(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":AN[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var RN={[ac]:"ENVMAP_BLENDING_MULTIPLY",[V_]:"ENVMAP_BLENDING_MIX",[H_]:"ENVMAP_BLENDING_ADD"};function wN(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":RN[i.combine]||"ENVMAP_BLENDING_NONE"}function NN(i){let t=i.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function DN(i,t,e,n){let s=i.getContext(),r=e.defines,l=e.vertexShader,c=e.fragmentShader,h=bN(e),f=TN(e),p=CN(e),m=wN(e),g=NN(e),v=pN(e),y=mN(r),b=s.createProgram(),S,x,E=e.glslVersion?"#version "+e.glslVersion+`
3951
3951
  `:"";e.isRawShaderMaterial?(S=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,y].filter(Rf).join(`
3952
3952
  `),S.length>0&&(S+=`
3953
3953
  `),x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,y].filter(Rf).join(`
3954
3954
  `),x.length>0&&(x+=`
3955
3955
  `)):(S=[Fb(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,y,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+p:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+h:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.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",`
3956
3956
  `].filter(Rf).join(`
3957
- `),x=[Fb(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,y,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+f:"",e.envMap?"#define "+p:"",e.envMap?"#define "+m:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+h:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Si?"#define TONE_MAPPING":"",e.toneMapping!==Si?xe.tonemapping_pars_fragment:"",e.toneMapping!==Si?hN("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",xe.colorspace_pars_fragment,cN("linearToOutputTexel",e.outputColorSpace),fN(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
3957
+ `),x=[Fb(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,y,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+f:"",e.envMap?"#define "+p:"",e.envMap?"#define "+m:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+h:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Si?"#define TONE_MAPPING":"",e.toneMapping!==Si?xe.tonemapping_pars_fragment:"",e.toneMapping!==Si?fN("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",xe.colorspace_pars_fragment,uN("linearToOutputTexel",e.outputColorSpace),dN(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
3958
3958
  `].filter(Rf).join(`
3959
3959
  `)),l=yv(l),l=Lb(l,e),l=Ob(l,e),c=yv(c),c=Lb(c,e),c=Ob(c,e),l=Bb(l),c=Bb(c),e.isRawShaderMaterial!==!0&&(E=`#version 300 es
3960
3960
  `,S=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
@@ -3968,9 +3968,9 @@ Material Type: `+z.type+`
3968
3968
 
3969
3969
  Program Info Log: `+nt+`
3970
3970
  `+bt+`
3971
- `+mt)}else nt!==""?wt("WebGLProgram: Program Info Log:",nt):(J===""||et==="")&&(St=!1);St&&(z.diagnostics={runnable:rt,programLog:nt,vertexShader:{log:J,prefix:S},fragmentShader:{log:et,prefix:x}})}s.deleteShader(N),s.deleteShader(D),F=new gc(s,b),C=mN(s,b)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let C;this.getAttributes=function(){return C===void 0&&L(this),C};let w=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=s.getProgramParameter(b,aN)),w},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(b),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=rN++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=N,this.fragmentShader=D,this}var DN=0,Sv=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,n=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(n),l=this._getShaderCacheForMaterial(t);return l.has(s)===!1&&(l.add(s),s.usedTimes++),l.has(r)===!1&&(l.add(r),r.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Mv(t),e.set(t,n)),n}},Mv=class{constructor(t){this.id=DN++,this.code=t,this.usedTimes=0}};function UN(i,t,e,n,s,r,l){let c=new Is,h=new Sv,f=new Set,p=[],m=new Map,g=s.logarithmicDepthBuffer,v=s.precision,y={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 b(C){return f.add(C),C===0?"uv":`uv${C}`}function S(C,w,z,Y,G){let j=Y.fog,nt=G.geometry,J=C.isMeshStandardMaterial?Y.environment:null,et=(C.isMeshStandardMaterial?e:t).get(C.envMap||J),rt=et&&et.mapping===co?et.image.height:null,St=y[C.type];C.precision!==null&&(v=s.getMaxPrecision(C.precision),v!==C.precision&&wt("WebGLProgram.getParameters:",C.precision,"not supported, using",v,"instead."));let bt=nt.morphAttributes.position||nt.morphAttributes.normal||nt.morphAttributes.color,mt=bt!==void 0?bt.length:0,kt=0;nt.morphAttributes.position!==void 0&&(kt=1),nt.morphAttributes.normal!==void 0&&(kt=2),nt.morphAttributes.color!==void 0&&(kt=3);let $t,re,Ce,at;if(St){let De=Ms[St];$t=De.vertexShader,re=De.fragmentShader}else $t=C.vertexShader,re=C.fragmentShader,h.update(C),Ce=h.getVertexShaderID(C),at=h.getFragmentShaderID(C);let dt=i.getRenderTarget(),Vt=i.state.buffers.depth.getReversed(),ie=G.isInstancedMesh===!0,Ft=G.isBatchedMesh===!0,ye=!!C.map,Re=!!C.matcap,ce=!!et,ct=!!C.aoMap,gt=!!C.lightMap,lt=!!C.bumpMap,Nt=!!C.normalMap,B=!!C.displacementMap,Zt=!!C.emissiveMap,Dt=!!C.metalnessMap,se=!!C.roughnessMap,Mt=C.anisotropy>0,I=C.clearcoat>0,R=C.dispersion>0,k=C.iridescence>0,it=C.sheen>0,ht=C.transmission>0,st=Mt&&!!C.anisotropyMap,jt=I&&!!C.clearcoatMap,Et=I&&!!C.clearcoatNormalMap,Wt=I&&!!C.clearcoatRoughnessMap,Kt=k&&!!C.iridescenceMap,pt=k&&!!C.iridescenceThicknessMap,Ct=it&&!!C.sheenColorMap,Xt=it&&!!C.sheenRoughnessMap,Yt=!!C.specularMap,Tt=!!C.specularColorMap,ge=!!C.specularIntensityMap,H=ht&&!!C.transmissionMap,Ut=ht&&!!C.thicknessMap,xt=!!C.gradientMap,Ot=!!C.alphaMap,_t=C.alphaTest>0,ut=!!C.alphaHash,At=!!C.extensions,oe=Si;C.toneMapped&&(dt===null||dt.isXRRenderTarget===!0)&&(oe=i.toneMapping);let Be={shaderID:St,shaderType:C.type,shaderName:C.name,vertexShader:$t,fragmentShader:re,defines:C.defines,customVertexShaderID:Ce,customFragmentShaderID:at,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:v,batching:Ft,batchingColor:Ft&&G._colorsTexture!==null,instancing:ie,instancingColor:ie&&G.instanceColor!==null,instancingMorph:ie&&G.morphTexture!==null,outputColorSpace:dt===null?i.outputColorSpace:dt.isXRRenderTarget===!0?dt.texture.colorSpace:Ps,alphaToCoverage:!!C.alphaToCoverage,map:ye,matcap:Re,envMap:ce,envMapMode:ce&&et.mapping,envMapCubeUVHeight:rt,aoMap:ct,lightMap:gt,bumpMap:lt,normalMap:Nt,displacementMap:B,emissiveMap:Zt,normalMapObjectSpace:Nt&&C.normalMapType===Y_,normalMapTangentSpace:Nt&&C.normalMapType===va,metalnessMap:Dt,roughnessMap:se,anisotropy:Mt,anisotropyMap:st,clearcoat:I,clearcoatMap:jt,clearcoatNormalMap:Et,clearcoatRoughnessMap:Wt,dispersion:R,iridescence:k,iridescenceMap:Kt,iridescenceThicknessMap:pt,sheen:it,sheenColorMap:Ct,sheenRoughnessMap:Xt,specularMap:Yt,specularColorMap:Tt,specularIntensityMap:ge,transmission:ht,transmissionMap:H,thicknessMap:Ut,gradientMap:xt,opaque:C.transparent===!1&&C.blending===qa&&C.alphaToCoverage===!1,alphaMap:Ot,alphaTest:_t,alphaHash:ut,combine:C.combine,mapUv:ye&&b(C.map.channel),aoMapUv:ct&&b(C.aoMap.channel),lightMapUv:gt&&b(C.lightMap.channel),bumpMapUv:lt&&b(C.bumpMap.channel),normalMapUv:Nt&&b(C.normalMap.channel),displacementMapUv:B&&b(C.displacementMap.channel),emissiveMapUv:Zt&&b(C.emissiveMap.channel),metalnessMapUv:Dt&&b(C.metalnessMap.channel),roughnessMapUv:se&&b(C.roughnessMap.channel),anisotropyMapUv:st&&b(C.anisotropyMap.channel),clearcoatMapUv:jt&&b(C.clearcoatMap.channel),clearcoatNormalMapUv:Et&&b(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Wt&&b(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Kt&&b(C.iridescenceMap.channel),iridescenceThicknessMapUv:pt&&b(C.iridescenceThicknessMap.channel),sheenColorMapUv:Ct&&b(C.sheenColorMap.channel),sheenRoughnessMapUv:Xt&&b(C.sheenRoughnessMap.channel),specularMapUv:Yt&&b(C.specularMap.channel),specularColorMapUv:Tt&&b(C.specularColorMap.channel),specularIntensityMapUv:ge&&b(C.specularIntensityMap.channel),transmissionMapUv:H&&b(C.transmissionMap.channel),thicknessMapUv:Ut&&b(C.thicknessMap.channel),alphaMapUv:Ot&&b(C.alphaMap.channel),vertexTangents:!!nt.attributes.tangent&&(Nt||Mt),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!nt.attributes.color&&nt.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!nt.attributes.uv&&(ye||Ot),fog:!!j,useFog:C.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:C.flatShading===!0&&C.wireframe===!1,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Vt,skinning:G.isSkinnedMesh===!0,morphTargets:nt.morphAttributes.position!==void 0,morphNormals:nt.morphAttributes.normal!==void 0,morphColors:nt.morphAttributes.color!==void 0,morphTargetsCount:mt,morphTextureStride:kt,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:oe,decodeVideoTexture:ye&&C.map.isVideoTexture===!0&&be.getTransfer(C.map.colorSpace)===Ve,decodeVideoTextureEmissive:Zt&&C.emissiveMap.isVideoTexture===!0&&be.getTransfer(C.emissiveMap.colorSpace)===Ve,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===_s,flipSided:C.side===ti,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:At&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&C.extensions.multiDraw===!0||Ft)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Be.vertexUv1s=f.has(1),Be.vertexUv2s=f.has(2),Be.vertexUv3s=f.has(3),f.clear(),Be}function x(C){let w=[];if(C.shaderID?w.push(C.shaderID):(w.push(C.customVertexShaderID),w.push(C.customFragmentShaderID)),C.defines!==void 0)for(let z in C.defines)w.push(z),w.push(C.defines[z]);return C.isRawShaderMaterial===!1&&(E(w,C),T(w,C),w.push(i.outputColorSpace)),w.push(C.customProgramCacheKey),w.join()}function E(C,w){C.push(w.precision),C.push(w.outputColorSpace),C.push(w.envMapMode),C.push(w.envMapCubeUVHeight),C.push(w.mapUv),C.push(w.alphaMapUv),C.push(w.lightMapUv),C.push(w.aoMapUv),C.push(w.bumpMapUv),C.push(w.normalMapUv),C.push(w.displacementMapUv),C.push(w.emissiveMapUv),C.push(w.metalnessMapUv),C.push(w.roughnessMapUv),C.push(w.anisotropyMapUv),C.push(w.clearcoatMapUv),C.push(w.clearcoatNormalMapUv),C.push(w.clearcoatRoughnessMapUv),C.push(w.iridescenceMapUv),C.push(w.iridescenceThicknessMapUv),C.push(w.sheenColorMapUv),C.push(w.sheenRoughnessMapUv),C.push(w.specularMapUv),C.push(w.specularColorMapUv),C.push(w.specularIntensityMapUv),C.push(w.transmissionMapUv),C.push(w.thicknessMapUv),C.push(w.combine),C.push(w.fogExp2),C.push(w.sizeAttenuation),C.push(w.morphTargetsCount),C.push(w.morphAttributeCount),C.push(w.numDirLights),C.push(w.numPointLights),C.push(w.numSpotLights),C.push(w.numSpotLightMaps),C.push(w.numHemiLights),C.push(w.numRectAreaLights),C.push(w.numDirLightShadows),C.push(w.numPointLightShadows),C.push(w.numSpotLightShadows),C.push(w.numSpotLightShadowsWithMaps),C.push(w.numLightProbes),C.push(w.shadowMapType),C.push(w.toneMapping),C.push(w.numClippingPlanes),C.push(w.numClipIntersection),C.push(w.depthPacking)}function T(C,w){c.disableAll(),w.instancing&&c.enable(0),w.instancingColor&&c.enable(1),w.instancingMorph&&c.enable(2),w.matcap&&c.enable(3),w.envMap&&c.enable(4),w.normalMapObjectSpace&&c.enable(5),w.normalMapTangentSpace&&c.enable(6),w.clearcoat&&c.enable(7),w.iridescence&&c.enable(8),w.alphaTest&&c.enable(9),w.vertexColors&&c.enable(10),w.vertexAlphas&&c.enable(11),w.vertexUv1s&&c.enable(12),w.vertexUv2s&&c.enable(13),w.vertexUv3s&&c.enable(14),w.vertexTangents&&c.enable(15),w.anisotropy&&c.enable(16),w.alphaHash&&c.enable(17),w.batching&&c.enable(18),w.dispersion&&c.enable(19),w.batchingColor&&c.enable(20),w.gradientMap&&c.enable(21),C.push(c.mask),c.disableAll(),w.fog&&c.enable(0),w.useFog&&c.enable(1),w.flatShading&&c.enable(2),w.logarithmicDepthBuffer&&c.enable(3),w.reversedDepthBuffer&&c.enable(4),w.skinning&&c.enable(5),w.morphTargets&&c.enable(6),w.morphNormals&&c.enable(7),w.morphColors&&c.enable(8),w.premultipliedAlpha&&c.enable(9),w.shadowMapEnabled&&c.enable(10),w.doubleSided&&c.enable(11),w.flipSided&&c.enable(12),w.useDepthPacking&&c.enable(13),w.dithering&&c.enable(14),w.transmission&&c.enable(15),w.sheen&&c.enable(16),w.opaque&&c.enable(17),w.pointsUvs&&c.enable(18),w.decodeVideoTexture&&c.enable(19),w.decodeVideoTextureEmissive&&c.enable(20),w.alphaToCoverage&&c.enable(21),C.push(c.mask)}function A(C){let w=y[C.type],z;if(w){let Y=Ms[w];z=sv.clone(Y.uniforms)}else z=C.uniforms;return z}function N(C,w){let z=m.get(w);return z!==void 0?++z.usedTimes:(z=new NN(i,w,C,r),p.push(z),m.set(w,z)),z}function D(C){if(--C.usedTimes===0){let w=p.indexOf(C);p[w]=p[p.length-1],p.pop(),m.delete(C.cacheKey),C.destroy()}}function L(C){h.remove(C)}function F(){h.dispose()}return{getParameters:S,getProgramCacheKey:x,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:L,programs:p,dispose:F}}function PN(){let i=new WeakMap;function t(l){return i.has(l)}function e(l){let c=i.get(l);return c===void 0&&(c={},i.set(l,c)),c}function n(l){i.delete(l)}function s(l,c,h){i.get(l)[c]=h}function r(){i=new WeakMap}return{has:t,get:e,remove:n,update:s,dispose:r}}function IN(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.z!==t.z?i.z-t.z:i.id-t.id}function zb(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function Vb(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function l(m,g,v,y,b,S){let x=i[t];return x===void 0?(x={id:m.id,object:m,geometry:g,material:v,groupOrder:y,renderOrder:m.renderOrder,z:b,group:S},i[t]=x):(x.id=m.id,x.object=m,x.geometry=g,x.material=v,x.groupOrder=y,x.renderOrder=m.renderOrder,x.z=b,x.group=S),t++,x}function c(m,g,v,y,b,S){let x=l(m,g,v,y,b,S);v.transmission>0?n.push(x):v.transparent===!0?s.push(x):e.push(x)}function h(m,g,v,y,b,S){let x=l(m,g,v,y,b,S);v.transmission>0?n.unshift(x):v.transparent===!0?s.unshift(x):e.unshift(x)}function f(m,g){e.length>1&&e.sort(m||IN),n.length>1&&n.sort(g||zb),s.length>1&&s.sort(g||zb)}function p(){for(let m=t,g=i.length;m<g;m++){let v=i[m];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:e,transmissive:n,transparent:s,init:r,push:c,unshift:h,finish:p,sort:f}}function LN(){let i=new WeakMap;function t(n,s){let r=i.get(n),l;return r===void 0?(l=new Vb,i.set(n,[l])):s>=r.length?(l=new Vb,r.push(l)):l=r[s],l}function e(){i=new WeakMap}return{get:t,dispose:e}}function ON(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new O,color:new Lt};break;case"SpotLight":e={position:new O,direction:new O,color:new Lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new O,color:new Lt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new O,skyColor:new Lt,groundColor:new Lt};break;case"RectAreaLight":e={color:new Lt,position:new O,halfWidth:new O,halfHeight:new O};break}return i[t.id]=e,e}}}function BN(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var FN=0;function zN(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function VN(i){let t=new ON,e=BN(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new O);let s=new O,r=new ue,l=new ue;function c(f){let p=0,m=0,g=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let v=0,y=0,b=0,S=0,x=0,E=0,T=0,A=0,N=0,D=0,L=0;f.sort(zN);for(let C=0,w=f.length;C<w;C++){let z=f[C],Y=z.color,G=z.intensity,j=z.distance,nt=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===ar?nt=z.shadow.map.texture:nt=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)p+=Y.r*G,m+=Y.g*G,g+=Y.b*G;else if(z.isLightProbe){for(let J=0;J<9;J++)n.probe[J].addScaledVector(z.sh.coefficients[J],G);L++}else if(z.isDirectionalLight){let J=t.get(z);if(J.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let et=z.shadow,rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,n.directionalShadow[v]=rt,n.directionalShadowMap[v]=nt,n.directionalShadowMatrix[v]=z.shadow.matrix,E++}n.directional[v]=J,v++}else if(z.isSpotLight){let J=t.get(z);J.position.setFromMatrixPosition(z.matrixWorld),J.color.copy(Y).multiplyScalar(G),J.distance=j,J.coneCos=Math.cos(z.angle),J.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),J.decay=z.decay,n.spot[b]=J;let et=z.shadow;if(z.map&&(n.spotLightMap[N]=z.map,N++,et.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[b]=et.matrix,z.castShadow){let rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,n.spotShadow[b]=rt,n.spotShadowMap[b]=nt,A++}b++}else if(z.isRectAreaLight){let J=t.get(z);J.color.copy(Y).multiplyScalar(G),J.halfWidth.set(z.width*.5,0,0),J.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=J,S++}else if(z.isPointLight){let J=t.get(z);if(J.color.copy(z.color).multiplyScalar(z.intensity),J.distance=z.distance,J.decay=z.decay,z.castShadow){let et=z.shadow,rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,rt.shadowCameraNear=et.camera.near,rt.shadowCameraFar=et.camera.far,n.pointShadow[y]=rt,n.pointShadowMap[y]=nt,n.pointShadowMatrix[y]=z.shadow.matrix,T++}n.point[y]=J,y++}else if(z.isHemisphereLight){let J=t.get(z);J.skyColor.copy(z.color).multiplyScalar(G),J.groundColor.copy(z.groundColor).multiplyScalar(G),n.hemi[x]=J,x++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=It.LTC_FLOAT_1,n.rectAreaLTC2=It.LTC_FLOAT_2):(n.rectAreaLTC1=It.LTC_HALF_1,n.rectAreaLTC2=It.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=m,n.ambient[2]=g;let F=n.hash;(F.directionalLength!==v||F.pointLength!==y||F.spotLength!==b||F.rectAreaLength!==S||F.hemiLength!==x||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==A||F.numSpotMaps!==N||F.numLightProbes!==L)&&(n.directional.length=v,n.spot.length=b,n.rectArea.length=S,n.point.length=y,n.hemi.length=x,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=A,n.spotShadowMap.length=A,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=A+N-D,n.spotLightMap.length=N,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,F.directionalLength=v,F.pointLength=y,F.spotLength=b,F.rectAreaLength=S,F.hemiLength=x,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=A,F.numSpotMaps=N,F.numLightProbes=L,n.version=FN++)}function h(f,p){let m=0,g=0,v=0,y=0,b=0,S=p.matrixWorldInverse;for(let x=0,E=f.length;x<E;x++){let T=f[x];if(T.isDirectionalLight){let A=n.directional[m];A.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(S),m++}else if(T.isSpotLight){let A=n.spot[v];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),A.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(S),v++}else if(T.isRectAreaLight){let A=n.rectArea[y];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),l.identity(),r.copy(T.matrixWorld),r.premultiply(S),l.extractRotation(r),A.halfWidth.set(T.width*.5,0,0),A.halfHeight.set(0,T.height*.5,0),A.halfWidth.applyMatrix4(l),A.halfHeight.applyMatrix4(l),y++}else if(T.isPointLight){let A=n.point[g];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),g++}else if(T.isHemisphereLight){let A=n.hemi[b];A.direction.setFromMatrixPosition(T.matrixWorld),A.direction.transformDirection(S),b++}}}return{setup:c,setupView:h,state:n}}function Hb(i){let t=new VN(i),e=[],n=[];function s(p){f.camera=p,e.length=0,n.length=0}function r(p){e.push(p)}function l(p){n.push(p)}function c(){t.setup(e)}function h(p){t.setupView(e,p)}let f={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:s,state:f,setupLights:c,setupLightsView:h,pushLight:r,pushShadow:l}}function HN(i){let t=new WeakMap;function e(s,r=0){let l=t.get(s),c;return l===void 0?(c=new Hb(i),t.set(s,[c])):r>=l.length?(c=new Hb(i),l.push(c)):c=l[r],c}function n(){t=new WeakMap}return{get:e,dispose:n}}var GN=`void main() {
3971
+ `+mt)}else nt!==""?wt("WebGLProgram: Program Info Log:",nt):(J===""||et==="")&&(St=!1);St&&(z.diagnostics={runnable:rt,programLog:nt,vertexShader:{log:J,prefix:S},fragmentShader:{log:et,prefix:x}})}s.deleteShader(N),s.deleteShader(D),F=new gc(s,b),C=gN(s,b)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let C;this.getAttributes=function(){return C===void 0&&L(this),C};let w=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=s.getProgramParameter(b,rN)),w},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(b),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=oN++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=N,this.fragmentShader=D,this}var UN=0,Sv=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,n=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(n),l=this._getShaderCacheForMaterial(t);return l.has(s)===!1&&(l.add(s),s.usedTimes++),l.has(r)===!1&&(l.add(r),r.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Mv(t),e.set(t,n)),n}},Mv=class{constructor(t){this.id=UN++,this.code=t,this.usedTimes=0}};function PN(i,t,e,n,s,r,l){let c=new Is,h=new Sv,f=new Set,p=[],m=new Map,g=s.logarithmicDepthBuffer,v=s.precision,y={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 b(C){return f.add(C),C===0?"uv":`uv${C}`}function S(C,w,z,Y,G){let j=Y.fog,nt=G.geometry,J=C.isMeshStandardMaterial?Y.environment:null,et=(C.isMeshStandardMaterial?e:t).get(C.envMap||J),rt=et&&et.mapping===co?et.image.height:null,St=y[C.type];C.precision!==null&&(v=s.getMaxPrecision(C.precision),v!==C.precision&&wt("WebGLProgram.getParameters:",C.precision,"not supported, using",v,"instead."));let bt=nt.morphAttributes.position||nt.morphAttributes.normal||nt.morphAttributes.color,mt=bt!==void 0?bt.length:0,kt=0;nt.morphAttributes.position!==void 0&&(kt=1),nt.morphAttributes.normal!==void 0&&(kt=2),nt.morphAttributes.color!==void 0&&(kt=3);let $t,re,Ce,at;if(St){let De=Ms[St];$t=De.vertexShader,re=De.fragmentShader}else $t=C.vertexShader,re=C.fragmentShader,h.update(C),Ce=h.getVertexShaderID(C),at=h.getFragmentShaderID(C);let dt=i.getRenderTarget(),Vt=i.state.buffers.depth.getReversed(),ie=G.isInstancedMesh===!0,Ft=G.isBatchedMesh===!0,ye=!!C.map,Re=!!C.matcap,ce=!!et,ct=!!C.aoMap,gt=!!C.lightMap,lt=!!C.bumpMap,Nt=!!C.normalMap,B=!!C.displacementMap,Zt=!!C.emissiveMap,Dt=!!C.metalnessMap,se=!!C.roughnessMap,Mt=C.anisotropy>0,I=C.clearcoat>0,R=C.dispersion>0,k=C.iridescence>0,it=C.sheen>0,ht=C.transmission>0,st=Mt&&!!C.anisotropyMap,jt=I&&!!C.clearcoatMap,Et=I&&!!C.clearcoatNormalMap,Wt=I&&!!C.clearcoatRoughnessMap,Kt=k&&!!C.iridescenceMap,pt=k&&!!C.iridescenceThicknessMap,Ct=it&&!!C.sheenColorMap,Xt=it&&!!C.sheenRoughnessMap,Yt=!!C.specularMap,Tt=!!C.specularColorMap,ge=!!C.specularIntensityMap,H=ht&&!!C.transmissionMap,Ut=ht&&!!C.thicknessMap,xt=!!C.gradientMap,Ot=!!C.alphaMap,_t=C.alphaTest>0,ut=!!C.alphaHash,At=!!C.extensions,oe=Si;C.toneMapped&&(dt===null||dt.isXRRenderTarget===!0)&&(oe=i.toneMapping);let Be={shaderID:St,shaderType:C.type,shaderName:C.name,vertexShader:$t,fragmentShader:re,defines:C.defines,customVertexShaderID:Ce,customFragmentShaderID:at,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:v,batching:Ft,batchingColor:Ft&&G._colorsTexture!==null,instancing:ie,instancingColor:ie&&G.instanceColor!==null,instancingMorph:ie&&G.morphTexture!==null,outputColorSpace:dt===null?i.outputColorSpace:dt.isXRRenderTarget===!0?dt.texture.colorSpace:Ps,alphaToCoverage:!!C.alphaToCoverage,map:ye,matcap:Re,envMap:ce,envMapMode:ce&&et.mapping,envMapCubeUVHeight:rt,aoMap:ct,lightMap:gt,bumpMap:lt,normalMap:Nt,displacementMap:B,emissiveMap:Zt,normalMapObjectSpace:Nt&&C.normalMapType===Y_,normalMapTangentSpace:Nt&&C.normalMapType===xa,metalnessMap:Dt,roughnessMap:se,anisotropy:Mt,anisotropyMap:st,clearcoat:I,clearcoatMap:jt,clearcoatNormalMap:Et,clearcoatRoughnessMap:Wt,dispersion:R,iridescence:k,iridescenceMap:Kt,iridescenceThicknessMap:pt,sheen:it,sheenColorMap:Ct,sheenRoughnessMap:Xt,specularMap:Yt,specularColorMap:Tt,specularIntensityMap:ge,transmission:ht,transmissionMap:H,thicknessMap:Ut,gradientMap:xt,opaque:C.transparent===!1&&C.blending===Ya&&C.alphaToCoverage===!1,alphaMap:Ot,alphaTest:_t,alphaHash:ut,combine:C.combine,mapUv:ye&&b(C.map.channel),aoMapUv:ct&&b(C.aoMap.channel),lightMapUv:gt&&b(C.lightMap.channel),bumpMapUv:lt&&b(C.bumpMap.channel),normalMapUv:Nt&&b(C.normalMap.channel),displacementMapUv:B&&b(C.displacementMap.channel),emissiveMapUv:Zt&&b(C.emissiveMap.channel),metalnessMapUv:Dt&&b(C.metalnessMap.channel),roughnessMapUv:se&&b(C.roughnessMap.channel),anisotropyMapUv:st&&b(C.anisotropyMap.channel),clearcoatMapUv:jt&&b(C.clearcoatMap.channel),clearcoatNormalMapUv:Et&&b(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Wt&&b(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Kt&&b(C.iridescenceMap.channel),iridescenceThicknessMapUv:pt&&b(C.iridescenceThicknessMap.channel),sheenColorMapUv:Ct&&b(C.sheenColorMap.channel),sheenRoughnessMapUv:Xt&&b(C.sheenRoughnessMap.channel),specularMapUv:Yt&&b(C.specularMap.channel),specularColorMapUv:Tt&&b(C.specularColorMap.channel),specularIntensityMapUv:ge&&b(C.specularIntensityMap.channel),transmissionMapUv:H&&b(C.transmissionMap.channel),thicknessMapUv:Ut&&b(C.thicknessMap.channel),alphaMapUv:Ot&&b(C.alphaMap.channel),vertexTangents:!!nt.attributes.tangent&&(Nt||Mt),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!nt.attributes.color&&nt.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!nt.attributes.uv&&(ye||Ot),fog:!!j,useFog:C.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:C.flatShading===!0&&C.wireframe===!1,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Vt,skinning:G.isSkinnedMesh===!0,morphTargets:nt.morphAttributes.position!==void 0,morphNormals:nt.morphAttributes.normal!==void 0,morphColors:nt.morphAttributes.color!==void 0,morphTargetsCount:mt,morphTextureStride:kt,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:oe,decodeVideoTexture:ye&&C.map.isVideoTexture===!0&&be.getTransfer(C.map.colorSpace)===Ve,decodeVideoTextureEmissive:Zt&&C.emissiveMap.isVideoTexture===!0&&be.getTransfer(C.emissiveMap.colorSpace)===Ve,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===_s,flipSided:C.side===ti,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:At&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&C.extensions.multiDraw===!0||Ft)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Be.vertexUv1s=f.has(1),Be.vertexUv2s=f.has(2),Be.vertexUv3s=f.has(3),f.clear(),Be}function x(C){let w=[];if(C.shaderID?w.push(C.shaderID):(w.push(C.customVertexShaderID),w.push(C.customFragmentShaderID)),C.defines!==void 0)for(let z in C.defines)w.push(z),w.push(C.defines[z]);return C.isRawShaderMaterial===!1&&(E(w,C),T(w,C),w.push(i.outputColorSpace)),w.push(C.customProgramCacheKey),w.join()}function E(C,w){C.push(w.precision),C.push(w.outputColorSpace),C.push(w.envMapMode),C.push(w.envMapCubeUVHeight),C.push(w.mapUv),C.push(w.alphaMapUv),C.push(w.lightMapUv),C.push(w.aoMapUv),C.push(w.bumpMapUv),C.push(w.normalMapUv),C.push(w.displacementMapUv),C.push(w.emissiveMapUv),C.push(w.metalnessMapUv),C.push(w.roughnessMapUv),C.push(w.anisotropyMapUv),C.push(w.clearcoatMapUv),C.push(w.clearcoatNormalMapUv),C.push(w.clearcoatRoughnessMapUv),C.push(w.iridescenceMapUv),C.push(w.iridescenceThicknessMapUv),C.push(w.sheenColorMapUv),C.push(w.sheenRoughnessMapUv),C.push(w.specularMapUv),C.push(w.specularColorMapUv),C.push(w.specularIntensityMapUv),C.push(w.transmissionMapUv),C.push(w.thicknessMapUv),C.push(w.combine),C.push(w.fogExp2),C.push(w.sizeAttenuation),C.push(w.morphTargetsCount),C.push(w.morphAttributeCount),C.push(w.numDirLights),C.push(w.numPointLights),C.push(w.numSpotLights),C.push(w.numSpotLightMaps),C.push(w.numHemiLights),C.push(w.numRectAreaLights),C.push(w.numDirLightShadows),C.push(w.numPointLightShadows),C.push(w.numSpotLightShadows),C.push(w.numSpotLightShadowsWithMaps),C.push(w.numLightProbes),C.push(w.shadowMapType),C.push(w.toneMapping),C.push(w.numClippingPlanes),C.push(w.numClipIntersection),C.push(w.depthPacking)}function T(C,w){c.disableAll(),w.instancing&&c.enable(0),w.instancingColor&&c.enable(1),w.instancingMorph&&c.enable(2),w.matcap&&c.enable(3),w.envMap&&c.enable(4),w.normalMapObjectSpace&&c.enable(5),w.normalMapTangentSpace&&c.enable(6),w.clearcoat&&c.enable(7),w.iridescence&&c.enable(8),w.alphaTest&&c.enable(9),w.vertexColors&&c.enable(10),w.vertexAlphas&&c.enable(11),w.vertexUv1s&&c.enable(12),w.vertexUv2s&&c.enable(13),w.vertexUv3s&&c.enable(14),w.vertexTangents&&c.enable(15),w.anisotropy&&c.enable(16),w.alphaHash&&c.enable(17),w.batching&&c.enable(18),w.dispersion&&c.enable(19),w.batchingColor&&c.enable(20),w.gradientMap&&c.enable(21),C.push(c.mask),c.disableAll(),w.fog&&c.enable(0),w.useFog&&c.enable(1),w.flatShading&&c.enable(2),w.logarithmicDepthBuffer&&c.enable(3),w.reversedDepthBuffer&&c.enable(4),w.skinning&&c.enable(5),w.morphTargets&&c.enable(6),w.morphNormals&&c.enable(7),w.morphColors&&c.enable(8),w.premultipliedAlpha&&c.enable(9),w.shadowMapEnabled&&c.enable(10),w.doubleSided&&c.enable(11),w.flipSided&&c.enable(12),w.useDepthPacking&&c.enable(13),w.dithering&&c.enable(14),w.transmission&&c.enable(15),w.sheen&&c.enable(16),w.opaque&&c.enable(17),w.pointsUvs&&c.enable(18),w.decodeVideoTexture&&c.enable(19),w.decodeVideoTextureEmissive&&c.enable(20),w.alphaToCoverage&&c.enable(21),C.push(c.mask)}function A(C){let w=y[C.type],z;if(w){let Y=Ms[w];z=sv.clone(Y.uniforms)}else z=C.uniforms;return z}function N(C,w){let z=m.get(w);return z!==void 0?++z.usedTimes:(z=new DN(i,w,C,r),p.push(z),m.set(w,z)),z}function D(C){if(--C.usedTimes===0){let w=p.indexOf(C);p[w]=p[p.length-1],p.pop(),m.delete(C.cacheKey),C.destroy()}}function L(C){h.remove(C)}function F(){h.dispose()}return{getParameters:S,getProgramCacheKey:x,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:L,programs:p,dispose:F}}function IN(){let i=new WeakMap;function t(l){return i.has(l)}function e(l){let c=i.get(l);return c===void 0&&(c={},i.set(l,c)),c}function n(l){i.delete(l)}function s(l,c,h){i.get(l)[c]=h}function r(){i=new WeakMap}return{has:t,get:e,remove:n,update:s,dispose:r}}function LN(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.z!==t.z?i.z-t.z:i.id-t.id}function zb(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function Vb(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function l(m,g,v,y,b,S){let x=i[t];return x===void 0?(x={id:m.id,object:m,geometry:g,material:v,groupOrder:y,renderOrder:m.renderOrder,z:b,group:S},i[t]=x):(x.id=m.id,x.object=m,x.geometry=g,x.material=v,x.groupOrder=y,x.renderOrder=m.renderOrder,x.z=b,x.group=S),t++,x}function c(m,g,v,y,b,S){let x=l(m,g,v,y,b,S);v.transmission>0?n.push(x):v.transparent===!0?s.push(x):e.push(x)}function h(m,g,v,y,b,S){let x=l(m,g,v,y,b,S);v.transmission>0?n.unshift(x):v.transparent===!0?s.unshift(x):e.unshift(x)}function f(m,g){e.length>1&&e.sort(m||LN),n.length>1&&n.sort(g||zb),s.length>1&&s.sort(g||zb)}function p(){for(let m=t,g=i.length;m<g;m++){let v=i[m];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:e,transmissive:n,transparent:s,init:r,push:c,unshift:h,finish:p,sort:f}}function ON(){let i=new WeakMap;function t(n,s){let r=i.get(n),l;return r===void 0?(l=new Vb,i.set(n,[l])):s>=r.length?(l=new Vb,r.push(l)):l=r[s],l}function e(){i=new WeakMap}return{get:t,dispose:e}}function BN(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new O,color:new Lt};break;case"SpotLight":e={position:new O,direction:new O,color:new Lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new O,color:new Lt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new O,skyColor:new Lt,groundColor:new Lt};break;case"RectAreaLight":e={color:new Lt,position:new O,halfWidth:new O,halfHeight:new O};break}return i[t.id]=e,e}}}function FN(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ft,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var zN=0;function VN(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function HN(i){let t=new BN,e=FN(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new O);let s=new O,r=new ue,l=new ue;function c(f){let p=0,m=0,g=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let v=0,y=0,b=0,S=0,x=0,E=0,T=0,A=0,N=0,D=0,L=0;f.sort(VN);for(let C=0,w=f.length;C<w;C++){let z=f[C],Y=z.color,G=z.intensity,j=z.distance,nt=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===rr?nt=z.shadow.map.texture:nt=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)p+=Y.r*G,m+=Y.g*G,g+=Y.b*G;else if(z.isLightProbe){for(let J=0;J<9;J++)n.probe[J].addScaledVector(z.sh.coefficients[J],G);L++}else if(z.isDirectionalLight){let J=t.get(z);if(J.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let et=z.shadow,rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,n.directionalShadow[v]=rt,n.directionalShadowMap[v]=nt,n.directionalShadowMatrix[v]=z.shadow.matrix,E++}n.directional[v]=J,v++}else if(z.isSpotLight){let J=t.get(z);J.position.setFromMatrixPosition(z.matrixWorld),J.color.copy(Y).multiplyScalar(G),J.distance=j,J.coneCos=Math.cos(z.angle),J.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),J.decay=z.decay,n.spot[b]=J;let et=z.shadow;if(z.map&&(n.spotLightMap[N]=z.map,N++,et.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[b]=et.matrix,z.castShadow){let rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,n.spotShadow[b]=rt,n.spotShadowMap[b]=nt,A++}b++}else if(z.isRectAreaLight){let J=t.get(z);J.color.copy(Y).multiplyScalar(G),J.halfWidth.set(z.width*.5,0,0),J.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=J,S++}else if(z.isPointLight){let J=t.get(z);if(J.color.copy(z.color).multiplyScalar(z.intensity),J.distance=z.distance,J.decay=z.decay,z.castShadow){let et=z.shadow,rt=e.get(z);rt.shadowIntensity=et.intensity,rt.shadowBias=et.bias,rt.shadowNormalBias=et.normalBias,rt.shadowRadius=et.radius,rt.shadowMapSize=et.mapSize,rt.shadowCameraNear=et.camera.near,rt.shadowCameraFar=et.camera.far,n.pointShadow[y]=rt,n.pointShadowMap[y]=nt,n.pointShadowMatrix[y]=z.shadow.matrix,T++}n.point[y]=J,y++}else if(z.isHemisphereLight){let J=t.get(z);J.skyColor.copy(z.color).multiplyScalar(G),J.groundColor.copy(z.groundColor).multiplyScalar(G),n.hemi[x]=J,x++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=It.LTC_FLOAT_1,n.rectAreaLTC2=It.LTC_FLOAT_2):(n.rectAreaLTC1=It.LTC_HALF_1,n.rectAreaLTC2=It.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=m,n.ambient[2]=g;let F=n.hash;(F.directionalLength!==v||F.pointLength!==y||F.spotLength!==b||F.rectAreaLength!==S||F.hemiLength!==x||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==A||F.numSpotMaps!==N||F.numLightProbes!==L)&&(n.directional.length=v,n.spot.length=b,n.rectArea.length=S,n.point.length=y,n.hemi.length=x,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=A,n.spotShadowMap.length=A,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=A+N-D,n.spotLightMap.length=N,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,F.directionalLength=v,F.pointLength=y,F.spotLength=b,F.rectAreaLength=S,F.hemiLength=x,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=A,F.numSpotMaps=N,F.numLightProbes=L,n.version=zN++)}function h(f,p){let m=0,g=0,v=0,y=0,b=0,S=p.matrixWorldInverse;for(let x=0,E=f.length;x<E;x++){let T=f[x];if(T.isDirectionalLight){let A=n.directional[m];A.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(S),m++}else if(T.isSpotLight){let A=n.spot[v];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),A.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(S),v++}else if(T.isRectAreaLight){let A=n.rectArea[y];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),l.identity(),r.copy(T.matrixWorld),r.premultiply(S),l.extractRotation(r),A.halfWidth.set(T.width*.5,0,0),A.halfHeight.set(0,T.height*.5,0),A.halfWidth.applyMatrix4(l),A.halfHeight.applyMatrix4(l),y++}else if(T.isPointLight){let A=n.point[g];A.position.setFromMatrixPosition(T.matrixWorld),A.position.applyMatrix4(S),g++}else if(T.isHemisphereLight){let A=n.hemi[b];A.direction.setFromMatrixPosition(T.matrixWorld),A.direction.transformDirection(S),b++}}}return{setup:c,setupView:h,state:n}}function Hb(i){let t=new HN(i),e=[],n=[];function s(p){f.camera=p,e.length=0,n.length=0}function r(p){e.push(p)}function l(p){n.push(p)}function c(){t.setup(e)}function h(p){t.setupView(e,p)}let f={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:s,state:f,setupLights:c,setupLightsView:h,pushLight:r,pushShadow:l}}function GN(i){let t=new WeakMap;function e(s,r=0){let l=t.get(s),c;return l===void 0?(c=new Hb(i),t.set(s,[c])):r>=l.length?(c=new Hb(i),l.push(c)):c=l[r],c}function n(){t=new WeakMap}return{get:e,dispose:n}}var kN=`void main() {
3972
3972
  gl_Position = vec4( position, 1.0 );
3973
- }`,kN=`uniform sampler2D shadow_pass;
3973
+ }`,WN=`uniform sampler2D shadow_pass;
3974
3974
  uniform vec2 resolution;
3975
3975
  uniform float radius;
3976
3976
  void main() {
@@ -3995,12 +3995,12 @@ void main() {
3995
3995
  squared_mean = squared_mean / samples;
3996
3996
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
3997
3997
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
3998
- }`,WN=[new O(1,0,0),new O(-1,0,0),new O(0,1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1)],XN=[new O(0,-1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1),new O(0,-1,0),new O(0,-1,0)],Gb=new ue,Cf=new O,mv=new O;function qN(i,t,e){let n=new fa,s=new ft,r=new ft,l=new qe,c=new Jl,h=new Kl,f={},p=e.maxTextureSize,m={[Us]:ti,[ti]:Us,[_s]:_s},g=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ft},radius:{value:4}},vertexShader:GN,fragmentShader:kN}),v=g.clone();v.defines.HORIZONTAL_PASS=1;let y=new de;y.setAttribute("position",new He(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let b=new rn(y,g),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sr;let x=this.type;this.render=function(D,L,F){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;D.type===lo&&(wt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),D.type=sr);let C=i.getRenderTarget(),w=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),Y=i.state;Y.setBlending(vs),Y.buffers.depth.getReversed()===!0?Y.buffers.color.setClear(0,0,0,0):Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);let G=x!==this.type;G&&L.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(nt=>nt.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,nt=D.length;j<nt;j++){let J=D[j],et=J.shadow;if(et===void 0){wt("WebGLShadowMap:",J,"has no shadow.");continue}if(et.autoUpdate===!1&&et.needsUpdate===!1)continue;s.copy(et.mapSize);let rt=et.getFrameExtents();if(s.multiply(rt),r.copy(et.mapSize),(s.x>p||s.y>p)&&(s.x>p&&(r.x=Math.floor(p/rt.x),s.x=r.x*rt.x,et.mapSize.x=r.x),s.y>p&&(r.y=Math.floor(p/rt.y),s.y=r.y*rt.y,et.mapSize.y=r.y)),et.map===null||G===!0){if(et.map!==null&&(et.map.depthTexture!==null&&(et.map.depthTexture.dispose(),et.map.depthTexture=null),et.map.dispose()),this.type===ma){if(J.isPointLight){wt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}et.map=new $n(s.x,s.y,{format:ar,type:Ss,minFilter:Je,magFilter:Je,generateMipmaps:!1}),et.map.texture.name=J.name+".shadowMap",et.map.depthTexture=new da(s.x,s.y,Qn),et.map.depthTexture.name=J.name+".shadowMapDepth",et.map.depthTexture.format=ds,et.map.depthTexture.compareFunction=null,et.map.depthTexture.minFilter=dn,et.map.depthTexture.magFilter=dn}else{J.isPointLight?(et.map=new Pl(s.x),et.map.depthTexture=new Lu(s.x,Fi)):(et.map=new $n(s.x,s.y),et.map.depthTexture=new da(s.x,s.y,Fi)),et.map.depthTexture.name=J.name+".shadowMap",et.map.depthTexture.format=ds;let bt=i.state.buffers.depth.getReversed();this.type===sr?(et.map.depthTexture.compareFunction=bt?Tf:Ef,et.map.depthTexture.minFilter=Je,et.map.depthTexture.magFilter=Je):(et.map.depthTexture.compareFunction=null,et.map.depthTexture.minFilter=dn,et.map.depthTexture.magFilter=dn)}et.camera.updateProjectionMatrix()}let St=et.map.isWebGLCubeRenderTarget?6:1;for(let bt=0;bt<St;bt++){if(et.map.isWebGLCubeRenderTarget)i.setRenderTarget(et.map,bt),i.clear();else{bt===0&&(i.setRenderTarget(et.map),i.clear());let mt=et.getViewport(bt);l.set(r.x*mt.x,r.y*mt.y,r.x*mt.z,r.y*mt.w),Y.viewport(l)}if(J.isPointLight){let mt=et.camera,kt=et.matrix,$t=J.distance||mt.far;$t!==mt.far&&(mt.far=$t,mt.updateProjectionMatrix()),Cf.setFromMatrixPosition(J.matrixWorld),mt.position.copy(Cf),mv.copy(mt.position),mv.add(WN[bt]),mt.up.copy(XN[bt]),mt.lookAt(mv),mt.updateMatrixWorld(),kt.makeTranslation(-Cf.x,-Cf.y,-Cf.z),Gb.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),et._frustum.setFromProjectionMatrix(Gb,mt.coordinateSystem,mt.reversedDepth)}else et.updateMatrices(J);n=et.getFrustum(),A(L,F,et.camera,J,this.type)}et.isPointLightShadow!==!0&&this.type===ma&&E(et,F),et.needsUpdate=!1}x=this.type,S.needsUpdate=!1,i.setRenderTarget(C,w,z)};function E(D,L){let F=t.update(b);g.defines.VSM_SAMPLES!==D.blurSamples&&(g.defines.VSM_SAMPLES=D.blurSamples,v.defines.VSM_SAMPLES=D.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new $n(s.x,s.y,{format:ar,type:Ss})),g.uniforms.shadow_pass.value=D.map.depthTexture,g.uniforms.resolution.value=D.mapSize,g.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,F,g,b,null),v.uniforms.shadow_pass.value=D.mapPass.texture,v.uniforms.resolution.value=D.mapSize,v.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,F,v,b,null)}function T(D,L,F,C){let w=null,z=F.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)w=z;else if(w=F.isPointLight===!0?h:c,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let Y=w.uuid,G=L.uuid,j=f[Y];j===void 0&&(j={},f[Y]=j);let nt=j[G];nt===void 0&&(nt=w.clone(),j[G]=nt,L.addEventListener("dispose",N)),w=nt}if(w.visible=L.visible,w.wireframe=L.wireframe,C===ma?w.side=L.shadowSide!==null?L.shadowSide:L.side:w.side=L.shadowSide!==null?L.shadowSide:m[L.side],w.alphaMap=L.alphaMap,w.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,w.map=L.map,w.clipShadows=L.clipShadows,w.clippingPlanes=L.clippingPlanes,w.clipIntersection=L.clipIntersection,w.displacementMap=L.displacementMap,w.displacementScale=L.displacementScale,w.displacementBias=L.displacementBias,w.wireframeLinewidth=L.wireframeLinewidth,w.linewidth=L.linewidth,F.isPointLight===!0&&w.isMeshDistanceMaterial===!0){let Y=i.properties.get(w);Y.light=F}return w}function A(D,L,F,C,w){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&w===ma)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,D.matrixWorld);let G=t.update(D),j=D.material;if(Array.isArray(j)){let nt=G.groups;for(let J=0,et=nt.length;J<et;J++){let rt=nt[J],St=j[rt.materialIndex];if(St&&St.visible){let bt=T(D,St,C,w);D.onBeforeShadow(i,D,L,F,G,bt,rt),i.renderBufferDirect(F,null,G,bt,D,rt),D.onAfterShadow(i,D,L,F,G,bt,rt)}}}else if(j.visible){let nt=T(D,j,C,w);D.onBeforeShadow(i,D,L,F,G,nt,null),i.renderBufferDirect(F,null,G,nt,D,null),D.onAfterShadow(i,D,L,F,G,nt,null)}}let Y=D.children;for(let G=0,j=Y.length;G<j;G++)A(Y[G],L,F,C,w)}function N(D){D.target.removeEventListener("dispose",N);for(let F in f){let C=f[F],w=D.target.uuid;w in C&&(C[w].dispose(),delete C[w])}}}var YN={[Nh]:Dh,[Uh]:Lh,[Ph]:Oh,[Ya]:Ih,[Dh]:Nh,[Lh]:Uh,[Oh]:Ph,[Ih]:Ya};function ZN(i,t){function e(){let H=!1,Ut=new qe,xt=null,Ot=new qe(0,0,0,0);return{setMask:function(_t){xt!==_t&&!H&&(i.colorMask(_t,_t,_t,_t),xt=_t)},setLocked:function(_t){H=_t},setClear:function(_t,ut,At,oe,Be){Be===!0&&(_t*=oe,ut*=oe,At*=oe),Ut.set(_t,ut,At,oe),Ot.equals(Ut)===!1&&(i.clearColor(_t,ut,At,oe),Ot.copy(Ut))},reset:function(){H=!1,xt=null,Ot.set(-1,0,0,0)}}}function n(){let H=!1,Ut=!1,xt=null,Ot=null,_t=null;return{setReversed:function(ut){if(Ut!==ut){let At=t.get("EXT_clip_control");ut?At.clipControlEXT(At.LOWER_LEFT_EXT,At.ZERO_TO_ONE_EXT):At.clipControlEXT(At.LOWER_LEFT_EXT,At.NEGATIVE_ONE_TO_ONE_EXT),Ut=ut;let oe=_t;_t=null,this.setClear(oe)}},getReversed:function(){return Ut},setTest:function(ut){ut?dt(i.DEPTH_TEST):Vt(i.DEPTH_TEST)},setMask:function(ut){xt!==ut&&!H&&(i.depthMask(ut),xt=ut)},setFunc:function(ut){if(Ut&&(ut=YN[ut]),Ot!==ut){switch(ut){case Nh:i.depthFunc(i.NEVER);break;case Dh:i.depthFunc(i.ALWAYS);break;case Uh:i.depthFunc(i.LESS);break;case Ya:i.depthFunc(i.LEQUAL);break;case Ph:i.depthFunc(i.EQUAL);break;case Ih:i.depthFunc(i.GEQUAL);break;case Lh:i.depthFunc(i.GREATER);break;case Oh:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Ot=ut}},setLocked:function(ut){H=ut},setClear:function(ut){_t!==ut&&(Ut&&(ut=1-ut),i.clearDepth(ut),_t=ut)},reset:function(){H=!1,xt=null,Ot=null,_t=null,Ut=!1}}}function s(){let H=!1,Ut=null,xt=null,Ot=null,_t=null,ut=null,At=null,oe=null,Be=null;return{setTest:function(De){H||(De?dt(i.STENCIL_TEST):Vt(i.STENCIL_TEST))},setMask:function(De){Ut!==De&&!H&&(i.stencilMask(De),Ut=De)},setFunc:function(De,Mi,zi){(xt!==De||Ot!==Mi||_t!==zi)&&(i.stencilFunc(De,Mi,zi),xt=De,Ot=Mi,_t=zi)},setOp:function(De,Mi,zi){(ut!==De||At!==Mi||oe!==zi)&&(i.stencilOp(De,Mi,zi),ut=De,At=Mi,oe=zi)},setLocked:function(De){H=De},setClear:function(De){Be!==De&&(i.clearStencil(De),Be=De)},reset:function(){H=!1,Ut=null,xt=null,Ot=null,_t=null,ut=null,At=null,oe=null,Be=null}}}let r=new e,l=new n,c=new s,h=new WeakMap,f=new WeakMap,p={},m={},g=new WeakMap,v=[],y=null,b=!1,S=null,x=null,E=null,T=null,A=null,N=null,D=null,L=new Lt(0,0,0),F=0,C=!1,w=null,z=null,Y=null,G=null,j=null,nt=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,et=0,rt=i.getParameter(i.VERSION);rt.indexOf("WebGL")!==-1?(et=parseFloat(/^WebGL (\d)/.exec(rt)[1]),J=et>=1):rt.indexOf("OpenGL ES")!==-1&&(et=parseFloat(/^OpenGL ES (\d)/.exec(rt)[1]),J=et>=2);let St=null,bt={},mt=i.getParameter(i.SCISSOR_BOX),kt=i.getParameter(i.VIEWPORT),$t=new qe().fromArray(mt),re=new qe().fromArray(kt);function Ce(H,Ut,xt,Ot){let _t=new Uint8Array(4),ut=i.createTexture();i.bindTexture(H,ut),i.texParameteri(H,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(H,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let At=0;At<xt;At++)H===i.TEXTURE_3D||H===i.TEXTURE_2D_ARRAY?i.texImage3D(Ut,0,i.RGBA,1,1,Ot,0,i.RGBA,i.UNSIGNED_BYTE,_t):i.texImage2D(Ut+At,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,_t);return ut}let at={};at[i.TEXTURE_2D]=Ce(i.TEXTURE_2D,i.TEXTURE_2D,1),at[i.TEXTURE_CUBE_MAP]=Ce(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),at[i.TEXTURE_2D_ARRAY]=Ce(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),at[i.TEXTURE_3D]=Ce(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),l.setClear(1),c.setClear(0),dt(i.DEPTH_TEST),l.setFunc(Ya),lt(!1),Nt(um),dt(i.CULL_FACE),ct(vs);function dt(H){p[H]!==!0&&(i.enable(H),p[H]=!0)}function Vt(H){p[H]!==!1&&(i.disable(H),p[H]=!1)}function ie(H,Ut){return m[H]!==Ut?(i.bindFramebuffer(H,Ut),m[H]=Ut,H===i.DRAW_FRAMEBUFFER&&(m[i.FRAMEBUFFER]=Ut),H===i.FRAMEBUFFER&&(m[i.DRAW_FRAMEBUFFER]=Ut),!0):!1}function Ft(H,Ut){let xt=v,Ot=!1;if(H){xt=g.get(Ut),xt===void 0&&(xt=[],g.set(Ut,xt));let _t=H.textures;if(xt.length!==_t.length||xt[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,At=_t.length;ut<At;ut++)xt[ut]=i.COLOR_ATTACHMENT0+ut;xt.length=_t.length,Ot=!0}}else xt[0]!==i.BACK&&(xt[0]=i.BACK,Ot=!0);Ot&&i.drawBuffers(xt)}function ye(H){return y!==H?(i.useProgram(H),y=H,!0):!1}let Re={[ca]:i.FUNC_ADD,[b_]:i.FUNC_SUBTRACT,[E_]:i.FUNC_REVERSE_SUBTRACT};Re[T_]=i.MIN,Re[A_]=i.MAX;let ce={[C_]:i.ZERO,[R_]:i.ONE,[w_]:i.SRC_COLOR,[vu]:i.SRC_ALPHA,[L_]:i.SRC_ALPHA_SATURATE,[P_]:i.DST_COLOR,[D_]:i.DST_ALPHA,[N_]:i.ONE_MINUS_SRC_COLOR,[xu]:i.ONE_MINUS_SRC_ALPHA,[I_]:i.ONE_MINUS_DST_COLOR,[U_]:i.ONE_MINUS_DST_ALPHA,[O_]:i.CONSTANT_COLOR,[B_]:i.ONE_MINUS_CONSTANT_COLOR,[F_]:i.CONSTANT_ALPHA,[z_]:i.ONE_MINUS_CONSTANT_ALPHA};function ct(H,Ut,xt,Ot,_t,ut,At,oe,Be,De){if(H===vs){b===!0&&(Vt(i.BLEND),b=!1);return}if(b===!1&&(dt(i.BLEND),b=!0),H!==M_){if(H!==S||De!==C){if((x!==ca||A!==ca)&&(i.blendEquation(i.FUNC_ADD),x=ca,A=ca),De)switch(H){case qa:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case fm:i.blendFunc(i.ONE,i.ONE);break;case dm:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case pm:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Qt("WebGLState: Invalid blending: ",H);break}else switch(H){case qa:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case fm:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case dm:Qt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case pm:Qt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Qt("WebGLState: Invalid blending: ",H);break}E=null,T=null,N=null,D=null,L.set(0,0,0),F=0,S=H,C=De}return}_t=_t||Ut,ut=ut||xt,At=At||Ot,(Ut!==x||_t!==A)&&(i.blendEquationSeparate(Re[Ut],Re[_t]),x=Ut,A=_t),(xt!==E||Ot!==T||ut!==N||At!==D)&&(i.blendFuncSeparate(ce[xt],ce[Ot],ce[ut],ce[At]),E=xt,T=Ot,N=ut,D=At),(oe.equals(L)===!1||Be!==F)&&(i.blendColor(oe.r,oe.g,oe.b,Be),L.copy(oe),F=Be),S=H,C=!1}function gt(H,Ut){H.side===_s?Vt(i.CULL_FACE):dt(i.CULL_FACE);let xt=H.side===ti;Ut&&(xt=!xt),lt(xt),H.blending===qa&&H.transparent===!1?ct(vs):ct(H.blending,H.blendEquation,H.blendSrc,H.blendDst,H.blendEquationAlpha,H.blendSrcAlpha,H.blendDstAlpha,H.blendColor,H.blendAlpha,H.premultipliedAlpha),l.setFunc(H.depthFunc),l.setTest(H.depthTest),l.setMask(H.depthWrite),r.setMask(H.colorWrite);let Ot=H.stencilWrite;c.setTest(Ot),Ot&&(c.setMask(H.stencilWriteMask),c.setFunc(H.stencilFunc,H.stencilRef,H.stencilFuncMask),c.setOp(H.stencilFail,H.stencilZFail,H.stencilZPass)),Zt(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),H.alphaToCoverage===!0?dt(i.SAMPLE_ALPHA_TO_COVERAGE):Vt(i.SAMPLE_ALPHA_TO_COVERAGE)}function lt(H){w!==H&&(H?i.frontFace(i.CW):i.frontFace(i.CCW),w=H)}function Nt(H){H!==y_?(dt(i.CULL_FACE),H!==z&&(H===um?i.cullFace(i.BACK):H===S_?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Vt(i.CULL_FACE),z=H}function B(H){H!==Y&&(J&&i.lineWidth(H),Y=H)}function Zt(H,Ut,xt){H?(dt(i.POLYGON_OFFSET_FILL),(G!==Ut||j!==xt)&&(i.polygonOffset(Ut,xt),G=Ut,j=xt)):Vt(i.POLYGON_OFFSET_FILL)}function Dt(H){H?dt(i.SCISSOR_TEST):Vt(i.SCISSOR_TEST)}function se(H){H===void 0&&(H=i.TEXTURE0+nt-1),St!==H&&(i.activeTexture(H),St=H)}function Mt(H,Ut,xt){xt===void 0&&(St===null?xt=i.TEXTURE0+nt-1:xt=St);let Ot=bt[xt];Ot===void 0&&(Ot={type:void 0,texture:void 0},bt[xt]=Ot),(Ot.type!==H||Ot.texture!==Ut)&&(St!==xt&&(i.activeTexture(xt),St=xt),i.bindTexture(H,Ut||at[H]),Ot.type=H,Ot.texture=Ut)}function I(){let H=bt[St];H!==void 0&&H.type!==void 0&&(i.bindTexture(H.type,null),H.type=void 0,H.texture=void 0)}function R(){try{i.compressedTexImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function k(){try{i.compressedTexImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function it(){try{i.texSubImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function ht(){try{i.texSubImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function st(){try{i.compressedTexSubImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function jt(){try{i.compressedTexSubImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Et(){try{i.texStorage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Wt(){try{i.texStorage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Kt(){try{i.texImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function pt(){try{i.texImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Ct(H){$t.equals(H)===!1&&(i.scissor(H.x,H.y,H.z,H.w),$t.copy(H))}function Xt(H){re.equals(H)===!1&&(i.viewport(H.x,H.y,H.z,H.w),re.copy(H))}function Yt(H,Ut){let xt=f.get(Ut);xt===void 0&&(xt=new WeakMap,f.set(Ut,xt));let Ot=xt.get(H);Ot===void 0&&(Ot=i.getUniformBlockIndex(Ut,H.name),xt.set(H,Ot))}function Tt(H,Ut){let Ot=f.get(Ut).get(H);h.get(Ut)!==Ot&&(i.uniformBlockBinding(Ut,Ot,H.__bindingPointIndex),h.set(Ut,Ot))}function ge(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),l.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),p={},St=null,bt={},m={},g=new WeakMap,v=[],y=null,b=!1,S=null,x=null,E=null,T=null,A=null,N=null,D=null,L=new Lt(0,0,0),F=0,C=!1,w=null,z=null,Y=null,G=null,j=null,$t.set(0,0,i.canvas.width,i.canvas.height),re.set(0,0,i.canvas.width,i.canvas.height),r.reset(),l.reset(),c.reset()}return{buffers:{color:r,depth:l,stencil:c},enable:dt,disable:Vt,bindFramebuffer:ie,drawBuffers:Ft,useProgram:ye,setBlending:ct,setMaterial:gt,setFlipSided:lt,setCullFace:Nt,setLineWidth:B,setPolygonOffset:Zt,setScissorTest:Dt,activeTexture:se,bindTexture:Mt,unbindTexture:I,compressedTexImage2D:R,compressedTexImage3D:k,texImage2D:Kt,texImage3D:pt,updateUBOMapping:Yt,uniformBlockBinding:Tt,texStorage2D:Et,texStorage3D:Wt,texSubImage2D:it,texSubImage3D:ht,compressedTexSubImage2D:st,compressedTexSubImage3D:jt,scissor:Ct,viewport:Xt,reset:ge}}function jN(i,t,e,n,s,r,l){let c=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ft,p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(I,R){return v?new OffscreenCanvas(I,R):Rl("canvas")}function b(I,R,k){let it=1,ht=Mt(I);if((ht.width>k||ht.height>k)&&(it=k/Math.max(ht.width,ht.height)),it<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){let st=Math.floor(it*ht.width),jt=Math.floor(it*ht.height);m===void 0&&(m=y(st,jt));let Et=R?y(st,jt):m;return Et.width=st,Et.height=jt,Et.getContext("2d").drawImage(I,0,0,st,jt),wt("WebGLRenderer: Texture has been resized from ("+ht.width+"x"+ht.height+") to ("+st+"x"+jt+")."),Et}else return"data"in I&&wt("WebGLRenderer: Image in DataTexture is too big ("+ht.width+"x"+ht.height+")."),I;return I}function S(I){return I.generateMipmaps}function x(I){i.generateMipmap(I)}function E(I){return I.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:I.isWebGL3DRenderTarget?i.TEXTURE_3D:I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(I,R,k,it,ht=!1){if(I!==null){if(i[I]!==void 0)return i[I];wt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let st=R;if(R===i.RED&&(k===i.FLOAT&&(st=i.R32F),k===i.HALF_FLOAT&&(st=i.R16F),k===i.UNSIGNED_BYTE&&(st=i.R8)),R===i.RED_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.R8UI),k===i.UNSIGNED_SHORT&&(st=i.R16UI),k===i.UNSIGNED_INT&&(st=i.R32UI),k===i.BYTE&&(st=i.R8I),k===i.SHORT&&(st=i.R16I),k===i.INT&&(st=i.R32I)),R===i.RG&&(k===i.FLOAT&&(st=i.RG32F),k===i.HALF_FLOAT&&(st=i.RG16F),k===i.UNSIGNED_BYTE&&(st=i.RG8)),R===i.RG_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RG8UI),k===i.UNSIGNED_SHORT&&(st=i.RG16UI),k===i.UNSIGNED_INT&&(st=i.RG32UI),k===i.BYTE&&(st=i.RG8I),k===i.SHORT&&(st=i.RG16I),k===i.INT&&(st=i.RG32I)),R===i.RGB_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RGB8UI),k===i.UNSIGNED_SHORT&&(st=i.RGB16UI),k===i.UNSIGNED_INT&&(st=i.RGB32UI),k===i.BYTE&&(st=i.RGB8I),k===i.SHORT&&(st=i.RGB16I),k===i.INT&&(st=i.RGB32I)),R===i.RGBA_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RGBA8UI),k===i.UNSIGNED_SHORT&&(st=i.RGBA16UI),k===i.UNSIGNED_INT&&(st=i.RGBA32UI),k===i.BYTE&&(st=i.RGBA8I),k===i.SHORT&&(st=i.RGBA16I),k===i.INT&&(st=i.RGBA32I)),R===i.RGB&&(k===i.UNSIGNED_INT_5_9_9_9_REV&&(st=i.RGB9_E5),k===i.UNSIGNED_INT_10F_11F_11F_REV&&(st=i.R11F_G11F_B10F)),R===i.RGBA){let jt=ht?Al:be.getTransfer(it);k===i.FLOAT&&(st=i.RGBA32F),k===i.HALF_FLOAT&&(st=i.RGBA16F),k===i.UNSIGNED_BYTE&&(st=jt===Ve?i.SRGB8_ALPHA8:i.RGBA8),k===i.UNSIGNED_SHORT_4_4_4_4&&(st=i.RGBA4),k===i.UNSIGNED_SHORT_5_5_5_1&&(st=i.RGB5_A1)}return(st===i.R16F||st===i.R32F||st===i.RG16F||st===i.RG32F||st===i.RGBA16F||st===i.RGBA32F)&&t.get("EXT_color_buffer_float"),st}function A(I,R){let k;return I?R===null||R===Fi||R===fo?k=i.DEPTH24_STENCIL8:R===Qn?k=i.DEPTH32F_STENCIL8:R===ho&&(k=i.DEPTH24_STENCIL8,wt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===Fi||R===fo?k=i.DEPTH_COMPONENT24:R===Qn?k=i.DEPTH_COMPONENT32F:R===ho&&(k=i.DEPTH_COMPONENT16),k}function N(I,R){return S(I)===!0||I.isFramebufferTexture&&I.minFilter!==dn&&I.minFilter!==Je?Math.log2(Math.max(R.width,R.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?R.mipmaps.length:1}function D(I){let R=I.target;R.removeEventListener("dispose",D),F(R),R.isVideoTexture&&p.delete(R)}function L(I){let R=I.target;R.removeEventListener("dispose",L),w(R)}function F(I){let R=n.get(I);if(R.__webglInit===void 0)return;let k=I.source,it=g.get(k);if(it){let ht=it[R.__cacheKey];ht.usedTimes--,ht.usedTimes===0&&C(I),Object.keys(it).length===0&&g.delete(k)}n.remove(I)}function C(I){let R=n.get(I);i.deleteTexture(R.__webglTexture);let k=I.source,it=g.get(k);delete it[R.__cacheKey],l.memory.textures--}function w(I){let R=n.get(I);if(I.depthTexture&&(I.depthTexture.dispose(),n.remove(I.depthTexture)),I.isWebGLCubeRenderTarget)for(let it=0;it<6;it++){if(Array.isArray(R.__webglFramebuffer[it]))for(let ht=0;ht<R.__webglFramebuffer[it].length;ht++)i.deleteFramebuffer(R.__webglFramebuffer[it][ht]);else i.deleteFramebuffer(R.__webglFramebuffer[it]);R.__webglDepthbuffer&&i.deleteRenderbuffer(R.__webglDepthbuffer[it])}else{if(Array.isArray(R.__webglFramebuffer))for(let it=0;it<R.__webglFramebuffer.length;it++)i.deleteFramebuffer(R.__webglFramebuffer[it]);else i.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&i.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&i.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let it=0;it<R.__webglColorRenderbuffer.length;it++)R.__webglColorRenderbuffer[it]&&i.deleteRenderbuffer(R.__webglColorRenderbuffer[it]);R.__webglDepthRenderbuffer&&i.deleteRenderbuffer(R.__webglDepthRenderbuffer)}let k=I.textures;for(let it=0,ht=k.length;it<ht;it++){let st=n.get(k[it]);st.__webglTexture&&(i.deleteTexture(st.__webglTexture),l.memory.textures--),n.remove(k[it])}n.remove(I)}let z=0;function Y(){z=0}function G(){let I=z;return I>=s.maxTextures&&wt("WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+s.maxTextures),z+=1,I}function j(I){let R=[];return R.push(I.wrapS),R.push(I.wrapT),R.push(I.wrapR||0),R.push(I.magFilter),R.push(I.minFilter),R.push(I.anisotropy),R.push(I.internalFormat),R.push(I.format),R.push(I.type),R.push(I.generateMipmaps),R.push(I.premultiplyAlpha),R.push(I.flipY),R.push(I.unpackAlignment),R.push(I.colorSpace),R.join()}function nt(I,R){let k=n.get(I);if(I.isVideoTexture&&Dt(I),I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&k.__version!==I.version){let it=I.image;if(it===null)wt("WebGLRenderer: Texture marked for update but no image data found.");else if(it.complete===!1)wt("WebGLRenderer: Texture marked for update but image is incomplete");else{at(k,I,R);return}}else I.isExternalTexture&&(k.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,k.__webglTexture,i.TEXTURE0+R)}function J(I,R){let k=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&k.__version!==I.version){at(k,I,R);return}else I.isExternalTexture&&(k.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,k.__webglTexture,i.TEXTURE0+R)}function et(I,R){let k=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&k.__version!==I.version){at(k,I,R);return}e.bindTexture(i.TEXTURE_3D,k.__webglTexture,i.TEXTURE0+R)}function rt(I,R){let k=n.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&k.__version!==I.version){dt(k,I,R);return}e.bindTexture(i.TEXTURE_CUBE_MAP,k.__webglTexture,i.TEXTURE0+R)}let St={[Ml]:i.REPEAT,[li]:i.CLAMP_TO_EDGE,[bl]:i.MIRRORED_REPEAT},bt={[dn]:i.NEAREST,[Sm]:i.NEAREST_MIPMAP_NEAREST,[uo]:i.NEAREST_MIPMAP_LINEAR,[Je]:i.LINEAR,[cc]:i.LINEAR_MIPMAP_NEAREST,[ys]:i.LINEAR_MIPMAP_LINEAR},mt={[Z_]:i.NEVER,[$_]:i.ALWAYS,[j_]:i.LESS,[Ef]:i.LEQUAL,[J_]:i.EQUAL,[Tf]:i.GEQUAL,[K_]:i.GREATER,[Q_]:i.NOTEQUAL};function kt(I,R){if(R.type===Qn&&t.has("OES_texture_float_linear")===!1&&(R.magFilter===Je||R.magFilter===cc||R.magFilter===uo||R.magFilter===ys||R.minFilter===Je||R.minFilter===cc||R.minFilter===uo||R.minFilter===ys)&&wt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(I,i.TEXTURE_WRAP_S,St[R.wrapS]),i.texParameteri(I,i.TEXTURE_WRAP_T,St[R.wrapT]),(I===i.TEXTURE_3D||I===i.TEXTURE_2D_ARRAY)&&i.texParameteri(I,i.TEXTURE_WRAP_R,St[R.wrapR]),i.texParameteri(I,i.TEXTURE_MAG_FILTER,bt[R.magFilter]),i.texParameteri(I,i.TEXTURE_MIN_FILTER,bt[R.minFilter]),R.compareFunction&&(i.texParameteri(I,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(I,i.TEXTURE_COMPARE_FUNC,mt[R.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===dn||R.minFilter!==uo&&R.minFilter!==ys||R.type===Qn&&t.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||n.get(R).__currentAnisotropy){let k=t.get("EXT_texture_filter_anisotropic");i.texParameterf(I,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,s.getMaxAnisotropy())),n.get(R).__currentAnisotropy=R.anisotropy}}}function $t(I,R){let k=!1;I.__webglInit===void 0&&(I.__webglInit=!0,R.addEventListener("dispose",D));let it=R.source,ht=g.get(it);ht===void 0&&(ht={},g.set(it,ht));let st=j(R);if(st!==I.__cacheKey){ht[st]===void 0&&(ht[st]={texture:i.createTexture(),usedTimes:0},l.memory.textures++,k=!0),ht[st].usedTimes++;let jt=ht[I.__cacheKey];jt!==void 0&&(ht[I.__cacheKey].usedTimes--,jt.usedTimes===0&&C(R)),I.__cacheKey=st,I.__webglTexture=ht[st].texture}return k}function re(I,R,k){return Math.floor(Math.floor(I/k)/R)}function Ce(I,R,k,it){let st=I.updateRanges;if(st.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,R.width,R.height,k,it,R.data);else{st.sort((pt,Ct)=>pt.start-Ct.start);let jt=0;for(let pt=1;pt<st.length;pt++){let Ct=st[jt],Xt=st[pt],Yt=Ct.start+Ct.count,Tt=re(Xt.start,R.width,4),ge=re(Ct.start,R.width,4);Xt.start<=Yt+1&&Tt===ge&&re(Xt.start+Xt.count-1,R.width,4)===Tt?Ct.count=Math.max(Ct.count,Xt.start+Xt.count-Ct.start):(++jt,st[jt]=Xt)}st.length=jt+1;let Et=i.getParameter(i.UNPACK_ROW_LENGTH),Wt=i.getParameter(i.UNPACK_SKIP_PIXELS),Kt=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,R.width);for(let pt=0,Ct=st.length;pt<Ct;pt++){let Xt=st[pt],Yt=Math.floor(Xt.start/4),Tt=Math.ceil(Xt.count/4),ge=Yt%R.width,H=Math.floor(Yt/R.width),Ut=Tt,xt=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,ge),i.pixelStorei(i.UNPACK_SKIP_ROWS,H),e.texSubImage2D(i.TEXTURE_2D,0,ge,H,Ut,xt,k,it,R.data)}I.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,Et),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Wt),i.pixelStorei(i.UNPACK_SKIP_ROWS,Kt)}}function at(I,R,k){let it=i.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(it=i.TEXTURE_2D_ARRAY),R.isData3DTexture&&(it=i.TEXTURE_3D);let ht=$t(I,R),st=R.source;e.bindTexture(it,I.__webglTexture,i.TEXTURE0+k);let jt=n.get(st);if(st.version!==jt.__version||ht===!0){e.activeTexture(i.TEXTURE0+k);let Et=be.getPrimaries(be.workingColorSpace),Wt=R.colorSpace===Fs?null:be.getPrimaries(R.colorSpace),Kt=R.colorSpace===Fs||Et===Wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,R.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,R.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Kt);let pt=b(R.image,!1,s.maxTextureSize);pt=se(R,pt);let Ct=r.convert(R.format,R.colorSpace),Xt=r.convert(R.type),Yt=T(R.internalFormat,Ct,Xt,R.colorSpace,R.isVideoTexture);kt(it,R);let Tt,ge=R.mipmaps,H=R.isVideoTexture!==!0,Ut=jt.__version===void 0||ht===!0,xt=st.dataReady,Ot=N(R,pt);if(R.isDepthTexture)Yt=A(R.format===_a,R.type),Ut&&(H?e.texStorage2D(i.TEXTURE_2D,1,Yt,pt.width,pt.height):e.texImage2D(i.TEXTURE_2D,0,Yt,pt.width,pt.height,0,Ct,Xt,null));else if(R.isDataTexture)if(ge.length>0){H&&Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,ge[0].width,ge[0].height);for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Xt,Tt.data):e.texImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Ct,Xt,Tt.data);R.generateMipmaps=!1}else H?(Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,pt.width,pt.height),xt&&Ce(R,pt,Ct,Xt)):e.texImage2D(i.TEXTURE_2D,0,Yt,pt.width,pt.height,0,Ct,Xt,pt.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){H&&Ut&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ot,Yt,ge[0].width,ge[0].height,pt.depth);for(let _t=0,ut=ge.length;_t<ut;_t++)if(Tt=ge[_t],R.format!==Un)if(Ct!==null)if(H){if(xt)if(R.layerUpdates.size>0){let At=Nm(Tt.width,Tt.height,R.format,R.type);for(let oe of R.layerUpdates){let Be=Tt.data.subarray(oe*At/Tt.data.BYTES_PER_ELEMENT,(oe+1)*At/Tt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,oe,Tt.width,Tt.height,1,Ct,Be)}R.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,0,Tt.width,Tt.height,pt.depth,Ct,Tt.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,_t,Yt,Tt.width,Tt.height,pt.depth,0,Tt.data,0,0);else wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else H?xt&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,0,Tt.width,Tt.height,pt.depth,Ct,Xt,Tt.data):e.texImage3D(i.TEXTURE_2D_ARRAY,_t,Yt,Tt.width,Tt.height,pt.depth,0,Ct,Xt,Tt.data)}else{H&&Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,ge[0].width,ge[0].height);for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],R.format!==Un?Ct!==null?H?xt&&e.compressedTexSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Tt.data):e.compressedTexImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Tt.data):wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Xt,Tt.data):e.texImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Ct,Xt,Tt.data)}else if(R.isDataArrayTexture)if(H){if(Ut&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ot,Yt,pt.width,pt.height,pt.depth),xt)if(R.layerUpdates.size>0){let _t=Nm(pt.width,pt.height,R.format,R.type);for(let ut of R.layerUpdates){let At=pt.data.subarray(ut*_t/pt.data.BYTES_PER_ELEMENT,(ut+1)*_t/pt.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ut,pt.width,pt.height,1,Ct,Xt,At)}R.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,pt.width,pt.height,pt.depth,Ct,Xt,pt.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,Yt,pt.width,pt.height,pt.depth,0,Ct,Xt,pt.data);else if(R.isData3DTexture)H?(Ut&&e.texStorage3D(i.TEXTURE_3D,Ot,Yt,pt.width,pt.height,pt.depth),xt&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,pt.width,pt.height,pt.depth,Ct,Xt,pt.data)):e.texImage3D(i.TEXTURE_3D,0,Yt,pt.width,pt.height,pt.depth,0,Ct,Xt,pt.data);else if(R.isFramebufferTexture){if(Ut)if(H)e.texStorage2D(i.TEXTURE_2D,Ot,Yt,pt.width,pt.height);else{let _t=pt.width,ut=pt.height;for(let At=0;At<Ot;At++)e.texImage2D(i.TEXTURE_2D,At,Yt,_t,ut,0,Ct,Xt,null),_t>>=1,ut>>=1}}else if(ge.length>0){if(H&&Ut){let _t=Mt(ge[0]);e.texStorage2D(i.TEXTURE_2D,Ot,Yt,_t.width,_t.height)}for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Ct,Xt,Tt):e.texImage2D(i.TEXTURE_2D,_t,Yt,Ct,Xt,Tt);R.generateMipmaps=!1}else if(H){if(Ut){let _t=Mt(pt);e.texStorage2D(i.TEXTURE_2D,Ot,Yt,_t.width,_t.height)}xt&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,Ct,Xt,pt)}else e.texImage2D(i.TEXTURE_2D,0,Yt,Ct,Xt,pt);S(R)&&x(it),jt.__version=st.version,R.onUpdate&&R.onUpdate(R)}I.__version=R.version}function dt(I,R,k){if(R.image.length!==6)return;let it=$t(I,R),ht=R.source;e.bindTexture(i.TEXTURE_CUBE_MAP,I.__webglTexture,i.TEXTURE0+k);let st=n.get(ht);if(ht.version!==st.__version||it===!0){e.activeTexture(i.TEXTURE0+k);let jt=be.getPrimaries(be.workingColorSpace),Et=R.colorSpace===Fs?null:be.getPrimaries(R.colorSpace),Wt=R.colorSpace===Fs||jt===Et?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,R.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,R.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);let Kt=R.isCompressedTexture||R.image[0].isCompressedTexture,pt=R.image[0]&&R.image[0].isDataTexture,Ct=[];for(let ut=0;ut<6;ut++)!Kt&&!pt?Ct[ut]=b(R.image[ut],!0,s.maxCubemapSize):Ct[ut]=pt?R.image[ut].image:R.image[ut],Ct[ut]=se(R,Ct[ut]);let Xt=Ct[0],Yt=r.convert(R.format,R.colorSpace),Tt=r.convert(R.type),ge=T(R.internalFormat,Yt,Tt,R.colorSpace),H=R.isVideoTexture!==!0,Ut=st.__version===void 0||it===!0,xt=ht.dataReady,Ot=N(R,Xt);kt(i.TEXTURE_CUBE_MAP,R);let _t;if(Kt){H&&Ut&&e.texStorage2D(i.TEXTURE_CUBE_MAP,Ot,ge,Xt.width,Xt.height);for(let ut=0;ut<6;ut++){_t=Ct[ut].mipmaps;for(let At=0;At<_t.length;At++){let oe=_t[At];R.format!==Un?Yt!==null?H?xt&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,0,0,oe.width,oe.height,Yt,oe.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,ge,oe.width,oe.height,0,oe.data):wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,0,0,oe.width,oe.height,Yt,Tt,oe.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,ge,oe.width,oe.height,0,Yt,Tt,oe.data)}}}else{if(_t=R.mipmaps,H&&Ut){_t.length>0&&Ot++;let ut=Mt(Ct[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,Ot,ge,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(pt){H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Ct[ut].width,Ct[ut].height,Yt,Tt,Ct[ut].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,ge,Ct[ut].width,Ct[ut].height,0,Yt,Tt,Ct[ut].data);for(let At=0;At<_t.length;At++){let Be=_t[At].image[ut].image;H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,0,0,Be.width,Be.height,Yt,Tt,Be.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,ge,Be.width,Be.height,0,Yt,Tt,Be.data)}}else{H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Yt,Tt,Ct[ut]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,ge,Yt,Tt,Ct[ut]);for(let At=0;At<_t.length;At++){let oe=_t[At];H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,0,0,Yt,Tt,oe.image[ut]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,ge,Yt,Tt,oe.image[ut])}}}S(R)&&x(i.TEXTURE_CUBE_MAP),st.__version=ht.version,R.onUpdate&&R.onUpdate(R)}I.__version=R.version}function Vt(I,R,k,it,ht,st){let jt=r.convert(k.format,k.colorSpace),Et=r.convert(k.type),Wt=T(k.internalFormat,jt,Et,k.colorSpace),Kt=n.get(R),pt=n.get(k);if(pt.__renderTarget=R,!Kt.__hasExternalTextures){let Ct=Math.max(1,R.width>>st),Xt=Math.max(1,R.height>>st);ht===i.TEXTURE_3D||ht===i.TEXTURE_2D_ARRAY?e.texImage3D(ht,st,Wt,Ct,Xt,R.depth,0,jt,Et,null):e.texImage2D(ht,st,Wt,Ct,Xt,0,jt,Et,null)}e.bindFramebuffer(i.FRAMEBUFFER,I),Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,it,ht,pt.__webglTexture,0,B(R)):(ht===i.TEXTURE_2D||ht>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ht<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,it,ht,pt.__webglTexture,st),e.bindFramebuffer(i.FRAMEBUFFER,null)}function ie(I,R,k){if(i.bindRenderbuffer(i.RENDERBUFFER,I),R.depthBuffer){let it=R.depthTexture,ht=it&&it.isDepthTexture?it.type:null,st=A(R.stencilBuffer,ht),jt=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Zt(R)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,B(R),st,R.width,R.height):k?i.renderbufferStorageMultisample(i.RENDERBUFFER,B(R),st,R.width,R.height):i.renderbufferStorage(i.RENDERBUFFER,st,R.width,R.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,jt,i.RENDERBUFFER,I)}else{let it=R.textures;for(let ht=0;ht<it.length;ht++){let st=it[ht],jt=r.convert(st.format,st.colorSpace),Et=r.convert(st.type),Wt=T(st.internalFormat,jt,Et,st.colorSpace);Zt(R)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,B(R),Wt,R.width,R.height):k?i.renderbufferStorageMultisample(i.RENDERBUFFER,B(R),Wt,R.width,R.height):i.renderbufferStorage(i.RENDERBUFFER,Wt,R.width,R.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ft(I,R,k){let it=R.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,I),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let ht=n.get(R.depthTexture);if(ht.__renderTarget=R,(!ht.__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),it){if(ht.__webglInit===void 0&&(ht.__webglInit=!0,R.depthTexture.addEventListener("dispose",D)),ht.__webglTexture===void 0){ht.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,ht.__webglTexture),kt(i.TEXTURE_CUBE_MAP,R.depthTexture);let Kt=r.convert(R.depthTexture.format),pt=r.convert(R.depthTexture.type),Ct;R.depthTexture.format===ds?Ct=i.DEPTH_COMPONENT24:R.depthTexture.format===_a&&(Ct=i.DEPTH24_STENCIL8);for(let Xt=0;Xt<6;Xt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Xt,0,Ct,R.width,R.height,0,Kt,pt,null)}}else nt(R.depthTexture,0);let st=ht.__webglTexture,jt=B(R),Et=it?i.TEXTURE_CUBE_MAP_POSITIVE_X+k:i.TEXTURE_2D,Wt=R.depthTexture.format===_a?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(R.depthTexture.format===ds)Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,Et,st,0,jt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,Et,st,0);else if(R.depthTexture.format===_a)Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,Et,st,0,jt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,Et,st,0);else throw new Error("Unknown depthTexture format")}function ye(I){let R=n.get(I),k=I.isWebGLCubeRenderTarget===!0;if(R.__boundDepthTexture!==I.depthTexture){let it=I.depthTexture;if(R.__depthDisposeCallback&&R.__depthDisposeCallback(),it){let ht=()=>{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,it.removeEventListener("dispose",ht)};it.addEventListener("dispose",ht),R.__depthDisposeCallback=ht}R.__boundDepthTexture=it}if(I.depthTexture&&!R.__autoAllocateDepthBuffer)if(k)for(let it=0;it<6;it++)Ft(R.__webglFramebuffer[it],I,it);else{let it=I.texture.mipmaps;it&&it.length>0?Ft(R.__webglFramebuffer[0],I,0):Ft(R.__webglFramebuffer,I,0)}else if(k){R.__webglDepthbuffer=[];for(let it=0;it<6;it++)if(e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer[it]),R.__webglDepthbuffer[it]===void 0)R.__webglDepthbuffer[it]=i.createRenderbuffer(),ie(R.__webglDepthbuffer[it],I,!1);else{let ht=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,st=R.__webglDepthbuffer[it];i.bindRenderbuffer(i.RENDERBUFFER,st),i.framebufferRenderbuffer(i.FRAMEBUFFER,ht,i.RENDERBUFFER,st)}}else{let it=I.texture.mipmaps;if(it&&it.length>0?e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=i.createRenderbuffer(),ie(R.__webglDepthbuffer,I,!1);else{let ht=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,st=R.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,st),i.framebufferRenderbuffer(i.FRAMEBUFFER,ht,i.RENDERBUFFER,st)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function Re(I,R,k){let it=n.get(I);R!==void 0&&Vt(it.__webglFramebuffer,I,I.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),k!==void 0&&ye(I)}function ce(I){let R=I.texture,k=n.get(I),it=n.get(R);I.addEventListener("dispose",L);let ht=I.textures,st=I.isWebGLCubeRenderTarget===!0,jt=ht.length>1;if(jt||(it.__webglTexture===void 0&&(it.__webglTexture=i.createTexture()),it.__version=R.version,l.memory.textures++),st){k.__webglFramebuffer=[];for(let Et=0;Et<6;Et++)if(R.mipmaps&&R.mipmaps.length>0){k.__webglFramebuffer[Et]=[];for(let Wt=0;Wt<R.mipmaps.length;Wt++)k.__webglFramebuffer[Et][Wt]=i.createFramebuffer()}else k.__webglFramebuffer[Et]=i.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){k.__webglFramebuffer=[];for(let Et=0;Et<R.mipmaps.length;Et++)k.__webglFramebuffer[Et]=i.createFramebuffer()}else k.__webglFramebuffer=i.createFramebuffer();if(jt)for(let Et=0,Wt=ht.length;Et<Wt;Et++){let Kt=n.get(ht[Et]);Kt.__webglTexture===void 0&&(Kt.__webglTexture=i.createTexture(),l.memory.textures++)}if(I.samples>0&&Zt(I)===!1){k.__webglMultisampledFramebuffer=i.createFramebuffer(),k.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,k.__webglMultisampledFramebuffer);for(let Et=0;Et<ht.length;Et++){let Wt=ht[Et];k.__webglColorRenderbuffer[Et]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,k.__webglColorRenderbuffer[Et]);let Kt=r.convert(Wt.format,Wt.colorSpace),pt=r.convert(Wt.type),Ct=T(Wt.internalFormat,Kt,pt,Wt.colorSpace,I.isXRRenderTarget===!0),Xt=B(I);i.renderbufferStorageMultisample(i.RENDERBUFFER,Xt,Ct,I.width,I.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Et,i.RENDERBUFFER,k.__webglColorRenderbuffer[Et])}i.bindRenderbuffer(i.RENDERBUFFER,null),I.depthBuffer&&(k.__webglDepthRenderbuffer=i.createRenderbuffer(),ie(k.__webglDepthRenderbuffer,I,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(st){e.bindTexture(i.TEXTURE_CUBE_MAP,it.__webglTexture),kt(i.TEXTURE_CUBE_MAP,R);for(let Et=0;Et<6;Et++)if(R.mipmaps&&R.mipmaps.length>0)for(let Wt=0;Wt<R.mipmaps.length;Wt++)Vt(k.__webglFramebuffer[Et][Wt],I,R,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Et,Wt);else Vt(k.__webglFramebuffer[Et],I,R,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Et,0);S(R)&&x(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(jt){for(let Et=0,Wt=ht.length;Et<Wt;Et++){let Kt=ht[Et],pt=n.get(Kt),Ct=i.TEXTURE_2D;(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(Ct=I.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(Ct,pt.__webglTexture),kt(Ct,Kt),Vt(k.__webglFramebuffer,I,Kt,i.COLOR_ATTACHMENT0+Et,Ct,0),S(Kt)&&x(Ct)}e.unbindTexture()}else{let Et=i.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(Et=I.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(Et,it.__webglTexture),kt(Et,R),R.mipmaps&&R.mipmaps.length>0)for(let Wt=0;Wt<R.mipmaps.length;Wt++)Vt(k.__webglFramebuffer[Wt],I,R,i.COLOR_ATTACHMENT0,Et,Wt);else Vt(k.__webglFramebuffer,I,R,i.COLOR_ATTACHMENT0,Et,0);S(R)&&x(Et),e.unbindTexture()}I.depthBuffer&&ye(I)}function ct(I){let R=I.textures;for(let k=0,it=R.length;k<it;k++){let ht=R[k];if(S(ht)){let st=E(I),jt=n.get(ht).__webglTexture;e.bindTexture(st,jt),x(st),e.unbindTexture()}}}let gt=[],lt=[];function Nt(I){if(I.samples>0){if(Zt(I)===!1){let R=I.textures,k=I.width,it=I.height,ht=i.COLOR_BUFFER_BIT,st=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,jt=n.get(I),Et=R.length>1;if(Et)for(let Kt=0;Kt<R.length;Kt++)e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,jt.__webglMultisampledFramebuffer);let Wt=I.texture.mipmaps;Wt&&Wt.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglFramebuffer);for(let Kt=0;Kt<R.length;Kt++){if(I.resolveDepthBuffer&&(I.depthBuffer&&(ht|=i.DEPTH_BUFFER_BIT),I.stencilBuffer&&I.resolveStencilBuffer&&(ht|=i.STENCIL_BUFFER_BIT)),Et){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,jt.__webglColorRenderbuffer[Kt]);let pt=n.get(R[Kt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,pt,0)}i.blitFramebuffer(0,0,k,it,0,0,k,it,ht,i.NEAREST),h===!0&&(gt.length=0,lt.length=0,gt.push(i.COLOR_ATTACHMENT0+Kt),I.depthBuffer&&I.resolveDepthBuffer===!1&&(gt.push(st),lt.push(st),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,lt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,gt))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Et)for(let Kt=0;Kt<R.length;Kt++){e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.RENDERBUFFER,jt.__webglColorRenderbuffer[Kt]);let pt=n.get(R[Kt]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.TEXTURE_2D,pt,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglMultisampledFramebuffer)}else if(I.depthBuffer&&I.resolveDepthBuffer===!1&&h){let R=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[R])}}}function B(I){return Math.min(s.maxSamples,I.samples)}function Zt(I){let R=n.get(I);return I.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function Dt(I){let R=l.render.frame;p.get(I)!==R&&(p.set(I,R),I.update())}function se(I,R){let k=I.colorSpace,it=I.format,ht=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||k!==Ps&&k!==Fs&&(be.getTransfer(k)===Ve?(it!==Un||ht!==Gn)&&wt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Qt("WebGLTextures: Unsupported texture color space:",k)),R}function Mt(I){return typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement?(f.width=I.naturalWidth||I.width,f.height=I.naturalHeight||I.height):typeof VideoFrame<"u"&&I instanceof VideoFrame?(f.width=I.displayWidth,f.height=I.displayHeight):(f.width=I.width,f.height=I.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=Y,this.setTexture2D=nt,this.setTexture2DArray=J,this.setTexture3D=et,this.setTextureCube=rt,this.rebindTextures=Re,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ct,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=Vt,this.useMultisampledRTT=Zt,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function Zb(i,t){function e(n,s=Fs){let r,l=be.getTransfer(s);if(n===Gn)return i.UNSIGNED_BYTE;if(n===zh)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Vh)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Em)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Tm)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Mm)return i.BYTE;if(n===bm)return i.SHORT;if(n===ho)return i.UNSIGNED_SHORT;if(n===Fh)return i.INT;if(n===Fi)return i.UNSIGNED_INT;if(n===Qn)return i.FLOAT;if(n===Ss)return i.HALF_FLOAT;if(n===Am)return i.ALPHA;if(n===Cm)return i.RGB;if(n===Un)return i.RGBA;if(n===ds)return i.DEPTH_COMPONENT;if(n===_a)return i.DEPTH_STENCIL;if(n===Hh)return i.RED;if(n===uc)return i.RED_INTEGER;if(n===ar)return i.RG;if(n===Gh)return i.RG_INTEGER;if(n===kh)return i.RGBA_INTEGER;if(n===hc||n===fc||n===dc||n===pc)if(l===Ve)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===hc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===fc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===pc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===hc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===fc)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===pc)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Wh||n===Xh||n===qh||n===Yh)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Wh)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Xh)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===qh)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Yh)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Zh||n===jh||n===Jh||n===Kh||n===Qh||n===$h||n===tf)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Zh||n===jh)return l===Ve?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Jh)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Kh)return r.COMPRESSED_R11_EAC;if(n===Qh)return r.COMPRESSED_SIGNED_R11_EAC;if(n===$h)return r.COMPRESSED_RG11_EAC;if(n===tf)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ef||n===nf||n===sf||n===af||n===rf||n===of||n===lf||n===cf||n===uf||n===hf||n===ff||n===df||n===pf||n===mf)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ef)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===nf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===sf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===af)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===rf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===of)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===lf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===cf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===uf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===hf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ff)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===df)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===mf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===gf||n===_f||n===vf)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===gf)return l===Ve?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===_f)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===vf)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===xf||n===yf||n===Sf||n===Mf)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===xf)return r.COMPRESSED_RED_RGTC1_EXT;if(n===yf)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Sf)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Mf)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===fo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var JN=`
3998
+ }`,XN=[new O(1,0,0),new O(-1,0,0),new O(0,1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1)],qN=[new O(0,-1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1),new O(0,-1,0),new O(0,-1,0)],Gb=new ue,Cf=new O,mv=new O;function YN(i,t,e){let n=new fa,s=new ft,r=new ft,l=new qe,c=new Jl,h=new Kl,f={},p=e.maxTextureSize,m={[Us]:ti,[ti]:Us,[_s]:_s},g=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ft},radius:{value:4}},vertexShader:kN,fragmentShader:WN}),v=g.clone();v.defines.HORIZONTAL_PASS=1;let y=new de;y.setAttribute("position",new He(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let b=new rn(y,g),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ar;let x=this.type;this.render=function(D,L,F){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;D.type===ma&&(wt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),D.type=ar);let C=i.getRenderTarget(),w=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),Y=i.state;Y.setBlending(vs),Y.buffers.depth.getReversed()===!0?Y.buffers.color.setClear(0,0,0,0):Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);let G=x!==this.type;G&&L.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(nt=>nt.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,nt=D.length;j<nt;j++){let J=D[j],et=J.shadow;if(et===void 0){wt("WebGLShadowMap:",J,"has no shadow.");continue}if(et.autoUpdate===!1&&et.needsUpdate===!1)continue;s.copy(et.mapSize);let rt=et.getFrameExtents();if(s.multiply(rt),r.copy(et.mapSize),(s.x>p||s.y>p)&&(s.x>p&&(r.x=Math.floor(p/rt.x),s.x=r.x*rt.x,et.mapSize.x=r.x),s.y>p&&(r.y=Math.floor(p/rt.y),s.y=r.y*rt.y,et.mapSize.y=r.y)),et.map===null||G===!0){if(et.map!==null&&(et.map.depthTexture!==null&&(et.map.depthTexture.dispose(),et.map.depthTexture=null),et.map.dispose()),this.type===ga){if(J.isPointLight){wt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}et.map=new $n(s.x,s.y,{format:rr,type:Ss,minFilter:Je,magFilter:Je,generateMipmaps:!1}),et.map.texture.name=J.name+".shadowMap",et.map.depthTexture=new da(s.x,s.y,Qn),et.map.depthTexture.name=J.name+".shadowMapDepth",et.map.depthTexture.format=ds,et.map.depthTexture.compareFunction=null,et.map.depthTexture.minFilter=dn,et.map.depthTexture.magFilter=dn}else{J.isPointLight?(et.map=new Pl(s.x),et.map.depthTexture=new Lu(s.x,Fi)):(et.map=new $n(s.x,s.y),et.map.depthTexture=new da(s.x,s.y,Fi)),et.map.depthTexture.name=J.name+".shadowMap",et.map.depthTexture.format=ds;let bt=i.state.buffers.depth.getReversed();this.type===ar?(et.map.depthTexture.compareFunction=bt?Tf:Ef,et.map.depthTexture.minFilter=Je,et.map.depthTexture.magFilter=Je):(et.map.depthTexture.compareFunction=null,et.map.depthTexture.minFilter=dn,et.map.depthTexture.magFilter=dn)}et.camera.updateProjectionMatrix()}let St=et.map.isWebGLCubeRenderTarget?6:1;for(let bt=0;bt<St;bt++){if(et.map.isWebGLCubeRenderTarget)i.setRenderTarget(et.map,bt),i.clear();else{bt===0&&(i.setRenderTarget(et.map),i.clear());let mt=et.getViewport(bt);l.set(r.x*mt.x,r.y*mt.y,r.x*mt.z,r.y*mt.w),Y.viewport(l)}if(J.isPointLight){let mt=et.camera,kt=et.matrix,$t=J.distance||mt.far;$t!==mt.far&&(mt.far=$t,mt.updateProjectionMatrix()),Cf.setFromMatrixPosition(J.matrixWorld),mt.position.copy(Cf),mv.copy(mt.position),mv.add(XN[bt]),mt.up.copy(qN[bt]),mt.lookAt(mv),mt.updateMatrixWorld(),kt.makeTranslation(-Cf.x,-Cf.y,-Cf.z),Gb.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),et._frustum.setFromProjectionMatrix(Gb,mt.coordinateSystem,mt.reversedDepth)}else et.updateMatrices(J);n=et.getFrustum(),A(L,F,et.camera,J,this.type)}et.isPointLightShadow!==!0&&this.type===ga&&E(et,F),et.needsUpdate=!1}x=this.type,S.needsUpdate=!1,i.setRenderTarget(C,w,z)};function E(D,L){let F=t.update(b);g.defines.VSM_SAMPLES!==D.blurSamples&&(g.defines.VSM_SAMPLES=D.blurSamples,v.defines.VSM_SAMPLES=D.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new $n(s.x,s.y,{format:rr,type:Ss})),g.uniforms.shadow_pass.value=D.map.depthTexture,g.uniforms.resolution.value=D.mapSize,g.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,F,g,b,null),v.uniforms.shadow_pass.value=D.mapPass.texture,v.uniforms.resolution.value=D.mapSize,v.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,F,v,b,null)}function T(D,L,F,C){let w=null,z=F.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)w=z;else if(w=F.isPointLight===!0?h:c,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let Y=w.uuid,G=L.uuid,j=f[Y];j===void 0&&(j={},f[Y]=j);let nt=j[G];nt===void 0&&(nt=w.clone(),j[G]=nt,L.addEventListener("dispose",N)),w=nt}if(w.visible=L.visible,w.wireframe=L.wireframe,C===ga?w.side=L.shadowSide!==null?L.shadowSide:L.side:w.side=L.shadowSide!==null?L.shadowSide:m[L.side],w.alphaMap=L.alphaMap,w.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,w.map=L.map,w.clipShadows=L.clipShadows,w.clippingPlanes=L.clippingPlanes,w.clipIntersection=L.clipIntersection,w.displacementMap=L.displacementMap,w.displacementScale=L.displacementScale,w.displacementBias=L.displacementBias,w.wireframeLinewidth=L.wireframeLinewidth,w.linewidth=L.linewidth,F.isPointLight===!0&&w.isMeshDistanceMaterial===!0){let Y=i.properties.get(w);Y.light=F}return w}function A(D,L,F,C,w){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&w===ga)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,D.matrixWorld);let G=t.update(D),j=D.material;if(Array.isArray(j)){let nt=G.groups;for(let J=0,et=nt.length;J<et;J++){let rt=nt[J],St=j[rt.materialIndex];if(St&&St.visible){let bt=T(D,St,C,w);D.onBeforeShadow(i,D,L,F,G,bt,rt),i.renderBufferDirect(F,null,G,bt,D,rt),D.onAfterShadow(i,D,L,F,G,bt,rt)}}}else if(j.visible){let nt=T(D,j,C,w);D.onBeforeShadow(i,D,L,F,G,nt,null),i.renderBufferDirect(F,null,G,nt,D,null),D.onAfterShadow(i,D,L,F,G,nt,null)}}let Y=D.children;for(let G=0,j=Y.length;G<j;G++)A(Y[G],L,F,C,w)}function N(D){D.target.removeEventListener("dispose",N);for(let F in f){let C=f[F],w=D.target.uuid;w in C&&(C[w].dispose(),delete C[w])}}}var ZN={[Nh]:Dh,[Uh]:Lh,[Ph]:Oh,[Za]:Ih,[Dh]:Nh,[Lh]:Uh,[Oh]:Ph,[Ih]:Za};function jN(i,t){function e(){let H=!1,Ut=new qe,xt=null,Ot=new qe(0,0,0,0);return{setMask:function(_t){xt!==_t&&!H&&(i.colorMask(_t,_t,_t,_t),xt=_t)},setLocked:function(_t){H=_t},setClear:function(_t,ut,At,oe,Be){Be===!0&&(_t*=oe,ut*=oe,At*=oe),Ut.set(_t,ut,At,oe),Ot.equals(Ut)===!1&&(i.clearColor(_t,ut,At,oe),Ot.copy(Ut))},reset:function(){H=!1,xt=null,Ot.set(-1,0,0,0)}}}function n(){let H=!1,Ut=!1,xt=null,Ot=null,_t=null;return{setReversed:function(ut){if(Ut!==ut){let At=t.get("EXT_clip_control");ut?At.clipControlEXT(At.LOWER_LEFT_EXT,At.ZERO_TO_ONE_EXT):At.clipControlEXT(At.LOWER_LEFT_EXT,At.NEGATIVE_ONE_TO_ONE_EXT),Ut=ut;let oe=_t;_t=null,this.setClear(oe)}},getReversed:function(){return Ut},setTest:function(ut){ut?dt(i.DEPTH_TEST):Vt(i.DEPTH_TEST)},setMask:function(ut){xt!==ut&&!H&&(i.depthMask(ut),xt=ut)},setFunc:function(ut){if(Ut&&(ut=ZN[ut]),Ot!==ut){switch(ut){case Nh:i.depthFunc(i.NEVER);break;case Dh:i.depthFunc(i.ALWAYS);break;case Uh:i.depthFunc(i.LESS);break;case Za:i.depthFunc(i.LEQUAL);break;case Ph:i.depthFunc(i.EQUAL);break;case Ih:i.depthFunc(i.GEQUAL);break;case Lh:i.depthFunc(i.GREATER);break;case Oh:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Ot=ut}},setLocked:function(ut){H=ut},setClear:function(ut){_t!==ut&&(Ut&&(ut=1-ut),i.clearDepth(ut),_t=ut)},reset:function(){H=!1,xt=null,Ot=null,_t=null,Ut=!1}}}function s(){let H=!1,Ut=null,xt=null,Ot=null,_t=null,ut=null,At=null,oe=null,Be=null;return{setTest:function(De){H||(De?dt(i.STENCIL_TEST):Vt(i.STENCIL_TEST))},setMask:function(De){Ut!==De&&!H&&(i.stencilMask(De),Ut=De)},setFunc:function(De,Mi,zi){(xt!==De||Ot!==Mi||_t!==zi)&&(i.stencilFunc(De,Mi,zi),xt=De,Ot=Mi,_t=zi)},setOp:function(De,Mi,zi){(ut!==De||At!==Mi||oe!==zi)&&(i.stencilOp(De,Mi,zi),ut=De,At=Mi,oe=zi)},setLocked:function(De){H=De},setClear:function(De){Be!==De&&(i.clearStencil(De),Be=De)},reset:function(){H=!1,Ut=null,xt=null,Ot=null,_t=null,ut=null,At=null,oe=null,Be=null}}}let r=new e,l=new n,c=new s,h=new WeakMap,f=new WeakMap,p={},m={},g=new WeakMap,v=[],y=null,b=!1,S=null,x=null,E=null,T=null,A=null,N=null,D=null,L=new Lt(0,0,0),F=0,C=!1,w=null,z=null,Y=null,G=null,j=null,nt=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,et=0,rt=i.getParameter(i.VERSION);rt.indexOf("WebGL")!==-1?(et=parseFloat(/^WebGL (\d)/.exec(rt)[1]),J=et>=1):rt.indexOf("OpenGL ES")!==-1&&(et=parseFloat(/^OpenGL ES (\d)/.exec(rt)[1]),J=et>=2);let St=null,bt={},mt=i.getParameter(i.SCISSOR_BOX),kt=i.getParameter(i.VIEWPORT),$t=new qe().fromArray(mt),re=new qe().fromArray(kt);function Ce(H,Ut,xt,Ot){let _t=new Uint8Array(4),ut=i.createTexture();i.bindTexture(H,ut),i.texParameteri(H,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(H,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let At=0;At<xt;At++)H===i.TEXTURE_3D||H===i.TEXTURE_2D_ARRAY?i.texImage3D(Ut,0,i.RGBA,1,1,Ot,0,i.RGBA,i.UNSIGNED_BYTE,_t):i.texImage2D(Ut+At,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,_t);return ut}let at={};at[i.TEXTURE_2D]=Ce(i.TEXTURE_2D,i.TEXTURE_2D,1),at[i.TEXTURE_CUBE_MAP]=Ce(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),at[i.TEXTURE_2D_ARRAY]=Ce(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),at[i.TEXTURE_3D]=Ce(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),l.setClear(1),c.setClear(0),dt(i.DEPTH_TEST),l.setFunc(Za),lt(!1),Nt(um),dt(i.CULL_FACE),ct(vs);function dt(H){p[H]!==!0&&(i.enable(H),p[H]=!0)}function Vt(H){p[H]!==!1&&(i.disable(H),p[H]=!1)}function ie(H,Ut){return m[H]!==Ut?(i.bindFramebuffer(H,Ut),m[H]=Ut,H===i.DRAW_FRAMEBUFFER&&(m[i.FRAMEBUFFER]=Ut),H===i.FRAMEBUFFER&&(m[i.DRAW_FRAMEBUFFER]=Ut),!0):!1}function Ft(H,Ut){let xt=v,Ot=!1;if(H){xt=g.get(Ut),xt===void 0&&(xt=[],g.set(Ut,xt));let _t=H.textures;if(xt.length!==_t.length||xt[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,At=_t.length;ut<At;ut++)xt[ut]=i.COLOR_ATTACHMENT0+ut;xt.length=_t.length,Ot=!0}}else xt[0]!==i.BACK&&(xt[0]=i.BACK,Ot=!0);Ot&&i.drawBuffers(xt)}function ye(H){return y!==H?(i.useProgram(H),y=H,!0):!1}let Re={[ca]:i.FUNC_ADD,[b_]:i.FUNC_SUBTRACT,[E_]:i.FUNC_REVERSE_SUBTRACT};Re[T_]=i.MIN,Re[A_]=i.MAX;let ce={[C_]:i.ZERO,[R_]:i.ONE,[w_]:i.SRC_COLOR,[vu]:i.SRC_ALPHA,[L_]:i.SRC_ALPHA_SATURATE,[P_]:i.DST_COLOR,[D_]:i.DST_ALPHA,[N_]:i.ONE_MINUS_SRC_COLOR,[xu]:i.ONE_MINUS_SRC_ALPHA,[I_]:i.ONE_MINUS_DST_COLOR,[U_]:i.ONE_MINUS_DST_ALPHA,[O_]:i.CONSTANT_COLOR,[B_]:i.ONE_MINUS_CONSTANT_COLOR,[F_]:i.CONSTANT_ALPHA,[z_]:i.ONE_MINUS_CONSTANT_ALPHA};function ct(H,Ut,xt,Ot,_t,ut,At,oe,Be,De){if(H===vs){b===!0&&(Vt(i.BLEND),b=!1);return}if(b===!1&&(dt(i.BLEND),b=!0),H!==M_){if(H!==S||De!==C){if((x!==ca||A!==ca)&&(i.blendEquation(i.FUNC_ADD),x=ca,A=ca),De)switch(H){case Ya:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case fm:i.blendFunc(i.ONE,i.ONE);break;case dm:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case pm:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Qt("WebGLState: Invalid blending: ",H);break}else switch(H){case Ya:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case fm:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case dm:Qt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case pm:Qt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Qt("WebGLState: Invalid blending: ",H);break}E=null,T=null,N=null,D=null,L.set(0,0,0),F=0,S=H,C=De}return}_t=_t||Ut,ut=ut||xt,At=At||Ot,(Ut!==x||_t!==A)&&(i.blendEquationSeparate(Re[Ut],Re[_t]),x=Ut,A=_t),(xt!==E||Ot!==T||ut!==N||At!==D)&&(i.blendFuncSeparate(ce[xt],ce[Ot],ce[ut],ce[At]),E=xt,T=Ot,N=ut,D=At),(oe.equals(L)===!1||Be!==F)&&(i.blendColor(oe.r,oe.g,oe.b,Be),L.copy(oe),F=Be),S=H,C=!1}function gt(H,Ut){H.side===_s?Vt(i.CULL_FACE):dt(i.CULL_FACE);let xt=H.side===ti;Ut&&(xt=!xt),lt(xt),H.blending===Ya&&H.transparent===!1?ct(vs):ct(H.blending,H.blendEquation,H.blendSrc,H.blendDst,H.blendEquationAlpha,H.blendSrcAlpha,H.blendDstAlpha,H.blendColor,H.blendAlpha,H.premultipliedAlpha),l.setFunc(H.depthFunc),l.setTest(H.depthTest),l.setMask(H.depthWrite),r.setMask(H.colorWrite);let Ot=H.stencilWrite;c.setTest(Ot),Ot&&(c.setMask(H.stencilWriteMask),c.setFunc(H.stencilFunc,H.stencilRef,H.stencilFuncMask),c.setOp(H.stencilFail,H.stencilZFail,H.stencilZPass)),Zt(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),H.alphaToCoverage===!0?dt(i.SAMPLE_ALPHA_TO_COVERAGE):Vt(i.SAMPLE_ALPHA_TO_COVERAGE)}function lt(H){w!==H&&(H?i.frontFace(i.CW):i.frontFace(i.CCW),w=H)}function Nt(H){H!==y_?(dt(i.CULL_FACE),H!==z&&(H===um?i.cullFace(i.BACK):H===S_?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Vt(i.CULL_FACE),z=H}function B(H){H!==Y&&(J&&i.lineWidth(H),Y=H)}function Zt(H,Ut,xt){H?(dt(i.POLYGON_OFFSET_FILL),(G!==Ut||j!==xt)&&(i.polygonOffset(Ut,xt),G=Ut,j=xt)):Vt(i.POLYGON_OFFSET_FILL)}function Dt(H){H?dt(i.SCISSOR_TEST):Vt(i.SCISSOR_TEST)}function se(H){H===void 0&&(H=i.TEXTURE0+nt-1),St!==H&&(i.activeTexture(H),St=H)}function Mt(H,Ut,xt){xt===void 0&&(St===null?xt=i.TEXTURE0+nt-1:xt=St);let Ot=bt[xt];Ot===void 0&&(Ot={type:void 0,texture:void 0},bt[xt]=Ot),(Ot.type!==H||Ot.texture!==Ut)&&(St!==xt&&(i.activeTexture(xt),St=xt),i.bindTexture(H,Ut||at[H]),Ot.type=H,Ot.texture=Ut)}function I(){let H=bt[St];H!==void 0&&H.type!==void 0&&(i.bindTexture(H.type,null),H.type=void 0,H.texture=void 0)}function R(){try{i.compressedTexImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function k(){try{i.compressedTexImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function it(){try{i.texSubImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function ht(){try{i.texSubImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function st(){try{i.compressedTexSubImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function jt(){try{i.compressedTexSubImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Et(){try{i.texStorage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Wt(){try{i.texStorage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Kt(){try{i.texImage2D(...arguments)}catch(H){Qt("WebGLState:",H)}}function pt(){try{i.texImage3D(...arguments)}catch(H){Qt("WebGLState:",H)}}function Ct(H){$t.equals(H)===!1&&(i.scissor(H.x,H.y,H.z,H.w),$t.copy(H))}function Xt(H){re.equals(H)===!1&&(i.viewport(H.x,H.y,H.z,H.w),re.copy(H))}function Yt(H,Ut){let xt=f.get(Ut);xt===void 0&&(xt=new WeakMap,f.set(Ut,xt));let Ot=xt.get(H);Ot===void 0&&(Ot=i.getUniformBlockIndex(Ut,H.name),xt.set(H,Ot))}function Tt(H,Ut){let Ot=f.get(Ut).get(H);h.get(Ut)!==Ot&&(i.uniformBlockBinding(Ut,Ot,H.__bindingPointIndex),h.set(Ut,Ot))}function ge(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),l.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),p={},St=null,bt={},m={},g=new WeakMap,v=[],y=null,b=!1,S=null,x=null,E=null,T=null,A=null,N=null,D=null,L=new Lt(0,0,0),F=0,C=!1,w=null,z=null,Y=null,G=null,j=null,$t.set(0,0,i.canvas.width,i.canvas.height),re.set(0,0,i.canvas.width,i.canvas.height),r.reset(),l.reset(),c.reset()}return{buffers:{color:r,depth:l,stencil:c},enable:dt,disable:Vt,bindFramebuffer:ie,drawBuffers:Ft,useProgram:ye,setBlending:ct,setMaterial:gt,setFlipSided:lt,setCullFace:Nt,setLineWidth:B,setPolygonOffset:Zt,setScissorTest:Dt,activeTexture:se,bindTexture:Mt,unbindTexture:I,compressedTexImage2D:R,compressedTexImage3D:k,texImage2D:Kt,texImage3D:pt,updateUBOMapping:Yt,uniformBlockBinding:Tt,texStorage2D:Et,texStorage3D:Wt,texSubImage2D:it,texSubImage3D:ht,compressedTexSubImage2D:st,compressedTexSubImage3D:jt,scissor:Ct,viewport:Xt,reset:ge}}function JN(i,t,e,n,s,r,l){let c=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new ft,p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(I,R){return v?new OffscreenCanvas(I,R):Rl("canvas")}function b(I,R,k){let it=1,ht=Mt(I);if((ht.width>k||ht.height>k)&&(it=k/Math.max(ht.width,ht.height)),it<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){let st=Math.floor(it*ht.width),jt=Math.floor(it*ht.height);m===void 0&&(m=y(st,jt));let Et=R?y(st,jt):m;return Et.width=st,Et.height=jt,Et.getContext("2d").drawImage(I,0,0,st,jt),wt("WebGLRenderer: Texture has been resized from ("+ht.width+"x"+ht.height+") to ("+st+"x"+jt+")."),Et}else return"data"in I&&wt("WebGLRenderer: Image in DataTexture is too big ("+ht.width+"x"+ht.height+")."),I;return I}function S(I){return I.generateMipmaps}function x(I){i.generateMipmap(I)}function E(I){return I.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:I.isWebGL3DRenderTarget?i.TEXTURE_3D:I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(I,R,k,it,ht=!1){if(I!==null){if(i[I]!==void 0)return i[I];wt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let st=R;if(R===i.RED&&(k===i.FLOAT&&(st=i.R32F),k===i.HALF_FLOAT&&(st=i.R16F),k===i.UNSIGNED_BYTE&&(st=i.R8)),R===i.RED_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.R8UI),k===i.UNSIGNED_SHORT&&(st=i.R16UI),k===i.UNSIGNED_INT&&(st=i.R32UI),k===i.BYTE&&(st=i.R8I),k===i.SHORT&&(st=i.R16I),k===i.INT&&(st=i.R32I)),R===i.RG&&(k===i.FLOAT&&(st=i.RG32F),k===i.HALF_FLOAT&&(st=i.RG16F),k===i.UNSIGNED_BYTE&&(st=i.RG8)),R===i.RG_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RG8UI),k===i.UNSIGNED_SHORT&&(st=i.RG16UI),k===i.UNSIGNED_INT&&(st=i.RG32UI),k===i.BYTE&&(st=i.RG8I),k===i.SHORT&&(st=i.RG16I),k===i.INT&&(st=i.RG32I)),R===i.RGB_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RGB8UI),k===i.UNSIGNED_SHORT&&(st=i.RGB16UI),k===i.UNSIGNED_INT&&(st=i.RGB32UI),k===i.BYTE&&(st=i.RGB8I),k===i.SHORT&&(st=i.RGB16I),k===i.INT&&(st=i.RGB32I)),R===i.RGBA_INTEGER&&(k===i.UNSIGNED_BYTE&&(st=i.RGBA8UI),k===i.UNSIGNED_SHORT&&(st=i.RGBA16UI),k===i.UNSIGNED_INT&&(st=i.RGBA32UI),k===i.BYTE&&(st=i.RGBA8I),k===i.SHORT&&(st=i.RGBA16I),k===i.INT&&(st=i.RGBA32I)),R===i.RGB&&(k===i.UNSIGNED_INT_5_9_9_9_REV&&(st=i.RGB9_E5),k===i.UNSIGNED_INT_10F_11F_11F_REV&&(st=i.R11F_G11F_B10F)),R===i.RGBA){let jt=ht?Al:be.getTransfer(it);k===i.FLOAT&&(st=i.RGBA32F),k===i.HALF_FLOAT&&(st=i.RGBA16F),k===i.UNSIGNED_BYTE&&(st=jt===Ve?i.SRGB8_ALPHA8:i.RGBA8),k===i.UNSIGNED_SHORT_4_4_4_4&&(st=i.RGBA4),k===i.UNSIGNED_SHORT_5_5_5_1&&(st=i.RGB5_A1)}return(st===i.R16F||st===i.R32F||st===i.RG16F||st===i.RG32F||st===i.RGBA16F||st===i.RGBA32F)&&t.get("EXT_color_buffer_float"),st}function A(I,R){let k;return I?R===null||R===Fi||R===fo?k=i.DEPTH24_STENCIL8:R===Qn?k=i.DEPTH32F_STENCIL8:R===ho&&(k=i.DEPTH24_STENCIL8,wt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===Fi||R===fo?k=i.DEPTH_COMPONENT24:R===Qn?k=i.DEPTH_COMPONENT32F:R===ho&&(k=i.DEPTH_COMPONENT16),k}function N(I,R){return S(I)===!0||I.isFramebufferTexture&&I.minFilter!==dn&&I.minFilter!==Je?Math.log2(Math.max(R.width,R.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?R.mipmaps.length:1}function D(I){let R=I.target;R.removeEventListener("dispose",D),F(R),R.isVideoTexture&&p.delete(R)}function L(I){let R=I.target;R.removeEventListener("dispose",L),w(R)}function F(I){let R=n.get(I);if(R.__webglInit===void 0)return;let k=I.source,it=g.get(k);if(it){let ht=it[R.__cacheKey];ht.usedTimes--,ht.usedTimes===0&&C(I),Object.keys(it).length===0&&g.delete(k)}n.remove(I)}function C(I){let R=n.get(I);i.deleteTexture(R.__webglTexture);let k=I.source,it=g.get(k);delete it[R.__cacheKey],l.memory.textures--}function w(I){let R=n.get(I);if(I.depthTexture&&(I.depthTexture.dispose(),n.remove(I.depthTexture)),I.isWebGLCubeRenderTarget)for(let it=0;it<6;it++){if(Array.isArray(R.__webglFramebuffer[it]))for(let ht=0;ht<R.__webglFramebuffer[it].length;ht++)i.deleteFramebuffer(R.__webglFramebuffer[it][ht]);else i.deleteFramebuffer(R.__webglFramebuffer[it]);R.__webglDepthbuffer&&i.deleteRenderbuffer(R.__webglDepthbuffer[it])}else{if(Array.isArray(R.__webglFramebuffer))for(let it=0;it<R.__webglFramebuffer.length;it++)i.deleteFramebuffer(R.__webglFramebuffer[it]);else i.deleteFramebuffer(R.__webglFramebuffer);if(R.__webglDepthbuffer&&i.deleteRenderbuffer(R.__webglDepthbuffer),R.__webglMultisampledFramebuffer&&i.deleteFramebuffer(R.__webglMultisampledFramebuffer),R.__webglColorRenderbuffer)for(let it=0;it<R.__webglColorRenderbuffer.length;it++)R.__webglColorRenderbuffer[it]&&i.deleteRenderbuffer(R.__webglColorRenderbuffer[it]);R.__webglDepthRenderbuffer&&i.deleteRenderbuffer(R.__webglDepthRenderbuffer)}let k=I.textures;for(let it=0,ht=k.length;it<ht;it++){let st=n.get(k[it]);st.__webglTexture&&(i.deleteTexture(st.__webglTexture),l.memory.textures--),n.remove(k[it])}n.remove(I)}let z=0;function Y(){z=0}function G(){let I=z;return I>=s.maxTextures&&wt("WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+s.maxTextures),z+=1,I}function j(I){let R=[];return R.push(I.wrapS),R.push(I.wrapT),R.push(I.wrapR||0),R.push(I.magFilter),R.push(I.minFilter),R.push(I.anisotropy),R.push(I.internalFormat),R.push(I.format),R.push(I.type),R.push(I.generateMipmaps),R.push(I.premultiplyAlpha),R.push(I.flipY),R.push(I.unpackAlignment),R.push(I.colorSpace),R.join()}function nt(I,R){let k=n.get(I);if(I.isVideoTexture&&Dt(I),I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&k.__version!==I.version){let it=I.image;if(it===null)wt("WebGLRenderer: Texture marked for update but no image data found.");else if(it.complete===!1)wt("WebGLRenderer: Texture marked for update but image is incomplete");else{at(k,I,R);return}}else I.isExternalTexture&&(k.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,k.__webglTexture,i.TEXTURE0+R)}function J(I,R){let k=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&k.__version!==I.version){at(k,I,R);return}else I.isExternalTexture&&(k.__webglTexture=I.sourceTexture?I.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,k.__webglTexture,i.TEXTURE0+R)}function et(I,R){let k=n.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&k.__version!==I.version){at(k,I,R);return}e.bindTexture(i.TEXTURE_3D,k.__webglTexture,i.TEXTURE0+R)}function rt(I,R){let k=n.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&k.__version!==I.version){dt(k,I,R);return}e.bindTexture(i.TEXTURE_CUBE_MAP,k.__webglTexture,i.TEXTURE0+R)}let St={[Ml]:i.REPEAT,[li]:i.CLAMP_TO_EDGE,[bl]:i.MIRRORED_REPEAT},bt={[dn]:i.NEAREST,[Sm]:i.NEAREST_MIPMAP_NEAREST,[uo]:i.NEAREST_MIPMAP_LINEAR,[Je]:i.LINEAR,[cc]:i.LINEAR_MIPMAP_NEAREST,[ys]:i.LINEAR_MIPMAP_LINEAR},mt={[Z_]:i.NEVER,[$_]:i.ALWAYS,[j_]:i.LESS,[Ef]:i.LEQUAL,[J_]:i.EQUAL,[Tf]:i.GEQUAL,[K_]:i.GREATER,[Q_]:i.NOTEQUAL};function kt(I,R){if(R.type===Qn&&t.has("OES_texture_float_linear")===!1&&(R.magFilter===Je||R.magFilter===cc||R.magFilter===uo||R.magFilter===ys||R.minFilter===Je||R.minFilter===cc||R.minFilter===uo||R.minFilter===ys)&&wt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(I,i.TEXTURE_WRAP_S,St[R.wrapS]),i.texParameteri(I,i.TEXTURE_WRAP_T,St[R.wrapT]),(I===i.TEXTURE_3D||I===i.TEXTURE_2D_ARRAY)&&i.texParameteri(I,i.TEXTURE_WRAP_R,St[R.wrapR]),i.texParameteri(I,i.TEXTURE_MAG_FILTER,bt[R.magFilter]),i.texParameteri(I,i.TEXTURE_MIN_FILTER,bt[R.minFilter]),R.compareFunction&&(i.texParameteri(I,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(I,i.TEXTURE_COMPARE_FUNC,mt[R.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(R.magFilter===dn||R.minFilter!==uo&&R.minFilter!==ys||R.type===Qn&&t.has("OES_texture_float_linear")===!1)return;if(R.anisotropy>1||n.get(R).__currentAnisotropy){let k=t.get("EXT_texture_filter_anisotropic");i.texParameterf(I,k.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,s.getMaxAnisotropy())),n.get(R).__currentAnisotropy=R.anisotropy}}}function $t(I,R){let k=!1;I.__webglInit===void 0&&(I.__webglInit=!0,R.addEventListener("dispose",D));let it=R.source,ht=g.get(it);ht===void 0&&(ht={},g.set(it,ht));let st=j(R);if(st!==I.__cacheKey){ht[st]===void 0&&(ht[st]={texture:i.createTexture(),usedTimes:0},l.memory.textures++,k=!0),ht[st].usedTimes++;let jt=ht[I.__cacheKey];jt!==void 0&&(ht[I.__cacheKey].usedTimes--,jt.usedTimes===0&&C(R)),I.__cacheKey=st,I.__webglTexture=ht[st].texture}return k}function re(I,R,k){return Math.floor(Math.floor(I/k)/R)}function Ce(I,R,k,it){let st=I.updateRanges;if(st.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,R.width,R.height,k,it,R.data);else{st.sort((pt,Ct)=>pt.start-Ct.start);let jt=0;for(let pt=1;pt<st.length;pt++){let Ct=st[jt],Xt=st[pt],Yt=Ct.start+Ct.count,Tt=re(Xt.start,R.width,4),ge=re(Ct.start,R.width,4);Xt.start<=Yt+1&&Tt===ge&&re(Xt.start+Xt.count-1,R.width,4)===Tt?Ct.count=Math.max(Ct.count,Xt.start+Xt.count-Ct.start):(++jt,st[jt]=Xt)}st.length=jt+1;let Et=i.getParameter(i.UNPACK_ROW_LENGTH),Wt=i.getParameter(i.UNPACK_SKIP_PIXELS),Kt=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,R.width);for(let pt=0,Ct=st.length;pt<Ct;pt++){let Xt=st[pt],Yt=Math.floor(Xt.start/4),Tt=Math.ceil(Xt.count/4),ge=Yt%R.width,H=Math.floor(Yt/R.width),Ut=Tt,xt=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,ge),i.pixelStorei(i.UNPACK_SKIP_ROWS,H),e.texSubImage2D(i.TEXTURE_2D,0,ge,H,Ut,xt,k,it,R.data)}I.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,Et),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Wt),i.pixelStorei(i.UNPACK_SKIP_ROWS,Kt)}}function at(I,R,k){let it=i.TEXTURE_2D;(R.isDataArrayTexture||R.isCompressedArrayTexture)&&(it=i.TEXTURE_2D_ARRAY),R.isData3DTexture&&(it=i.TEXTURE_3D);let ht=$t(I,R),st=R.source;e.bindTexture(it,I.__webglTexture,i.TEXTURE0+k);let jt=n.get(st);if(st.version!==jt.__version||ht===!0){e.activeTexture(i.TEXTURE0+k);let Et=be.getPrimaries(be.workingColorSpace),Wt=R.colorSpace===Fs?null:be.getPrimaries(R.colorSpace),Kt=R.colorSpace===Fs||Et===Wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,R.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,R.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Kt);let pt=b(R.image,!1,s.maxTextureSize);pt=se(R,pt);let Ct=r.convert(R.format,R.colorSpace),Xt=r.convert(R.type),Yt=T(R.internalFormat,Ct,Xt,R.colorSpace,R.isVideoTexture);kt(it,R);let Tt,ge=R.mipmaps,H=R.isVideoTexture!==!0,Ut=jt.__version===void 0||ht===!0,xt=st.dataReady,Ot=N(R,pt);if(R.isDepthTexture)Yt=A(R.format===va,R.type),Ut&&(H?e.texStorage2D(i.TEXTURE_2D,1,Yt,pt.width,pt.height):e.texImage2D(i.TEXTURE_2D,0,Yt,pt.width,pt.height,0,Ct,Xt,null));else if(R.isDataTexture)if(ge.length>0){H&&Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,ge[0].width,ge[0].height);for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Xt,Tt.data):e.texImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Ct,Xt,Tt.data);R.generateMipmaps=!1}else H?(Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,pt.width,pt.height),xt&&Ce(R,pt,Ct,Xt)):e.texImage2D(i.TEXTURE_2D,0,Yt,pt.width,pt.height,0,Ct,Xt,pt.data);else if(R.isCompressedTexture)if(R.isCompressedArrayTexture){H&&Ut&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ot,Yt,ge[0].width,ge[0].height,pt.depth);for(let _t=0,ut=ge.length;_t<ut;_t++)if(Tt=ge[_t],R.format!==Un)if(Ct!==null)if(H){if(xt)if(R.layerUpdates.size>0){let At=Nm(Tt.width,Tt.height,R.format,R.type);for(let oe of R.layerUpdates){let Be=Tt.data.subarray(oe*At/Tt.data.BYTES_PER_ELEMENT,(oe+1)*At/Tt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,oe,Tt.width,Tt.height,1,Ct,Be)}R.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,0,Tt.width,Tt.height,pt.depth,Ct,Tt.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,_t,Yt,Tt.width,Tt.height,pt.depth,0,Tt.data,0,0);else wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else H?xt&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,_t,0,0,0,Tt.width,Tt.height,pt.depth,Ct,Xt,Tt.data):e.texImage3D(i.TEXTURE_2D_ARRAY,_t,Yt,Tt.width,Tt.height,pt.depth,0,Ct,Xt,Tt.data)}else{H&&Ut&&e.texStorage2D(i.TEXTURE_2D,Ot,Yt,ge[0].width,ge[0].height);for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],R.format!==Un?Ct!==null?H?xt&&e.compressedTexSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Tt.data):e.compressedTexImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Tt.data):wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Tt.width,Tt.height,Ct,Xt,Tt.data):e.texImage2D(i.TEXTURE_2D,_t,Yt,Tt.width,Tt.height,0,Ct,Xt,Tt.data)}else if(R.isDataArrayTexture)if(H){if(Ut&&e.texStorage3D(i.TEXTURE_2D_ARRAY,Ot,Yt,pt.width,pt.height,pt.depth),xt)if(R.layerUpdates.size>0){let _t=Nm(pt.width,pt.height,R.format,R.type);for(let ut of R.layerUpdates){let At=pt.data.subarray(ut*_t/pt.data.BYTES_PER_ELEMENT,(ut+1)*_t/pt.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ut,pt.width,pt.height,1,Ct,Xt,At)}R.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,pt.width,pt.height,pt.depth,Ct,Xt,pt.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,Yt,pt.width,pt.height,pt.depth,0,Ct,Xt,pt.data);else if(R.isData3DTexture)H?(Ut&&e.texStorage3D(i.TEXTURE_3D,Ot,Yt,pt.width,pt.height,pt.depth),xt&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,pt.width,pt.height,pt.depth,Ct,Xt,pt.data)):e.texImage3D(i.TEXTURE_3D,0,Yt,pt.width,pt.height,pt.depth,0,Ct,Xt,pt.data);else if(R.isFramebufferTexture){if(Ut)if(H)e.texStorage2D(i.TEXTURE_2D,Ot,Yt,pt.width,pt.height);else{let _t=pt.width,ut=pt.height;for(let At=0;At<Ot;At++)e.texImage2D(i.TEXTURE_2D,At,Yt,_t,ut,0,Ct,Xt,null),_t>>=1,ut>>=1}}else if(ge.length>0){if(H&&Ut){let _t=Mt(ge[0]);e.texStorage2D(i.TEXTURE_2D,Ot,Yt,_t.width,_t.height)}for(let _t=0,ut=ge.length;_t<ut;_t++)Tt=ge[_t],H?xt&&e.texSubImage2D(i.TEXTURE_2D,_t,0,0,Ct,Xt,Tt):e.texImage2D(i.TEXTURE_2D,_t,Yt,Ct,Xt,Tt);R.generateMipmaps=!1}else if(H){if(Ut){let _t=Mt(pt);e.texStorage2D(i.TEXTURE_2D,Ot,Yt,_t.width,_t.height)}xt&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,Ct,Xt,pt)}else e.texImage2D(i.TEXTURE_2D,0,Yt,Ct,Xt,pt);S(R)&&x(it),jt.__version=st.version,R.onUpdate&&R.onUpdate(R)}I.__version=R.version}function dt(I,R,k){if(R.image.length!==6)return;let it=$t(I,R),ht=R.source;e.bindTexture(i.TEXTURE_CUBE_MAP,I.__webglTexture,i.TEXTURE0+k);let st=n.get(ht);if(ht.version!==st.__version||it===!0){e.activeTexture(i.TEXTURE0+k);let jt=be.getPrimaries(be.workingColorSpace),Et=R.colorSpace===Fs?null:be.getPrimaries(R.colorSpace),Wt=R.colorSpace===Fs||jt===Et?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,R.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,R.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);let Kt=R.isCompressedTexture||R.image[0].isCompressedTexture,pt=R.image[0]&&R.image[0].isDataTexture,Ct=[];for(let ut=0;ut<6;ut++)!Kt&&!pt?Ct[ut]=b(R.image[ut],!0,s.maxCubemapSize):Ct[ut]=pt?R.image[ut].image:R.image[ut],Ct[ut]=se(R,Ct[ut]);let Xt=Ct[0],Yt=r.convert(R.format,R.colorSpace),Tt=r.convert(R.type),ge=T(R.internalFormat,Yt,Tt,R.colorSpace),H=R.isVideoTexture!==!0,Ut=st.__version===void 0||it===!0,xt=ht.dataReady,Ot=N(R,Xt);kt(i.TEXTURE_CUBE_MAP,R);let _t;if(Kt){H&&Ut&&e.texStorage2D(i.TEXTURE_CUBE_MAP,Ot,ge,Xt.width,Xt.height);for(let ut=0;ut<6;ut++){_t=Ct[ut].mipmaps;for(let At=0;At<_t.length;At++){let oe=_t[At];R.format!==Un?Yt!==null?H?xt&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,0,0,oe.width,oe.height,Yt,oe.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,ge,oe.width,oe.height,0,oe.data):wt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,0,0,oe.width,oe.height,Yt,Tt,oe.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At,ge,oe.width,oe.height,0,Yt,Tt,oe.data)}}}else{if(_t=R.mipmaps,H&&Ut){_t.length>0&&Ot++;let ut=Mt(Ct[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,Ot,ge,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(pt){H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Ct[ut].width,Ct[ut].height,Yt,Tt,Ct[ut].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,ge,Ct[ut].width,Ct[ut].height,0,Yt,Tt,Ct[ut].data);for(let At=0;At<_t.length;At++){let Be=_t[At].image[ut].image;H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,0,0,Be.width,Be.height,Yt,Tt,Be.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,ge,Be.width,Be.height,0,Yt,Tt,Be.data)}}else{H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Yt,Tt,Ct[ut]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,ge,Yt,Tt,Ct[ut]);for(let At=0;At<_t.length;At++){let oe=_t[At];H?xt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,0,0,Yt,Tt,oe.image[ut]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,At+1,ge,Yt,Tt,oe.image[ut])}}}S(R)&&x(i.TEXTURE_CUBE_MAP),st.__version=ht.version,R.onUpdate&&R.onUpdate(R)}I.__version=R.version}function Vt(I,R,k,it,ht,st){let jt=r.convert(k.format,k.colorSpace),Et=r.convert(k.type),Wt=T(k.internalFormat,jt,Et,k.colorSpace),Kt=n.get(R),pt=n.get(k);if(pt.__renderTarget=R,!Kt.__hasExternalTextures){let Ct=Math.max(1,R.width>>st),Xt=Math.max(1,R.height>>st);ht===i.TEXTURE_3D||ht===i.TEXTURE_2D_ARRAY?e.texImage3D(ht,st,Wt,Ct,Xt,R.depth,0,jt,Et,null):e.texImage2D(ht,st,Wt,Ct,Xt,0,jt,Et,null)}e.bindFramebuffer(i.FRAMEBUFFER,I),Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,it,ht,pt.__webglTexture,0,B(R)):(ht===i.TEXTURE_2D||ht>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ht<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,it,ht,pt.__webglTexture,st),e.bindFramebuffer(i.FRAMEBUFFER,null)}function ie(I,R,k){if(i.bindRenderbuffer(i.RENDERBUFFER,I),R.depthBuffer){let it=R.depthTexture,ht=it&&it.isDepthTexture?it.type:null,st=A(R.stencilBuffer,ht),jt=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Zt(R)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,B(R),st,R.width,R.height):k?i.renderbufferStorageMultisample(i.RENDERBUFFER,B(R),st,R.width,R.height):i.renderbufferStorage(i.RENDERBUFFER,st,R.width,R.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,jt,i.RENDERBUFFER,I)}else{let it=R.textures;for(let ht=0;ht<it.length;ht++){let st=it[ht],jt=r.convert(st.format,st.colorSpace),Et=r.convert(st.type),Wt=T(st.internalFormat,jt,Et,st.colorSpace);Zt(R)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,B(R),Wt,R.width,R.height):k?i.renderbufferStorageMultisample(i.RENDERBUFFER,B(R),Wt,R.width,R.height):i.renderbufferStorage(i.RENDERBUFFER,Wt,R.width,R.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ft(I,R,k){let it=R.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,I),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let ht=n.get(R.depthTexture);if(ht.__renderTarget=R,(!ht.__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),it){if(ht.__webglInit===void 0&&(ht.__webglInit=!0,R.depthTexture.addEventListener("dispose",D)),ht.__webglTexture===void 0){ht.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,ht.__webglTexture),kt(i.TEXTURE_CUBE_MAP,R.depthTexture);let Kt=r.convert(R.depthTexture.format),pt=r.convert(R.depthTexture.type),Ct;R.depthTexture.format===ds?Ct=i.DEPTH_COMPONENT24:R.depthTexture.format===va&&(Ct=i.DEPTH24_STENCIL8);for(let Xt=0;Xt<6;Xt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Xt,0,Ct,R.width,R.height,0,Kt,pt,null)}}else nt(R.depthTexture,0);let st=ht.__webglTexture,jt=B(R),Et=it?i.TEXTURE_CUBE_MAP_POSITIVE_X+k:i.TEXTURE_2D,Wt=R.depthTexture.format===va?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(R.depthTexture.format===ds)Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,Et,st,0,jt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,Et,st,0);else if(R.depthTexture.format===va)Zt(R)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,Et,st,0,jt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,Et,st,0);else throw new Error("Unknown depthTexture format")}function ye(I){let R=n.get(I),k=I.isWebGLCubeRenderTarget===!0;if(R.__boundDepthTexture!==I.depthTexture){let it=I.depthTexture;if(R.__depthDisposeCallback&&R.__depthDisposeCallback(),it){let ht=()=>{delete R.__boundDepthTexture,delete R.__depthDisposeCallback,it.removeEventListener("dispose",ht)};it.addEventListener("dispose",ht),R.__depthDisposeCallback=ht}R.__boundDepthTexture=it}if(I.depthTexture&&!R.__autoAllocateDepthBuffer)if(k)for(let it=0;it<6;it++)Ft(R.__webglFramebuffer[it],I,it);else{let it=I.texture.mipmaps;it&&it.length>0?Ft(R.__webglFramebuffer[0],I,0):Ft(R.__webglFramebuffer,I,0)}else if(k){R.__webglDepthbuffer=[];for(let it=0;it<6;it++)if(e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer[it]),R.__webglDepthbuffer[it]===void 0)R.__webglDepthbuffer[it]=i.createRenderbuffer(),ie(R.__webglDepthbuffer[it],I,!1);else{let ht=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,st=R.__webglDepthbuffer[it];i.bindRenderbuffer(i.RENDERBUFFER,st),i.framebufferRenderbuffer(i.FRAMEBUFFER,ht,i.RENDERBUFFER,st)}}else{let it=I.texture.mipmaps;if(it&&it.length>0?e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,R.__webglFramebuffer),R.__webglDepthbuffer===void 0)R.__webglDepthbuffer=i.createRenderbuffer(),ie(R.__webglDepthbuffer,I,!1);else{let ht=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,st=R.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,st),i.framebufferRenderbuffer(i.FRAMEBUFFER,ht,i.RENDERBUFFER,st)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function Re(I,R,k){let it=n.get(I);R!==void 0&&Vt(it.__webglFramebuffer,I,I.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),k!==void 0&&ye(I)}function ce(I){let R=I.texture,k=n.get(I),it=n.get(R);I.addEventListener("dispose",L);let ht=I.textures,st=I.isWebGLCubeRenderTarget===!0,jt=ht.length>1;if(jt||(it.__webglTexture===void 0&&(it.__webglTexture=i.createTexture()),it.__version=R.version,l.memory.textures++),st){k.__webglFramebuffer=[];for(let Et=0;Et<6;Et++)if(R.mipmaps&&R.mipmaps.length>0){k.__webglFramebuffer[Et]=[];for(let Wt=0;Wt<R.mipmaps.length;Wt++)k.__webglFramebuffer[Et][Wt]=i.createFramebuffer()}else k.__webglFramebuffer[Et]=i.createFramebuffer()}else{if(R.mipmaps&&R.mipmaps.length>0){k.__webglFramebuffer=[];for(let Et=0;Et<R.mipmaps.length;Et++)k.__webglFramebuffer[Et]=i.createFramebuffer()}else k.__webglFramebuffer=i.createFramebuffer();if(jt)for(let Et=0,Wt=ht.length;Et<Wt;Et++){let Kt=n.get(ht[Et]);Kt.__webglTexture===void 0&&(Kt.__webglTexture=i.createTexture(),l.memory.textures++)}if(I.samples>0&&Zt(I)===!1){k.__webglMultisampledFramebuffer=i.createFramebuffer(),k.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,k.__webglMultisampledFramebuffer);for(let Et=0;Et<ht.length;Et++){let Wt=ht[Et];k.__webglColorRenderbuffer[Et]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,k.__webglColorRenderbuffer[Et]);let Kt=r.convert(Wt.format,Wt.colorSpace),pt=r.convert(Wt.type),Ct=T(Wt.internalFormat,Kt,pt,Wt.colorSpace,I.isXRRenderTarget===!0),Xt=B(I);i.renderbufferStorageMultisample(i.RENDERBUFFER,Xt,Ct,I.width,I.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Et,i.RENDERBUFFER,k.__webglColorRenderbuffer[Et])}i.bindRenderbuffer(i.RENDERBUFFER,null),I.depthBuffer&&(k.__webglDepthRenderbuffer=i.createRenderbuffer(),ie(k.__webglDepthRenderbuffer,I,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(st){e.bindTexture(i.TEXTURE_CUBE_MAP,it.__webglTexture),kt(i.TEXTURE_CUBE_MAP,R);for(let Et=0;Et<6;Et++)if(R.mipmaps&&R.mipmaps.length>0)for(let Wt=0;Wt<R.mipmaps.length;Wt++)Vt(k.__webglFramebuffer[Et][Wt],I,R,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Et,Wt);else Vt(k.__webglFramebuffer[Et],I,R,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Et,0);S(R)&&x(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(jt){for(let Et=0,Wt=ht.length;Et<Wt;Et++){let Kt=ht[Et],pt=n.get(Kt),Ct=i.TEXTURE_2D;(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(Ct=I.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(Ct,pt.__webglTexture),kt(Ct,Kt),Vt(k.__webglFramebuffer,I,Kt,i.COLOR_ATTACHMENT0+Et,Ct,0),S(Kt)&&x(Ct)}e.unbindTexture()}else{let Et=i.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(Et=I.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(Et,it.__webglTexture),kt(Et,R),R.mipmaps&&R.mipmaps.length>0)for(let Wt=0;Wt<R.mipmaps.length;Wt++)Vt(k.__webglFramebuffer[Wt],I,R,i.COLOR_ATTACHMENT0,Et,Wt);else Vt(k.__webglFramebuffer,I,R,i.COLOR_ATTACHMENT0,Et,0);S(R)&&x(Et),e.unbindTexture()}I.depthBuffer&&ye(I)}function ct(I){let R=I.textures;for(let k=0,it=R.length;k<it;k++){let ht=R[k];if(S(ht)){let st=E(I),jt=n.get(ht).__webglTexture;e.bindTexture(st,jt),x(st),e.unbindTexture()}}}let gt=[],lt=[];function Nt(I){if(I.samples>0){if(Zt(I)===!1){let R=I.textures,k=I.width,it=I.height,ht=i.COLOR_BUFFER_BIT,st=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,jt=n.get(I),Et=R.length>1;if(Et)for(let Kt=0;Kt<R.length;Kt++)e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,jt.__webglMultisampledFramebuffer);let Wt=I.texture.mipmaps;Wt&&Wt.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglFramebuffer);for(let Kt=0;Kt<R.length;Kt++){if(I.resolveDepthBuffer&&(I.depthBuffer&&(ht|=i.DEPTH_BUFFER_BIT),I.stencilBuffer&&I.resolveStencilBuffer&&(ht|=i.STENCIL_BUFFER_BIT)),Et){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,jt.__webglColorRenderbuffer[Kt]);let pt=n.get(R[Kt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,pt,0)}i.blitFramebuffer(0,0,k,it,0,0,k,it,ht,i.NEAREST),h===!0&&(gt.length=0,lt.length=0,gt.push(i.COLOR_ATTACHMENT0+Kt),I.depthBuffer&&I.resolveDepthBuffer===!1&&(gt.push(st),lt.push(st),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,lt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,gt))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Et)for(let Kt=0;Kt<R.length;Kt++){e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.RENDERBUFFER,jt.__webglColorRenderbuffer[Kt]);let pt=n.get(R[Kt]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,jt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Kt,i.TEXTURE_2D,pt,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,jt.__webglMultisampledFramebuffer)}else if(I.depthBuffer&&I.resolveDepthBuffer===!1&&h){let R=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[R])}}}function B(I){return Math.min(s.maxSamples,I.samples)}function Zt(I){let R=n.get(I);return I.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&R.__useRenderToTexture!==!1}function Dt(I){let R=l.render.frame;p.get(I)!==R&&(p.set(I,R),I.update())}function se(I,R){let k=I.colorSpace,it=I.format,ht=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||k!==Ps&&k!==Fs&&(be.getTransfer(k)===Ve?(it!==Un||ht!==Gn)&&wt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Qt("WebGLTextures: Unsupported texture color space:",k)),R}function Mt(I){return typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement?(f.width=I.naturalWidth||I.width,f.height=I.naturalHeight||I.height):typeof VideoFrame<"u"&&I instanceof VideoFrame?(f.width=I.displayWidth,f.height=I.displayHeight):(f.width=I.width,f.height=I.height),f}this.allocateTextureUnit=G,this.resetTextureUnits=Y,this.setTexture2D=nt,this.setTexture2DArray=J,this.setTexture3D=et,this.setTextureCube=rt,this.rebindTextures=Re,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ct,this.updateMultisampleRenderTarget=Nt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=Vt,this.useMultisampledRTT=Zt,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function Zb(i,t){function e(n,s=Fs){let r,l=be.getTransfer(s);if(n===Gn)return i.UNSIGNED_BYTE;if(n===zh)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Vh)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Em)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Tm)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Mm)return i.BYTE;if(n===bm)return i.SHORT;if(n===ho)return i.UNSIGNED_SHORT;if(n===Fh)return i.INT;if(n===Fi)return i.UNSIGNED_INT;if(n===Qn)return i.FLOAT;if(n===Ss)return i.HALF_FLOAT;if(n===Am)return i.ALPHA;if(n===Cm)return i.RGB;if(n===Un)return i.RGBA;if(n===ds)return i.DEPTH_COMPONENT;if(n===va)return i.DEPTH_STENCIL;if(n===Hh)return i.RED;if(n===uc)return i.RED_INTEGER;if(n===rr)return i.RG;if(n===Gh)return i.RG_INTEGER;if(n===kh)return i.RGBA_INTEGER;if(n===hc||n===fc||n===dc||n===pc)if(l===Ve)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===hc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===fc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===pc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===hc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===fc)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===dc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===pc)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Wh||n===Xh||n===qh||n===Yh)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Wh)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Xh)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===qh)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Yh)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Zh||n===jh||n===Jh||n===Kh||n===Qh||n===$h||n===tf)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Zh||n===jh)return l===Ve?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Jh)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Kh)return r.COMPRESSED_R11_EAC;if(n===Qh)return r.COMPRESSED_SIGNED_R11_EAC;if(n===$h)return r.COMPRESSED_RG11_EAC;if(n===tf)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ef||n===nf||n===sf||n===af||n===rf||n===of||n===lf||n===cf||n===uf||n===hf||n===ff||n===df||n===pf||n===mf)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ef)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===nf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===sf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===af)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===rf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===of)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===lf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===cf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===uf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===hf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ff)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===df)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===mf)return l===Ve?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===gf||n===_f||n===vf)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===gf)return l===Ve?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===_f)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===vf)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===xf||n===yf||n===Sf||n===Mf)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===xf)return r.COMPRESSED_RED_RGTC1_EXT;if(n===yf)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Sf)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Mf)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===fo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var KN=`
3999
3999
  void main() {
4000
4000
 
4001
4001
  gl_Position = vec4( position, 1.0 );
4002
4002
 
4003
- }`,KN=`
4003
+ }`,QN=`
4004
4004
  uniform sampler2DArray depthColor;
4005
4005
  uniform float depthWidth;
4006
4006
  uniform float depthHeight;
@@ -4019,7 +4019,7 @@ void main() {
4019
4019
 
4020
4020
  }
4021
4021
 
4022
- }`,bv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new Bl(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new ci({vertexShader:JN,fragmentShader:KN,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new rn(new ro(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Ev=class extends Oi{constructor(t,e){super();let n=this,s=null,r=1,l=null,c="local-floor",h=1,f=null,p=null,m=null,g=null,v=null,y=null,b=typeof XRWebGLBinding<"u",S=new bv,x={},E=e.getContextAttributes(),T=null,A=null,N=[],D=[],L=new ft,F=null,C=new fn;C.viewport=new qe;let w=new fn;w.viewport=new qe;let z=[C,w],Y=new Ah,G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let dt=N[at];return dt===void 0&&(dt=new $r,N[at]=dt),dt.getTargetRaySpace()},this.getControllerGrip=function(at){let dt=N[at];return dt===void 0&&(dt=new $r,N[at]=dt),dt.getGripSpace()},this.getHand=function(at){let dt=N[at];return dt===void 0&&(dt=new $r,N[at]=dt),dt.getHandSpace()};function nt(at){let dt=D.indexOf(at.inputSource);if(dt===-1)return;let Vt=N[dt];Vt!==void 0&&(Vt.update(at.inputSource,at.frame,f||l),Vt.dispatchEvent({type:at.type,data:at.inputSource}))}function J(){s.removeEventListener("select",nt),s.removeEventListener("selectstart",nt),s.removeEventListener("selectend",nt),s.removeEventListener("squeeze",nt),s.removeEventListener("squeezestart",nt),s.removeEventListener("squeezeend",nt),s.removeEventListener("end",J),s.removeEventListener("inputsourceschange",et);for(let at=0;at<N.length;at++){let dt=D[at];dt!==null&&(D[at]=null,N[at].disconnect(dt))}G=null,j=null,S.reset();for(let at in x)delete x[at];t.setRenderTarget(T),v=null,g=null,m=null,s=null,A=null,Ce.stop(),n.isPresenting=!1,t.setPixelRatio(F),t.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){r=at,n.isPresenting===!0&&wt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){c=at,n.isPresenting===!0&&wt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||l},this.setReferenceSpace=function(at){f=at},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return m===null&&b&&(m=new XRWebGLBinding(s,e)),m},this.getFrame=function(){return y},this.getSession=function(){return s},this.setSession=async function(at){if(s=at,s!==null){if(T=t.getRenderTarget(),s.addEventListener("select",nt),s.addEventListener("selectstart",nt),s.addEventListener("selectend",nt),s.addEventListener("squeeze",nt),s.addEventListener("squeezestart",nt),s.addEventListener("squeezeend",nt),s.addEventListener("end",J),s.addEventListener("inputsourceschange",et),E.xrCompatible!==!0&&await e.makeXRCompatible(),F=t.getPixelRatio(),t.getSize(L),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let Vt=null,ie=null,Ft=null;E.depth&&(Ft=E.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Vt=E.stencil?_a:ds,ie=E.stencil?fo:Fi);let ye={colorFormat:e.RGBA8,depthFormat:Ft,scaleFactor:r};m=this.getBinding(),g=m.createProjectionLayer(ye),s.updateRenderState({layers:[g]}),t.setPixelRatio(1),t.setSize(g.textureWidth,g.textureHeight,!1),A=new $n(g.textureWidth,g.textureHeight,{format:Un,type:Gn,depthTexture:new da(g.textureWidth,g.textureHeight,ie,void 0,void 0,void 0,void 0,void 0,void 0,Vt),stencilBuffer:E.stencil,colorSpace:t.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{let Vt={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};v=new XRWebGLLayer(s,e,Vt),s.updateRenderState({baseLayer:v}),t.setPixelRatio(1),t.setSize(v.framebufferWidth,v.framebufferHeight,!1),A=new $n(v.framebufferWidth,v.framebufferHeight,{format:Un,type:Gn,colorSpace:t.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(h),f=null,l=await s.requestReferenceSpace(c),Ce.setContext(s),Ce.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function et(at){for(let dt=0;dt<at.removed.length;dt++){let Vt=at.removed[dt],ie=D.indexOf(Vt);ie>=0&&(D[ie]=null,N[ie].disconnect(Vt))}for(let dt=0;dt<at.added.length;dt++){let Vt=at.added[dt],ie=D.indexOf(Vt);if(ie===-1){for(let ye=0;ye<N.length;ye++)if(ye>=D.length){D.push(Vt),ie=ye;break}else if(D[ye]===null){D[ye]=Vt,ie=ye;break}if(ie===-1)break}let Ft=N[ie];Ft&&Ft.connect(Vt)}}let rt=new O,St=new O;function bt(at,dt,Vt){rt.setFromMatrixPosition(dt.matrixWorld),St.setFromMatrixPosition(Vt.matrixWorld);let ie=rt.distanceTo(St),Ft=dt.projectionMatrix.elements,ye=Vt.projectionMatrix.elements,Re=Ft[14]/(Ft[10]-1),ce=Ft[14]/(Ft[10]+1),ct=(Ft[9]+1)/Ft[5],gt=(Ft[9]-1)/Ft[5],lt=(Ft[8]-1)/Ft[0],Nt=(ye[8]+1)/ye[0],B=Re*lt,Zt=Re*Nt,Dt=ie/(-lt+Nt),se=Dt*-lt;if(dt.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(se),at.translateZ(Dt),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert(),Ft[10]===-1)at.projectionMatrix.copy(dt.projectionMatrix),at.projectionMatrixInverse.copy(dt.projectionMatrixInverse);else{let Mt=Re+Dt,I=ce+Dt,R=B-se,k=Zt+(ie-se),it=ct*ce/I*Mt,ht=gt*ce/I*Mt;at.projectionMatrix.makePerspective(R,k,it,ht,Mt,I),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}}function mt(at,dt){dt===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(dt.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;let dt=at.near,Vt=at.far;S.texture!==null&&(S.depthNear>0&&(dt=S.depthNear),S.depthFar>0&&(Vt=S.depthFar)),Y.near=w.near=C.near=dt,Y.far=w.far=C.far=Vt,(G!==Y.near||j!==Y.far)&&(s.updateRenderState({depthNear:Y.near,depthFar:Y.far}),G=Y.near,j=Y.far),Y.layers.mask=at.layers.mask|6,C.layers.mask=Y.layers.mask&3,w.layers.mask=Y.layers.mask&5;let ie=at.parent,Ft=Y.cameras;mt(Y,ie);for(let ye=0;ye<Ft.length;ye++)mt(Ft[ye],ie);Ft.length===2?bt(Y,C,w):Y.projectionMatrix.copy(C.projectionMatrix),kt(at,Y,ie)};function kt(at,dt,Vt){Vt===null?at.matrix.copy(dt.matrixWorld):(at.matrix.copy(Vt.matrixWorld),at.matrix.invert(),at.matrix.multiply(dt.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(dt.projectionMatrix),at.projectionMatrixInverse.copy(dt.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=jr*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return Y},this.getFoveation=function(){if(!(g===null&&v===null))return h},this.setFoveation=function(at){h=at,g!==null&&(g.fixedFoveation=at),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=at)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(Y)},this.getCameraTexture=function(at){return x[at]};let $t=null;function re(at,dt){if(p=dt.getViewerPose(f||l),y=dt,p!==null){let Vt=p.views;v!==null&&(t.setRenderTargetFramebuffer(A,v.framebuffer),t.setRenderTarget(A));let ie=!1;Vt.length!==Y.cameras.length&&(Y.cameras.length=0,ie=!0);for(let ce=0;ce<Vt.length;ce++){let ct=Vt[ce],gt=null;if(v!==null)gt=v.getViewport(ct);else{let Nt=m.getViewSubImage(g,ct);gt=Nt.viewport,ce===0&&(t.setRenderTargetTextures(A,Nt.colorTexture,Nt.depthStencilTexture),t.setRenderTarget(A))}let lt=z[ce];lt===void 0&&(lt=new fn,lt.layers.enable(ce),lt.viewport=new qe,z[ce]=lt),lt.matrix.fromArray(ct.transform.matrix),lt.matrix.decompose(lt.position,lt.quaternion,lt.scale),lt.projectionMatrix.fromArray(ct.projectionMatrix),lt.projectionMatrixInverse.copy(lt.projectionMatrix).invert(),lt.viewport.set(gt.x,gt.y,gt.width,gt.height),ce===0&&(Y.matrix.copy(lt.matrix),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)),ie===!0&&Y.cameras.push(lt)}let Ft=s.enabledFeatures;if(Ft&&Ft.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&b){m=n.getBinding();let ce=m.getDepthInformation(Vt[0]);ce&&ce.isValid&&ce.texture&&S.init(ce,s.renderState)}if(Ft&&Ft.includes("camera-access")&&b){t.state.unbindTexture(),m=n.getBinding();for(let ce=0;ce<Vt.length;ce++){let ct=Vt[ce].camera;if(ct){let gt=x[ct];gt||(gt=new Bl,x[ct]=gt);let lt=m.getCameraImage(ct);gt.sourceTexture=lt}}}}for(let Vt=0;Vt<N.length;Vt++){let ie=D[Vt],Ft=N[Vt];ie!==null&&Ft!==void 0&&Ft.update(ie,dt,f||l)}$t&&$t(at,dt),dt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:dt}),y=null}let Ce=new kb;Ce.setAnimationLoop(re),this.setAnimationLoop=function(at){$t=at},this.dispose=function(){}}},go=new xi,QN=new ue;function $N(i,t){function e(S,x){S.matrixAutoUpdate===!0&&S.updateMatrix(),x.value.copy(S.matrix)}function n(S,x){x.color.getRGB(S.fogColor.value,iv(i)),x.isFog?(S.fogNear.value=x.near,S.fogFar.value=x.far):x.isFogExp2&&(S.fogDensity.value=x.density)}function s(S,x,E,T,A){x.isMeshBasicMaterial||x.isMeshLambertMaterial?r(S,x):x.isMeshToonMaterial?(r(S,x),m(S,x)):x.isMeshPhongMaterial?(r(S,x),p(S,x)):x.isMeshStandardMaterial?(r(S,x),g(S,x),x.isMeshPhysicalMaterial&&v(S,x,A)):x.isMeshMatcapMaterial?(r(S,x),y(S,x)):x.isMeshDepthMaterial?r(S,x):x.isMeshDistanceMaterial?(r(S,x),b(S,x)):x.isMeshNormalMaterial?r(S,x):x.isLineBasicMaterial?(l(S,x),x.isLineDashedMaterial&&c(S,x)):x.isPointsMaterial?h(S,x,E,T):x.isSpriteMaterial?f(S,x):x.isShadowMaterial?(S.color.value.copy(x.color),S.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function r(S,x){S.opacity.value=x.opacity,x.color&&S.diffuse.value.copy(x.color),x.emissive&&S.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(S.map.value=x.map,e(x.map,S.mapTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.bumpMap&&(S.bumpMap.value=x.bumpMap,e(x.bumpMap,S.bumpMapTransform),S.bumpScale.value=x.bumpScale,x.side===ti&&(S.bumpScale.value*=-1)),x.normalMap&&(S.normalMap.value=x.normalMap,e(x.normalMap,S.normalMapTransform),S.normalScale.value.copy(x.normalScale),x.side===ti&&S.normalScale.value.negate()),x.displacementMap&&(S.displacementMap.value=x.displacementMap,e(x.displacementMap,S.displacementMapTransform),S.displacementScale.value=x.displacementScale,S.displacementBias.value=x.displacementBias),x.emissiveMap&&(S.emissiveMap.value=x.emissiveMap,e(x.emissiveMap,S.emissiveMapTransform)),x.specularMap&&(S.specularMap.value=x.specularMap,e(x.specularMap,S.specularMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest);let E=t.get(x),T=E.envMap,A=E.envMapRotation;T&&(S.envMap.value=T,go.copy(A),go.x*=-1,go.y*=-1,go.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(go.y*=-1,go.z*=-1),S.envMapRotation.value.setFromMatrix4(QN.makeRotationFromEuler(go)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=x.reflectivity,S.ior.value=x.ior,S.refractionRatio.value=x.refractionRatio),x.lightMap&&(S.lightMap.value=x.lightMap,S.lightMapIntensity.value=x.lightMapIntensity,e(x.lightMap,S.lightMapTransform)),x.aoMap&&(S.aoMap.value=x.aoMap,S.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,S.aoMapTransform))}function l(S,x){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,x.map&&(S.map.value=x.map,e(x.map,S.mapTransform))}function c(S,x){S.dashSize.value=x.dashSize,S.totalSize.value=x.dashSize+x.gapSize,S.scale.value=x.scale}function h(S,x,E,T){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,S.size.value=x.size*E,S.scale.value=T*.5,x.map&&(S.map.value=x.map,e(x.map,S.uvTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest)}function f(S,x){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,S.rotation.value=x.rotation,x.map&&(S.map.value=x.map,e(x.map,S.mapTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest)}function p(S,x){S.specular.value.copy(x.specular),S.shininess.value=Math.max(x.shininess,1e-4)}function m(S,x){x.gradientMap&&(S.gradientMap.value=x.gradientMap)}function g(S,x){S.metalness.value=x.metalness,x.metalnessMap&&(S.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,S.metalnessMapTransform)),S.roughness.value=x.roughness,x.roughnessMap&&(S.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,S.roughnessMapTransform)),x.envMap&&(S.envMapIntensity.value=x.envMapIntensity)}function v(S,x,E){S.ior.value=x.ior,x.sheen>0&&(S.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),S.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(S.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,S.sheenColorMapTransform)),x.sheenRoughnessMap&&(S.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,S.sheenRoughnessMapTransform))),x.clearcoat>0&&(S.clearcoat.value=x.clearcoat,S.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(S.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,S.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(S.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===ti&&S.clearcoatNormalScale.value.negate())),x.dispersion>0&&(S.dispersion.value=x.dispersion),x.iridescence>0&&(S.iridescence.value=x.iridescence,S.iridescenceIOR.value=x.iridescenceIOR,S.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(S.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,S.iridescenceMapTransform)),x.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),x.transmission>0&&(S.transmission.value=x.transmission,S.transmissionSamplerMap.value=E.texture,S.transmissionSamplerSize.value.set(E.width,E.height),x.transmissionMap&&(S.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,S.transmissionMapTransform)),S.thickness.value=x.thickness,x.thicknessMap&&(S.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=x.attenuationDistance,S.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(S.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(S.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=x.specularIntensity,S.specularColor.value.copy(x.specularColor),x.specularColorMap&&(S.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,S.specularColorMapTransform)),x.specularIntensityMap&&(S.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,x){x.matcap&&(S.matcap.value=x.matcap)}function b(S,x){let E=t.get(x).light;S.referencePosition.value.setFromMatrixPosition(E.matrixWorld),S.nearDistance.value=E.shadow.camera.near,S.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function tD(i,t,e,n){let s={},r={},l=[],c=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function h(E,T){let A=T.program;n.uniformBlockBinding(E,A)}function f(E,T){let A=s[E.id];A===void 0&&(y(E),A=p(E),s[E.id]=A,E.addEventListener("dispose",S));let N=T.program;n.updateUBOMapping(E,N);let D=t.render.frame;r[E.id]!==D&&(g(E),r[E.id]=D)}function p(E){let T=m();E.__bindingPointIndex=T;let A=i.createBuffer(),N=E.__size,D=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,A),i.bufferData(i.UNIFORM_BUFFER,N,D),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,A),A}function m(){for(let E=0;E<c;E++)if(l.indexOf(E)===-1)return l.push(E),E;return Qt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(E){let T=s[E.id],A=E.uniforms,N=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let D=0,L=A.length;D<L;D++){let F=Array.isArray(A[D])?A[D]:[A[D]];for(let C=0,w=F.length;C<w;C++){let z=F[C];if(v(z,D,C,N)===!0){let Y=z.__offset,G=Array.isArray(z.value)?z.value:[z.value],j=0;for(let nt=0;nt<G.length;nt++){let J=G[nt],et=b(J);typeof J=="number"||typeof J=="boolean"?(z.__data[0]=J,i.bufferSubData(i.UNIFORM_BUFFER,Y+j,z.__data)):J.isMatrix3?(z.__data[0]=J.elements[0],z.__data[1]=J.elements[1],z.__data[2]=J.elements[2],z.__data[3]=0,z.__data[4]=J.elements[3],z.__data[5]=J.elements[4],z.__data[6]=J.elements[5],z.__data[7]=0,z.__data[8]=J.elements[6],z.__data[9]=J.elements[7],z.__data[10]=J.elements[8],z.__data[11]=0):(J.toArray(z.__data,j),j+=et.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,Y,z.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function v(E,T,A,N){let D=E.value,L=T+"_"+A;if(N[L]===void 0)return typeof D=="number"||typeof D=="boolean"?N[L]=D:N[L]=D.clone(),!0;{let F=N[L];if(typeof D=="number"||typeof D=="boolean"){if(F!==D)return N[L]=D,!0}else if(F.equals(D)===!1)return F.copy(D),!0}return!1}function y(E){let T=E.uniforms,A=0,N=16;for(let L=0,F=T.length;L<F;L++){let C=Array.isArray(T[L])?T[L]:[T[L]];for(let w=0,z=C.length;w<z;w++){let Y=C[w],G=Array.isArray(Y.value)?Y.value:[Y.value];for(let j=0,nt=G.length;j<nt;j++){let J=G[j],et=b(J),rt=A%N,St=rt%et.boundary,bt=rt+St;A+=St,bt!==0&&N-bt<et.storage&&(A+=N-bt),Y.__data=new Float32Array(et.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=A,A+=et.storage}}}let D=A%N;return D>0&&(A+=N-D),E.__size=A,E.__cache={},this}function b(E){let T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?wt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):wt("WebGLRenderer: Unsupported uniform value type.",E),T}function S(E){let T=E.target;T.removeEventListener("dispose",S);let A=l.indexOf(T.__bindingPointIndex);l.splice(A,1),i.deleteBuffer(s[T.id]),delete s[T.id],delete r[T.id]}function x(){for(let E in s)i.deleteBuffer(s[E]);l=[],s={},r={}}return{bind:h,update:f,dispose:x}}var eD=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]),zs=null;function nD(){return zs===null&&(zs=new vi(eD,16,16,ar,Ss),zs.name="DFG_LUT",zs.minFilter=Je,zs.magFilter=Je,zs.wrapS=li,zs.wrapT=li,zs.generateMipmaps=!1,zs.needsUpdate=!0),zs}var vo=class{constructor(t={}){let{canvas:e=ev(),context:n=null,depth:s=!0,stencil:r=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:g=!1,outputBufferType:v=Gn}=t;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=l;let b=v,S=new Set([kh,Gh,uc]),x=new Set([Gn,Fi,ho,fo,zh,Vh]),E=new Uint32Array(4),T=new Int32Array(4),A=null,N=null,D=[],L=[],F=null;this.domElement=e,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=Si,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let C=this,w=!1;this._outputColorSpace=Dn;let z=0,Y=0,G=null,j=-1,nt=null,J=new qe,et=new qe,rt=null,St=new Lt(0),bt=0,mt=e.width,kt=e.height,$t=1,re=null,Ce=null,at=new qe(0,0,mt,kt),dt=new qe(0,0,mt,kt),Vt=!1,ie=new fa,Ft=!1,ye=!1,Re=new ue,ce=new O,ct=new qe,gt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},lt=!1;function Nt(){return G===null?$t:1}let B=n;function Zt(U,W){return e.getContext(U,W)}try{let U={alpha:!0,depth:s,stencil:r,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:m};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"182"}`),e.addEventListener("webglcontextlost",oe,!1),e.addEventListener("webglcontextrestored",Be,!1),e.addEventListener("webglcontextcreationerror",De,!1),B===null){let W="webgl2";if(B=Zt(W,U),B===null)throw Zt(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(U){throw Qt("WebGLRenderer: "+U.message),U}let Dt,se,Mt,I,R,k,it,ht,st,jt,Et,Wt,Kt,pt,Ct,Xt,Yt,Tt,ge,H,Ut,xt,Ot,_t;function ut(){Dt=new u3(B),Dt.init(),xt=new Zb(B,Dt),se=new e3(B,Dt,t,xt),Mt=new ZN(B,Dt),se.reversedDepthBuffer&&g&&Mt.buffers.depth.setReversed(!0),I=new d3(B),R=new PN,k=new jN(B,Dt,Mt,R,se,xt,I),it=new i3(C),ht=new c3(C),st=new _R(B),Ot=new $2(B,st),jt=new h3(B,st,I,Ot),Et=new m3(B,jt,st,I),ge=new p3(B,se,k),Xt=new n3(R),Wt=new UN(C,it,ht,Dt,se,Ot,Xt),Kt=new $N(C,R),pt=new LN,Ct=new HN(Dt),Tt=new Q2(C,it,ht,Mt,Et,y,h),Yt=new qN(C,Et,se),_t=new tD(B,I,se,Mt),H=new t3(B,Dt,I),Ut=new f3(B,Dt,I),I.programs=Wt.programs,C.capabilities=se,C.extensions=Dt,C.properties=R,C.renderLists=pt,C.shadowMap=Yt,C.state=Mt,C.info=I}ut(),b!==Gn&&(F=new _3(b,e.width,e.height,s,r));let At=new Ev(C,B);this.xr=At,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let U=Dt.get("WEBGL_lose_context");U&&U.loseContext()},this.forceContextRestore=function(){let U=Dt.get("WEBGL_lose_context");U&&U.restoreContext()},this.getPixelRatio=function(){return $t},this.setPixelRatio=function(U){U!==void 0&&($t=U,this.setSize(mt,kt,!1))},this.getSize=function(U){return U.set(mt,kt)},this.setSize=function(U,W,$=!0){if(At.isPresenting){wt("WebGLRenderer: Can't change size while VR device is presenting.");return}mt=U,kt=W,e.width=Math.floor(U*$t),e.height=Math.floor(W*$t),$===!0&&(e.style.width=U+"px",e.style.height=W+"px"),F!==null&&F.setSize(e.width,e.height),this.setViewport(0,0,U,W)},this.getDrawingBufferSize=function(U){return U.set(mt*$t,kt*$t).floor()},this.setDrawingBufferSize=function(U,W,$){mt=U,kt=W,$t=$,e.width=Math.floor(U*$),e.height=Math.floor(W*$),this.setViewport(0,0,U,W)},this.setEffects=function(U){if(b===Gn){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(U){for(let W=0;W<U.length;W++)if(U[W].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}F.setEffects(U||[])},this.getCurrentViewport=function(U){return U.copy(J)},this.getViewport=function(U){return U.copy(at)},this.setViewport=function(U,W,$,Q){U.isVector4?at.set(U.x,U.y,U.z,U.w):at.set(U,W,$,Q),Mt.viewport(J.copy(at).multiplyScalar($t).round())},this.getScissor=function(U){return U.copy(dt)},this.setScissor=function(U,W,$,Q){U.isVector4?dt.set(U.x,U.y,U.z,U.w):dt.set(U,W,$,Q),Mt.scissor(et.copy(dt).multiplyScalar($t).round())},this.getScissorTest=function(){return Vt},this.setScissorTest=function(U){Mt.setScissorTest(Vt=U)},this.setOpaqueSort=function(U){re=U},this.setTransparentSort=function(U){Ce=U},this.getClearColor=function(U){return U.copy(Tt.getClearColor())},this.setClearColor=function(){Tt.setClearColor(...arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){Tt.setClearAlpha(...arguments)},this.clear=function(U=!0,W=!0,$=!0){let Q=0;if(U){let Z=!1;if(G!==null){let Rt=G.texture.format;Z=S.has(Rt)}if(Z){let Rt=G.texture.type,Ht=x.has(Rt),Pt=Tt.getClearColor(),qt=Tt.getClearAlpha(),Jt=Pt.r,ae=Pt.g,te=Pt.b;Ht?(E[0]=Jt,E[1]=ae,E[2]=te,E[3]=qt,B.clearBufferuiv(B.COLOR,0,E)):(T[0]=Jt,T[1]=ae,T[2]=te,T[3]=qt,B.clearBufferiv(B.COLOR,0,T))}else Q|=B.COLOR_BUFFER_BIT}W&&(Q|=B.DEPTH_BUFFER_BIT),$&&(Q|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B.clear(Q)},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(){e.removeEventListener("webglcontextlost",oe,!1),e.removeEventListener("webglcontextrestored",Be,!1),e.removeEventListener("webglcontextcreationerror",De,!1),Tt.dispose(),pt.dispose(),Ct.dispose(),R.dispose(),it.dispose(),ht.dispose(),Et.dispose(),Ot.dispose(),_t.dispose(),Wt.dispose(),At.dispose(),At.removeEventListener("sessionstart",es),At.removeEventListener("sessionend",Hi),Gi.stop()};function oe(U){U.preventDefault(),wl("WebGLRenderer: Context Lost."),w=!0}function Be(){wl("WebGLRenderer: Context Restored."),w=!1;let U=I.autoReset,W=Yt.enabled,$=Yt.autoUpdate,Q=Yt.needsUpdate,Z=Yt.type;ut(),I.autoReset=U,Yt.enabled=W,Yt.autoUpdate=$,Yt.needsUpdate=Q,Yt.type=Z}function De(U){Qt("WebGLRenderer: A WebGL context could not be created. Reason: ",U.statusMessage)}function Mi(U){let W=U.target;W.removeEventListener("dispose",Mi),zi(W)}function zi(U){Rc(U),R.remove(U)}function Rc(U){let W=R.get(U).programs;W!==void 0&&(W.forEach(function($){Wt.releaseProgram($)}),U.isShaderMaterial&&Wt.releaseShaderCache(U))}this.renderBufferDirect=function(U,W,$,Q,Z,Rt){W===null&&(W=gt);let Ht=Z.isMesh&&Z.matrixWorld.determinant()<0,Pt=Nc(U,W,$,Q,Z);Mt.setMaterial(Q,Ht);let qt=$.index,Jt=1;if(Q.wireframe===!0){if(qt=jt.getWireframeAttribute($),qt===void 0)return;Jt=2}let ae=$.drawRange,te=$.attributes.position,Se=ae.start*Jt,Fe=(ae.start+ae.count)*Jt;Rt!==null&&(Se=Math.max(Se,Rt.start*Jt),Fe=Math.min(Fe,(Rt.start+Rt.count)*Jt)),qt!==null?(Se=Math.max(Se,0),Fe=Math.min(Fe,qt.count)):te!=null&&(Se=Math.max(Se,0),Fe=Math.min(Fe,te.count));let Qe=Fe-Se;if(Qe<0||Qe===1/0)return;Ot.setup(Z,Q,Pt,$,qt);let $e,ze=H;if(qt!==null&&($e=st.get(qt),ze=Ut,ze.setIndex($e)),Z.isMesh)Q.wireframe===!0?(Mt.setLineWidth(Q.wireframeLinewidth*Nt()),ze.setMode(B.LINES)):ze.setMode(B.TRIANGLES);else if(Z.isLine){let ee=Q.linewidth;ee===void 0&&(ee=1),Mt.setLineWidth(ee*Nt()),Z.isLineSegments?ze.setMode(B.LINES):Z.isLineLoop?ze.setMode(B.LINE_LOOP):ze.setMode(B.LINE_STRIP)}else Z.isPoints?ze.setMode(B.POINTS):Z.isSprite&&ze.setMode(B.TRIANGLES);if(Z.isBatchedMesh)if(Z._multiDrawInstances!==null)Zr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ze.renderMultiDrawInstances(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount,Z._multiDrawInstances);else if(Dt.get("WEBGL_multi_draw"))ze.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else{let ee=Z._multiDrawStarts,Ue=Z._multiDrawCounts,Ae=Z._multiDrawCount,Wn=qt?st.get(qt).bytesPerElement:1,Gs=R.get(Q).currentProgram.getUniforms();for(let ii=0;ii<Ae;ii++)Gs.setValue(B,"_gl_DrawID",ii),ze.render(ee[ii]/Wn,Ue[ii])}else if(Z.isInstancedMesh)ze.renderInstances(Se,Qe,Z.count);else if($.isInstancedBufferGeometry){let ee=$._maxInstanceCount!==void 0?$._maxInstanceCount:1/0,Ue=Math.min($.instanceCount,ee);ze.renderInstances(Se,Qe,Ue)}else ze.render(Se,Qe)};function bo(U,W,$){U.transparent===!0&&U.side===_s&&U.forceSinglePass===!1?(U.side=ti,U.needsUpdate=!0,Ao(U,W,$),U.side=Us,U.needsUpdate=!0,Ao(U,W,$),U.side=_s):Ao(U,W,$)}this.compile=function(U,W,$=null){$===null&&($=U),N=Ct.get($),N.init(W),L.push(N),$.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(N.pushLight(Z),Z.castShadow&&N.pushShadow(Z))}),U!==$&&U.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(N.pushLight(Z),Z.castShadow&&N.pushShadow(Z))}),N.setupLights();let Q=new Set;return U.traverse(function(Z){if(!(Z.isMesh||Z.isPoints||Z.isLine||Z.isSprite))return;let Rt=Z.material;if(Rt)if(Array.isArray(Rt))for(let Ht=0;Ht<Rt.length;Ht++){let Pt=Rt[Ht];bo(Pt,$,Z),Q.add(Pt)}else bo(Rt,$,Z),Q.add(Rt)}),N=L.pop(),Q},this.compileAsync=function(U,W,$=null){let Q=this.compile(U,W,$);return new Promise(Z=>{function Rt(){if(Q.forEach(function(Ht){R.get(Ht).currentProgram.isReady()&&Q.delete(Ht)}),Q.size===0){Z(U);return}setTimeout(Rt,10)}Dt.get("KHR_parallel_shader_compile")!==null?Rt():setTimeout(Rt,10)})};let Vi=null;function Lf(U){Vi&&Vi(U)}function es(){Gi.stop()}function Hi(){Gi.start()}let Gi=new kb;Gi.setAnimationLoop(Lf),typeof self<"u"&&Gi.setContext(self),this.setAnimationLoop=function(U){Vi=U,At.setAnimationLoop(U),U===null?Gi.stop():Gi.start()},At.addEventListener("sessionstart",es),At.addEventListener("sessionend",Hi),this.render=function(U,W){if(W!==void 0&&W.isCamera!==!0){Qt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;let $=At.enabled===!0&&At.isPresenting===!0,Q=F!==null&&(G===null||$)&&F.begin(C,G);if(U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),At.enabled===!0&&At.isPresenting===!0&&(F===null||F.isCompositing()===!1)&&(At.cameraAutoUpdate===!0&&At.updateCamera(W),W=At.getCamera()),U.isScene===!0&&U.onBeforeRender(C,U,W,G),N=Ct.get(U,L.length),N.init(W),L.push(N),Re.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),ie.setFromProjectionMatrix(Re,_i,W.reversedDepth),ye=this.localClippingEnabled,Ft=Xt.init(this.clippingPlanes,ye),A=pt.get(U,D.length),A.init(),D.push(A),At.enabled===!0&&At.isPresenting===!0){let Ht=C.xr.getDepthSensingMesh();Ht!==null&&Ke(Ht,W,-1/0,C.sortObjects)}Ke(U,W,0,C.sortObjects),A.finish(),C.sortObjects===!0&&A.sort(re,Ce),lt=At.enabled===!1||At.isPresenting===!1||At.hasDepthSensing()===!1,lt&&Tt.addToRenderList(A,U),this.info.render.frame++,Ft===!0&&Xt.beginShadows();let Z=N.state.shadowsArray;if(Yt.render(Z,U,W),Ft===!0&&Xt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&F.hasRenderPass())===!1){let Ht=A.opaque,Pt=A.transmissive;if(N.setupLights(),W.isArrayCamera){let qt=W.cameras;if(Pt.length>0)for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt];To(Ht,Pt,U,te)}lt&&Tt.render(U);for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt];Eo(A,U,te,te.viewport)}}else Pt.length>0&&To(Ht,Pt,U,W),lt&&Tt.render(U),Eo(A,U,W)}G!==null&&Y===0&&(k.updateMultisampleRenderTarget(G),k.updateRenderTargetMipmap(G)),Q&&F.end(C),U.isScene===!0&&U.onAfterRender(C,U,W),Ot.resetDefaultState(),j=-1,nt=null,L.pop(),L.length>0?(N=L[L.length-1],Ft===!0&&Xt.setGlobalState(C.clippingPlanes,N.state.camera)):N=null,D.pop(),D.length>0?A=D[D.length-1]:A=null};function Ke(U,W,$,Q){if(U.visible===!1)return;if(U.layers.test(W.layers)){if(U.isGroup)$=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(W);else if(U.isLight)N.pushLight(U),U.castShadow&&N.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||ie.intersectsSprite(U)){Q&&ct.setFromMatrixPosition(U.matrixWorld).applyMatrix4(Re);let Ht=Et.update(U),Pt=U.material;Pt.visible&&A.push(U,Ht,Pt,$,ct.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(!U.frustumCulled||ie.intersectsObject(U))){let Ht=Et.update(U),Pt=U.material;if(Q&&(U.boundingSphere!==void 0?(U.boundingSphere===null&&U.computeBoundingSphere(),ct.copy(U.boundingSphere.center)):(Ht.boundingSphere===null&&Ht.computeBoundingSphere(),ct.copy(Ht.boundingSphere.center)),ct.applyMatrix4(U.matrixWorld).applyMatrix4(Re)),Array.isArray(Pt)){let qt=Ht.groups;for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt],Se=Pt[te.materialIndex];Se&&Se.visible&&A.push(U,Ht,Se,$,ct.z,te)}}else Pt.visible&&A.push(U,Ht,Pt,$,ct.z,null)}}let Rt=U.children;for(let Ht=0,Pt=Rt.length;Ht<Pt;Ht++)Ke(Rt[Ht],W,$,Q)}function Eo(U,W,$,Q){let{opaque:Z,transmissive:Rt,transparent:Ht}=U;N.setupLightsView($),Ft===!0&&Xt.setGlobalState(C.clippingPlanes,$),Q&&Mt.viewport(J.copy(Q)),Z.length>0&&fr(Z,W,$),Rt.length>0&&fr(Rt,W,$),Ht.length>0&&fr(Ht,W,$),Mt.buffers.depth.setTest(!0),Mt.buffers.depth.setMask(!0),Mt.buffers.color.setMask(!0),Mt.setPolygonOffset(!1)}function To(U,W,$,Q){if(($.isScene===!0?$.overrideMaterial:null)!==null)return;if(N.state.transmissionRenderTarget[Q.id]===void 0){let Se=Dt.has("EXT_color_buffer_half_float")||Dt.has("EXT_color_buffer_float");N.state.transmissionRenderTarget[Q.id]=new $n(1,1,{generateMipmaps:!0,type:Se?Ss:Gn,minFilter:ys,samples:se.samples,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:be.workingColorSpace})}let Rt=N.state.transmissionRenderTarget[Q.id],Ht=Q.viewport||J;Rt.setSize(Ht.z*C.transmissionResolutionScale,Ht.w*C.transmissionResolutionScale);let Pt=C.getRenderTarget(),qt=C.getActiveCubeFace(),Jt=C.getActiveMipmapLevel();C.setRenderTarget(Rt),C.getClearColor(St),bt=C.getClearAlpha(),bt<1&&C.setClearColor(16777215,.5),C.clear(),lt&&Tt.render($);let ae=C.toneMapping;C.toneMapping=Si;let te=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),N.setupLightsView(Q),Ft===!0&&Xt.setGlobalState(C.clippingPlanes,Q),fr(U,$,Q),k.updateMultisampleRenderTarget(Rt),k.updateRenderTargetMipmap(Rt),Dt.has("WEBGL_multisampled_render_to_texture")===!1){let Se=!1;for(let Fe=0,Qe=W.length;Fe<Qe;Fe++){let $e=W[Fe],{object:ze,geometry:ee,material:Ue,group:Ae}=$e;if(Ue.side===_s&&ze.layers.test(Q.layers)){let Wn=Ue.side;Ue.side=ti,Ue.needsUpdate=!0,wc(ze,$,Q,ee,Ue,Ae),Ue.side=Wn,Ue.needsUpdate=!0,Se=!0}}Se===!0&&(k.updateMultisampleRenderTarget(Rt),k.updateRenderTargetMipmap(Rt))}C.setRenderTarget(Pt,qt,Jt),C.setClearColor(St,bt),te!==void 0&&(Q.viewport=te),C.toneMapping=ae}function fr(U,W,$){let Q=W.isScene===!0?W.overrideMaterial:null;for(let Z=0,Rt=U.length;Z<Rt;Z++){let Ht=U[Z],{object:Pt,geometry:qt,group:Jt}=Ht,ae=Ht.material;ae.allowOverride===!0&&Q!==null&&(ae=Q),Pt.layers.test($.layers)&&wc(Pt,W,$,qt,ae,Jt)}}function wc(U,W,$,Q,Z,Rt){U.onBeforeRender(C,W,$,Q,Z,Rt),U.modelViewMatrix.multiplyMatrices($.matrixWorldInverse,U.matrixWorld),U.normalMatrix.getNormalMatrix(U.modelViewMatrix),Z.onBeforeRender(C,W,$,Q,U,Rt),Z.transparent===!0&&Z.side===_s&&Z.forceSinglePass===!1?(Z.side=ti,Z.needsUpdate=!0,C.renderBufferDirect($,W,Q,Z,U,Rt),Z.side=Us,Z.needsUpdate=!0,C.renderBufferDirect($,W,Q,Z,U,Rt),Z.side=_s):C.renderBufferDirect($,W,Q,Z,U,Rt),U.onAfterRender(C,W,$,Q,Z,Rt)}function Ao(U,W,$){W.isScene!==!0&&(W=gt);let Q=R.get(U),Z=N.state.lights,Rt=N.state.shadowsArray,Ht=Z.state.version,Pt=Wt.getParameters(U,Z.state,Rt,W,$),qt=Wt.getProgramCacheKey(Pt),Jt=Q.programs;Q.environment=U.isMeshStandardMaterial?W.environment:null,Q.fog=W.fog,Q.envMap=(U.isMeshStandardMaterial?ht:it).get(U.envMap||Q.environment),Q.envMapRotation=Q.environment!==null&&U.envMap===null?W.environmentRotation:U.envMapRotation,Jt===void 0&&(U.addEventListener("dispose",Mi),Jt=new Map,Q.programs=Jt);let ae=Jt.get(qt);if(ae!==void 0){if(Q.currentProgram===ae&&Q.lightsStateVersion===Ht)return Ro(U,Pt),ae}else Pt.uniforms=Wt.getUniforms(U),U.onBeforeCompile(Pt,C),ae=Wt.acquireProgram(Pt,qt),Jt.set(qt,ae),Q.uniforms=Pt.uniforms;let te=Q.uniforms;return(!U.isShaderMaterial&&!U.isRawShaderMaterial||U.clipping===!0)&&(te.clippingPlanes=Xt.uniform),Ro(U,Pt),Q.needsLights=on(U),Q.lightsStateVersion=Ht,Q.needsLights&&(te.ambientLightColor.value=Z.state.ambient,te.lightProbe.value=Z.state.probe,te.directionalLights.value=Z.state.directional,te.directionalLightShadows.value=Z.state.directionalShadow,te.spotLights.value=Z.state.spot,te.spotLightShadows.value=Z.state.spotShadow,te.rectAreaLights.value=Z.state.rectArea,te.ltc_1.value=Z.state.rectAreaLTC1,te.ltc_2.value=Z.state.rectAreaLTC2,te.pointLights.value=Z.state.point,te.pointLightShadows.value=Z.state.pointShadow,te.hemisphereLights.value=Z.state.hemi,te.directionalShadowMap.value=Z.state.directionalShadowMap,te.directionalShadowMatrix.value=Z.state.directionalShadowMatrix,te.spotShadowMap.value=Z.state.spotShadowMap,te.spotLightMatrix.value=Z.state.spotLightMatrix,te.spotLightMap.value=Z.state.spotLightMap,te.pointShadowMap.value=Z.state.pointShadowMap,te.pointShadowMatrix.value=Z.state.pointShadowMatrix),Q.currentProgram=ae,Q.uniformsList=null,ae}function Co(U){if(U.uniformsList===null){let W=U.currentProgram.getUniforms();U.uniformsList=gc.seqWithValue(W.seq,U.uniforms)}return U.uniformsList}function Ro(U,W){let $=R.get(U);$.outputColorSpace=W.outputColorSpace,$.batching=W.batching,$.batchingColor=W.batchingColor,$.instancing=W.instancing,$.instancingColor=W.instancingColor,$.instancingMorph=W.instancingMorph,$.skinning=W.skinning,$.morphTargets=W.morphTargets,$.morphNormals=W.morphNormals,$.morphColors=W.morphColors,$.morphTargetsCount=W.morphTargetsCount,$.numClippingPlanes=W.numClippingPlanes,$.numIntersection=W.numClipIntersection,$.vertexAlphas=W.vertexAlphas,$.vertexTangents=W.vertexTangents,$.toneMapping=W.toneMapping}function Nc(U,W,$,Q,Z){W.isScene!==!0&&(W=gt),k.resetTextureUnits();let Rt=W.fog,Ht=Q.isMeshStandardMaterial?W.environment:null,Pt=G===null?C.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:Ps,qt=(Q.isMeshStandardMaterial?ht:it).get(Q.envMap||Ht),Jt=Q.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,ae=!!$.attributes.tangent&&(!!Q.normalMap||Q.anisotropy>0),te=!!$.morphAttributes.position,Se=!!$.morphAttributes.normal,Fe=!!$.morphAttributes.color,Qe=Si;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Qe=C.toneMapping);let $e=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ze=$e!==void 0?$e.length:0,ee=R.get(Q),Ue=N.state.lights;if(Ft===!0&&(ye===!0||U!==nt)){let gn=U===nt&&Q.id===j;Xt.setState(Q,U,gn)}let Ae=!1;Q.version===ee.__version?(ee.needsLights&&ee.lightsStateVersion!==Ue.state.version||ee.outputColorSpace!==Pt||Z.isBatchedMesh&&ee.batching===!1||!Z.isBatchedMesh&&ee.batching===!0||Z.isBatchedMesh&&ee.batchingColor===!0&&Z.colorTexture===null||Z.isBatchedMesh&&ee.batchingColor===!1&&Z.colorTexture!==null||Z.isInstancedMesh&&ee.instancing===!1||!Z.isInstancedMesh&&ee.instancing===!0||Z.isSkinnedMesh&&ee.skinning===!1||!Z.isSkinnedMesh&&ee.skinning===!0||Z.isInstancedMesh&&ee.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&ee.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&ee.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&ee.instancingMorph===!1&&Z.morphTexture!==null||ee.envMap!==qt||Q.fog===!0&&ee.fog!==Rt||ee.numClippingPlanes!==void 0&&(ee.numClippingPlanes!==Xt.numPlanes||ee.numIntersection!==Xt.numIntersection)||ee.vertexAlphas!==Jt||ee.vertexTangents!==ae||ee.morphTargets!==te||ee.morphNormals!==Se||ee.morphColors!==Fe||ee.toneMapping!==Qe||ee.morphTargetsCount!==ze)&&(Ae=!0):(Ae=!0,ee.__version=Q.version);let Wn=ee.currentProgram;Ae===!0&&(Wn=Ao(Q,W,Z));let Gs=!1,ii=!1,ya=!1,Ne=Wn.getUniforms(),In=ee.uniforms;if(Mt.useProgram(Wn.program)&&(Gs=!0,ii=!0,ya=!0),Q.id!==j&&(j=Q.id,ii=!0),Gs||nt!==U){Mt.buffers.depth.getReversed()&&U.reversedDepth!==!0&&(U._reversedDepth=!0,U.updateProjectionMatrix()),Ne.setValue(B,"projectionMatrix",U.projectionMatrix),Ne.setValue(B,"viewMatrix",U.matrixWorldInverse);let On=Ne.map.cameraPosition;On!==void 0&&On.setValue(B,ce.setFromMatrixPosition(U.matrixWorld)),se.logarithmicDepthBuffer&&Ne.setValue(B,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ne.setValue(B,"isOrthographic",U.isOrthographicCamera===!0),nt!==U&&(nt=U,ii=!0,ya=!0)}if(ee.needsLights&&(Ue.state.directionalShadowMap.length>0&&Ne.setValue(B,"directionalShadowMap",Ue.state.directionalShadowMap,k),Ue.state.spotShadowMap.length>0&&Ne.setValue(B,"spotShadowMap",Ue.state.spotShadowMap,k),Ue.state.pointShadowMap.length>0&&Ne.setValue(B,"pointShadowMap",Ue.state.pointShadowMap,k)),Z.isSkinnedMesh){Ne.setOptional(B,Z,"bindMatrix"),Ne.setOptional(B,Z,"bindMatrixInverse");let gn=Z.skeleton;gn&&(gn.boneTexture===null&&gn.computeBoneTexture(),Ne.setValue(B,"boneTexture",gn.boneTexture,k))}Z.isBatchedMesh&&(Ne.setOptional(B,Z,"batchingTexture"),Ne.setValue(B,"batchingTexture",Z._matricesTexture,k),Ne.setOptional(B,Z,"batchingIdTexture"),Ne.setValue(B,"batchingIdTexture",Z._indirectTexture,k),Ne.setOptional(B,Z,"batchingColorTexture"),Z._colorsTexture!==null&&Ne.setValue(B,"batchingColorTexture",Z._colorsTexture,k));let Ln=$.morphAttributes;if((Ln.position!==void 0||Ln.normal!==void 0||Ln.color!==void 0)&&ge.update(Z,$,Wn),(ii||ee.receiveShadow!==Z.receiveShadow)&&(ee.receiveShadow=Z.receiveShadow,Ne.setValue(B,"receiveShadow",Z.receiveShadow)),Q.isMeshGouraudMaterial&&Q.envMap!==null&&(In.envMap.value=qt,In.flipEnvMap.value=qt.isCubeTexture&&qt.isRenderTargetTexture===!1?-1:1),Q.isMeshStandardMaterial&&Q.envMap===null&&W.environment!==null&&(In.envMapIntensity.value=W.environmentIntensity),In.dfgLUT!==void 0&&(In.dfgLUT.value=nD()),ii&&(Ne.setValue(B,"toneMappingExposure",C.toneMappingExposure),ee.needsLights&&kn(In,ya),Rt&&Q.fog===!0&&Kt.refreshFogUniforms(In,Rt),Kt.refreshMaterialUniforms(In,Q,$t,kt,N.state.transmissionRenderTarget[U.id]),gc.upload(B,Co(ee),In,k)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(gc.upload(B,Co(ee),In,k),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ne.setValue(B,"center",Z.center),Ne.setValue(B,"modelViewMatrix",Z.modelViewMatrix),Ne.setValue(B,"normalMatrix",Z.normalMatrix),Ne.setValue(B,"modelMatrix",Z.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){let gn=Q.uniformsGroups;for(let On=0,pr=gn.length;On<pr;On++){let Es=gn[On];_t.update(Es,Wn),_t.bind(Es,Wn)}}return Wn}function kn(U,W){U.ambientLightColor.needsUpdate=W,U.lightProbe.needsUpdate=W,U.directionalLights.needsUpdate=W,U.directionalLightShadows.needsUpdate=W,U.pointLights.needsUpdate=W,U.pointLightShadows.needsUpdate=W,U.spotLights.needsUpdate=W,U.spotLightShadows.needsUpdate=W,U.rectAreaLights.needsUpdate=W,U.hemisphereLights.needsUpdate=W}function on(U){return U.isMeshLambertMaterial||U.isMeshToonMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isShadowMaterial||U.isShaderMaterial&&U.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(U,W,$){let Q=R.get(U);Q.__autoAllocateDepthBuffer=U.resolveDepthBuffer===!1,Q.__autoAllocateDepthBuffer===!1&&(Q.__useRenderToTexture=!1),R.get(U.texture).__webglTexture=W,R.get(U.depthTexture).__webglTexture=Q.__autoAllocateDepthBuffer?void 0:$,Q.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(U,W){let $=R.get(U);$.__webglFramebuffer=W,$.__useDefaultFramebuffer=W===void 0};let dr=B.createFramebuffer();this.setRenderTarget=function(U,W=0,$=0){G=U,z=W,Y=$;let Q=null,Z=!1,Rt=!1;if(U){let Pt=R.get(U);if(Pt.__useDefaultFramebuffer!==void 0){Mt.bindFramebuffer(B.FRAMEBUFFER,Pt.__webglFramebuffer),J.copy(U.viewport),et.copy(U.scissor),rt=U.scissorTest,Mt.viewport(J),Mt.scissor(et),Mt.setScissorTest(rt),j=-1;return}else if(Pt.__webglFramebuffer===void 0)k.setupRenderTarget(U);else if(Pt.__hasExternalTextures)k.rebindTextures(U,R.get(U.texture).__webglTexture,R.get(U.depthTexture).__webglTexture);else if(U.depthBuffer){let ae=U.depthTexture;if(Pt.__boundDepthTexture!==ae){if(ae!==null&&R.has(ae)&&(U.width!==ae.image.width||U.height!==ae.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");k.setupDepthRenderbuffer(U)}}let qt=U.texture;(qt.isData3DTexture||qt.isDataArrayTexture||qt.isCompressedArrayTexture)&&(Rt=!0);let Jt=R.get(U).__webglFramebuffer;U.isWebGLCubeRenderTarget?(Array.isArray(Jt[W])?Q=Jt[W][$]:Q=Jt[W],Z=!0):U.samples>0&&k.useMultisampledRTT(U)===!1?Q=R.get(U).__webglMultisampledFramebuffer:Array.isArray(Jt)?Q=Jt[$]:Q=Jt,J.copy(U.viewport),et.copy(U.scissor),rt=U.scissorTest}else J.copy(at).multiplyScalar($t).floor(),et.copy(dt).multiplyScalar($t).floor(),rt=Vt;if($!==0&&(Q=dr),Mt.bindFramebuffer(B.FRAMEBUFFER,Q)&&Mt.drawBuffers(U,Q),Mt.viewport(J),Mt.scissor(et),Mt.setScissorTest(rt),Z){let Pt=R.get(U.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+W,Pt.__webglTexture,$)}else if(Rt){let Pt=W;for(let qt=0;qt<U.textures.length;qt++){let Jt=R.get(U.textures[qt]);B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0+qt,Jt.__webglTexture,$,Pt)}}else if(U!==null&&$!==0){let Pt=R.get(U.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Pt.__webglTexture,$)}j=-1},this.readRenderTargetPixels=function(U,W,$,Q,Z,Rt,Ht,Pt=0){if(!(U&&U.isWebGLRenderTarget)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qt=R.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Ht!==void 0&&(qt=qt[Ht]),qt){Mt.bindFramebuffer(B.FRAMEBUFFER,qt);try{let Jt=U.textures[Pt],ae=Jt.format,te=Jt.type;if(!se.textureFormatReadable(ae)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!se.textureTypeReadable(te)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=U.width-Q&&$>=0&&$<=U.height-Z&&(U.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Pt),B.readPixels(W,$,Q,Z,xt.convert(ae),xt.convert(te),Rt))}finally{let Jt=G!==null?R.get(G).__webglFramebuffer:null;Mt.bindFramebuffer(B.FRAMEBUFFER,Jt)}}},this.readRenderTargetPixelsAsync=async function(U,W,$,Q,Z,Rt,Ht,Pt=0){if(!(U&&U.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qt=R.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Ht!==void 0&&(qt=qt[Ht]),qt)if(W>=0&&W<=U.width-Q&&$>=0&&$<=U.height-Z){Mt.bindFramebuffer(B.FRAMEBUFFER,qt);let Jt=U.textures[Pt],ae=Jt.format,te=Jt.type;if(!se.textureFormatReadable(ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!se.textureTypeReadable(te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Se=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,Se),B.bufferData(B.PIXEL_PACK_BUFFER,Rt.byteLength,B.STREAM_READ),U.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Pt),B.readPixels(W,$,Q,Z,xt.convert(ae),xt.convert(te),0);let Fe=G!==null?R.get(G).__webglFramebuffer:null;Mt.bindFramebuffer(B.FRAMEBUFFER,Fe);let Qe=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await hb(B,Qe,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,Se),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Rt),B.deleteBuffer(Se),B.deleteSync(Qe),Rt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(U,W=null,$=0){let Q=Math.pow(2,-$),Z=Math.floor(U.image.width*Q),Rt=Math.floor(U.image.height*Q),Ht=W!==null?W.x:0,Pt=W!==null?W.y:0;k.setTexture2D(U,0),B.copyTexSubImage2D(B.TEXTURE_2D,$,0,0,Ht,Pt,Z,Rt),Mt.unbindTexture()};let wo=B.createFramebuffer(),Dc=B.createFramebuffer();this.copyTextureToTexture=function(U,W,$=null,Q=null,Z=0,Rt=null){Rt===null&&(Z!==0?(Zr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Rt=Z,Z=0):Rt=0);let Ht,Pt,qt,Jt,ae,te,Se,Fe,Qe,$e=U.isCompressedTexture?U.mipmaps[Rt]:U.image;if($!==null)Ht=$.max.x-$.min.x,Pt=$.max.y-$.min.y,qt=$.isBox3?$.max.z-$.min.z:1,Jt=$.min.x,ae=$.min.y,te=$.isBox3?$.min.z:0;else{let Ln=Math.pow(2,-Z);Ht=Math.floor($e.width*Ln),Pt=Math.floor($e.height*Ln),U.isDataArrayTexture?qt=$e.depth:U.isData3DTexture?qt=Math.floor($e.depth*Ln):qt=1,Jt=0,ae=0,te=0}Q!==null?(Se=Q.x,Fe=Q.y,Qe=Q.z):(Se=0,Fe=0,Qe=0);let ze=xt.convert(W.format),ee=xt.convert(W.type),Ue;W.isData3DTexture?(k.setTexture3D(W,0),Ue=B.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(k.setTexture2DArray(W,0),Ue=B.TEXTURE_2D_ARRAY):(k.setTexture2D(W,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,W.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,W.unpackAlignment);let Ae=B.getParameter(B.UNPACK_ROW_LENGTH),Wn=B.getParameter(B.UNPACK_IMAGE_HEIGHT),Gs=B.getParameter(B.UNPACK_SKIP_PIXELS),ii=B.getParameter(B.UNPACK_SKIP_ROWS),ya=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$e.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$e.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Jt),B.pixelStorei(B.UNPACK_SKIP_ROWS,ae),B.pixelStorei(B.UNPACK_SKIP_IMAGES,te);let Ne=U.isDataArrayTexture||U.isData3DTexture,In=W.isDataArrayTexture||W.isData3DTexture;if(U.isDepthTexture){let Ln=R.get(U),gn=R.get(W),On=R.get(Ln.__renderTarget),pr=R.get(gn.__renderTarget);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,On.__webglFramebuffer),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,pr.__webglFramebuffer);for(let Es=0;Es<qt;Es++)Ne&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,R.get(U).__webglTexture,Z,te+Es),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,R.get(W).__webglTexture,Rt,Qe+Es)),B.blitFramebuffer(Jt,ae,Ht,Pt,Se,Fe,Ht,Pt,B.DEPTH_BUFFER_BIT,B.NEAREST);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,null),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(Z!==0||U.isRenderTargetTexture||R.has(U)){let Ln=R.get(U),gn=R.get(W);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,wo),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,Dc);for(let On=0;On<qt;On++)Ne?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,Ln.__webglTexture,Z,te+On):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Ln.__webglTexture,Z),In?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,gn.__webglTexture,Rt,Qe+On):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,gn.__webglTexture,Rt),Z!==0?B.blitFramebuffer(Jt,ae,Ht,Pt,Se,Fe,Ht,Pt,B.COLOR_BUFFER_BIT,B.NEAREST):In?B.copyTexSubImage3D(Ue,Rt,Se,Fe,Qe+On,Jt,ae,Ht,Pt):B.copyTexSubImage2D(Ue,Rt,Se,Fe,Jt,ae,Ht,Pt);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,null),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else In?U.isDataTexture||U.isData3DTexture?B.texSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,ee,$e.data):W.isCompressedArrayTexture?B.compressedTexSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,$e.data):B.texSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,ee,$e):U.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,Ht,Pt,ze,ee,$e.data):U.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,$e.width,$e.height,ze,$e.data):B.texSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,Ht,Pt,ze,ee,$e);B.pixelStorei(B.UNPACK_ROW_LENGTH,Ae),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,Wn),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Gs),B.pixelStorei(B.UNPACK_SKIP_ROWS,ii),B.pixelStorei(B.UNPACK_SKIP_IMAGES,ya),Rt===0&&W.generateMipmaps&&B.generateMipmap(Ue),Mt.unbindTexture()},this.initRenderTarget=function(U){R.get(U).__webglFramebuffer===void 0&&k.setupRenderTarget(U)},this.initTexture=function(U){U.isCubeTexture?k.setTextureCube(U,0):U.isData3DTexture?k.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?k.setTexture2DArray(U,0):k.setTexture2D(U,0),Mt.unbindTexture()},this.resetState=function(){z=0,Y=0,G=null,Mt.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=be._getDrawingBufferColorSpace(t),e.unpackColorSpace=be._getUnpackColorSpace()}};var Sn=zn(or()),hr=zn(Uv());var y1=zn(or(),1),S1=zn(g1(),1);var _1=i=>{let t,e=new Set,n=(f,p)=>{let m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){let g=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),e.forEach(v=>v(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>h,subscribe:f=>(e.add(f),()=>e.delete(f))},h=t=i(n,s,c);return c},v1=(i=>i?_1(i):_1);var{useSyncExternalStoreWithSelector:OD}=S1.default,BD=i=>i;function FD(i,t=BD,e){let n=OD(i.subscribe,i.getState,i.getInitialState,t,e);return y1.default.useDebugValue(n),n}var x1=(i,t)=>{let e=v1(i),n=(s,r=t)=>FD(e,s,r);return Object.assign(n,e),n},M1=((i,t)=>i?x1(i,t):x1);var zD=i=>typeof i=="object"&&typeof i.then=="function",xo=[];function b1(i,t,e=(n,s)=>n===s){if(i===t)return!0;if(!i||!t)return!1;let n=i.length;if(t.length!==n)return!1;for(let s=0;s<n;s++)if(!e(i[s],t[s]))return!1;return!0}function E1(i,t=null,e=!1,n={}){t===null&&(t=[i]);for(let r of xo)if(b1(t,r.keys,r.equal)){if(e)return;if(Object.prototype.hasOwnProperty.call(r,"error"))throw r.error;if(Object.prototype.hasOwnProperty.call(r,"response"))return n.lifespan&&n.lifespan>0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,n.lifespan)),r.response;if(!e)throw r.promise}let s={keys:t,equal:n.equal,remove:()=>{let r=xo.indexOf(s);r!==-1&&xo.splice(r,1)},promise:(zD(i)?i:i(...t)).then(r=>{s.response=r,n.lifespan&&n.lifespan>0&&(s.timeout=setTimeout(s.remove,n.lifespan))}).catch(r=>s.error=r)};if(xo.push(s),!e)throw s.promise}var T1=(i,t,e)=>E1(i,t,!1,e),A1=(i,t,e)=>{E1(i,t,!0,e)};var C1=i=>{if(i===void 0||i.length===0)xo.splice(0,xo.length);else{let t=xo.find(e=>b1(i,e.keys,e.equal));t&&t.remove()}};var K1=zn(Hv()),tg=zn(km()),eg=zn(So());function Q1(i){let t=i.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}var $1=i=>i&&i.isOrthographicCamera;var kD=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),tx=((i,t)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((t=window.navigator)==null?void 0:t.product)==="ReactNative"))()?Sn.useLayoutEffect:Sn.useEffect;function WD(i){let t=Sn.useRef(i);return tx(()=>{t.current=i},[i]),t}function tE(i){var t;let e=typeof window<"u"?(t=window.devicePixelRatio)!=null?t:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],e),i[1]):i}function Mo(i){var t;return(t=i.__r3f)==null?void 0:t.root.getState()}var nn={obj:i=>i===Object(i)&&!nn.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,t,{arrays:e="shallow",objects:n="reference",strict:s=!0}={}){if(typeof i!=typeof t||!!i!=!!t)return!1;if(nn.str(i)||nn.num(i)||nn.boo(i))return i===t;let r=nn.obj(i);if(r&&n==="reference")return i===t;let l=nn.arr(i);if(l&&e==="reference")return i===t;if((l||r)&&i===t)return!0;let c;for(c in i)if(!(c in t))return!1;if(r&&e==="shallow"&&n==="shallow"){for(c in s?t:i)if(!nn.equ(i[c],t[c],{strict:s,objects:"reference"}))return!1}else for(c in s?t:i)if(i[c]!==t[c])return!1;if(nn.und(c)){if(l&&i.length===0&&t.length===0||r&&Object.keys(i).length===0&&Object.keys(t).length===0)return!0;if(i!==t)return!1}return!0}};function eE(i){let t={nodes:{},materials:{},meshes:{}};return i&&i.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}function nE(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(let t in i){let e=i[t];e?.type!=="Scene"&&(e==null||e.dispose==null||e.dispose())}}var iE=["children","key","ref"];function XD(i){let t={};for(let e in i)iE.includes(e)||(t[e]=i[e]);return t}function Zm(i,t,e,n){let s=i,r=s?.__r3f;return r||(r={root:t,type:e,parent:null,children:[],props:XD(n),object:s,eventCount:0,handlers:{},isHidden:!1},s&&(s.__r3f=r)),r}function If(i,t){if(!t.includes("-"))return{root:i,key:t,target:i[t]};if(t in i)return{root:i,key:t,target:i[t]};let e=i,n=t.split("-");for(let s of n){if(typeof e!="object"||e===null){if(e!==void 0){let r=n.slice(n.indexOf(s)).join("-");return{root:e,key:r,target:void 0}}return{root:i,key:t,target:void 0}}t=s,i=e,e=e[t]}return{root:i,key:t,target:e}}var W1=/-\d+$/;function jm(i,t){if(nn.str(t.props.attach)){if(W1.test(t.props.attach)){let s=t.props.attach.replace(W1,""),{root:r,key:l}=If(i.object,s);Array.isArray(r[l])||(r[l]=[])}let{root:e,key:n}=If(i.object,t.props.attach);t.previousAttach=e[n],e[n]=t.object}else nn.fun(t.props.attach)&&(t.previousAttach=t.props.attach(i.object,t.object))}function Jm(i,t){if(nn.str(t.props.attach)){let{root:e,key:n}=If(i.object,t.props.attach),s=t.previousAttach;s===void 0?delete e[n]:e[n]=s}else t.previousAttach==null||t.previousAttach(i.object,t.object);delete t.previousAttach}var jv=[...iE,"args","dispose","attach","object","onUpdate","dispose"],X1=new Map;function qD(i){let t=X1.get(i.constructor);try{t||(t=new i.constructor,X1.set(i.constructor,t))}catch{}return t}function YD(i,t){let e={};for(let n in t)if(!jv.includes(n)&&!nn.equ(t[n],i.props[n])){e[n]=t[n];for(let s in t)s.startsWith(`${n}-`)&&(e[s]=t[s])}for(let n in i.props){if(jv.includes(n)||t.hasOwnProperty(n))continue;let{root:s,key:r}=If(i.object,n);if(s.constructor&&s.constructor.length===0){let l=qD(s);nn.und(l)||(e[r]=l[r])}else e[r]=0}return e}var ZD=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],jD=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function xa(i,t){var e;let n=i.__r3f,s=n&&Q1(n).getState(),r=n?.eventCount;for(let c in t){let h=t[c];if(jv.includes(c))continue;if(n&&jD.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:m}=If(i,c);if(m===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(m instanceof Is&&h instanceof Is)m.mask=h.mask;else if(m instanceof Lt&&kD(h))m.set(h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof m.copy=="function"&&h!=null&&h.constructor&&m.constructor===h.constructor)m.copy(h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&Array.isArray(h))typeof m.fromArray=="function"?m.fromArray(h):m.set(...h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof h=="number")typeof m.setScalar=="function"?m.setScalar(h):m.set(h);else{var l;f[p]=h,s&&!s.linear&&ZD.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===Un&&f[p].type===Gn&&(f[p].colorSpace=Dn)}}if(n!=null&&n.parent&&s!=null&&s.internal&&(e=n.object)!=null&&e.isObject3D&&r!==n.eventCount){let c=n.object,h=s.internal.interaction.indexOf(c);h>-1&&s.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&s.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Tc(n),i}function Tc(i){var t;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);let e=(t=i.root)==null||t.getState==null?void 0:t.getState();e&&e.internal.frames===0&&e.invalidate()}function JD(i,t){i.manual||($1(i)?(i.left=t.width/-2,i.right=t.width/2,i.top=t.height/2,i.bottom=t.height/-2):i.aspect=t.width/t.height,i.updateProjectionMatrix())}var hi=i=>i?.isObject3D;function Xm(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function sE(i,t,e,n){let s=e.get(t);s&&(e.delete(t),e.size===0&&(i.delete(n),s.target.releasePointerCapture(n)))}function KD(i,t){let{internal:e}=i.getState();e.interaction=e.interaction.filter(n=>n!==t),e.initialHits=e.initialHits.filter(n=>n!==t),e.hovered.forEach((n,s)=>{(n.eventObject===t||n.object===t)&&e.hovered.delete(s)}),e.capturedMap.forEach((n,s)=>{sE(e.capturedMap,t,n,s)})}function aE(i){function t(h){let{internal:f}=i.getState(),p=h.offsetX-f.initialClick[0],m=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+m*m))}function e(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var m;return(m=f.__r3f)==null?void 0:m.handlers["onPointer"+p]}))}function n(h,f){let p=i.getState(),m=new Set,g=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let x=0;x<v.length;x++){let E=Mo(v[x]);E&&(E.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(h,p);function y(x){let E=Mo(x);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var T;E.events.compute==null||E.events.compute(h,E,(T=E.previousRoot)==null?void 0:T.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(x,!0):[]}let b=v.flatMap(y).sort((x,E)=>{let T=Mo(x.object),A=Mo(E.object);return!T||!A?x.distance-E.distance:A.events.priority-T.events.priority||x.distance-E.distance}).filter(x=>{let E=Xm(x);return m.has(E)?!1:(m.add(E),!0)});p.events.filter&&(b=p.events.filter(b,p));for(let x of b){let E=x.object;for(;E;){var S;(S=E.__r3f)!=null&&S.eventCount&&g.push({...x,eventObject:E}),E=E.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let x of p.internal.capturedMap.get(h.pointerId).values())m.has(Xm(x.intersection))||g.push(x.intersection);return g}function s(h,f,p,m){if(h.length){let g={stopped:!1};for(let v of h){let y=Mo(v.object);if(y||v.object.traverseAncestors(b=>{let S=Mo(b);if(S)return y=S,!1}),y){let{raycaster:b,pointer:S,camera:x,internal:E}=y,T=new O(S.x,S.y,0).unproject(x),A=C=>{var w,z;return(w=(z=E.capturedMap.get(C))==null?void 0:z.has(v.eventObject))!=null?w:!1},N=C=>{let w={intersection:v,target:f.target};E.capturedMap.has(C)?E.capturedMap.get(C).set(v.eventObject,w):E.capturedMap.set(C,new Map([[v.eventObject,w]])),f.target.setPointerCapture(C)},D=C=>{let w=E.capturedMap.get(C);w&&sE(E.capturedMap,v.eventObject,w,C)},L={};for(let C in f){let w=f[C];typeof w!="function"&&(L[C]=w)}let F={...v,...L,pointer:S,intersections:h,stopped:g.stopped,delta:p,unprojectedPoint:T,ray:b.ray,camera:x,stopPropagation(){let C="pointerId"in f&&E.capturedMap.get(f.pointerId);if((!C||C.has(v.eventObject))&&(F.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(w=>w.eventObject===v.eventObject))){let w=h.slice(0,h.indexOf(v));r([...w,v])}},target:{hasPointerCapture:A,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:A,setPointerCapture:N,releasePointerCapture:D},nativeEvent:f};if(m(F),g.stopped===!0)break}}}return h}function r(h){let{internal:f}=i.getState();for(let p of f.hovered.values())if(!h.length||!h.find(m=>m.object===p.object&&m.index===p.index&&m.instanceId===p.instanceId)){let g=p.eventObject.__r3f;if(f.hovered.delete(Xm(p)),g!=null&&g.eventCount){let v=g.handlers,y={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(y),v.onPointerLeave==null||v.onPointerLeave(y)}}}function l(h,f){for(let p=0;p<f.length;p++){let m=f[p].__r3f;m==null||m.handlers.onPointerMissed==null||m.handlers.onPointerMissed(h)}}function c(h){switch(h){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return f=>{let{internal:p}=i.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),r([]))})}}return function(p){let{onPointerMissed:m,internal:g}=i.getState();g.lastEvent.current=p;let v=h==="onPointerMove",y=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",S=n(p,v?e:void 0),x=y?t(p):0;h==="onPointerDown"&&(g.initialClick=[p.offsetX,p.offsetY],g.initialHits=S.map(T=>T.eventObject)),y&&!S.length&&x<=2&&(l(p,g.interaction),m&&m(p)),v&&r(S);function E(T){let A=T.eventObject,N=A.__r3f;if(!(N!=null&&N.eventCount))return;let D=N.handlers;if(v){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){let L=Xm(T),F=g.hovered.get(L);F?F.stopped&&T.stopPropagation():(g.hovered.set(L,T),D.onPointerOver==null||D.onPointerOver(T),D.onPointerEnter==null||D.onPointerEnter(T))}D.onPointerMove==null||D.onPointerMove(T)}else{let L=D[h];L?(!y||g.initialHits.includes(A))&&(l(p,g.interaction.filter(F=>!g.initialHits.includes(F))),L(T)):y&&g.initialHits.includes(A)&&l(p,g.interaction.filter(F=>!g.initialHits.includes(F)))}}s(S,p,x,E)}}return{handlePointer:c}}var q1=i=>!!(i!=null&&i.render),ex=Sn.createContext(null),QD=(i,t)=>{let e=M1((c,h)=>{let f=new O,p=new O,m=new O;function g(x=h().camera,E=p,T=h().size){let{width:A,height:N,top:D,left:L}=T,F=A/N;E.isVector3?m.copy(E):m.set(...E);let C=x.getWorldPosition(f).distanceTo(m);if($1(x))return{width:A/x.zoom,height:N/x.zoom,top:D,left:L,factor:1,distance:C,aspect:F};{let w=x.fov*Math.PI/180,z=2*Math.tan(w/2)*C,Y=z*(A/N);return{width:Y,height:z,top:D,left:L,factor:A/Y,distance:C,aspect:F}}}let v,y=x=>c(E=>({performance:{...E.performance,current:x}})),b=new ft;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(x=1)=>i(h(),x),advance:(x,E)=>t(x,E,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new oo,pointer:b,mouse:b,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let x=h();v&&clearTimeout(v),x.performance.current!==x.performance.min&&y(x.performance.min),v=setTimeout(()=>y(h().performance.max),x.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:g},setEvents:x=>c(E=>({...E,events:{...E.events,...x}})),setSize:(x,E,T=0,A=0)=>{let N=h().camera,D={width:x,height:E,top:T,left:A};c(L=>({size:D,viewport:{...L.viewport,...g(N,p,D)}}))},setDpr:x=>c(E=>{let T=tE(x);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(x="always")=>{let E=h().clock;E.stop(),E.elapsedTime=0,x!=="never"&&(E.start(),E.elapsedTime=0),c(()=>({frameloop:x}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Sn.createRef(),active:!1,frames:0,priority:0,subscribe:(x,E,T)=>{let A=h().internal;return A.priority=A.priority+(E>0?1:0),A.subscribers.push({ref:x,priority:E,store:T}),A.subscribers=A.subscribers.sort((N,D)=>N.priority-D.priority),()=>{let N=h().internal;N!=null&&N.subscribers&&(N.priority=N.priority-(E>0?1:0),N.subscribers=N.subscribers.filter(D=>D.ref!==x))}}}}}),n=e.getState(),s=n.size,r=n.viewport.dpr,l=n.camera;return e.subscribe(()=>{let{camera:c,size:h,viewport:f,gl:p,set:m}=e.getState();if(h.width!==s.width||h.height!==s.height||f.dpr!==r){s=h,r=f.dpr,JD(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);let g=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,g)}c!==l&&(l=c,m(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),e.subscribe(c=>i(c)),e};function rE(){let i=Sn.useContext(ex);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function nx(i,t=0){let e=rE(),n=e.getState().internal.subscribe,s=WD(i);return tx(()=>n(s,t,e),[t,n,e]),null}var Y1=new WeakMap,$D=i=>{var t;return typeof i=="function"&&(i==null||(t=i.prototype)==null?void 0:t.constructor)===i};function oE(i,t){return function(e,...n){let s;return $D(e)?(s=Y1.get(e),s||(s=new e,Y1.set(e,s))):s=e,i&&i(s),Promise.all(n.map(r=>new Promise((l,c)=>s.load(r,h=>{hi(h?.scene)&&Object.assign(h,eE(h.scene)),l(h)},t,h=>c(new Error(`Could not load ${r}: ${h?.message}`))))))}}function ix(i,t,e,n){let s=Array.isArray(t)?t:[t],r=T1(oE(e,n),[i,...s],{equal:nn.equ});return Array.isArray(t)?r:r[0]}ix.preload=function(i,t,e){let n=Array.isArray(t)?t:[t];return A1(oE(e),[i,...n])};ix.clear=function(i,t){let e=Array.isArray(t)?t:[t];return C1([i,...e])};var tU={name:"@react-three/fiber",version:"9.4.2",description:"A React renderer for Threejs",keywords:["react","renderer","fiber","three","threejs"],author:"Paul Henschel (https://github.com/drcmda)",license:"MIT",maintainers:["Josh Ellis (https://github.com/joshuaellis)","Cody Bennett (https://github.com/codyjasonbennett)","Kris Baumgarter (https://github.com/krispya)"],bugs:{url:"https://github.com/pmndrs/react-three-fiber/issues"},homepage:"https://github.com/pmndrs/react-three-fiber#readme",repository:{type:"git",url:"git+https://github.com/pmndrs/react-three-fiber.git"},collective:{type:"opencollective",url:"https://opencollective.com/react-three-fiber"},main:"dist/react-three-fiber.cjs.js",module:"dist/react-three-fiber.esm.js",types:"dist/react-three-fiber.cjs.d.ts","react-native":"native/dist/react-three-fiber-native.cjs.js",sideEffects:!1,preconstruct:{entrypoints:["index.tsx","native.tsx"]},scripts:{prebuild:"cp ../../readme.md readme.md"},dependencies:{"@babel/runtime":"^7.17.8","@types/react-reconciler":"^0.32.0","@types/webxr":"*","base64-js":"^1.5.1",buffer:"^6.0.3","its-fine":"^2.0.0","react-reconciler":"^0.31.0","react-use-measure":"^2.1.7",scheduler:"^0.25.0","suspend-react":"^0.1.3","use-sync-external-store":"^1.4.0",zustand:"^5.0.3"},peerDependencies:{expo:">=43.0","expo-asset":">=8.4","expo-file-system":">=11.0","expo-gl":">=11.0",react:"^19.0.0","react-dom":"^19.0.0","react-native":">=0.78",three:">=0.156"},peerDependenciesMeta:{"react-dom":{optional:!0},"react-native":{optional:!0},expo:{optional:!0},"expo-asset":{optional:!0},"expo-file-system":{optional:!0},"expo-gl":{optional:!0}}};function eU(i){let t=(0,K1.default)(i);return t.injectIntoDevTools(),t}var lE=0,Ec={},nU=/^three(?=[A-Z])/,ng=i=>`${i[0].toUpperCase()}${i.slice(1)}`,iU=0,sU=i=>typeof i=="function";function sx(i){if(sU(i)){let t=`${iU++}`;return Ec[t]=i,t}else Object.assign(Ec,i)}function cE(i,t){let e=ng(i),n=Ec[e];if(i!=="primitive"&&!n)throw new Error(`R3F: ${e} 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(i==="primitive"&&!t.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(t.args!==void 0&&!Array.isArray(t.args))throw new Error("R3F: The args prop must be an array!")}function aU(i,t,e){var n;return i=ng(i)in Ec?i:i.replace(nU,""),cE(i,t),i==="primitive"&&(n=t.object)!=null&&n.__r3f&&delete t.object.__r3f,Zm(t.object,e,i,t)}function rU(i){if(!i.isHidden){var t;i.props.attach&&(t=i.parent)!=null&&t.object?Jm(i.parent,i):hi(i.object)&&(i.object.visible=!1),i.isHidden=!0,Tc(i)}}function uE(i){if(i.isHidden){var t;i.props.attach&&(t=i.parent)!=null&&t.object?jm(i.parent,i):hi(i.object)&&i.props.visible!==!1&&(i.object.visible=!0),i.isHidden=!1,Tc(i)}}function ax(i,t,e){let n=t.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!t.object){var s,r;let l=Ec[ng(t.type)];t.object=(s=t.props.object)!=null?s:new l(...(r=t.props.args)!=null?r:[]),t.object.__r3f=t}if(xa(t.object,t.props),t.props.attach)jm(i,t);else if(hi(t.object)&&hi(i.object)){let l=i.object.children.indexOf(e?.object);if(e&&l!==-1){let c=i.object.children.indexOf(t.object);if(c!==-1){i.object.children.splice(c,1);let h=c<l?l-1:l;i.object.children.splice(h,0,t.object)}else t.object.parent=i.object,i.object.children.splice(l,0,t.object),t.object.dispatchEvent({type:"added"}),i.object.dispatchEvent({type:"childadded",child:t.object})}else i.object.add(t.object)}for(let l of t.children)ax(t,l);Tc(t)}}function Gv(i,t){t&&(t.parent=i,i.children.push(t),ax(i,t))}function Z1(i,t,e){if(!t||!e)return;t.parent=i;let n=i.children.indexOf(e);n!==-1?i.children.splice(n,0,t):i.children.push(t),ax(i,t,e)}function hE(i){if(typeof i.dispose=="function"){let t=()=>{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?t():(0,tg.unstable_scheduleCallback)(tg.unstable_IdlePriority,t)}}function Jv(i,t,e){if(!t)return;t.parent=null;let n=i.children.indexOf(t);n!==-1&&i.children.splice(n,1),t.props.attach?Jm(i,t):hi(t.object)&&hi(i.object)&&(i.object.remove(t.object),KD(Q1(t),t.object));let s=t.props.dispose!==null&&e!==!1;for(let r=t.children.length-1;r>=0;r--){let l=t.children[r];Jv(t,l,s)}t.children.length=0,delete t.object.__r3f,s&&t.type!=="primitive"&&t.object.type!=="Scene"&&hE(t.object),e===void 0&&Tc(t)}function oU(i,t){for(let e of[i,i.alternate])if(e!==null)if(typeof e.ref=="function"){e.refCleanup==null||e.refCleanup();let n=e.ref(t);typeof n=="function"&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t)}var Ym=[];function lU(){for(let[e]of Ym){let n=e.parent;if(n){e.props.attach?Jm(n,e):hi(e.object)&&hi(n.object)&&n.object.remove(e.object);for(let s of e.children)s.props.attach?Jm(e,s):hi(s.object)&&hi(e.object)&&e.object.remove(s.object)}e.isHidden&&uE(e),e.object.__r3f&&delete e.object.__r3f,e.type!=="primitive"&&hE(e.object)}for(let[e,n,s]of Ym){e.props=n;let r=e.parent;if(r){var i,t;let l=Ec[ng(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(t=e.props.args)!=null?t:[]),e.object.__r3f=e,oU(s,e.object),xa(e.object,e.props),e.props.attach?jm(r,e):hi(e.object)&&hi(r.object)&&r.object.add(e.object);for(let c of e.children)c.props.attach?jm(e,c):hi(c.object)&&hi(e.object)&&e.object.add(c.object);Tc(e)}}Ym.length=0}var kv=()=>{},j1={},qm=lE,cU=0,uU=4,Km=eU({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:aU,removeChild:Jv,appendChild:Gv,appendInitialChild:Gv,insertBefore:Z1,appendChildToContainer(i,t){let e=i.getState().scene.__r3f;!t||!e||Gv(e,t)},removeChildFromContainer(i,t){let e=i.getState().scene.__r3f;!t||!e||Jv(e,t)},insertInContainerBefore(i,t,e){let n=i.getState().scene.__r3f;!t||!e||!n||Z1(n,t,e)},getRootHostContext:()=>j1,getChildHostContext:()=>j1,commitUpdate(i,t,e,n,s){var r,l,c;cE(t,n);let h=!1;if((i.type==="primitive"&&e.object!==n.object||((r=n.args)==null?void 0:r.length)!==((l=e.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,m)=>{var g;return p!==((g=e.args)==null?void 0:g[m])}))&&(h=!0),h)Ym.push([i,{...n},s]);else{let p=YD(i,n);Object.keys(p).length&&(Object.assign(i.props,p),xa(i.object,p))}(s.sibling===null||(s.flags&uU)===cU)&&lU()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i?.object,prepareForCommit:()=>null,preparePortalMount:i=>Zm(i.getState().scene,i,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:rU,unhideInstance:uE,createTextInstance:kv,hideTextInstance:kv,unhideTextInstance:kv,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,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Sn.createContext(null),setCurrentUpdatePriority(i){qm=i},getCurrentUpdatePriority(){return qm},resolveUpdatePriority(){var i;if(qm!==lE)return qm;switch(typeof window<"u"&&((i=window.event)==null?void 0:i.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return hr.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return hr.ContinuousEventPriority;default:return hr.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:tU.version}),ur=new Map,Sc={objects:"shallow",strict:!1};function hU(i,t){if(!t&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){let{width:e,height:n,top:s,left:r}=i.parentElement.getBoundingClientRect();return{width:e,height:n,top:s,left:r}}else if(!t&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...t}}function rx(i){let t=ur.get(i),e=t?.fiber,n=t?.store;t&&console.warn("R3F.createRoot should only be called once!");let s=typeof reportError=="function"?reportError:console.error,r=n||QD($m,$v),l=e||Km.createContainer(r,hr.ConcurrentRoot,null,!1,null,"",s,s,s,null);t||ur.set(i,{fiber:l,store:r});let c,h,f=!1,p=null;return{async configure(m={}){let g;p=new Promise(mt=>g=mt);let{gl:v,size:y,scene:b,events:S,onCreated:x,shadows:E=!1,linear:T=!1,flat:A=!1,legacy:N=!1,orthographic:D=!1,frameloop:L="always",dpr:F=[1,2],performance:C,raycaster:w,camera:z,onPointerMissed:Y}=m,G=r.getState(),j=G.gl;if(!G.gl){let mt={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0},kt=typeof v=="function"?await v(mt):v;q1(kt)?j=kt:j=new vo({...mt,...v}),G.set({gl:j})}let nt=G.raycaster;nt||G.set({raycaster:nt=new sc});let{params:J,...et}=w||{};if(nn.equ(et,nt,Sc)||xa(nt,{...et}),nn.equ(J,nt.params,Sc)||xa(nt,{params:{...nt.params,...J}}),!G.camera||G.camera===h&&!nn.equ(h,z,Sc)){h=z;let mt=z?.isCamera,kt=mt?z:D?new Bs(0,0,0,0,.1,1e3):new fn(75,0,.1,1e3);mt||(kt.position.z=5,z&&(xa(kt,z),kt.manual||("aspect"in z||"left"in z||"right"in z||"bottom"in z||"top"in z)&&(kt.manual=!0,kt.updateProjectionMatrix())),!G.camera&&!(z!=null&&z.rotation)&&kt.lookAt(0,0,0)),G.set({camera:kt}),nt.camera=kt}if(!G.scene){let mt;b!=null&&b.isScene?(mt=b,Zm(mt,r,"",{})):(mt=new to,Zm(mt,r,"",{}),b&&xa(mt,b)),G.set({scene:mt})}S&&!G.events.handlers&&G.set({events:S(r)});let rt=hU(i,y);if(nn.equ(rt,G.size,Sc)||G.setSize(rt.width,rt.height,rt.top,rt.left),F&&G.viewport.dpr!==tE(F)&&G.setDpr(F),G.frameloop!==L&&G.setFrameloop(L),G.onPointerMissed||G.set({onPointerMissed:Y}),C&&!nn.equ(C,G.performance,Sc)&&G.set(mt=>({performance:{...mt.performance,...C}})),!G.xr){var St;let mt=(re,Ce)=>{let at=r.getState();at.frameloop!=="never"&&$v(re,!0,at,Ce)},kt=()=>{let re=r.getState();re.gl.xr.enabled=re.gl.xr.isPresenting,re.gl.xr.setAnimationLoop(re.gl.xr.isPresenting?mt:null),re.gl.xr.isPresenting||$m(re)},$t={connect(){let re=r.getState().gl;re.xr.addEventListener("sessionstart",kt),re.xr.addEventListener("sessionend",kt)},disconnect(){let re=r.getState().gl;re.xr.removeEventListener("sessionstart",kt),re.xr.removeEventListener("sessionend",kt)}};typeof((St=j.xr)==null?void 0:St.addEventListener)=="function"&&$t.connect(),G.set({xr:$t})}if(j.shadowMap){let mt=j.shadowMap.enabled,kt=j.shadowMap.type;if(j.shadowMap.enabled=!!E,nn.boo(E))j.shadowMap.type=lo;else if(nn.str(E)){var bt;let $t={basic:hm,percentage:sr,soft:lo,variance:ma};j.shadowMap.type=(bt=$t[E])!=null?bt:lo}else nn.obj(E)&&Object.assign(j.shadowMap,E);(mt!==j.shadowMap.enabled||kt!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return be.enabled=!N,f||(j.outputColorSpace=T?Ps:Dn,j.toneMapping=A?Si:rc),G.legacy!==N&&G.set(()=>({legacy:N})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==A&&G.set(()=>({flat:A})),v&&!nn.fun(v)&&!q1(v)&&!nn.equ(v,j,Sc)&&xa(j,v),c=x,f=!0,g(),this},render(m){return!f&&!p&&this.configure(),p.then(()=>{Km.updateContainer((0,eg.jsx)(fU,{store:r,children:m,onCreated:c,rootElement:i}),l,null,()=>{})}),r},unmount(){fE(i)}}}function fU({store:i,children:t,onCreated:e,rootElement:n}){return tx(()=>{let s=i.getState();s.set(r=>({internal:{...r.internal,active:!0}})),e&&e(s),i.getState().events.connected||s.events.connect==null||s.events.connect(n)},[]),(0,eg.jsx)(ex.Provider,{value:i,children:t})}function fE(i,t){let e=ur.get(i),n=e?.fiber;if(n){let s=e?.store.getState();s&&(s.internal.active=!1),Km.updateContainer(null,n,null,()=>{s&&setTimeout(()=>{try{var r,l,c,h;s.events.disconnect==null||s.events.disconnect(),(r=s.gl)==null||(l=r.renderLists)==null||l.dispose==null||l.dispose(),(c=s.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=s.gl)!=null&&h.xr&&s.xr.disconnect(),nE(s.scene),ur.delete(i),t&&t(i)}catch{}},500)})}}var dU=new Set,pU=new Set,mU=new Set;function Wv(i,t){if(i.size)for(let{callback:e}of i.values())e(t)}function bc(i,t){switch(i){case"before":return Wv(dU,t);case"after":return Wv(pU,t);case"tail":return Wv(mU,t)}}var Xv,qv;function Kv(i,t,e){let n=t.clock.getDelta();t.frameloop==="never"&&typeof i=="number"&&(n=i-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=i),Xv=t.internal.subscribers;for(let s=0;s<Xv.length;s++)qv=Xv[s],qv.ref.current(qv.store.getState(),n,e);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),t.frameloop==="always"?1:t.internal.frames}var Qm=!1,Qv=!1,Yv,J1,Mc;function dE(i){J1=requestAnimationFrame(dE),Qm=!0,Yv=0,bc("before",i),Qv=!0;for(let e of ur.values()){var t;Mc=e.store.getState(),Mc.internal.active&&(Mc.frameloop==="always"||Mc.internal.frames>0)&&!((t=Mc.gl.xr)!=null&&t.isPresenting)&&(Yv+=Kv(i,Mc))}if(Qv=!1,bc("after",i),Yv===0)return bc("tail",i),Qm=!1,cancelAnimationFrame(J1)}function $m(i,t=1){var e;if(!i)return ur.forEach(n=>$m(n.store.getState(),t));(e=i.gl.xr)!=null&&e.isPresenting||!i.internal.active||i.frameloop==="never"||(t>1?i.internal.frames=Math.min(60,i.internal.frames+t):Qv?i.internal.frames=2:i.internal.frames=1,Qm||(Qm=!0,requestAnimationFrame(dE)))}function $v(i,t=!0,e,n){if(t&&bc("before",i),e)Kv(i,e,n);else for(let s of ur.values())Kv(i,s.store.getState());t&&bc("after",i)}var Zv={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 ox(i){let{handlePointer:t}=aE(i);return{priority:1,enabled:!0,compute(e,n,s){n.pointer.set(e.offsetX/n.size.width*2-1,-(e.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Zv).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var e;let{events:n,internal:s}=i.getState();(e=s.lastEvent)!=null&&e.current&&n.handlers&&n.handlers.onPointerMove(s.lastEvent.current)},connect:e=>{let{set:n,events:s}=i.getState();if(s.disconnect==null||s.disconnect(),n(r=>({events:{...r.events,connected:e}})),s.handlers)for(let r in s.handlers){let l=s.handlers[r],[c,h]=Zv[r];e.addEventListener(c,l,{passive:h})}},disconnect:()=>{let{set:e,events:n}=i.getState();if(n.connected){if(n.handlers)for(let s in n.handlers){let r=n.handlers[s],[l]=Zv[s];n.connected.removeEventListener(l,r)}e(s=>({events:{...s.events,connected:void 0}}))}}}}var Ac=zn(or());var gU=zn(So()),$U=zn(Uv());var tP=zn(Hv()),eP=zn(km());var pE=zn(or(),1);var Hs=zn(So(),1);function mE(){let i=(0,pE.useRef)(null);return nx((t,e)=>{i.current&&(i.current.rotation.x+=e,i.current.rotation.y+=e*.5)}),(0,Hs.jsxs)(Hs.Fragment,{children:[(0,Hs.jsx)("ambientLight",{intensity:.5}),(0,Hs.jsx)("pointLight",{position:[10,10,10]}),(0,Hs.jsxs)("mesh",{ref:i,children:[(0,Hs.jsx)("boxGeometry",{args:[1,1,1]}),(0,Hs.jsx)("meshStandardMaterial",{color:"orange"})]})]})}var _E=zn(So(),1);function _U(i){return typeof i=="function"&&!!i.prototype&&i.constructor.name!=="Object"}var gE={};Object.entries(Lm).forEach(([i,t])=>{_U(t)&&(gE[i]=t)});sx(gE);var Cc=null;self.onmessage=async i=>{let{type:t,canvas:e,width:n,height:s,dpr:r}=i.data;if(t==="INIT"&&e){Cc&&(Cc.unmount(),Cc=null);let l=new vo({canvas:e,antialias:!0});Cc=rx(e),await Cc.configure({gl:l,events:ox,size:{width:n,height:s,top:0,left:0},dpr:r,camera:{position:[0,0,5]}}),Cc.render((0,_E.jsx)(mE,{}))}};})();
4022
+ }`,bv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new Bl(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new ci({vertexShader:KN,fragmentShader:QN,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new rn(new oo(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Ev=class extends Oi{constructor(t,e){super();let n=this,s=null,r=1,l=null,c="local-floor",h=1,f=null,p=null,m=null,g=null,v=null,y=null,b=typeof XRWebGLBinding<"u",S=new bv,x={},E=e.getContextAttributes(),T=null,A=null,N=[],D=[],L=new ft,F=null,C=new fn;C.viewport=new qe;let w=new fn;w.viewport=new qe;let z=[C,w],Y=new Ah,G=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let dt=N[at];return dt===void 0&&(dt=new to,N[at]=dt),dt.getTargetRaySpace()},this.getControllerGrip=function(at){let dt=N[at];return dt===void 0&&(dt=new to,N[at]=dt),dt.getGripSpace()},this.getHand=function(at){let dt=N[at];return dt===void 0&&(dt=new to,N[at]=dt),dt.getHandSpace()};function nt(at){let dt=D.indexOf(at.inputSource);if(dt===-1)return;let Vt=N[dt];Vt!==void 0&&(Vt.update(at.inputSource,at.frame,f||l),Vt.dispatchEvent({type:at.type,data:at.inputSource}))}function J(){s.removeEventListener("select",nt),s.removeEventListener("selectstart",nt),s.removeEventListener("selectend",nt),s.removeEventListener("squeeze",nt),s.removeEventListener("squeezestart",nt),s.removeEventListener("squeezeend",nt),s.removeEventListener("end",J),s.removeEventListener("inputsourceschange",et);for(let at=0;at<N.length;at++){let dt=D[at];dt!==null&&(D[at]=null,N[at].disconnect(dt))}G=null,j=null,S.reset();for(let at in x)delete x[at];t.setRenderTarget(T),v=null,g=null,m=null,s=null,A=null,Ce.stop(),n.isPresenting=!1,t.setPixelRatio(F),t.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){r=at,n.isPresenting===!0&&wt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){c=at,n.isPresenting===!0&&wt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||l},this.setReferenceSpace=function(at){f=at},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return m===null&&b&&(m=new XRWebGLBinding(s,e)),m},this.getFrame=function(){return y},this.getSession=function(){return s},this.setSession=async function(at){if(s=at,s!==null){if(T=t.getRenderTarget(),s.addEventListener("select",nt),s.addEventListener("selectstart",nt),s.addEventListener("selectend",nt),s.addEventListener("squeeze",nt),s.addEventListener("squeezestart",nt),s.addEventListener("squeezeend",nt),s.addEventListener("end",J),s.addEventListener("inputsourceschange",et),E.xrCompatible!==!0&&await e.makeXRCompatible(),F=t.getPixelRatio(),t.getSize(L),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let Vt=null,ie=null,Ft=null;E.depth&&(Ft=E.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Vt=E.stencil?va:ds,ie=E.stencil?fo:Fi);let ye={colorFormat:e.RGBA8,depthFormat:Ft,scaleFactor:r};m=this.getBinding(),g=m.createProjectionLayer(ye),s.updateRenderState({layers:[g]}),t.setPixelRatio(1),t.setSize(g.textureWidth,g.textureHeight,!1),A=new $n(g.textureWidth,g.textureHeight,{format:Un,type:Gn,depthTexture:new da(g.textureWidth,g.textureHeight,ie,void 0,void 0,void 0,void 0,void 0,void 0,Vt),stencilBuffer:E.stencil,colorSpace:t.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{let Vt={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};v=new XRWebGLLayer(s,e,Vt),s.updateRenderState({baseLayer:v}),t.setPixelRatio(1),t.setSize(v.framebufferWidth,v.framebufferHeight,!1),A=new $n(v.framebufferWidth,v.framebufferHeight,{format:Un,type:Gn,colorSpace:t.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(h),f=null,l=await s.requestReferenceSpace(c),Ce.setContext(s),Ce.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function et(at){for(let dt=0;dt<at.removed.length;dt++){let Vt=at.removed[dt],ie=D.indexOf(Vt);ie>=0&&(D[ie]=null,N[ie].disconnect(Vt))}for(let dt=0;dt<at.added.length;dt++){let Vt=at.added[dt],ie=D.indexOf(Vt);if(ie===-1){for(let ye=0;ye<N.length;ye++)if(ye>=D.length){D.push(Vt),ie=ye;break}else if(D[ye]===null){D[ye]=Vt,ie=ye;break}if(ie===-1)break}let Ft=N[ie];Ft&&Ft.connect(Vt)}}let rt=new O,St=new O;function bt(at,dt,Vt){rt.setFromMatrixPosition(dt.matrixWorld),St.setFromMatrixPosition(Vt.matrixWorld);let ie=rt.distanceTo(St),Ft=dt.projectionMatrix.elements,ye=Vt.projectionMatrix.elements,Re=Ft[14]/(Ft[10]-1),ce=Ft[14]/(Ft[10]+1),ct=(Ft[9]+1)/Ft[5],gt=(Ft[9]-1)/Ft[5],lt=(Ft[8]-1)/Ft[0],Nt=(ye[8]+1)/ye[0],B=Re*lt,Zt=Re*Nt,Dt=ie/(-lt+Nt),se=Dt*-lt;if(dt.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(se),at.translateZ(Dt),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert(),Ft[10]===-1)at.projectionMatrix.copy(dt.projectionMatrix),at.projectionMatrixInverse.copy(dt.projectionMatrixInverse);else{let Mt=Re+Dt,I=ce+Dt,R=B-se,k=Zt+(ie-se),it=ct*ce/I*Mt,ht=gt*ce/I*Mt;at.projectionMatrix.makePerspective(R,k,it,ht,Mt,I),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}}function mt(at,dt){dt===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(dt.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;let dt=at.near,Vt=at.far;S.texture!==null&&(S.depthNear>0&&(dt=S.depthNear),S.depthFar>0&&(Vt=S.depthFar)),Y.near=w.near=C.near=dt,Y.far=w.far=C.far=Vt,(G!==Y.near||j!==Y.far)&&(s.updateRenderState({depthNear:Y.near,depthFar:Y.far}),G=Y.near,j=Y.far),Y.layers.mask=at.layers.mask|6,C.layers.mask=Y.layers.mask&3,w.layers.mask=Y.layers.mask&5;let ie=at.parent,Ft=Y.cameras;mt(Y,ie);for(let ye=0;ye<Ft.length;ye++)mt(Ft[ye],ie);Ft.length===2?bt(Y,C,w):Y.projectionMatrix.copy(C.projectionMatrix),kt(at,Y,ie)};function kt(at,dt,Vt){Vt===null?at.matrix.copy(dt.matrixWorld):(at.matrix.copy(Vt.matrixWorld),at.matrix.invert(),at.matrix.multiply(dt.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(dt.projectionMatrix),at.projectionMatrixInverse.copy(dt.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=Jr*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return Y},this.getFoveation=function(){if(!(g===null&&v===null))return h},this.setFoveation=function(at){h=at,g!==null&&(g.fixedFoveation=at),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=at)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(Y)},this.getCameraTexture=function(at){return x[at]};let $t=null;function re(at,dt){if(p=dt.getViewerPose(f||l),y=dt,p!==null){let Vt=p.views;v!==null&&(t.setRenderTargetFramebuffer(A,v.framebuffer),t.setRenderTarget(A));let ie=!1;Vt.length!==Y.cameras.length&&(Y.cameras.length=0,ie=!0);for(let ce=0;ce<Vt.length;ce++){let ct=Vt[ce],gt=null;if(v!==null)gt=v.getViewport(ct);else{let Nt=m.getViewSubImage(g,ct);gt=Nt.viewport,ce===0&&(t.setRenderTargetTextures(A,Nt.colorTexture,Nt.depthStencilTexture),t.setRenderTarget(A))}let lt=z[ce];lt===void 0&&(lt=new fn,lt.layers.enable(ce),lt.viewport=new qe,z[ce]=lt),lt.matrix.fromArray(ct.transform.matrix),lt.matrix.decompose(lt.position,lt.quaternion,lt.scale),lt.projectionMatrix.fromArray(ct.projectionMatrix),lt.projectionMatrixInverse.copy(lt.projectionMatrix).invert(),lt.viewport.set(gt.x,gt.y,gt.width,gt.height),ce===0&&(Y.matrix.copy(lt.matrix),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)),ie===!0&&Y.cameras.push(lt)}let Ft=s.enabledFeatures;if(Ft&&Ft.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&b){m=n.getBinding();let ce=m.getDepthInformation(Vt[0]);ce&&ce.isValid&&ce.texture&&S.init(ce,s.renderState)}if(Ft&&Ft.includes("camera-access")&&b){t.state.unbindTexture(),m=n.getBinding();for(let ce=0;ce<Vt.length;ce++){let ct=Vt[ce].camera;if(ct){let gt=x[ct];gt||(gt=new Bl,x[ct]=gt);let lt=m.getCameraImage(ct);gt.sourceTexture=lt}}}}for(let Vt=0;Vt<N.length;Vt++){let ie=D[Vt],Ft=N[Vt];ie!==null&&Ft!==void 0&&Ft.update(ie,dt,f||l)}$t&&$t(at,dt),dt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:dt}),y=null}let Ce=new kb;Ce.setAnimationLoop(re),this.setAnimationLoop=function(at){$t=at},this.dispose=function(){}}},go=new xi,$N=new ue;function tD(i,t){function e(S,x){S.matrixAutoUpdate===!0&&S.updateMatrix(),x.value.copy(S.matrix)}function n(S,x){x.color.getRGB(S.fogColor.value,iv(i)),x.isFog?(S.fogNear.value=x.near,S.fogFar.value=x.far):x.isFogExp2&&(S.fogDensity.value=x.density)}function s(S,x,E,T,A){x.isMeshBasicMaterial||x.isMeshLambertMaterial?r(S,x):x.isMeshToonMaterial?(r(S,x),m(S,x)):x.isMeshPhongMaterial?(r(S,x),p(S,x)):x.isMeshStandardMaterial?(r(S,x),g(S,x),x.isMeshPhysicalMaterial&&v(S,x,A)):x.isMeshMatcapMaterial?(r(S,x),y(S,x)):x.isMeshDepthMaterial?r(S,x):x.isMeshDistanceMaterial?(r(S,x),b(S,x)):x.isMeshNormalMaterial?r(S,x):x.isLineBasicMaterial?(l(S,x),x.isLineDashedMaterial&&c(S,x)):x.isPointsMaterial?h(S,x,E,T):x.isSpriteMaterial?f(S,x):x.isShadowMaterial?(S.color.value.copy(x.color),S.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function r(S,x){S.opacity.value=x.opacity,x.color&&S.diffuse.value.copy(x.color),x.emissive&&S.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(S.map.value=x.map,e(x.map,S.mapTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.bumpMap&&(S.bumpMap.value=x.bumpMap,e(x.bumpMap,S.bumpMapTransform),S.bumpScale.value=x.bumpScale,x.side===ti&&(S.bumpScale.value*=-1)),x.normalMap&&(S.normalMap.value=x.normalMap,e(x.normalMap,S.normalMapTransform),S.normalScale.value.copy(x.normalScale),x.side===ti&&S.normalScale.value.negate()),x.displacementMap&&(S.displacementMap.value=x.displacementMap,e(x.displacementMap,S.displacementMapTransform),S.displacementScale.value=x.displacementScale,S.displacementBias.value=x.displacementBias),x.emissiveMap&&(S.emissiveMap.value=x.emissiveMap,e(x.emissiveMap,S.emissiveMapTransform)),x.specularMap&&(S.specularMap.value=x.specularMap,e(x.specularMap,S.specularMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest);let E=t.get(x),T=E.envMap,A=E.envMapRotation;T&&(S.envMap.value=T,go.copy(A),go.x*=-1,go.y*=-1,go.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(go.y*=-1,go.z*=-1),S.envMapRotation.value.setFromMatrix4($N.makeRotationFromEuler(go)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=x.reflectivity,S.ior.value=x.ior,S.refractionRatio.value=x.refractionRatio),x.lightMap&&(S.lightMap.value=x.lightMap,S.lightMapIntensity.value=x.lightMapIntensity,e(x.lightMap,S.lightMapTransform)),x.aoMap&&(S.aoMap.value=x.aoMap,S.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,S.aoMapTransform))}function l(S,x){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,x.map&&(S.map.value=x.map,e(x.map,S.mapTransform))}function c(S,x){S.dashSize.value=x.dashSize,S.totalSize.value=x.dashSize+x.gapSize,S.scale.value=x.scale}function h(S,x,E,T){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,S.size.value=x.size*E,S.scale.value=T*.5,x.map&&(S.map.value=x.map,e(x.map,S.uvTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest)}function f(S,x){S.diffuse.value.copy(x.color),S.opacity.value=x.opacity,S.rotation.value=x.rotation,x.map&&(S.map.value=x.map,e(x.map,S.mapTransform)),x.alphaMap&&(S.alphaMap.value=x.alphaMap,e(x.alphaMap,S.alphaMapTransform)),x.alphaTest>0&&(S.alphaTest.value=x.alphaTest)}function p(S,x){S.specular.value.copy(x.specular),S.shininess.value=Math.max(x.shininess,1e-4)}function m(S,x){x.gradientMap&&(S.gradientMap.value=x.gradientMap)}function g(S,x){S.metalness.value=x.metalness,x.metalnessMap&&(S.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,S.metalnessMapTransform)),S.roughness.value=x.roughness,x.roughnessMap&&(S.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,S.roughnessMapTransform)),x.envMap&&(S.envMapIntensity.value=x.envMapIntensity)}function v(S,x,E){S.ior.value=x.ior,x.sheen>0&&(S.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),S.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(S.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,S.sheenColorMapTransform)),x.sheenRoughnessMap&&(S.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,S.sheenRoughnessMapTransform))),x.clearcoat>0&&(S.clearcoat.value=x.clearcoat,S.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(S.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,S.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(S.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===ti&&S.clearcoatNormalScale.value.negate())),x.dispersion>0&&(S.dispersion.value=x.dispersion),x.iridescence>0&&(S.iridescence.value=x.iridescence,S.iridescenceIOR.value=x.iridescenceIOR,S.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(S.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,S.iridescenceMapTransform)),x.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),x.transmission>0&&(S.transmission.value=x.transmission,S.transmissionSamplerMap.value=E.texture,S.transmissionSamplerSize.value.set(E.width,E.height),x.transmissionMap&&(S.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,S.transmissionMapTransform)),S.thickness.value=x.thickness,x.thicknessMap&&(S.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=x.attenuationDistance,S.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(S.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(S.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=x.specularIntensity,S.specularColor.value.copy(x.specularColor),x.specularColorMap&&(S.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,S.specularColorMapTransform)),x.specularIntensityMap&&(S.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,x){x.matcap&&(S.matcap.value=x.matcap)}function b(S,x){let E=t.get(x).light;S.referencePosition.value.setFromMatrixPosition(E.matrixWorld),S.nearDistance.value=E.shadow.camera.near,S.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function eD(i,t,e,n){let s={},r={},l=[],c=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function h(E,T){let A=T.program;n.uniformBlockBinding(E,A)}function f(E,T){let A=s[E.id];A===void 0&&(y(E),A=p(E),s[E.id]=A,E.addEventListener("dispose",S));let N=T.program;n.updateUBOMapping(E,N);let D=t.render.frame;r[E.id]!==D&&(g(E),r[E.id]=D)}function p(E){let T=m();E.__bindingPointIndex=T;let A=i.createBuffer(),N=E.__size,D=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,A),i.bufferData(i.UNIFORM_BUFFER,N,D),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,A),A}function m(){for(let E=0;E<c;E++)if(l.indexOf(E)===-1)return l.push(E),E;return Qt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(E){let T=s[E.id],A=E.uniforms,N=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let D=0,L=A.length;D<L;D++){let F=Array.isArray(A[D])?A[D]:[A[D]];for(let C=0,w=F.length;C<w;C++){let z=F[C];if(v(z,D,C,N)===!0){let Y=z.__offset,G=Array.isArray(z.value)?z.value:[z.value],j=0;for(let nt=0;nt<G.length;nt++){let J=G[nt],et=b(J);typeof J=="number"||typeof J=="boolean"?(z.__data[0]=J,i.bufferSubData(i.UNIFORM_BUFFER,Y+j,z.__data)):J.isMatrix3?(z.__data[0]=J.elements[0],z.__data[1]=J.elements[1],z.__data[2]=J.elements[2],z.__data[3]=0,z.__data[4]=J.elements[3],z.__data[5]=J.elements[4],z.__data[6]=J.elements[5],z.__data[7]=0,z.__data[8]=J.elements[6],z.__data[9]=J.elements[7],z.__data[10]=J.elements[8],z.__data[11]=0):(J.toArray(z.__data,j),j+=et.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,Y,z.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function v(E,T,A,N){let D=E.value,L=T+"_"+A;if(N[L]===void 0)return typeof D=="number"||typeof D=="boolean"?N[L]=D:N[L]=D.clone(),!0;{let F=N[L];if(typeof D=="number"||typeof D=="boolean"){if(F!==D)return N[L]=D,!0}else if(F.equals(D)===!1)return F.copy(D),!0}return!1}function y(E){let T=E.uniforms,A=0,N=16;for(let L=0,F=T.length;L<F;L++){let C=Array.isArray(T[L])?T[L]:[T[L]];for(let w=0,z=C.length;w<z;w++){let Y=C[w],G=Array.isArray(Y.value)?Y.value:[Y.value];for(let j=0,nt=G.length;j<nt;j++){let J=G[j],et=b(J),rt=A%N,St=rt%et.boundary,bt=rt+St;A+=St,bt!==0&&N-bt<et.storage&&(A+=N-bt),Y.__data=new Float32Array(et.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=A,A+=et.storage}}}let D=A%N;return D>0&&(A+=N-D),E.__size=A,E.__cache={},this}function b(E){let T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?wt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):wt("WebGLRenderer: Unsupported uniform value type.",E),T}function S(E){let T=E.target;T.removeEventListener("dispose",S);let A=l.indexOf(T.__bindingPointIndex);l.splice(A,1),i.deleteBuffer(s[T.id]),delete s[T.id],delete r[T.id]}function x(){for(let E in s)i.deleteBuffer(s[E]);l=[],s={},r={}}return{bind:h,update:f,dispose:x}}var nD=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]),zs=null;function iD(){return zs===null&&(zs=new vi(nD,16,16,rr,Ss),zs.name="DFG_LUT",zs.minFilter=Je,zs.magFilter=Je,zs.wrapS=li,zs.wrapT=li,zs.generateMipmaps=!1,zs.needsUpdate=!0),zs}var vo=class{constructor(t={}){let{canvas:e=ev(),context:n=null,depth:s=!0,stencil:r=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:g=!1,outputBufferType:v=Gn}=t;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=l;let b=v,S=new Set([kh,Gh,uc]),x=new Set([Gn,Fi,ho,fo,zh,Vh]),E=new Uint32Array(4),T=new Int32Array(4),A=null,N=null,D=[],L=[],F=null;this.domElement=e,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=Si,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let C=this,w=!1;this._outputColorSpace=Dn;let z=0,Y=0,G=null,j=-1,nt=null,J=new qe,et=new qe,rt=null,St=new Lt(0),bt=0,mt=e.width,kt=e.height,$t=1,re=null,Ce=null,at=new qe(0,0,mt,kt),dt=new qe(0,0,mt,kt),Vt=!1,ie=new fa,Ft=!1,ye=!1,Re=new ue,ce=new O,ct=new qe,gt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},lt=!1;function Nt(){return G===null?$t:1}let B=n;function Zt(U,W){return e.getContext(U,W)}try{let U={alpha:!0,depth:s,stencil:r,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:p,failIfMajorPerformanceCaveat:m};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"182"}`),e.addEventListener("webglcontextlost",oe,!1),e.addEventListener("webglcontextrestored",Be,!1),e.addEventListener("webglcontextcreationerror",De,!1),B===null){let W="webgl2";if(B=Zt(W,U),B===null)throw Zt(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(U){throw Qt("WebGLRenderer: "+U.message),U}let Dt,se,Mt,I,R,k,it,ht,st,jt,Et,Wt,Kt,pt,Ct,Xt,Yt,Tt,ge,H,Ut,xt,Ot,_t;function ut(){Dt=new h3(B),Dt.init(),xt=new Zb(B,Dt),se=new n3(B,Dt,t,xt),Mt=new jN(B,Dt),se.reversedDepthBuffer&&g&&Mt.buffers.depth.setReversed(!0),I=new p3(B),R=new IN,k=new JN(B,Dt,Mt,R,se,xt,I),it=new s3(C),ht=new u3(C),st=new vR(B),Ot=new t3(B,st),jt=new f3(B,st,I,Ot),Et=new g3(B,jt,st,I),ge=new m3(B,se,k),Xt=new i3(R),Wt=new PN(C,it,ht,Dt,se,Ot,Xt),Kt=new tD(C,R),pt=new ON,Ct=new GN(Dt),Tt=new $2(C,it,ht,Mt,Et,y,h),Yt=new YN(C,Et,se),_t=new eD(B,I,se,Mt),H=new e3(B,Dt,I),Ut=new d3(B,Dt,I),I.programs=Wt.programs,C.capabilities=se,C.extensions=Dt,C.properties=R,C.renderLists=pt,C.shadowMap=Yt,C.state=Mt,C.info=I}ut(),b!==Gn&&(F=new v3(b,e.width,e.height,s,r));let At=new Ev(C,B);this.xr=At,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let U=Dt.get("WEBGL_lose_context");U&&U.loseContext()},this.forceContextRestore=function(){let U=Dt.get("WEBGL_lose_context");U&&U.restoreContext()},this.getPixelRatio=function(){return $t},this.setPixelRatio=function(U){U!==void 0&&($t=U,this.setSize(mt,kt,!1))},this.getSize=function(U){return U.set(mt,kt)},this.setSize=function(U,W,$=!0){if(At.isPresenting){wt("WebGLRenderer: Can't change size while VR device is presenting.");return}mt=U,kt=W,e.width=Math.floor(U*$t),e.height=Math.floor(W*$t),$===!0&&(e.style.width=U+"px",e.style.height=W+"px"),F!==null&&F.setSize(e.width,e.height),this.setViewport(0,0,U,W)},this.getDrawingBufferSize=function(U){return U.set(mt*$t,kt*$t).floor()},this.setDrawingBufferSize=function(U,W,$){mt=U,kt=W,$t=$,e.width=Math.floor(U*$),e.height=Math.floor(W*$),this.setViewport(0,0,U,W)},this.setEffects=function(U){if(b===Gn){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(U){for(let W=0;W<U.length;W++)if(U[W].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}F.setEffects(U||[])},this.getCurrentViewport=function(U){return U.copy(J)},this.getViewport=function(U){return U.copy(at)},this.setViewport=function(U,W,$,Q){U.isVector4?at.set(U.x,U.y,U.z,U.w):at.set(U,W,$,Q),Mt.viewport(J.copy(at).multiplyScalar($t).round())},this.getScissor=function(U){return U.copy(dt)},this.setScissor=function(U,W,$,Q){U.isVector4?dt.set(U.x,U.y,U.z,U.w):dt.set(U,W,$,Q),Mt.scissor(et.copy(dt).multiplyScalar($t).round())},this.getScissorTest=function(){return Vt},this.setScissorTest=function(U){Mt.setScissorTest(Vt=U)},this.setOpaqueSort=function(U){re=U},this.setTransparentSort=function(U){Ce=U},this.getClearColor=function(U){return U.copy(Tt.getClearColor())},this.setClearColor=function(){Tt.setClearColor(...arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){Tt.setClearAlpha(...arguments)},this.clear=function(U=!0,W=!0,$=!0){let Q=0;if(U){let Z=!1;if(G!==null){let Rt=G.texture.format;Z=S.has(Rt)}if(Z){let Rt=G.texture.type,Ht=x.has(Rt),Pt=Tt.getClearColor(),qt=Tt.getClearAlpha(),Jt=Pt.r,ae=Pt.g,te=Pt.b;Ht?(E[0]=Jt,E[1]=ae,E[2]=te,E[3]=qt,B.clearBufferuiv(B.COLOR,0,E)):(T[0]=Jt,T[1]=ae,T[2]=te,T[3]=qt,B.clearBufferiv(B.COLOR,0,T))}else Q|=B.COLOR_BUFFER_BIT}W&&(Q|=B.DEPTH_BUFFER_BIT),$&&(Q|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B.clear(Q)},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(){e.removeEventListener("webglcontextlost",oe,!1),e.removeEventListener("webglcontextrestored",Be,!1),e.removeEventListener("webglcontextcreationerror",De,!1),Tt.dispose(),pt.dispose(),Ct.dispose(),R.dispose(),it.dispose(),ht.dispose(),Et.dispose(),Ot.dispose(),_t.dispose(),Wt.dispose(),At.dispose(),At.removeEventListener("sessionstart",es),At.removeEventListener("sessionend",Hi),Gi.stop()};function oe(U){U.preventDefault(),wl("WebGLRenderer: Context Lost."),w=!0}function Be(){wl("WebGLRenderer: Context Restored."),w=!1;let U=I.autoReset,W=Yt.enabled,$=Yt.autoUpdate,Q=Yt.needsUpdate,Z=Yt.type;ut(),I.autoReset=U,Yt.enabled=W,Yt.autoUpdate=$,Yt.needsUpdate=Q,Yt.type=Z}function De(U){Qt("WebGLRenderer: A WebGL context could not be created. Reason: ",U.statusMessage)}function Mi(U){let W=U.target;W.removeEventListener("dispose",Mi),zi(W)}function zi(U){Rc(U),R.remove(U)}function Rc(U){let W=R.get(U).programs;W!==void 0&&(W.forEach(function($){Wt.releaseProgram($)}),U.isShaderMaterial&&Wt.releaseShaderCache(U))}this.renderBufferDirect=function(U,W,$,Q,Z,Rt){W===null&&(W=gt);let Ht=Z.isMesh&&Z.matrixWorld.determinant()<0,Pt=Nc(U,W,$,Q,Z);Mt.setMaterial(Q,Ht);let qt=$.index,Jt=1;if(Q.wireframe===!0){if(qt=jt.getWireframeAttribute($),qt===void 0)return;Jt=2}let ae=$.drawRange,te=$.attributes.position,Se=ae.start*Jt,Fe=(ae.start+ae.count)*Jt;Rt!==null&&(Se=Math.max(Se,Rt.start*Jt),Fe=Math.min(Fe,(Rt.start+Rt.count)*Jt)),qt!==null?(Se=Math.max(Se,0),Fe=Math.min(Fe,qt.count)):te!=null&&(Se=Math.max(Se,0),Fe=Math.min(Fe,te.count));let Qe=Fe-Se;if(Qe<0||Qe===1/0)return;Ot.setup(Z,Q,Pt,$,qt);let $e,ze=H;if(qt!==null&&($e=st.get(qt),ze=Ut,ze.setIndex($e)),Z.isMesh)Q.wireframe===!0?(Mt.setLineWidth(Q.wireframeLinewidth*Nt()),ze.setMode(B.LINES)):ze.setMode(B.TRIANGLES);else if(Z.isLine){let ee=Q.linewidth;ee===void 0&&(ee=1),Mt.setLineWidth(ee*Nt()),Z.isLineSegments?ze.setMode(B.LINES):Z.isLineLoop?ze.setMode(B.LINE_LOOP):ze.setMode(B.LINE_STRIP)}else Z.isPoints?ze.setMode(B.POINTS):Z.isSprite&&ze.setMode(B.TRIANGLES);if(Z.isBatchedMesh)if(Z._multiDrawInstances!==null)jr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ze.renderMultiDrawInstances(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount,Z._multiDrawInstances);else if(Dt.get("WEBGL_multi_draw"))ze.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else{let ee=Z._multiDrawStarts,Ue=Z._multiDrawCounts,Ae=Z._multiDrawCount,Wn=qt?st.get(qt).bytesPerElement:1,Gs=R.get(Q).currentProgram.getUniforms();for(let ii=0;ii<Ae;ii++)Gs.setValue(B,"_gl_DrawID",ii),ze.render(ee[ii]/Wn,Ue[ii])}else if(Z.isInstancedMesh)ze.renderInstances(Se,Qe,Z.count);else if($.isInstancedBufferGeometry){let ee=$._maxInstanceCount!==void 0?$._maxInstanceCount:1/0,Ue=Math.min($.instanceCount,ee);ze.renderInstances(Se,Qe,Ue)}else ze.render(Se,Qe)};function bo(U,W,$){U.transparent===!0&&U.side===_s&&U.forceSinglePass===!1?(U.side=ti,U.needsUpdate=!0,Ao(U,W,$),U.side=Us,U.needsUpdate=!0,Ao(U,W,$),U.side=_s):Ao(U,W,$)}this.compile=function(U,W,$=null){$===null&&($=U),N=Ct.get($),N.init(W),L.push(N),$.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(N.pushLight(Z),Z.castShadow&&N.pushShadow(Z))}),U!==$&&U.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(N.pushLight(Z),Z.castShadow&&N.pushShadow(Z))}),N.setupLights();let Q=new Set;return U.traverse(function(Z){if(!(Z.isMesh||Z.isPoints||Z.isLine||Z.isSprite))return;let Rt=Z.material;if(Rt)if(Array.isArray(Rt))for(let Ht=0;Ht<Rt.length;Ht++){let Pt=Rt[Ht];bo(Pt,$,Z),Q.add(Pt)}else bo(Rt,$,Z),Q.add(Rt)}),N=L.pop(),Q},this.compileAsync=function(U,W,$=null){let Q=this.compile(U,W,$);return new Promise(Z=>{function Rt(){if(Q.forEach(function(Ht){R.get(Ht).currentProgram.isReady()&&Q.delete(Ht)}),Q.size===0){Z(U);return}setTimeout(Rt,10)}Dt.get("KHR_parallel_shader_compile")!==null?Rt():setTimeout(Rt,10)})};let Vi=null;function Lf(U){Vi&&Vi(U)}function es(){Gi.stop()}function Hi(){Gi.start()}let Gi=new kb;Gi.setAnimationLoop(Lf),typeof self<"u"&&Gi.setContext(self),this.setAnimationLoop=function(U){Vi=U,At.setAnimationLoop(U),U===null?Gi.stop():Gi.start()},At.addEventListener("sessionstart",es),At.addEventListener("sessionend",Hi),this.render=function(U,W){if(W!==void 0&&W.isCamera!==!0){Qt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;let $=At.enabled===!0&&At.isPresenting===!0,Q=F!==null&&(G===null||$)&&F.begin(C,G);if(U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),At.enabled===!0&&At.isPresenting===!0&&(F===null||F.isCompositing()===!1)&&(At.cameraAutoUpdate===!0&&At.updateCamera(W),W=At.getCamera()),U.isScene===!0&&U.onBeforeRender(C,U,W,G),N=Ct.get(U,L.length),N.init(W),L.push(N),Re.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),ie.setFromProjectionMatrix(Re,_i,W.reversedDepth),ye=this.localClippingEnabled,Ft=Xt.init(this.clippingPlanes,ye),A=pt.get(U,D.length),A.init(),D.push(A),At.enabled===!0&&At.isPresenting===!0){let Ht=C.xr.getDepthSensingMesh();Ht!==null&&Ke(Ht,W,-1/0,C.sortObjects)}Ke(U,W,0,C.sortObjects),A.finish(),C.sortObjects===!0&&A.sort(re,Ce),lt=At.enabled===!1||At.isPresenting===!1||At.hasDepthSensing()===!1,lt&&Tt.addToRenderList(A,U),this.info.render.frame++,Ft===!0&&Xt.beginShadows();let Z=N.state.shadowsArray;if(Yt.render(Z,U,W),Ft===!0&&Xt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Q&&F.hasRenderPass())===!1){let Ht=A.opaque,Pt=A.transmissive;if(N.setupLights(),W.isArrayCamera){let qt=W.cameras;if(Pt.length>0)for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt];To(Ht,Pt,U,te)}lt&&Tt.render(U);for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt];Eo(A,U,te,te.viewport)}}else Pt.length>0&&To(Ht,Pt,U,W),lt&&Tt.render(U),Eo(A,U,W)}G!==null&&Y===0&&(k.updateMultisampleRenderTarget(G),k.updateRenderTargetMipmap(G)),Q&&F.end(C),U.isScene===!0&&U.onAfterRender(C,U,W),Ot.resetDefaultState(),j=-1,nt=null,L.pop(),L.length>0?(N=L[L.length-1],Ft===!0&&Xt.setGlobalState(C.clippingPlanes,N.state.camera)):N=null,D.pop(),D.length>0?A=D[D.length-1]:A=null};function Ke(U,W,$,Q){if(U.visible===!1)return;if(U.layers.test(W.layers)){if(U.isGroup)$=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(W);else if(U.isLight)N.pushLight(U),U.castShadow&&N.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||ie.intersectsSprite(U)){Q&&ct.setFromMatrixPosition(U.matrixWorld).applyMatrix4(Re);let Ht=Et.update(U),Pt=U.material;Pt.visible&&A.push(U,Ht,Pt,$,ct.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(!U.frustumCulled||ie.intersectsObject(U))){let Ht=Et.update(U),Pt=U.material;if(Q&&(U.boundingSphere!==void 0?(U.boundingSphere===null&&U.computeBoundingSphere(),ct.copy(U.boundingSphere.center)):(Ht.boundingSphere===null&&Ht.computeBoundingSphere(),ct.copy(Ht.boundingSphere.center)),ct.applyMatrix4(U.matrixWorld).applyMatrix4(Re)),Array.isArray(Pt)){let qt=Ht.groups;for(let Jt=0,ae=qt.length;Jt<ae;Jt++){let te=qt[Jt],Se=Pt[te.materialIndex];Se&&Se.visible&&A.push(U,Ht,Se,$,ct.z,te)}}else Pt.visible&&A.push(U,Ht,Pt,$,ct.z,null)}}let Rt=U.children;for(let Ht=0,Pt=Rt.length;Ht<Pt;Ht++)Ke(Rt[Ht],W,$,Q)}function Eo(U,W,$,Q){let{opaque:Z,transmissive:Rt,transparent:Ht}=U;N.setupLightsView($),Ft===!0&&Xt.setGlobalState(C.clippingPlanes,$),Q&&Mt.viewport(J.copy(Q)),Z.length>0&&dr(Z,W,$),Rt.length>0&&dr(Rt,W,$),Ht.length>0&&dr(Ht,W,$),Mt.buffers.depth.setTest(!0),Mt.buffers.depth.setMask(!0),Mt.buffers.color.setMask(!0),Mt.setPolygonOffset(!1)}function To(U,W,$,Q){if(($.isScene===!0?$.overrideMaterial:null)!==null)return;if(N.state.transmissionRenderTarget[Q.id]===void 0){let Se=Dt.has("EXT_color_buffer_half_float")||Dt.has("EXT_color_buffer_float");N.state.transmissionRenderTarget[Q.id]=new $n(1,1,{generateMipmaps:!0,type:Se?Ss:Gn,minFilter:ys,samples:se.samples,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:be.workingColorSpace})}let Rt=N.state.transmissionRenderTarget[Q.id],Ht=Q.viewport||J;Rt.setSize(Ht.z*C.transmissionResolutionScale,Ht.w*C.transmissionResolutionScale);let Pt=C.getRenderTarget(),qt=C.getActiveCubeFace(),Jt=C.getActiveMipmapLevel();C.setRenderTarget(Rt),C.getClearColor(St),bt=C.getClearAlpha(),bt<1&&C.setClearColor(16777215,.5),C.clear(),lt&&Tt.render($);let ae=C.toneMapping;C.toneMapping=Si;let te=Q.viewport;if(Q.viewport!==void 0&&(Q.viewport=void 0),N.setupLightsView(Q),Ft===!0&&Xt.setGlobalState(C.clippingPlanes,Q),dr(U,$,Q),k.updateMultisampleRenderTarget(Rt),k.updateRenderTargetMipmap(Rt),Dt.has("WEBGL_multisampled_render_to_texture")===!1){let Se=!1;for(let Fe=0,Qe=W.length;Fe<Qe;Fe++){let $e=W[Fe],{object:ze,geometry:ee,material:Ue,group:Ae}=$e;if(Ue.side===_s&&ze.layers.test(Q.layers)){let Wn=Ue.side;Ue.side=ti,Ue.needsUpdate=!0,wc(ze,$,Q,ee,Ue,Ae),Ue.side=Wn,Ue.needsUpdate=!0,Se=!0}}Se===!0&&(k.updateMultisampleRenderTarget(Rt),k.updateRenderTargetMipmap(Rt))}C.setRenderTarget(Pt,qt,Jt),C.setClearColor(St,bt),te!==void 0&&(Q.viewport=te),C.toneMapping=ae}function dr(U,W,$){let Q=W.isScene===!0?W.overrideMaterial:null;for(let Z=0,Rt=U.length;Z<Rt;Z++){let Ht=U[Z],{object:Pt,geometry:qt,group:Jt}=Ht,ae=Ht.material;ae.allowOverride===!0&&Q!==null&&(ae=Q),Pt.layers.test($.layers)&&wc(Pt,W,$,qt,ae,Jt)}}function wc(U,W,$,Q,Z,Rt){U.onBeforeRender(C,W,$,Q,Z,Rt),U.modelViewMatrix.multiplyMatrices($.matrixWorldInverse,U.matrixWorld),U.normalMatrix.getNormalMatrix(U.modelViewMatrix),Z.onBeforeRender(C,W,$,Q,U,Rt),Z.transparent===!0&&Z.side===_s&&Z.forceSinglePass===!1?(Z.side=ti,Z.needsUpdate=!0,C.renderBufferDirect($,W,Q,Z,U,Rt),Z.side=Us,Z.needsUpdate=!0,C.renderBufferDirect($,W,Q,Z,U,Rt),Z.side=_s):C.renderBufferDirect($,W,Q,Z,U,Rt),U.onAfterRender(C,W,$,Q,Z,Rt)}function Ao(U,W,$){W.isScene!==!0&&(W=gt);let Q=R.get(U),Z=N.state.lights,Rt=N.state.shadowsArray,Ht=Z.state.version,Pt=Wt.getParameters(U,Z.state,Rt,W,$),qt=Wt.getProgramCacheKey(Pt),Jt=Q.programs;Q.environment=U.isMeshStandardMaterial?W.environment:null,Q.fog=W.fog,Q.envMap=(U.isMeshStandardMaterial?ht:it).get(U.envMap||Q.environment),Q.envMapRotation=Q.environment!==null&&U.envMap===null?W.environmentRotation:U.envMapRotation,Jt===void 0&&(U.addEventListener("dispose",Mi),Jt=new Map,Q.programs=Jt);let ae=Jt.get(qt);if(ae!==void 0){if(Q.currentProgram===ae&&Q.lightsStateVersion===Ht)return Ro(U,Pt),ae}else Pt.uniforms=Wt.getUniforms(U),U.onBeforeCompile(Pt,C),ae=Wt.acquireProgram(Pt,qt),Jt.set(qt,ae),Q.uniforms=Pt.uniforms;let te=Q.uniforms;return(!U.isShaderMaterial&&!U.isRawShaderMaterial||U.clipping===!0)&&(te.clippingPlanes=Xt.uniform),Ro(U,Pt),Q.needsLights=on(U),Q.lightsStateVersion=Ht,Q.needsLights&&(te.ambientLightColor.value=Z.state.ambient,te.lightProbe.value=Z.state.probe,te.directionalLights.value=Z.state.directional,te.directionalLightShadows.value=Z.state.directionalShadow,te.spotLights.value=Z.state.spot,te.spotLightShadows.value=Z.state.spotShadow,te.rectAreaLights.value=Z.state.rectArea,te.ltc_1.value=Z.state.rectAreaLTC1,te.ltc_2.value=Z.state.rectAreaLTC2,te.pointLights.value=Z.state.point,te.pointLightShadows.value=Z.state.pointShadow,te.hemisphereLights.value=Z.state.hemi,te.directionalShadowMap.value=Z.state.directionalShadowMap,te.directionalShadowMatrix.value=Z.state.directionalShadowMatrix,te.spotShadowMap.value=Z.state.spotShadowMap,te.spotLightMatrix.value=Z.state.spotLightMatrix,te.spotLightMap.value=Z.state.spotLightMap,te.pointShadowMap.value=Z.state.pointShadowMap,te.pointShadowMatrix.value=Z.state.pointShadowMatrix),Q.currentProgram=ae,Q.uniformsList=null,ae}function Co(U){if(U.uniformsList===null){let W=U.currentProgram.getUniforms();U.uniformsList=gc.seqWithValue(W.seq,U.uniforms)}return U.uniformsList}function Ro(U,W){let $=R.get(U);$.outputColorSpace=W.outputColorSpace,$.batching=W.batching,$.batchingColor=W.batchingColor,$.instancing=W.instancing,$.instancingColor=W.instancingColor,$.instancingMorph=W.instancingMorph,$.skinning=W.skinning,$.morphTargets=W.morphTargets,$.morphNormals=W.morphNormals,$.morphColors=W.morphColors,$.morphTargetsCount=W.morphTargetsCount,$.numClippingPlanes=W.numClippingPlanes,$.numIntersection=W.numClipIntersection,$.vertexAlphas=W.vertexAlphas,$.vertexTangents=W.vertexTangents,$.toneMapping=W.toneMapping}function Nc(U,W,$,Q,Z){W.isScene!==!0&&(W=gt),k.resetTextureUnits();let Rt=W.fog,Ht=Q.isMeshStandardMaterial?W.environment:null,Pt=G===null?C.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:Ps,qt=(Q.isMeshStandardMaterial?ht:it).get(Q.envMap||Ht),Jt=Q.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,ae=!!$.attributes.tangent&&(!!Q.normalMap||Q.anisotropy>0),te=!!$.morphAttributes.position,Se=!!$.morphAttributes.normal,Fe=!!$.morphAttributes.color,Qe=Si;Q.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Qe=C.toneMapping);let $e=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ze=$e!==void 0?$e.length:0,ee=R.get(Q),Ue=N.state.lights;if(Ft===!0&&(ye===!0||U!==nt)){let gn=U===nt&&Q.id===j;Xt.setState(Q,U,gn)}let Ae=!1;Q.version===ee.__version?(ee.needsLights&&ee.lightsStateVersion!==Ue.state.version||ee.outputColorSpace!==Pt||Z.isBatchedMesh&&ee.batching===!1||!Z.isBatchedMesh&&ee.batching===!0||Z.isBatchedMesh&&ee.batchingColor===!0&&Z.colorTexture===null||Z.isBatchedMesh&&ee.batchingColor===!1&&Z.colorTexture!==null||Z.isInstancedMesh&&ee.instancing===!1||!Z.isInstancedMesh&&ee.instancing===!0||Z.isSkinnedMesh&&ee.skinning===!1||!Z.isSkinnedMesh&&ee.skinning===!0||Z.isInstancedMesh&&ee.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&ee.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&ee.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&ee.instancingMorph===!1&&Z.morphTexture!==null||ee.envMap!==qt||Q.fog===!0&&ee.fog!==Rt||ee.numClippingPlanes!==void 0&&(ee.numClippingPlanes!==Xt.numPlanes||ee.numIntersection!==Xt.numIntersection)||ee.vertexAlphas!==Jt||ee.vertexTangents!==ae||ee.morphTargets!==te||ee.morphNormals!==Se||ee.morphColors!==Fe||ee.toneMapping!==Qe||ee.morphTargetsCount!==ze)&&(Ae=!0):(Ae=!0,ee.__version=Q.version);let Wn=ee.currentProgram;Ae===!0&&(Wn=Ao(Q,W,Z));let Gs=!1,ii=!1,Sa=!1,Ne=Wn.getUniforms(),In=ee.uniforms;if(Mt.useProgram(Wn.program)&&(Gs=!0,ii=!0,Sa=!0),Q.id!==j&&(j=Q.id,ii=!0),Gs||nt!==U){Mt.buffers.depth.getReversed()&&U.reversedDepth!==!0&&(U._reversedDepth=!0,U.updateProjectionMatrix()),Ne.setValue(B,"projectionMatrix",U.projectionMatrix),Ne.setValue(B,"viewMatrix",U.matrixWorldInverse);let On=Ne.map.cameraPosition;On!==void 0&&On.setValue(B,ce.setFromMatrixPosition(U.matrixWorld)),se.logarithmicDepthBuffer&&Ne.setValue(B,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),(Q.isMeshPhongMaterial||Q.isMeshToonMaterial||Q.isMeshLambertMaterial||Q.isMeshBasicMaterial||Q.isMeshStandardMaterial||Q.isShaderMaterial)&&Ne.setValue(B,"isOrthographic",U.isOrthographicCamera===!0),nt!==U&&(nt=U,ii=!0,Sa=!0)}if(ee.needsLights&&(Ue.state.directionalShadowMap.length>0&&Ne.setValue(B,"directionalShadowMap",Ue.state.directionalShadowMap,k),Ue.state.spotShadowMap.length>0&&Ne.setValue(B,"spotShadowMap",Ue.state.spotShadowMap,k),Ue.state.pointShadowMap.length>0&&Ne.setValue(B,"pointShadowMap",Ue.state.pointShadowMap,k)),Z.isSkinnedMesh){Ne.setOptional(B,Z,"bindMatrix"),Ne.setOptional(B,Z,"bindMatrixInverse");let gn=Z.skeleton;gn&&(gn.boneTexture===null&&gn.computeBoneTexture(),Ne.setValue(B,"boneTexture",gn.boneTexture,k))}Z.isBatchedMesh&&(Ne.setOptional(B,Z,"batchingTexture"),Ne.setValue(B,"batchingTexture",Z._matricesTexture,k),Ne.setOptional(B,Z,"batchingIdTexture"),Ne.setValue(B,"batchingIdTexture",Z._indirectTexture,k),Ne.setOptional(B,Z,"batchingColorTexture"),Z._colorsTexture!==null&&Ne.setValue(B,"batchingColorTexture",Z._colorsTexture,k));let Ln=$.morphAttributes;if((Ln.position!==void 0||Ln.normal!==void 0||Ln.color!==void 0)&&ge.update(Z,$,Wn),(ii||ee.receiveShadow!==Z.receiveShadow)&&(ee.receiveShadow=Z.receiveShadow,Ne.setValue(B,"receiveShadow",Z.receiveShadow)),Q.isMeshGouraudMaterial&&Q.envMap!==null&&(In.envMap.value=qt,In.flipEnvMap.value=qt.isCubeTexture&&qt.isRenderTargetTexture===!1?-1:1),Q.isMeshStandardMaterial&&Q.envMap===null&&W.environment!==null&&(In.envMapIntensity.value=W.environmentIntensity),In.dfgLUT!==void 0&&(In.dfgLUT.value=iD()),ii&&(Ne.setValue(B,"toneMappingExposure",C.toneMappingExposure),ee.needsLights&&kn(In,Sa),Rt&&Q.fog===!0&&Kt.refreshFogUniforms(In,Rt),Kt.refreshMaterialUniforms(In,Q,$t,kt,N.state.transmissionRenderTarget[U.id]),gc.upload(B,Co(ee),In,k)),Q.isShaderMaterial&&Q.uniformsNeedUpdate===!0&&(gc.upload(B,Co(ee),In,k),Q.uniformsNeedUpdate=!1),Q.isSpriteMaterial&&Ne.setValue(B,"center",Z.center),Ne.setValue(B,"modelViewMatrix",Z.modelViewMatrix),Ne.setValue(B,"normalMatrix",Z.normalMatrix),Ne.setValue(B,"modelMatrix",Z.matrixWorld),Q.isShaderMaterial||Q.isRawShaderMaterial){let gn=Q.uniformsGroups;for(let On=0,mr=gn.length;On<mr;On++){let Es=gn[On];_t.update(Es,Wn),_t.bind(Es,Wn)}}return Wn}function kn(U,W){U.ambientLightColor.needsUpdate=W,U.lightProbe.needsUpdate=W,U.directionalLights.needsUpdate=W,U.directionalLightShadows.needsUpdate=W,U.pointLights.needsUpdate=W,U.pointLightShadows.needsUpdate=W,U.spotLights.needsUpdate=W,U.spotLightShadows.needsUpdate=W,U.rectAreaLights.needsUpdate=W,U.hemisphereLights.needsUpdate=W}function on(U){return U.isMeshLambertMaterial||U.isMeshToonMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isShadowMaterial||U.isShaderMaterial&&U.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(U,W,$){let Q=R.get(U);Q.__autoAllocateDepthBuffer=U.resolveDepthBuffer===!1,Q.__autoAllocateDepthBuffer===!1&&(Q.__useRenderToTexture=!1),R.get(U.texture).__webglTexture=W,R.get(U.depthTexture).__webglTexture=Q.__autoAllocateDepthBuffer?void 0:$,Q.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(U,W){let $=R.get(U);$.__webglFramebuffer=W,$.__useDefaultFramebuffer=W===void 0};let pr=B.createFramebuffer();this.setRenderTarget=function(U,W=0,$=0){G=U,z=W,Y=$;let Q=null,Z=!1,Rt=!1;if(U){let Pt=R.get(U);if(Pt.__useDefaultFramebuffer!==void 0){Mt.bindFramebuffer(B.FRAMEBUFFER,Pt.__webglFramebuffer),J.copy(U.viewport),et.copy(U.scissor),rt=U.scissorTest,Mt.viewport(J),Mt.scissor(et),Mt.setScissorTest(rt),j=-1;return}else if(Pt.__webglFramebuffer===void 0)k.setupRenderTarget(U);else if(Pt.__hasExternalTextures)k.rebindTextures(U,R.get(U.texture).__webglTexture,R.get(U.depthTexture).__webglTexture);else if(U.depthBuffer){let ae=U.depthTexture;if(Pt.__boundDepthTexture!==ae){if(ae!==null&&R.has(ae)&&(U.width!==ae.image.width||U.height!==ae.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");k.setupDepthRenderbuffer(U)}}let qt=U.texture;(qt.isData3DTexture||qt.isDataArrayTexture||qt.isCompressedArrayTexture)&&(Rt=!0);let Jt=R.get(U).__webglFramebuffer;U.isWebGLCubeRenderTarget?(Array.isArray(Jt[W])?Q=Jt[W][$]:Q=Jt[W],Z=!0):U.samples>0&&k.useMultisampledRTT(U)===!1?Q=R.get(U).__webglMultisampledFramebuffer:Array.isArray(Jt)?Q=Jt[$]:Q=Jt,J.copy(U.viewport),et.copy(U.scissor),rt=U.scissorTest}else J.copy(at).multiplyScalar($t).floor(),et.copy(dt).multiplyScalar($t).floor(),rt=Vt;if($!==0&&(Q=pr),Mt.bindFramebuffer(B.FRAMEBUFFER,Q)&&Mt.drawBuffers(U,Q),Mt.viewport(J),Mt.scissor(et),Mt.setScissorTest(rt),Z){let Pt=R.get(U.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+W,Pt.__webglTexture,$)}else if(Rt){let Pt=W;for(let qt=0;qt<U.textures.length;qt++){let Jt=R.get(U.textures[qt]);B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0+qt,Jt.__webglTexture,$,Pt)}}else if(U!==null&&$!==0){let Pt=R.get(U.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Pt.__webglTexture,$)}j=-1},this.readRenderTargetPixels=function(U,W,$,Q,Z,Rt,Ht,Pt=0){if(!(U&&U.isWebGLRenderTarget)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qt=R.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Ht!==void 0&&(qt=qt[Ht]),qt){Mt.bindFramebuffer(B.FRAMEBUFFER,qt);try{let Jt=U.textures[Pt],ae=Jt.format,te=Jt.type;if(!se.textureFormatReadable(ae)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!se.textureTypeReadable(te)){Qt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=U.width-Q&&$>=0&&$<=U.height-Z&&(U.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Pt),B.readPixels(W,$,Q,Z,xt.convert(ae),xt.convert(te),Rt))}finally{let Jt=G!==null?R.get(G).__webglFramebuffer:null;Mt.bindFramebuffer(B.FRAMEBUFFER,Jt)}}},this.readRenderTargetPixelsAsync=async function(U,W,$,Q,Z,Rt,Ht,Pt=0){if(!(U&&U.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qt=R.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Ht!==void 0&&(qt=qt[Ht]),qt)if(W>=0&&W<=U.width-Q&&$>=0&&$<=U.height-Z){Mt.bindFramebuffer(B.FRAMEBUFFER,qt);let Jt=U.textures[Pt],ae=Jt.format,te=Jt.type;if(!se.textureFormatReadable(ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!se.textureTypeReadable(te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Se=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,Se),B.bufferData(B.PIXEL_PACK_BUFFER,Rt.byteLength,B.STREAM_READ),U.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+Pt),B.readPixels(W,$,Q,Z,xt.convert(ae),xt.convert(te),0);let Fe=G!==null?R.get(G).__webglFramebuffer:null;Mt.bindFramebuffer(B.FRAMEBUFFER,Fe);let Qe=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await hb(B,Qe,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,Se),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,Rt),B.deleteBuffer(Se),B.deleteSync(Qe),Rt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(U,W=null,$=0){let Q=Math.pow(2,-$),Z=Math.floor(U.image.width*Q),Rt=Math.floor(U.image.height*Q),Ht=W!==null?W.x:0,Pt=W!==null?W.y:0;k.setTexture2D(U,0),B.copyTexSubImage2D(B.TEXTURE_2D,$,0,0,Ht,Pt,Z,Rt),Mt.unbindTexture()};let wo=B.createFramebuffer(),Dc=B.createFramebuffer();this.copyTextureToTexture=function(U,W,$=null,Q=null,Z=0,Rt=null){Rt===null&&(Z!==0?(jr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Rt=Z,Z=0):Rt=0);let Ht,Pt,qt,Jt,ae,te,Se,Fe,Qe,$e=U.isCompressedTexture?U.mipmaps[Rt]:U.image;if($!==null)Ht=$.max.x-$.min.x,Pt=$.max.y-$.min.y,qt=$.isBox3?$.max.z-$.min.z:1,Jt=$.min.x,ae=$.min.y,te=$.isBox3?$.min.z:0;else{let Ln=Math.pow(2,-Z);Ht=Math.floor($e.width*Ln),Pt=Math.floor($e.height*Ln),U.isDataArrayTexture?qt=$e.depth:U.isData3DTexture?qt=Math.floor($e.depth*Ln):qt=1,Jt=0,ae=0,te=0}Q!==null?(Se=Q.x,Fe=Q.y,Qe=Q.z):(Se=0,Fe=0,Qe=0);let ze=xt.convert(W.format),ee=xt.convert(W.type),Ue;W.isData3DTexture?(k.setTexture3D(W,0),Ue=B.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(k.setTexture2DArray(W,0),Ue=B.TEXTURE_2D_ARRAY):(k.setTexture2D(W,0),Ue=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,W.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,W.unpackAlignment);let Ae=B.getParameter(B.UNPACK_ROW_LENGTH),Wn=B.getParameter(B.UNPACK_IMAGE_HEIGHT),Gs=B.getParameter(B.UNPACK_SKIP_PIXELS),ii=B.getParameter(B.UNPACK_SKIP_ROWS),Sa=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,$e.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,$e.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Jt),B.pixelStorei(B.UNPACK_SKIP_ROWS,ae),B.pixelStorei(B.UNPACK_SKIP_IMAGES,te);let Ne=U.isDataArrayTexture||U.isData3DTexture,In=W.isDataArrayTexture||W.isData3DTexture;if(U.isDepthTexture){let Ln=R.get(U),gn=R.get(W),On=R.get(Ln.__renderTarget),mr=R.get(gn.__renderTarget);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,On.__webglFramebuffer),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,mr.__webglFramebuffer);for(let Es=0;Es<qt;Es++)Ne&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,R.get(U).__webglTexture,Z,te+Es),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,R.get(W).__webglTexture,Rt,Qe+Es)),B.blitFramebuffer(Jt,ae,Ht,Pt,Se,Fe,Ht,Pt,B.DEPTH_BUFFER_BIT,B.NEAREST);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,null),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(Z!==0||U.isRenderTargetTexture||R.has(U)){let Ln=R.get(U),gn=R.get(W);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,wo),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,Dc);for(let On=0;On<qt;On++)Ne?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,Ln.__webglTexture,Z,te+On):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Ln.__webglTexture,Z),In?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,gn.__webglTexture,Rt,Qe+On):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,gn.__webglTexture,Rt),Z!==0?B.blitFramebuffer(Jt,ae,Ht,Pt,Se,Fe,Ht,Pt,B.COLOR_BUFFER_BIT,B.NEAREST):In?B.copyTexSubImage3D(Ue,Rt,Se,Fe,Qe+On,Jt,ae,Ht,Pt):B.copyTexSubImage2D(Ue,Rt,Se,Fe,Jt,ae,Ht,Pt);Mt.bindFramebuffer(B.READ_FRAMEBUFFER,null),Mt.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else In?U.isDataTexture||U.isData3DTexture?B.texSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,ee,$e.data):W.isCompressedArrayTexture?B.compressedTexSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,$e.data):B.texSubImage3D(Ue,Rt,Se,Fe,Qe,Ht,Pt,qt,ze,ee,$e):U.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,Ht,Pt,ze,ee,$e.data):U.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,$e.width,$e.height,ze,$e.data):B.texSubImage2D(B.TEXTURE_2D,Rt,Se,Fe,Ht,Pt,ze,ee,$e);B.pixelStorei(B.UNPACK_ROW_LENGTH,Ae),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,Wn),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Gs),B.pixelStorei(B.UNPACK_SKIP_ROWS,ii),B.pixelStorei(B.UNPACK_SKIP_IMAGES,Sa),Rt===0&&W.generateMipmaps&&B.generateMipmap(Ue),Mt.unbindTexture()},this.initRenderTarget=function(U){R.get(U).__webglFramebuffer===void 0&&k.setupRenderTarget(U)},this.initTexture=function(U){U.isCubeTexture?k.setTextureCube(U,0):U.isData3DTexture?k.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?k.setTexture2DArray(U,0):k.setTexture2D(U,0),Mt.unbindTexture()},this.resetState=function(){z=0,Y=0,G=null,Mt.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=be._getDrawingBufferColorSpace(t),e.unpackColorSpace=be._getUnpackColorSpace()}};var Sn=zn(lr()),fr=zn(Uv());var y1=zn(lr(),1),S1=zn(g1(),1);var _1=i=>{let t,e=new Set,n=(f,p)=>{let m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){let g=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),e.forEach(v=>v(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>h,subscribe:f=>(e.add(f),()=>e.delete(f))},h=t=i(n,s,c);return c},v1=(i=>i?_1(i):_1);var{useSyncExternalStoreWithSelector:BD}=S1.default,FD=i=>i;function zD(i,t=FD,e){let n=BD(i.subscribe,i.getState,i.getInitialState,t,e);return y1.default.useDebugValue(n),n}var x1=(i,t)=>{let e=v1(i),n=(s,r=t)=>zD(e,s,r);return Object.assign(n,e),n},M1=((i,t)=>i?x1(i,t):x1);var VD=i=>typeof i=="object"&&typeof i.then=="function",xo=[];function b1(i,t,e=(n,s)=>n===s){if(i===t)return!0;if(!i||!t)return!1;let n=i.length;if(t.length!==n)return!1;for(let s=0;s<n;s++)if(!e(i[s],t[s]))return!1;return!0}function E1(i,t=null,e=!1,n={}){t===null&&(t=[i]);for(let r of xo)if(b1(t,r.keys,r.equal)){if(e)return;if(Object.prototype.hasOwnProperty.call(r,"error"))throw r.error;if(Object.prototype.hasOwnProperty.call(r,"response"))return n.lifespan&&n.lifespan>0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,n.lifespan)),r.response;if(!e)throw r.promise}let s={keys:t,equal:n.equal,remove:()=>{let r=xo.indexOf(s);r!==-1&&xo.splice(r,1)},promise:(VD(i)?i:i(...t)).then(r=>{s.response=r,n.lifespan&&n.lifespan>0&&(s.timeout=setTimeout(s.remove,n.lifespan))}).catch(r=>s.error=r)};if(xo.push(s),!e)throw s.promise}var T1=(i,t,e)=>E1(i,t,!1,e),A1=(i,t,e)=>{E1(i,t,!0,e)};var C1=i=>{if(i===void 0||i.length===0)xo.splice(0,xo.length);else{let t=xo.find(e=>b1(i,e.keys,e.equal));t&&t.remove()}};var K1=zn(Hv()),tg=zn(km()),eg=zn(So());function Q1(i){let t=i.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}var $1=i=>i&&i.isOrthographicCamera;var WD=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),tx=((i,t)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((t=window.navigator)==null?void 0:t.product)==="ReactNative"))()?Sn.useLayoutEffect:Sn.useEffect;function XD(i){let t=Sn.useRef(i);return tx(()=>{t.current=i},[i]),t}function tE(i){var t;let e=typeof window<"u"?(t=window.devicePixelRatio)!=null?t:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],e),i[1]):i}function Mo(i){var t;return(t=i.__r3f)==null?void 0:t.root.getState()}var nn={obj:i=>i===Object(i)&&!nn.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,t,{arrays:e="shallow",objects:n="reference",strict:s=!0}={}){if(typeof i!=typeof t||!!i!=!!t)return!1;if(nn.str(i)||nn.num(i)||nn.boo(i))return i===t;let r=nn.obj(i);if(r&&n==="reference")return i===t;let l=nn.arr(i);if(l&&e==="reference")return i===t;if((l||r)&&i===t)return!0;let c;for(c in i)if(!(c in t))return!1;if(r&&e==="shallow"&&n==="shallow"){for(c in s?t:i)if(!nn.equ(i[c],t[c],{strict:s,objects:"reference"}))return!1}else for(c in s?t:i)if(i[c]!==t[c])return!1;if(nn.und(c)){if(l&&i.length===0&&t.length===0||r&&Object.keys(i).length===0&&Object.keys(t).length===0)return!0;if(i!==t)return!1}return!0}};function eE(i){let t={nodes:{},materials:{},meshes:{}};return i&&i.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}function nE(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(let t in i){let e=i[t];e?.type!=="Scene"&&(e==null||e.dispose==null||e.dispose())}}var iE=["children","key","ref"];function qD(i){let t={};for(let e in i)iE.includes(e)||(t[e]=i[e]);return t}function Zm(i,t,e,n){let s=i,r=s?.__r3f;return r||(r={root:t,type:e,parent:null,children:[],props:qD(n),object:s,eventCount:0,handlers:{},isHidden:!1},s&&(s.__r3f=r)),r}function If(i,t){if(!t.includes("-"))return{root:i,key:t,target:i[t]};if(t in i)return{root:i,key:t,target:i[t]};let e=i,n=t.split("-");for(let s of n){if(typeof e!="object"||e===null){if(e!==void 0){let r=n.slice(n.indexOf(s)).join("-");return{root:e,key:r,target:void 0}}return{root:i,key:t,target:void 0}}t=s,i=e,e=e[t]}return{root:i,key:t,target:e}}var W1=/-\d+$/;function jm(i,t){if(nn.str(t.props.attach)){if(W1.test(t.props.attach)){let s=t.props.attach.replace(W1,""),{root:r,key:l}=If(i.object,s);Array.isArray(r[l])||(r[l]=[])}let{root:e,key:n}=If(i.object,t.props.attach);t.previousAttach=e[n],e[n]=t.object}else nn.fun(t.props.attach)&&(t.previousAttach=t.props.attach(i.object,t.object))}function Jm(i,t){if(nn.str(t.props.attach)){let{root:e,key:n}=If(i.object,t.props.attach),s=t.previousAttach;s===void 0?delete e[n]:e[n]=s}else t.previousAttach==null||t.previousAttach(i.object,t.object);delete t.previousAttach}var jv=[...iE,"args","dispose","attach","object","onUpdate","dispose"],X1=new Map;function YD(i){let t=X1.get(i.constructor);try{t||(t=new i.constructor,X1.set(i.constructor,t))}catch{}return t}function ZD(i,t){let e={};for(let n in t)if(!jv.includes(n)&&!nn.equ(t[n],i.props[n])){e[n]=t[n];for(let s in t)s.startsWith(`${n}-`)&&(e[s]=t[s])}for(let n in i.props){if(jv.includes(n)||t.hasOwnProperty(n))continue;let{root:s,key:r}=If(i.object,n);if(s.constructor&&s.constructor.length===0){let l=YD(s);nn.und(l)||(e[r]=l[r])}else e[r]=0}return e}var jD=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],JD=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function ya(i,t){var e;let n=i.__r3f,s=n&&Q1(n).getState(),r=n?.eventCount;for(let c in t){let h=t[c];if(jv.includes(c))continue;if(n&&JD.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:f,key:p,target:m}=If(i,c);if(m===void 0&&(typeof f!="object"||f===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(m instanceof Is&&h instanceof Is)m.mask=h.mask;else if(m instanceof Lt&&WD(h))m.set(h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof m.copy=="function"&&h!=null&&h.constructor&&m.constructor===h.constructor)m.copy(h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&Array.isArray(h))typeof m.fromArray=="function"?m.fromArray(h):m.set(...h);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof h=="number")typeof m.setScalar=="function"?m.setScalar(h):m.set(h);else{var l;f[p]=h,s&&!s.linear&&jD.includes(p)&&(l=f[p])!=null&&l.isTexture&&f[p].format===Un&&f[p].type===Gn&&(f[p].colorSpace=Dn)}}if(n!=null&&n.parent&&s!=null&&s.internal&&(e=n.object)!=null&&e.isObject3D&&r!==n.eventCount){let c=n.object,h=s.internal.interaction.indexOf(c);h>-1&&s.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&s.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Tc(n),i}function Tc(i){var t;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);let e=(t=i.root)==null||t.getState==null?void 0:t.getState();e&&e.internal.frames===0&&e.invalidate()}function KD(i,t){i.manual||($1(i)?(i.left=t.width/-2,i.right=t.width/2,i.top=t.height/2,i.bottom=t.height/-2):i.aspect=t.width/t.height,i.updateProjectionMatrix())}var hi=i=>i?.isObject3D;function Xm(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function sE(i,t,e,n){let s=e.get(t);s&&(e.delete(t),e.size===0&&(i.delete(n),s.target.releasePointerCapture(n)))}function QD(i,t){let{internal:e}=i.getState();e.interaction=e.interaction.filter(n=>n!==t),e.initialHits=e.initialHits.filter(n=>n!==t),e.hovered.forEach((n,s)=>{(n.eventObject===t||n.object===t)&&e.hovered.delete(s)}),e.capturedMap.forEach((n,s)=>{sE(e.capturedMap,t,n,s)})}function aE(i){function t(h){let{internal:f}=i.getState(),p=h.offsetX-f.initialClick[0],m=h.offsetY-f.initialClick[1];return Math.round(Math.sqrt(p*p+m*m))}function e(h){return h.filter(f=>["Move","Over","Enter","Out","Leave"].some(p=>{var m;return(m=f.__r3f)==null?void 0:m.handlers["onPointer"+p]}))}function n(h,f){let p=i.getState(),m=new Set,g=[],v=f?f(p.internal.interaction):p.internal.interaction;for(let x=0;x<v.length;x++){let E=Mo(v[x]);E&&(E.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(h,p);function y(x){let E=Mo(x);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var T;E.events.compute==null||E.events.compute(h,E,(T=E.previousRoot)==null?void 0:T.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(x,!0):[]}let b=v.flatMap(y).sort((x,E)=>{let T=Mo(x.object),A=Mo(E.object);return!T||!A?x.distance-E.distance:A.events.priority-T.events.priority||x.distance-E.distance}).filter(x=>{let E=Xm(x);return m.has(E)?!1:(m.add(E),!0)});p.events.filter&&(b=p.events.filter(b,p));for(let x of b){let E=x.object;for(;E;){var S;(S=E.__r3f)!=null&&S.eventCount&&g.push({...x,eventObject:E}),E=E.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let x of p.internal.capturedMap.get(h.pointerId).values())m.has(Xm(x.intersection))||g.push(x.intersection);return g}function s(h,f,p,m){if(h.length){let g={stopped:!1};for(let v of h){let y=Mo(v.object);if(y||v.object.traverseAncestors(b=>{let S=Mo(b);if(S)return y=S,!1}),y){let{raycaster:b,pointer:S,camera:x,internal:E}=y,T=new O(S.x,S.y,0).unproject(x),A=C=>{var w,z;return(w=(z=E.capturedMap.get(C))==null?void 0:z.has(v.eventObject))!=null?w:!1},N=C=>{let w={intersection:v,target:f.target};E.capturedMap.has(C)?E.capturedMap.get(C).set(v.eventObject,w):E.capturedMap.set(C,new Map([[v.eventObject,w]])),f.target.setPointerCapture(C)},D=C=>{let w=E.capturedMap.get(C);w&&sE(E.capturedMap,v.eventObject,w,C)},L={};for(let C in f){let w=f[C];typeof w!="function"&&(L[C]=w)}let F={...v,...L,pointer:S,intersections:h,stopped:g.stopped,delta:p,unprojectedPoint:T,ray:b.ray,camera:x,stopPropagation(){let C="pointerId"in f&&E.capturedMap.get(f.pointerId);if((!C||C.has(v.eventObject))&&(F.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(w=>w.eventObject===v.eventObject))){let w=h.slice(0,h.indexOf(v));r([...w,v])}},target:{hasPointerCapture:A,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:A,setPointerCapture:N,releasePointerCapture:D},nativeEvent:f};if(m(F),g.stopped===!0)break}}}return h}function r(h){let{internal:f}=i.getState();for(let p of f.hovered.values())if(!h.length||!h.find(m=>m.object===p.object&&m.index===p.index&&m.instanceId===p.instanceId)){let g=p.eventObject.__r3f;if(f.hovered.delete(Xm(p)),g!=null&&g.eventCount){let v=g.handlers,y={...p,intersections:h};v.onPointerOut==null||v.onPointerOut(y),v.onPointerLeave==null||v.onPointerLeave(y)}}}function l(h,f){for(let p=0;p<f.length;p++){let m=f[p].__r3f;m==null||m.handlers.onPointerMissed==null||m.handlers.onPointerMissed(h)}}function c(h){switch(h){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return f=>{let{internal:p}=i.getState();"pointerId"in f&&p.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(f.pointerId)&&(p.capturedMap.delete(f.pointerId),r([]))})}}return function(p){let{onPointerMissed:m,internal:g}=i.getState();g.lastEvent.current=p;let v=h==="onPointerMove",y=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",S=n(p,v?e:void 0),x=y?t(p):0;h==="onPointerDown"&&(g.initialClick=[p.offsetX,p.offsetY],g.initialHits=S.map(T=>T.eventObject)),y&&!S.length&&x<=2&&(l(p,g.interaction),m&&m(p)),v&&r(S);function E(T){let A=T.eventObject,N=A.__r3f;if(!(N!=null&&N.eventCount))return;let D=N.handlers;if(v){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){let L=Xm(T),F=g.hovered.get(L);F?F.stopped&&T.stopPropagation():(g.hovered.set(L,T),D.onPointerOver==null||D.onPointerOver(T),D.onPointerEnter==null||D.onPointerEnter(T))}D.onPointerMove==null||D.onPointerMove(T)}else{let L=D[h];L?(!y||g.initialHits.includes(A))&&(l(p,g.interaction.filter(F=>!g.initialHits.includes(F))),L(T)):y&&g.initialHits.includes(A)&&l(p,g.interaction.filter(F=>!g.initialHits.includes(F)))}}s(S,p,x,E)}}return{handlePointer:c}}var q1=i=>!!(i!=null&&i.render),ex=Sn.createContext(null),$D=(i,t)=>{let e=M1((c,h)=>{let f=new O,p=new O,m=new O;function g(x=h().camera,E=p,T=h().size){let{width:A,height:N,top:D,left:L}=T,F=A/N;E.isVector3?m.copy(E):m.set(...E);let C=x.getWorldPosition(f).distanceTo(m);if($1(x))return{width:A/x.zoom,height:N/x.zoom,top:D,left:L,factor:1,distance:C,aspect:F};{let w=x.fov*Math.PI/180,z=2*Math.tan(w/2)*C,Y=z*(A/N);return{width:Y,height:z,top:D,left:L,factor:A/Y,distance:C,aspect:F}}}let v,y=x=>c(E=>({performance:{...E.performance,current:x}})),b=new ft;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(x=1)=>i(h(),x),advance:(x,E)=>t(x,E,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new lo,pointer:b,mouse:b,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let x=h();v&&clearTimeout(v),x.performance.current!==x.performance.min&&y(x.performance.min),v=setTimeout(()=>y(h().performance.max),x.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:g},setEvents:x=>c(E=>({...E,events:{...E.events,...x}})),setSize:(x,E,T=0,A=0)=>{let N=h().camera,D={width:x,height:E,top:T,left:A};c(L=>({size:D,viewport:{...L.viewport,...g(N,p,D)}}))},setDpr:x=>c(E=>{let T=tE(x);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(x="always")=>{let E=h().clock;E.stop(),E.elapsedTime=0,x!=="never"&&(E.start(),E.elapsedTime=0),c(()=>({frameloop:x}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Sn.createRef(),active:!1,frames:0,priority:0,subscribe:(x,E,T)=>{let A=h().internal;return A.priority=A.priority+(E>0?1:0),A.subscribers.push({ref:x,priority:E,store:T}),A.subscribers=A.subscribers.sort((N,D)=>N.priority-D.priority),()=>{let N=h().internal;N!=null&&N.subscribers&&(N.priority=N.priority-(E>0?1:0),N.subscribers=N.subscribers.filter(D=>D.ref!==x))}}}}}),n=e.getState(),s=n.size,r=n.viewport.dpr,l=n.camera;return e.subscribe(()=>{let{camera:c,size:h,viewport:f,gl:p,set:m}=e.getState();if(h.width!==s.width||h.height!==s.height||f.dpr!==r){s=h,r=f.dpr,KD(c,h),f.dpr>0&&p.setPixelRatio(f.dpr);let g=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,g)}c!==l&&(l=c,m(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),e.subscribe(c=>i(c)),e};function rE(){let i=Sn.useContext(ex);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function nx(i,t=0){let e=rE(),n=e.getState().internal.subscribe,s=XD(i);return tx(()=>n(s,t,e),[t,n,e]),null}var Y1=new WeakMap,tU=i=>{var t;return typeof i=="function"&&(i==null||(t=i.prototype)==null?void 0:t.constructor)===i};function oE(i,t){return function(e,...n){let s;return tU(e)?(s=Y1.get(e),s||(s=new e,Y1.set(e,s))):s=e,i&&i(s),Promise.all(n.map(r=>new Promise((l,c)=>s.load(r,h=>{hi(h?.scene)&&Object.assign(h,eE(h.scene)),l(h)},t,h=>c(new Error(`Could not load ${r}: ${h?.message}`))))))}}function ix(i,t,e,n){let s=Array.isArray(t)?t:[t],r=T1(oE(e,n),[i,...s],{equal:nn.equ});return Array.isArray(t)?r:r[0]}ix.preload=function(i,t,e){let n=Array.isArray(t)?t:[t];return A1(oE(e),[i,...n])};ix.clear=function(i,t){let e=Array.isArray(t)?t:[t];return C1([i,...e])};var eU={name:"@react-three/fiber",version:"9.4.2",description:"A React renderer for Threejs",keywords:["react","renderer","fiber","three","threejs"],author:"Paul Henschel (https://github.com/drcmda)",license:"MIT",maintainers:["Josh Ellis (https://github.com/joshuaellis)","Cody Bennett (https://github.com/codyjasonbennett)","Kris Baumgarter (https://github.com/krispya)"],bugs:{url:"https://github.com/pmndrs/react-three-fiber/issues"},homepage:"https://github.com/pmndrs/react-three-fiber#readme",repository:{type:"git",url:"git+https://github.com/pmndrs/react-three-fiber.git"},collective:{type:"opencollective",url:"https://opencollective.com/react-three-fiber"},main:"dist/react-three-fiber.cjs.js",module:"dist/react-three-fiber.esm.js",types:"dist/react-three-fiber.cjs.d.ts","react-native":"native/dist/react-three-fiber-native.cjs.js",sideEffects:!1,preconstruct:{entrypoints:["index.tsx","native.tsx"]},scripts:{prebuild:"cp ../../readme.md readme.md"},dependencies:{"@babel/runtime":"^7.17.8","@types/react-reconciler":"^0.32.0","@types/webxr":"*","base64-js":"^1.5.1",buffer:"^6.0.3","its-fine":"^2.0.0","react-reconciler":"^0.31.0","react-use-measure":"^2.1.7",scheduler:"^0.25.0","suspend-react":"^0.1.3","use-sync-external-store":"^1.4.0",zustand:"^5.0.3"},peerDependencies:{expo:">=43.0","expo-asset":">=8.4","expo-file-system":">=11.0","expo-gl":">=11.0",react:"^19.0.0","react-dom":"^19.0.0","react-native":">=0.78",three:">=0.156"},peerDependenciesMeta:{"react-dom":{optional:!0},"react-native":{optional:!0},expo:{optional:!0},"expo-asset":{optional:!0},"expo-file-system":{optional:!0},"expo-gl":{optional:!0}}};function nU(i){let t=(0,K1.default)(i);return t.injectIntoDevTools(),t}var lE=0,Ec={},iU=/^three(?=[A-Z])/,ng=i=>`${i[0].toUpperCase()}${i.slice(1)}`,sU=0,aU=i=>typeof i=="function";function sx(i){if(aU(i)){let t=`${sU++}`;return Ec[t]=i,t}else Object.assign(Ec,i)}function cE(i,t){let e=ng(i),n=Ec[e];if(i!=="primitive"&&!n)throw new Error(`R3F: ${e} 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(i==="primitive"&&!t.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(t.args!==void 0&&!Array.isArray(t.args))throw new Error("R3F: The args prop must be an array!")}function rU(i,t,e){var n;return i=ng(i)in Ec?i:i.replace(iU,""),cE(i,t),i==="primitive"&&(n=t.object)!=null&&n.__r3f&&delete t.object.__r3f,Zm(t.object,e,i,t)}function oU(i){if(!i.isHidden){var t;i.props.attach&&(t=i.parent)!=null&&t.object?Jm(i.parent,i):hi(i.object)&&(i.object.visible=!1),i.isHidden=!0,Tc(i)}}function uE(i){if(i.isHidden){var t;i.props.attach&&(t=i.parent)!=null&&t.object?jm(i.parent,i):hi(i.object)&&i.props.visible!==!1&&(i.object.visible=!0),i.isHidden=!1,Tc(i)}}function ax(i,t,e){let n=t.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!t.object){var s,r;let l=Ec[ng(t.type)];t.object=(s=t.props.object)!=null?s:new l(...(r=t.props.args)!=null?r:[]),t.object.__r3f=t}if(ya(t.object,t.props),t.props.attach)jm(i,t);else if(hi(t.object)&&hi(i.object)){let l=i.object.children.indexOf(e?.object);if(e&&l!==-1){let c=i.object.children.indexOf(t.object);if(c!==-1){i.object.children.splice(c,1);let h=c<l?l-1:l;i.object.children.splice(h,0,t.object)}else t.object.parent=i.object,i.object.children.splice(l,0,t.object),t.object.dispatchEvent({type:"added"}),i.object.dispatchEvent({type:"childadded",child:t.object})}else i.object.add(t.object)}for(let l of t.children)ax(t,l);Tc(t)}}function Gv(i,t){t&&(t.parent=i,i.children.push(t),ax(i,t))}function Z1(i,t,e){if(!t||!e)return;t.parent=i;let n=i.children.indexOf(e);n!==-1?i.children.splice(n,0,t):i.children.push(t),ax(i,t,e)}function hE(i){if(typeof i.dispose=="function"){let t=()=>{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?t():(0,tg.unstable_scheduleCallback)(tg.unstable_IdlePriority,t)}}function Jv(i,t,e){if(!t)return;t.parent=null;let n=i.children.indexOf(t);n!==-1&&i.children.splice(n,1),t.props.attach?Jm(i,t):hi(t.object)&&hi(i.object)&&(i.object.remove(t.object),QD(Q1(t),t.object));let s=t.props.dispose!==null&&e!==!1;for(let r=t.children.length-1;r>=0;r--){let l=t.children[r];Jv(t,l,s)}t.children.length=0,delete t.object.__r3f,s&&t.type!=="primitive"&&t.object.type!=="Scene"&&hE(t.object),e===void 0&&Tc(t)}function lU(i,t){for(let e of[i,i.alternate])if(e!==null)if(typeof e.ref=="function"){e.refCleanup==null||e.refCleanup();let n=e.ref(t);typeof n=="function"&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t)}var Ym=[];function cU(){for(let[e]of Ym){let n=e.parent;if(n){e.props.attach?Jm(n,e):hi(e.object)&&hi(n.object)&&n.object.remove(e.object);for(let s of e.children)s.props.attach?Jm(e,s):hi(s.object)&&hi(e.object)&&e.object.remove(s.object)}e.isHidden&&uE(e),e.object.__r3f&&delete e.object.__r3f,e.type!=="primitive"&&hE(e.object)}for(let[e,n,s]of Ym){e.props=n;let r=e.parent;if(r){var i,t;let l=Ec[ng(e.type)];e.object=(i=e.props.object)!=null?i:new l(...(t=e.props.args)!=null?t:[]),e.object.__r3f=e,lU(s,e.object),ya(e.object,e.props),e.props.attach?jm(r,e):hi(e.object)&&hi(r.object)&&r.object.add(e.object);for(let c of e.children)c.props.attach?jm(e,c):hi(c.object)&&hi(e.object)&&e.object.add(c.object);Tc(e)}}Ym.length=0}var kv=()=>{},j1={},qm=lE,uU=0,hU=4,Km=nU({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:rU,removeChild:Jv,appendChild:Gv,appendInitialChild:Gv,insertBefore:Z1,appendChildToContainer(i,t){let e=i.getState().scene.__r3f;!t||!e||Gv(e,t)},removeChildFromContainer(i,t){let e=i.getState().scene.__r3f;!t||!e||Jv(e,t)},insertInContainerBefore(i,t,e){let n=i.getState().scene.__r3f;!t||!e||!n||Z1(n,t,e)},getRootHostContext:()=>j1,getChildHostContext:()=>j1,commitUpdate(i,t,e,n,s){var r,l,c;cE(t,n);let h=!1;if((i.type==="primitive"&&e.object!==n.object||((r=n.args)==null?void 0:r.length)!==((l=e.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((p,m)=>{var g;return p!==((g=e.args)==null?void 0:g[m])}))&&(h=!0),h)Ym.push([i,{...n},s]);else{let p=ZD(i,n);Object.keys(p).length&&(Object.assign(i.props,p),ya(i.object,p))}(s.sibling===null||(s.flags&hU)===uU)&&cU()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i?.object,prepareForCommit:()=>null,preparePortalMount:i=>Zm(i.getState().scene,i,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:oU,unhideInstance:uE,createTextInstance:kv,hideTextInstance:kv,unhideTextInstance:kv,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,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Sn.createContext(null),setCurrentUpdatePriority(i){qm=i},getCurrentUpdatePriority(){return qm},resolveUpdatePriority(){var i;if(qm!==lE)return qm;switch(typeof window<"u"&&((i=window.event)==null?void 0:i.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return fr.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return fr.ContinuousEventPriority;default:return fr.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:eU.version}),hr=new Map,Sc={objects:"shallow",strict:!1};function fU(i,t){if(!t&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){let{width:e,height:n,top:s,left:r}=i.parentElement.getBoundingClientRect();return{width:e,height:n,top:s,left:r}}else if(!t&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...t}}function rx(i){let t=hr.get(i),e=t?.fiber,n=t?.store;t&&console.warn("R3F.createRoot should only be called once!");let s=typeof reportError=="function"?reportError:console.error,r=n||$D($m,$v),l=e||Km.createContainer(r,fr.ConcurrentRoot,null,!1,null,"",s,s,s,null);t||hr.set(i,{fiber:l,store:r});let c,h,f=!1,p=null;return{async configure(m={}){let g;p=new Promise(mt=>g=mt);let{gl:v,size:y,scene:b,events:S,onCreated:x,shadows:E=!1,linear:T=!1,flat:A=!1,legacy:N=!1,orthographic:D=!1,frameloop:L="always",dpr:F=[1,2],performance:C,raycaster:w,camera:z,onPointerMissed:Y}=m,G=r.getState(),j=G.gl;if(!G.gl){let mt={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0},kt=typeof v=="function"?await v(mt):v;q1(kt)?j=kt:j=new vo({...mt,...v}),G.set({gl:j})}let nt=G.raycaster;nt||G.set({raycaster:nt=new sc});let{params:J,...et}=w||{};if(nn.equ(et,nt,Sc)||ya(nt,{...et}),nn.equ(J,nt.params,Sc)||ya(nt,{params:{...nt.params,...J}}),!G.camera||G.camera===h&&!nn.equ(h,z,Sc)){h=z;let mt=z?.isCamera,kt=mt?z:D?new Bs(0,0,0,0,.1,1e3):new fn(75,0,.1,1e3);mt||(kt.position.z=5,z&&(ya(kt,z),kt.manual||("aspect"in z||"left"in z||"right"in z||"bottom"in z||"top"in z)&&(kt.manual=!0,kt.updateProjectionMatrix())),!G.camera&&!(z!=null&&z.rotation)&&kt.lookAt(0,0,0)),G.set({camera:kt}),nt.camera=kt}if(!G.scene){let mt;b!=null&&b.isScene?(mt=b,Zm(mt,r,"",{})):(mt=new eo,Zm(mt,r,"",{}),b&&ya(mt,b)),G.set({scene:mt})}S&&!G.events.handlers&&G.set({events:S(r)});let rt=fU(i,y);if(nn.equ(rt,G.size,Sc)||G.setSize(rt.width,rt.height,rt.top,rt.left),F&&G.viewport.dpr!==tE(F)&&G.setDpr(F),G.frameloop!==L&&G.setFrameloop(L),G.onPointerMissed||G.set({onPointerMissed:Y}),C&&!nn.equ(C,G.performance,Sc)&&G.set(mt=>({performance:{...mt.performance,...C}})),!G.xr){var St;let mt=(re,Ce)=>{let at=r.getState();at.frameloop!=="never"&&$v(re,!0,at,Ce)},kt=()=>{let re=r.getState();re.gl.xr.enabled=re.gl.xr.isPresenting,re.gl.xr.setAnimationLoop(re.gl.xr.isPresenting?mt:null),re.gl.xr.isPresenting||$m(re)},$t={connect(){let re=r.getState().gl;re.xr.addEventListener("sessionstart",kt),re.xr.addEventListener("sessionend",kt)},disconnect(){let re=r.getState().gl;re.xr.removeEventListener("sessionstart",kt),re.xr.removeEventListener("sessionend",kt)}};typeof((St=j.xr)==null?void 0:St.addEventListener)=="function"&&$t.connect(),G.set({xr:$t})}if(j.shadowMap){let mt=j.shadowMap.enabled,kt=j.shadowMap.type;if(j.shadowMap.enabled=!!E,nn.boo(E))j.shadowMap.type=ma;else if(nn.str(E)){var bt;let $t={basic:hm,percentage:ar,soft:ma,variance:ga};j.shadowMap.type=(bt=$t[E])!=null?bt:ma}else nn.obj(E)&&Object.assign(j.shadowMap,E);(mt!==j.shadowMap.enabled||kt!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return be.enabled=!N,f||(j.outputColorSpace=T?Ps:Dn,j.toneMapping=A?Si:rc),G.legacy!==N&&G.set(()=>({legacy:N})),G.linear!==T&&G.set(()=>({linear:T})),G.flat!==A&&G.set(()=>({flat:A})),v&&!nn.fun(v)&&!q1(v)&&!nn.equ(v,j,Sc)&&ya(j,v),c=x,f=!0,g(),this},render(m){return!f&&!p&&this.configure(),p.then(()=>{Km.updateContainer((0,eg.jsx)(dU,{store:r,children:m,onCreated:c,rootElement:i}),l,null,()=>{})}),r},unmount(){fE(i)}}}function dU({store:i,children:t,onCreated:e,rootElement:n}){return tx(()=>{let s=i.getState();s.set(r=>({internal:{...r.internal,active:!0}})),e&&e(s),i.getState().events.connected||s.events.connect==null||s.events.connect(n)},[]),(0,eg.jsx)(ex.Provider,{value:i,children:t})}function fE(i,t){let e=hr.get(i),n=e?.fiber;if(n){let s=e?.store.getState();s&&(s.internal.active=!1),Km.updateContainer(null,n,null,()=>{s&&setTimeout(()=>{try{var r,l,c,h;s.events.disconnect==null||s.events.disconnect(),(r=s.gl)==null||(l=r.renderLists)==null||l.dispose==null||l.dispose(),(c=s.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(h=s.gl)!=null&&h.xr&&s.xr.disconnect(),nE(s.scene),hr.delete(i),t&&t(i)}catch{}},500)})}}var pU=new Set,mU=new Set,gU=new Set;function Wv(i,t){if(i.size)for(let{callback:e}of i.values())e(t)}function bc(i,t){switch(i){case"before":return Wv(pU,t);case"after":return Wv(mU,t);case"tail":return Wv(gU,t)}}var Xv,qv;function Kv(i,t,e){let n=t.clock.getDelta();t.frameloop==="never"&&typeof i=="number"&&(n=i-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=i),Xv=t.internal.subscribers;for(let s=0;s<Xv.length;s++)qv=Xv[s],qv.ref.current(qv.store.getState(),n,e);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),t.frameloop==="always"?1:t.internal.frames}var Qm=!1,Qv=!1,Yv,J1,Mc;function dE(i){J1=requestAnimationFrame(dE),Qm=!0,Yv=0,bc("before",i),Qv=!0;for(let e of hr.values()){var t;Mc=e.store.getState(),Mc.internal.active&&(Mc.frameloop==="always"||Mc.internal.frames>0)&&!((t=Mc.gl.xr)!=null&&t.isPresenting)&&(Yv+=Kv(i,Mc))}if(Qv=!1,bc("after",i),Yv===0)return bc("tail",i),Qm=!1,cancelAnimationFrame(J1)}function $m(i,t=1){var e;if(!i)return hr.forEach(n=>$m(n.store.getState(),t));(e=i.gl.xr)!=null&&e.isPresenting||!i.internal.active||i.frameloop==="never"||(t>1?i.internal.frames=Math.min(60,i.internal.frames+t):Qv?i.internal.frames=2:i.internal.frames=1,Qm||(Qm=!0,requestAnimationFrame(dE)))}function $v(i,t=!0,e,n){if(t&&bc("before",i),e)Kv(i,e,n);else for(let s of hr.values())Kv(i,s.store.getState());t&&bc("after",i)}var Zv={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 ox(i){let{handlePointer:t}=aE(i);return{priority:1,enabled:!0,compute(e,n,s){n.pointer.set(e.offsetX/n.size.width*2-1,-(e.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Zv).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var e;let{events:n,internal:s}=i.getState();(e=s.lastEvent)!=null&&e.current&&n.handlers&&n.handlers.onPointerMove(s.lastEvent.current)},connect:e=>{let{set:n,events:s}=i.getState();if(s.disconnect==null||s.disconnect(),n(r=>({events:{...r.events,connected:e}})),s.handlers)for(let r in s.handlers){let l=s.handlers[r],[c,h]=Zv[r];e.addEventListener(c,l,{passive:h})}},disconnect:()=>{let{set:e,events:n}=i.getState();if(n.connected){if(n.handlers)for(let s in n.handlers){let r=n.handlers[s],[l]=Zv[s];n.connected.removeEventListener(l,r)}e(s=>({events:{...s.events,connected:void 0}}))}}}}var Ac=zn(lr());var _U=zn(So()),tP=zn(Uv());var eP=zn(Hv()),nP=zn(km());var pE=zn(lr(),1);var Hs=zn(So(),1);function mE(){let i=(0,pE.useRef)(null);return nx((t,e)=>{i.current&&(i.current.rotation.x+=e,i.current.rotation.y+=e*.5)}),(0,Hs.jsxs)(Hs.Fragment,{children:[(0,Hs.jsx)("ambientLight",{intensity:.5}),(0,Hs.jsx)("pointLight",{position:[10,10,10]}),(0,Hs.jsxs)("mesh",{ref:i,children:[(0,Hs.jsx)("boxGeometry",{args:[1,1,1]}),(0,Hs.jsx)("meshStandardMaterial",{color:"orange"})]})]})}var gE=i=>({resolveScene:async t=>{let e=i[t];if(!e)throw new Error(`[Axion] Scene ID "${t}" not found.`);try{return(await import(e)).default}catch(n){throw console.error(`[Axion] Failed to load scene: ${e}`,n),n}}});var vE=zn(So(),1);function vU(i){return typeof i=="function"&&!!i.prototype&&i.constructor.name!=="Object"}var _E={};Object.entries(Lm).forEach(([i,t])=>{vU(t)&&(_E[i]=t)});sx(_E);var Cc=null;self.onmessage=async i=>{let{type:t,canvas:e,config:n,payload:s,manifest:r}=i.data;if(t==="INIT"&&e&&n){let l=new DataView(n),c=l.getUint32(0),h=l.getUint32(4),f=l.getFloat32(8),p=l.getUint8(12)===1;Cc&&(Cc.unmount(),Cc=null);let m=new vo({canvas:e,antialias:!0});m.shadowMap.enabled=p,m.shadowMap.type=ma,Cc=rx(e),r&&gE(r),await Cc.configure({gl:m,events:ox,size:{width:c,height:h,top:0,left:0},dpr:f,camera:{position:[0,0,5]}}),Cc.render((0,vE.jsx)(mE,{})),self.postMessage({type:"ENGINE_READY"}),console.log(`Engine initialized at ${c}x${h} with DPR ${f}`)}};})();
4023
4023
  /*! Bundled license information:
4024
4024
 
4025
4025
  react/cjs/react.production.js: