@shmulikdav/solix 1.4.1 → 1.5.0

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var wl=Symbol.for("react.element"),_w=Symbol.for("react.portal"),Sw=Symbol.for("react.fragment"),Mw=Symbol.for("react.strict_mode"),ww=Symbol.for("react.profiler"),bw=Symbol.for("react.provider"),Ew=Symbol.for("react.context"),Tw=Symbol.for("react.forward_ref"),Aw=Symbol.for("react.suspense"),Cw=Symbol.for("react.memo"),Rw=Symbol.for("react.lazy"),Dg=Symbol.iterator;function Pw(n){return n===null||typeof n!="object"?null:(n=Dg&&n[Dg]||n["@@iterator"],typeof n=="function"?n:null)}var Bv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zv=Object.assign,Vv={};function Fo(n,e,t){this.props=n,this.context=e,this.refs=Vv,this.updater=t||Bv}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Fo.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Hv(){}Hv.prototype=Fo.prototype;function Gp(n,e,t){this.props=n,this.context=e,this.refs=Vv,this.updater=t||Bv}var Wp=Gp.prototype=new Hv;Wp.constructor=Gp;zv(Wp,Fo.prototype);Wp.isPureReactComponent=!0;var Ug=Array.isArray,Gv=Object.prototype.hasOwnProperty,jp={current:null},Wv={key:!0,ref:!0,__self:!0,__source:!0};function jv(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Gv.call(e,i)&&!Wv.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:wl,type:n,key:s,ref:o,props:r,_owner:jp.current}}function Iw(n,e){return{$$typeof:wl,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function Xp(n){return typeof n=="object"&&n!==null&&n.$$typeof===wl}function Nw(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var kg=/\/+/g;function ph(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Nw(""+n.key):e.toString(36)}function qc(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case wl:case _w:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+ph(o,0):i,Ug(r)?(t="",n!=null&&(t=n.replace(kg,"$&/")+"/"),qc(r,e,t,"",function(c){return c})):r!=null&&(Xp(r)&&(r=Iw(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(kg,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",Ug(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+ph(s,a);o+=qc(s,e,t,l,r)}else if(l=Pw(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+ph(s,a++),o+=qc(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function zl(n,e,t){if(n==null)return n;var i=[],r=0;return qc(n,i,"","",function(s){return e.call(t,s,r++)}),i}function Lw(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var mn={current:null},Zc={transition:null},Dw={ReactCurrentDispatcher:mn,ReactCurrentBatchConfig:Zc,ReactCurrentOwner:jp};function Xv(){throw Error("act(...) is not supported in production builds of React.")}Ze.Children={map:zl,forEach:function(n,e,t){zl(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return zl(n,function(){e++}),e},toArray:function(n){return zl(n,function(e){return e})||[]},only:function(n){if(!Xp(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Ze.Component=Fo;Ze.Fragment=Sw;Ze.Profiler=ww;Ze.PureComponent=Gp;Ze.StrictMode=Mw;Ze.Suspense=Aw;Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dw;Ze.act=Xv;Ze.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=zv({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=jp.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)Gv.call(e,l)&&!Wv.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:wl,type:n.type,key:r,ref:s,props:i,_owner:o}};Ze.createContext=function(n){return n={$$typeof:Ew,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:bw,_context:n},n.Consumer=n};Ze.createElement=jv;Ze.createFactory=function(n){var e=jv.bind(null,n);return e.type=n,e};Ze.createRef=function(){return{current:null}};Ze.forwardRef=function(n){return{$$typeof:Tw,render:n}};Ze.isValidElement=Xp;Ze.lazy=function(n){return{$$typeof:Rw,_payload:{_status:-1,_result:n},_init:Lw}};Ze.memo=function(n,e){return{$$typeof:Cw,type:n,compare:e===void 0?null:e}};Ze.startTransition=function(n){var e=Zc.transition;Zc.transition={};try{n()}finally{Zc.transition=e}};Ze.unstable_act=Xv;Ze.useCallback=function(n,e){return mn.current.useCallback(n,e)};Ze.useContext=function(n){return mn.current.useContext(n)};Ze.useDebugValue=function(){};Ze.useDeferredValue=function(n){return mn.current.useDeferredValue(n)};Ze.useEffect=function(n,e){return mn.current.useEffect(n,e)};Ze.useId=function(){return mn.current.useId()};Ze.useImperativeHandle=function(n,e,t){return mn.current.useImperativeHandle(n,e,t)};Ze.useInsertionEffect=function(n,e){return mn.current.useInsertionEffect(n,e)};Ze.useLayoutEffect=function(n,e){return mn.current.useLayoutEffect(n,e)};Ze.useMemo=function(n,e){return mn.current.useMemo(n,e)};Ze.useReducer=function(n,e,t){return mn.current.useReducer(n,e,t)};Ze.useRef=function(n){return mn.current.useRef(n)};Ze.useState=function(n){return mn.current.useState(n)};Ze.useSyncExternalStore=function(n,e,t){return mn.current.useSyncExternalStore(n,e,t)};Ze.useTransition=function(){return mn.current.useTransition()};Ze.version="18.3.1";Fv.exports=Ze;var Ie=Fv.exports;const Uw=kv(Ie);/**
9
+ */var wl=Symbol.for("react.element"),_w=Symbol.for("react.portal"),Sw=Symbol.for("react.fragment"),Mw=Symbol.for("react.strict_mode"),ww=Symbol.for("react.profiler"),bw=Symbol.for("react.provider"),Ew=Symbol.for("react.context"),Tw=Symbol.for("react.forward_ref"),Aw=Symbol.for("react.suspense"),Cw=Symbol.for("react.memo"),Rw=Symbol.for("react.lazy"),Dg=Symbol.iterator;function Pw(n){return n===null||typeof n!="object"?null:(n=Dg&&n[Dg]||n["@@iterator"],typeof n=="function"?n:null)}var Bv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zv=Object.assign,Vv={};function Fo(n,e,t){this.props=n,this.context=e,this.refs=Vv,this.updater=t||Bv}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Fo.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Hv(){}Hv.prototype=Fo.prototype;function Gp(n,e,t){this.props=n,this.context=e,this.refs=Vv,this.updater=t||Bv}var Wp=Gp.prototype=new Hv;Wp.constructor=Gp;zv(Wp,Fo.prototype);Wp.isPureReactComponent=!0;var Ug=Array.isArray,Gv=Object.prototype.hasOwnProperty,jp={current:null},Wv={key:!0,ref:!0,__self:!0,__source:!0};function jv(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Gv.call(e,i)&&!Wv.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:wl,type:n,key:s,ref:o,props:r,_owner:jp.current}}function Iw(n,e){return{$$typeof:wl,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function Xp(n){return typeof n=="object"&&n!==null&&n.$$typeof===wl}function Nw(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var kg=/\/+/g;function ph(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Nw(""+n.key):e.toString(36)}function qc(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case wl:case _w:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+ph(o,0):i,Ug(r)?(t="",n!=null&&(t=n.replace(kg,"$&/")+"/"),qc(r,e,t,"",function(c){return c})):r!=null&&(Xp(r)&&(r=Iw(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(kg,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",Ug(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+ph(s,a);o+=qc(s,e,t,l,r)}else if(l=Pw(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+ph(s,a++),o+=qc(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function zl(n,e,t){if(n==null)return n;var i=[],r=0;return qc(n,i,"","",function(s){return e.call(t,s,r++)}),i}function Lw(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var mn={current:null},Zc={transition:null},Dw={ReactCurrentDispatcher:mn,ReactCurrentBatchConfig:Zc,ReactCurrentOwner:jp};function Xv(){throw Error("act(...) is not supported in production builds of React.")}Ze.Children={map:zl,forEach:function(n,e,t){zl(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return zl(n,function(){e++}),e},toArray:function(n){return zl(n,function(e){return e})||[]},only:function(n){if(!Xp(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Ze.Component=Fo;Ze.Fragment=Sw;Ze.Profiler=ww;Ze.PureComponent=Gp;Ze.StrictMode=Mw;Ze.Suspense=Aw;Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dw;Ze.act=Xv;Ze.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=zv({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=jp.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)Gv.call(e,l)&&!Wv.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:wl,type:n.type,key:r,ref:s,props:i,_owner:o}};Ze.createContext=function(n){return n={$$typeof:Ew,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:bw,_context:n},n.Consumer=n};Ze.createElement=jv;Ze.createFactory=function(n){var e=jv.bind(null,n);return e.type=n,e};Ze.createRef=function(){return{current:null}};Ze.forwardRef=function(n){return{$$typeof:Tw,render:n}};Ze.isValidElement=Xp;Ze.lazy=function(n){return{$$typeof:Rw,_payload:{_status:-1,_result:n},_init:Lw}};Ze.memo=function(n,e){return{$$typeof:Cw,type:n,compare:e===void 0?null:e}};Ze.startTransition=function(n){var e=Zc.transition;Zc.transition={};try{n()}finally{Zc.transition=e}};Ze.unstable_act=Xv;Ze.useCallback=function(n,e){return mn.current.useCallback(n,e)};Ze.useContext=function(n){return mn.current.useContext(n)};Ze.useDebugValue=function(){};Ze.useDeferredValue=function(n){return mn.current.useDeferredValue(n)};Ze.useEffect=function(n,e){return mn.current.useEffect(n,e)};Ze.useId=function(){return mn.current.useId()};Ze.useImperativeHandle=function(n,e,t){return mn.current.useImperativeHandle(n,e,t)};Ze.useInsertionEffect=function(n,e){return mn.current.useInsertionEffect(n,e)};Ze.useLayoutEffect=function(n,e){return mn.current.useLayoutEffect(n,e)};Ze.useMemo=function(n,e){return mn.current.useMemo(n,e)};Ze.useReducer=function(n,e,t){return mn.current.useReducer(n,e,t)};Ze.useRef=function(n){return mn.current.useRef(n)};Ze.useState=function(n){return mn.current.useState(n)};Ze.useSyncExternalStore=function(n,e,t){return mn.current.useSyncExternalStore(n,e,t)};Ze.useTransition=function(){return mn.current.useTransition()};Ze.version="18.3.1";Fv.exports=Ze;var Pe=Fv.exports;const Uw=kv(Pe);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var kw=Ie,Ow=Symbol.for("react.element"),Fw=Symbol.for("react.fragment"),Bw=Object.prototype.hasOwnProperty,zw=kw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vw={key:!0,ref:!0,__self:!0,__source:!0};function Yv(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)Bw.call(e,i)&&!Vw.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:Ow,type:n,key:s,ref:o,props:r,_owner:zw.current}}dd.Fragment=Fw;dd.jsx=Yv;dd.jsxs=Yv;Ov.exports=dd;var S=Ov.exports,$v={exports:{}},Fn={},qv={exports:{}},Zv={};/**
17
+ */var kw=Pe,Ow=Symbol.for("react.element"),Fw=Symbol.for("react.fragment"),Bw=Object.prototype.hasOwnProperty,zw=kw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vw={key:!0,ref:!0,__self:!0,__source:!0};function Yv(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)Bw.call(e,i)&&!Vw.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:Ow,type:n,key:s,ref:o,props:r,_owner:zw.current}}dd.Fragment=Fw;dd.jsx=Yv;dd.jsxs=Yv;Ov.exports=dd;var S=Ov.exports,$v={exports:{}},Fn={},qv={exports:{}},Zv={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(n){function e(D,X){var Q=D.length;D.push(X);e:for(;0<Q;){var oe=Q-1>>>1,Re=D[oe];if(0<r(Re,X))D[oe]=X,D[Q]=Re,Q=oe;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var X=D[0],Q=D.pop();if(Q!==X){D[0]=Q;e:for(var oe=0,Re=D.length,Ke=Re>>>1;oe<Ke;){var j=2*(oe+1)-1,se=D[j],xe=j+1,de=D[xe];if(0>r(se,Q))xe<Re&&0>r(de,se)?(D[oe]=de,D[xe]=Q,oe=xe):(D[oe]=se,D[j]=Q,oe=j);else if(xe<Re&&0>r(de,Q))D[oe]=de,D[xe]=Q,oe=xe;else break e}}return X}function r(D,X){var Q=D.sortIndex-X.sortIndex;return Q!==0?Q:D.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,h=3,p=!1,m=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(D){for(var X=t(c);X!==null;){if(X.callback===null)i(c);else if(X.startTime<=D)i(c),X.sortIndex=X.expirationTime,e(l,X);else break;X=t(c)}}function _(D){if(y=!1,x(D),!m)if(t(l)!==null)m=!0,W(R);else{var X=t(c);X!==null&&ne(_,X.startTime-D)}}function R(D,X){m=!1,y&&(y=!1,f(A),A=-1),p=!0;var Q=h;try{for(x(X),d=t(l);d!==null&&(!(d.expirationTime>X)||D&&!L());){var oe=d.callback;if(typeof oe=="function"){d.callback=null,h=d.priorityLevel;var Re=oe(d.expirationTime<=X);X=n.unstable_now(),typeof Re=="function"?d.callback=Re:d===t(l)&&i(l),x(X)}else i(l);d=t(l)}if(d!==null)var Ke=!0;else{var j=t(c);j!==null&&ne(_,j.startTime-X),Ke=!1}return Ke}finally{d=null,h=Q,p=!1}}var M=!1,T=null,A=-1,E=5,w=-1;function L(){return!(n.unstable_now()-w<E)}function V(){if(T!==null){var D=n.unstable_now();w=D;var X=!0;try{X=T(!0,D)}finally{X?F():(M=!1,T=null)}}else M=!1}var F;if(typeof v=="function")F=function(){v(V)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,Y=G.port2;G.port1.onmessage=V,F=function(){Y.postMessage(null)}}else F=function(){g(V,0)};function W(D){T=D,M||(M=!0,F())}function ne(D,X){A=g(function(){D(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,W(R))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return h},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(D){switch(h){case 1:case 2:case 3:var X=3;break;default:X=h}var Q=h;h=X;try{return D()}finally{h=Q}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,X){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var Q=h;h=D;try{return X()}finally{h=Q}},n.unstable_scheduleCallback=function(D,X,Q){var oe=n.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?oe+Q:oe):Q=oe,D){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=Q+Re,D={id:u++,callback:X,priorityLevel:D,startTime:Q,expirationTime:Re,sortIndex:-1},Q>oe?(D.sortIndex=Q,e(c,D),t(l)===null&&D===t(c)&&(y?(f(A),A=-1):y=!0,ne(_,Q-oe))):(D.sortIndex=Re,e(l,D),m||p||(m=!0,W(R))),D},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(D){var X=h;return function(){var Q=h;h=X;try{return D.apply(this,arguments)}finally{h=Q}}}})(Zv);qv.exports=Zv;var Hw=qv.exports;/**
25
+ */(function(n){function e(D,Y){var Q=D.length;D.push(Y);e:for(;0<Q;){var oe=Q-1>>>1,Re=D[oe];if(0<r(Re,Y))D[oe]=Y,D[Q]=Re,Q=oe;else break e}}function t(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var Y=D[0],Q=D.pop();if(Q!==Y){D[0]=Q;e:for(var oe=0,Re=D.length,Ke=Re>>>1;oe<Ke;){var j=2*(oe+1)-1,se=D[j],xe=j+1,de=D[xe];if(0>r(se,Q))xe<Re&&0>r(de,se)?(D[oe]=de,D[xe]=Q,oe=xe):(D[oe]=se,D[j]=Q,oe=j);else if(xe<Re&&0>r(de,Q))D[oe]=de,D[xe]=Q,oe=xe;else break e}}return Y}function r(D,Y){var Q=D.sortIndex-Y.sortIndex;return Q!==0?Q:D.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,h=3,p=!1,m=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(D){for(var Y=t(c);Y!==null;){if(Y.callback===null)i(c);else if(Y.startTime<=D)i(c),Y.sortIndex=Y.expirationTime,e(l,Y);else break;Y=t(c)}}function _(D){if(y=!1,g(D),!m)if(t(l)!==null)m=!0,W(R);else{var Y=t(c);Y!==null&&ne(_,Y.startTime-D)}}function R(D,Y){m=!1,y&&(y=!1,f(b),b=-1),p=!0;var Q=h;try{for(g(Y),d=t(l);d!==null&&(!(d.expirationTime>Y)||D&&!L());){var oe=d.callback;if(typeof oe=="function"){d.callback=null,h=d.priorityLevel;var Re=oe(d.expirationTime<=Y);Y=n.unstable_now(),typeof Re=="function"?d.callback=Re:d===t(l)&&i(l),g(Y)}else i(l);d=t(l)}if(d!==null)var Ke=!0;else{var j=t(c);j!==null&&ne(_,j.startTime-Y),Ke=!1}return Ke}finally{d=null,h=Q,p=!1}}var w=!1,A=null,b=-1,E=5,M=-1;function L(){return!(n.unstable_now()-M<E)}function V(){if(A!==null){var D=n.unstable_now();M=D;var Y=!0;try{Y=A(!0,D)}finally{Y?F():(w=!1,A=null)}}else w=!1}var F;if(typeof v=="function")F=function(){v(V)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,X=G.port2;G.port1.onmessage=V,F=function(){X.postMessage(null)}}else F=function(){x(V,0)};function W(D){A=D,w||(w=!0,F())}function ne(D,Y){b=x(function(){D(n.unstable_now())},Y)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_continueExecution=function(){m||p||(m=!0,W(R))},n.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<D?Math.floor(1e3/D):5},n.unstable_getCurrentPriorityLevel=function(){return h},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(D){switch(h){case 1:case 2:case 3:var Y=3;break;default:Y=h}var Q=h;h=Y;try{return D()}finally{h=Q}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(D,Y){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var Q=h;h=D;try{return Y()}finally{h=Q}},n.unstable_scheduleCallback=function(D,Y,Q){var oe=n.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?oe+Q:oe):Q=oe,D){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=Q+Re,D={id:u++,callback:Y,priorityLevel:D,startTime:Q,expirationTime:Re,sortIndex:-1},Q>oe?(D.sortIndex=Q,e(c,D),t(l)===null&&D===t(c)&&(y?(f(b),b=-1):y=!0,ne(_,Q-oe))):(D.sortIndex=Re,e(l,D),m||p||(m=!0,W(R))),D},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(D){var Y=h;return function(){var Q=h;h=Y;try{return D.apply(this,arguments)}finally{h=Q}}}})(Zv);qv.exports=Zv;var Hw=qv.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Gw=Ie,kn=Hw;function re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Kv=new Set,Ba={};function Ts(n,e){To(n,e),To(n+"Capture",e)}function To(n,e){for(Ba[n]=e,n=0;n<e.length;n++)Kv.add(e[n])}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uf=Object.prototype.hasOwnProperty,Ww=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Og={},Fg={};function jw(n){return Uf.call(Fg,n)?!0:Uf.call(Og,n)?!1:Ww.test(n)?Fg[n]=!0:(Og[n]=!0,!1)}function Xw(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function Yw(n,e,t,i){if(e===null||typeof e>"u"||Xw(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function gn(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Zt[n]=new gn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Zt[e]=new gn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Zt[n]=new gn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Zt[n]=new gn(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Zt[n]=new gn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Zt[n]=new gn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Zt[n]=new gn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Zt[n]=new gn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Zt[n]=new gn(n,5,!1,n.toLowerCase(),null,!1,!1)});var Yp=/[\-:]([a-z])/g;function $p(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new gn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!0,!0)});function qp(n,e,t,i){var r=Zt.hasOwnProperty(e)?Zt[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Yw(e,t,r,i)&&(t=null),i||r===null?jw(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var er=Gw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vl=Symbol.for("react.element"),eo=Symbol.for("react.portal"),to=Symbol.for("react.fragment"),Zp=Symbol.for("react.strict_mode"),kf=Symbol.for("react.profiler"),Jv=Symbol.for("react.provider"),Qv=Symbol.for("react.context"),Kp=Symbol.for("react.forward_ref"),Of=Symbol.for("react.suspense"),Ff=Symbol.for("react.suspense_list"),Jp=Symbol.for("react.memo"),fr=Symbol.for("react.lazy"),ey=Symbol.for("react.offscreen"),Bg=Symbol.iterator;function Yo(n){return n===null||typeof n!="object"?null:(n=Bg&&n[Bg]||n["@@iterator"],typeof n=="function"?n:null)}var Mt=Object.assign,mh;function ma(n){if(mh===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);mh=e&&e[1]||""}return`
33
+ */var Gw=Pe,kn=Hw;function re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Kv=new Set,Ba={};function Ts(n,e){To(n,e),To(n+"Capture",e)}function To(n,e){for(Ba[n]=e,n=0;n<e.length;n++)Kv.add(e[n])}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uf=Object.prototype.hasOwnProperty,Ww=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Og={},Fg={};function jw(n){return Uf.call(Fg,n)?!0:Uf.call(Og,n)?!1:Ww.test(n)?Fg[n]=!0:(Og[n]=!0,!1)}function Xw(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function Yw(n,e,t,i){if(e===null||typeof e>"u"||Xw(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function gn(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Zt[n]=new gn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Zt[e]=new gn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Zt[n]=new gn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Zt[n]=new gn(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Zt[n]=new gn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Zt[n]=new gn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Zt[n]=new gn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Zt[n]=new gn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Zt[n]=new gn(n,5,!1,n.toLowerCase(),null,!1,!1)});var Yp=/[\-:]([a-z])/g;function $p(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Yp,$p);Zt[e]=new gn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new gn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Zt[n]=new gn(n,1,!1,n.toLowerCase(),null,!0,!0)});function qp(n,e,t,i){var r=Zt.hasOwnProperty(e)?Zt[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Yw(e,t,r,i)&&(t=null),i||r===null?jw(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var er=Gw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vl=Symbol.for("react.element"),eo=Symbol.for("react.portal"),to=Symbol.for("react.fragment"),Zp=Symbol.for("react.strict_mode"),kf=Symbol.for("react.profiler"),Jv=Symbol.for("react.provider"),Qv=Symbol.for("react.context"),Kp=Symbol.for("react.forward_ref"),Of=Symbol.for("react.suspense"),Ff=Symbol.for("react.suspense_list"),Jp=Symbol.for("react.memo"),fr=Symbol.for("react.lazy"),ey=Symbol.for("react.offscreen"),Bg=Symbol.iterator;function Yo(n){return n===null||typeof n!="object"?null:(n=Bg&&n[Bg]||n["@@iterator"],typeof n=="function"?n:null)}var Mt=Object.assign,mh;function ma(n){if(mh===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);mh=e&&e[1]||""}return`
34
34
  `+mh+n}var gh=!1;function xh(n,e){if(!n||gh)return"";gh=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var i=c}Reflect.construct(n,[],e)}else{try{e.call()}catch(c){i=c}n.call(e.prototype)}else{try{throw Error()}catch(c){i=c}n()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var r=c.stack.split(`
35
35
  `),s=i.stack.split(`
36
36
  `),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var l=`
37
- `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{gh=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?ma(n):""}function $w(n){switch(n.tag){case 5:return ma(n.type);case 16:return ma("Lazy");case 13:return ma("Suspense");case 19:return ma("SuspenseList");case 0:case 2:case 15:return n=xh(n.type,!1),n;case 11:return n=xh(n.type.render,!1),n;case 1:return n=xh(n.type,!0),n;default:return""}}function Bf(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case to:return"Fragment";case eo:return"Portal";case kf:return"Profiler";case Zp:return"StrictMode";case Of:return"Suspense";case Ff:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case Qv:return(n.displayName||"Context")+".Consumer";case Jv:return(n._context.displayName||"Context")+".Provider";case Kp:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Jp:return e=n.displayName||null,e!==null?e:Bf(n.type)||"Memo";case fr:e=n._payload,n=n._init;try{return Bf(n(e))}catch{}}return null}function qw(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Bf(e);case 8:return e===Zp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Rr(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ty(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Zw(n){var e=ty(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Hl(n){n._valueTracker||(n._valueTracker=Zw(n))}function ny(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=ty(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function cu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function zf(n,e){var t=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zg(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Rr(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function iy(n,e){e=e.checked,e!=null&&qp(n,"checked",e,!1)}function Vf(n,e){iy(n,e);var t=Rr(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Hf(n,e.type,t):e.hasOwnProperty("defaultValue")&&Hf(n,e.type,Rr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Vg(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Hf(n,e,t){(e!=="number"||cu(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ga=Array.isArray;function vo(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Rr(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function Gf(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(re(91));return Mt({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Hg(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(re(92));if(ga(t)){if(1<t.length)throw Error(re(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Rr(t)}}function ry(n,e){var t=Rr(e.value),i=Rr(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Gg(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function sy(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Wf(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?sy(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Gl,oy=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(Gl=Gl||document.createElement("div"),Gl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Gl.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function za(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Sa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Kw=["Webkit","ms","Moz","O"];Object.keys(Sa).forEach(function(n){Kw.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Sa[e]=Sa[n]})});function ay(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Sa.hasOwnProperty(n)&&Sa[n]?(""+e).trim():e+"px"}function ly(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=ay(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var Jw=Mt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function jf(n,e){if(e){if(Jw[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function Xf(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Yf=null;function Qp(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var $f=null,yo=null,_o=null;function Wg(n){if(n=Tl(n)){if(typeof $f!="function")throw Error(re(280));var e=n.stateNode;e&&(e=gd(e),$f(n.stateNode,n.type,e))}}function cy(n){yo?_o?_o.push(n):_o=[n]:yo=n}function uy(){if(yo){var n=yo,e=_o;if(_o=yo=null,Wg(n),e)for(n=0;n<e.length;n++)Wg(e[n])}}function dy(n,e){return n(e)}function hy(){}var vh=!1;function fy(n,e,t){if(vh)return n(e,t);vh=!0;try{return dy(n,e,t)}finally{vh=!1,(yo!==null||_o!==null)&&(hy(),uy())}}function Va(n,e){var t=n.stateNode;if(t===null)return null;var i=gd(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(re(231,e,typeof t));return t}var qf=!1;if(Xi)try{var $o={};Object.defineProperty($o,"passive",{get:function(){qf=!0}}),window.addEventListener("test",$o,$o),window.removeEventListener("test",$o,$o)}catch{qf=!1}function Qw(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var Ma=!1,uu=null,du=!1,Zf=null,e1={onError:function(n){Ma=!0,uu=n}};function t1(n,e,t,i,r,s,o,a,l){Ma=!1,uu=null,Qw.apply(e1,arguments)}function n1(n,e,t,i,r,s,o,a,l){if(t1.apply(this,arguments),Ma){if(Ma){var c=uu;Ma=!1,uu=null}else throw Error(re(198));du||(du=!0,Zf=c)}}function As(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function py(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function jg(n){if(As(n)!==n)throw Error(re(188))}function i1(n){var e=n.alternate;if(!e){if(e=As(n),e===null)throw Error(re(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return jg(r),n;if(s===i)return jg(r),e;s=s.sibling}throw Error(re(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(re(189))}}if(t.alternate!==i)throw Error(re(190))}if(t.tag!==3)throw Error(re(188));return t.stateNode.current===t?n:e}function my(n){return n=i1(n),n!==null?gy(n):null}function gy(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=gy(n);if(e!==null)return e;n=n.sibling}return null}var xy=kn.unstable_scheduleCallback,Xg=kn.unstable_cancelCallback,r1=kn.unstable_shouldYield,s1=kn.unstable_requestPaint,Pt=kn.unstable_now,o1=kn.unstable_getCurrentPriorityLevel,em=kn.unstable_ImmediatePriority,vy=kn.unstable_UserBlockingPriority,hu=kn.unstable_NormalPriority,a1=kn.unstable_LowPriority,yy=kn.unstable_IdlePriority,hd=null,Si=null;function l1(n){if(Si&&typeof Si.onCommitFiberRoot=="function")try{Si.onCommitFiberRoot(hd,n,void 0,(n.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:d1,c1=Math.log,u1=Math.LN2;function d1(n){return n>>>=0,n===0?32:31-(c1(n)/u1|0)|0}var Wl=64,jl=4194304;function xa(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function fu(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=xa(a):(s&=o,s!==0&&(i=xa(s)))}else o=t&~r,o!==0?i=xa(o):s!==0&&(i=xa(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-si(e),r=1<<t,i|=n[t],e&=~r;return i}function h1(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function f1(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-si(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=h1(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function Kf(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function _y(){var n=Wl;return Wl<<=1,!(Wl&4194240)&&(Wl=64),n}function yh(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function bl(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-si(e),n[e]=t}function p1(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-si(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function tm(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-si(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var dt=0;function Sy(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var My,nm,wy,by,Ey,Jf=!1,Xl=[],Sr=null,Mr=null,wr=null,Ha=new Map,Ga=new Map,gr=[],m1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yg(n,e){switch(n){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":Ha.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ga.delete(e.pointerId)}}function qo(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Tl(e),e!==null&&nm(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function g1(n,e,t,i,r){switch(e){case"focusin":return Sr=qo(Sr,n,e,t,i,r),!0;case"dragenter":return Mr=qo(Mr,n,e,t,i,r),!0;case"mouseover":return wr=qo(wr,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Ha.set(s,qo(Ha.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Ga.set(s,qo(Ga.get(s)||null,n,e,t,i,r)),!0}return!1}function Ty(n){var e=rs(n.target);if(e!==null){var t=As(e);if(t!==null){if(e=t.tag,e===13){if(e=py(t),e!==null){n.blockedOn=e,Ey(n.priority,function(){wy(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Kc(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Qf(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);Yf=i,t.target.dispatchEvent(i),Yf=null}else return e=Tl(t),e!==null&&nm(e),n.blockedOn=t,!1;e.shift()}return!0}function $g(n,e,t){Kc(n)&&t.delete(e)}function x1(){Jf=!1,Sr!==null&&Kc(Sr)&&(Sr=null),Mr!==null&&Kc(Mr)&&(Mr=null),wr!==null&&Kc(wr)&&(wr=null),Ha.forEach($g),Ga.forEach($g)}function Zo(n,e){n.blockedOn===e&&(n.blockedOn=null,Jf||(Jf=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,x1)))}function Wa(n){function e(r){return Zo(r,n)}if(0<Xl.length){Zo(Xl[0],n);for(var t=1;t<Xl.length;t++){var i=Xl[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Sr!==null&&Zo(Sr,n),Mr!==null&&Zo(Mr,n),wr!==null&&Zo(wr,n),Ha.forEach(e),Ga.forEach(e),t=0;t<gr.length;t++)i=gr[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<gr.length&&(t=gr[0],t.blockedOn===null);)Ty(t),t.blockedOn===null&&gr.shift()}var So=er.ReactCurrentBatchConfig,pu=!0;function v1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=1,im(n,e,t,i)}finally{dt=r,So.transition=s}}function y1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=4,im(n,e,t,i)}finally{dt=r,So.transition=s}}function im(n,e,t,i){if(pu){var r=Qf(n,e,t,i);if(r===null)Rh(n,e,i,mu,t),Yg(n,i);else if(g1(r,n,e,t,i))i.stopPropagation();else if(Yg(n,i),e&4&&-1<m1.indexOf(n)){for(;r!==null;){var s=Tl(r);if(s!==null&&My(s),s=Qf(n,e,t,i),s===null&&Rh(n,e,i,mu,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Rh(n,e,i,null,t)}}var mu=null;function Qf(n,e,t,i){if(mu=null,n=Qp(i),n=rs(n),n!==null)if(e=As(n),e===null)n=null;else if(t=e.tag,t===13){if(n=py(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return mu=n,null}function Ay(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(o1()){case em:return 1;case vy:return 4;case hu:case a1:return 16;case yy:return 536870912;default:return 16}default:return 16}}var yr=null,rm=null,Jc=null;function Cy(){if(Jc)return Jc;var n,e=rm,t=e.length,i,r="value"in yr?yr.value:yr.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return Jc=r.slice(n,1<i?1-i:void 0)}function Qc(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Yl(){return!0}function qg(){return!1}function Bn(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Yl:qg,this.isPropagationStopped=qg,this}return Mt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Yl)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),e}var Bo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sm=Bn(Bo),El=Mt({},Bo,{view:0,detail:0}),_1=Bn(El),_h,Sh,Ko,fd=Mt({},El,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:om,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ko&&(Ko&&n.type==="mousemove"?(_h=n.screenX-Ko.screenX,Sh=n.screenY-Ko.screenY):Sh=_h=0,Ko=n),_h)},movementY:function(n){return"movementY"in n?n.movementY:Sh}}),Zg=Bn(fd),S1=Mt({},fd,{dataTransfer:0}),M1=Bn(S1),w1=Mt({},El,{relatedTarget:0}),Mh=Bn(w1),b1=Mt({},Bo,{animationName:0,elapsedTime:0,pseudoElement:0}),E1=Bn(b1),T1=Mt({},Bo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),A1=Bn(T1),C1=Mt({},Bo,{data:0}),Kg=Bn(C1),R1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},I1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function N1(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=I1[n])?!!e[n]:!1}function om(){return N1}var L1=Mt({},El,{key:function(n){if(n.key){var e=R1[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Qc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?P1[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:om,charCode:function(n){return n.type==="keypress"?Qc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Qc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),D1=Bn(L1),U1=Mt({},fd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jg=Bn(U1),k1=Mt({},El,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:om}),O1=Bn(k1),F1=Mt({},Bo,{propertyName:0,elapsedTime:0,pseudoElement:0}),B1=Bn(F1),z1=Mt({},fd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),V1=Bn(z1),H1=[9,13,27,32],am=Xi&&"CompositionEvent"in window,wa=null;Xi&&"documentMode"in document&&(wa=document.documentMode);var G1=Xi&&"TextEvent"in window&&!wa,Ry=Xi&&(!am||wa&&8<wa&&11>=wa),Qg=" ",ex=!1;function Py(n,e){switch(n){case"keyup":return H1.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var no=!1;function W1(n,e){switch(n){case"compositionend":return Iy(e);case"keypress":return e.which!==32?null:(ex=!0,Qg);case"textInput":return n=e.data,n===Qg&&ex?null:n;default:return null}}function j1(n,e){if(no)return n==="compositionend"||!am&&Py(n,e)?(n=Cy(),Jc=rm=yr=null,no=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Ry&&e.locale!=="ko"?null:e.data;default:return null}}var X1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function tx(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!X1[n.type]:e==="textarea"}function Ny(n,e,t,i){cy(i),e=gu(e,"onChange"),0<e.length&&(t=new sm("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var ba=null,ja=null;function Y1(n){Gy(n,0)}function pd(n){var e=so(n);if(ny(e))return n}function $1(n,e){if(n==="change")return e}var Ly=!1;if(Xi){var wh;if(Xi){var bh="oninput"in document;if(!bh){var nx=document.createElement("div");nx.setAttribute("oninput","return;"),bh=typeof nx.oninput=="function"}wh=bh}else wh=!1;Ly=wh&&(!document.documentMode||9<document.documentMode)}function ix(){ba&&(ba.detachEvent("onpropertychange",Dy),ja=ba=null)}function Dy(n){if(n.propertyName==="value"&&pd(ja)){var e=[];Ny(e,ja,n,Qp(n)),fy(Y1,e)}}function q1(n,e,t){n==="focusin"?(ix(),ba=e,ja=t,ba.attachEvent("onpropertychange",Dy)):n==="focusout"&&ix()}function Z1(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return pd(ja)}function K1(n,e){if(n==="click")return pd(e)}function J1(n,e){if(n==="input"||n==="change")return pd(e)}function Q1(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ai=typeof Object.is=="function"?Object.is:Q1;function Xa(n,e){if(ai(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!Uf.call(e,r)||!ai(n[r],e[r]))return!1}return!0}function rx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function sx(n,e){var t=rx(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=rx(t)}}function Uy(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Uy(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function ky(){for(var n=window,e=cu();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=cu(n.document)}return e}function lm(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function eb(n){var e=ky(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Uy(t.ownerDocument.documentElement,t)){if(i!==null&&lm(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=sx(t,s);var o=sx(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var tb=Xi&&"documentMode"in document&&11>=document.documentMode,io=null,ep=null,Ea=null,tp=!1;function ox(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;tp||io==null||io!==cu(i)||(i=io,"selectionStart"in i&&lm(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ea&&Xa(Ea,i)||(Ea=i,i=gu(ep,"onSelect"),0<i.length&&(e=new sm("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=io)))}function $l(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var ro={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionend:$l("Transition","TransitionEnd")},Eh={},Oy={};Xi&&(Oy=document.createElement("div").style,"AnimationEvent"in window||(delete ro.animationend.animation,delete ro.animationiteration.animation,delete ro.animationstart.animation),"TransitionEvent"in window||delete ro.transitionend.transition);function md(n){if(Eh[n])return Eh[n];if(!ro[n])return n;var e=ro[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in Oy)return Eh[n]=e[t];return n}var Fy=md("animationend"),By=md("animationiteration"),zy=md("animationstart"),Vy=md("transitionend"),Hy=new Map,ax="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Lr(n,e){Hy.set(n,e),Ts(e,[n])}for(var Th=0;Th<ax.length;Th++){var Ah=ax[Th],nb=Ah.toLowerCase(),ib=Ah[0].toUpperCase()+Ah.slice(1);Lr(nb,"on"+ib)}Lr(Fy,"onAnimationEnd");Lr(By,"onAnimationIteration");Lr(zy,"onAnimationStart");Lr("dblclick","onDoubleClick");Lr("focusin","onFocus");Lr("focusout","onBlur");Lr(Vy,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ts("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rb=new Set("cancel close invalid load scroll toggle".split(" ").concat(va));function lx(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,n1(i,e,void 0,n),n.currentTarget=null}function Gy(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}}}if(du)throw n=Zf,du=!1,Zf=null,n}function mt(n,e){var t=e[op];t===void 0&&(t=e[op]=new Set);var i=n+"__bubble";t.has(i)||(Wy(e,n,2,!1),t.add(i))}function Ch(n,e,t){var i=0;e&&(i|=4),Wy(t,n,i,e)}var ql="_reactListening"+Math.random().toString(36).slice(2);function Ya(n){if(!n[ql]){n[ql]=!0,Kv.forEach(function(t){t!=="selectionchange"&&(rb.has(t)||Ch(t,!1,n),Ch(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[ql]||(e[ql]=!0,Ch("selectionchange",!1,e))}}function Wy(n,e,t,i){switch(Ay(e)){case 1:var r=v1;break;case 4:r=y1;break;default:r=im}t=r.bind(null,e,t,n),r=void 0,!qf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Rh(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=rs(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}fy(function(){var c=s,u=Qp(t),d=[];e:{var h=Hy.get(n);if(h!==void 0){var p=sm,m=n;switch(n){case"keypress":if(Qc(t)===0)break e;case"keydown":case"keyup":p=D1;break;case"focusin":m="focus",p=Mh;break;case"focusout":m="blur",p=Mh;break;case"beforeblur":case"afterblur":p=Mh;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=M1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=O1;break;case Fy:case By:case zy:p=E1;break;case Vy:p=B1;break;case"scroll":p=_1;break;case"wheel":p=V1;break;case"copy":case"cut":case"paste":p=A1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Jg}var y=(e&4)!==0,g=!y&&n==="scroll",f=y?h!==null?h+"Capture":null:h;y=[];for(var v=c,x;v!==null;){x=v;var _=x.stateNode;if(x.tag===5&&_!==null&&(x=_,f!==null&&(_=Va(v,f),_!=null&&y.push($a(v,_,x)))),g)break;v=v.return}0<y.length&&(h=new p(h,m,null,t,u),d.push({event:h,listeners:y}))}}if(!(e&7)){e:{if(h=n==="mouseover"||n==="pointerover",p=n==="mouseout"||n==="pointerout",h&&t!==Yf&&(m=t.relatedTarget||t.fromElement)&&(rs(m)||m[Yi]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=c,m=m?rs(m):null,m!==null&&(g=As(m),m!==g||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(y=Zg,_="onMouseLeave",f="onMouseEnter",v="mouse",(n==="pointerout"||n==="pointerover")&&(y=Jg,_="onPointerLeave",f="onPointerEnter",v="pointer"),g=p==null?h:so(p),x=m==null?h:so(m),h=new y(_,v+"leave",p,t,u),h.target=g,h.relatedTarget=x,_=null,rs(u)===c&&(y=new y(f,v+"enter",m,t,u),y.target=x,y.relatedTarget=g,_=y),g=_,p&&m)t:{for(y=p,f=m,v=0,x=y;x;x=Ns(x))v++;for(x=0,_=f;_;_=Ns(_))x++;for(;0<v-x;)y=Ns(y),v--;for(;0<x-v;)f=Ns(f),x--;for(;v--;){if(y===f||f!==null&&y===f.alternate)break t;y=Ns(y),f=Ns(f)}y=null}else y=null;p!==null&&cx(d,h,p,y,!1),m!==null&&g!==null&&cx(d,g,m,y,!0)}}e:{if(h=c?so(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var R=$1;else if(tx(h))if(Ly)R=J1;else{R=Z1;var M=q1}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(R=K1);if(R&&(R=R(n,c))){Ny(d,R,t,u);break e}M&&M(n,h,c),n==="focusout"&&(M=h._wrapperState)&&M.controlled&&h.type==="number"&&Hf(h,"number",h.value)}switch(M=c?so(c):window,n){case"focusin":(tx(M)||M.contentEditable==="true")&&(io=M,ep=c,Ea=null);break;case"focusout":Ea=ep=io=null;break;case"mousedown":tp=!0;break;case"contextmenu":case"mouseup":case"dragend":tp=!1,ox(d,t,u);break;case"selectionchange":if(tb)break;case"keydown":case"keyup":ox(d,t,u)}var T;if(am)e:{switch(n){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else no?Py(n,t)&&(A="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(A="onCompositionStart");A&&(Ry&&t.locale!=="ko"&&(no||A!=="onCompositionStart"?A==="onCompositionEnd"&&no&&(T=Cy()):(yr=u,rm="value"in yr?yr.value:yr.textContent,no=!0)),M=gu(c,A),0<M.length&&(A=new Kg(A,n,null,t,u),d.push({event:A,listeners:M}),T?A.data=T:(T=Iy(t),T!==null&&(A.data=T)))),(T=G1?W1(n,t):j1(n,t))&&(c=gu(c,"onBeforeInput"),0<c.length&&(u=new Kg("onBeforeInput","beforeinput",null,t,u),d.push({event:u,listeners:c}),u.data=T))}Gy(d,e)})}function $a(n,e,t){return{instance:n,listener:e,currentTarget:t}}function gu(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Va(n,t),s!=null&&i.unshift($a(n,s,r)),s=Va(n,e),s!=null&&i.push($a(n,s,r))),n=n.return}return i}function Ns(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function cx(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=Va(t,s),l!=null&&o.unshift($a(t,l,a))):r||(l=Va(t,s),l!=null&&o.push($a(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var sb=/\r\n?/g,ob=/\u0000|\uFFFD/g;function ux(n){return(typeof n=="string"?n:""+n).replace(sb,`
38
- `).replace(ob,"")}function Zl(n,e,t){if(e=ux(e),ux(n)!==e&&t)throw Error(re(425))}function xu(){}var np=null,ip=null;function rp(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var sp=typeof setTimeout=="function"?setTimeout:void 0,ab=typeof clearTimeout=="function"?clearTimeout:void 0,dx=typeof Promise=="function"?Promise:void 0,lb=typeof queueMicrotask=="function"?queueMicrotask:typeof dx<"u"?function(n){return dx.resolve(null).then(n).catch(cb)}:sp;function cb(n){setTimeout(function(){throw n})}function Ph(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),Wa(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);Wa(e)}function br(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function hx(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var zo=Math.random().toString(36).slice(2),xi="__reactFiber$"+zo,qa="__reactProps$"+zo,Yi="__reactContainer$"+zo,op="__reactEvents$"+zo,ub="__reactListeners$"+zo,db="__reactHandles$"+zo;function rs(n){var e=n[xi];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Yi]||t[xi]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=hx(n);n!==null;){if(t=n[xi])return t;n=hx(n)}return e}n=t,t=n.parentNode}return null}function Tl(n){return n=n[xi]||n[Yi],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function so(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(re(33))}function gd(n){return n[qa]||null}var ap=[],oo=-1;function Dr(n){return{current:n}}function gt(n){0>oo||(n.current=ap[oo],ap[oo]=null,oo--)}function pt(n,e){oo++,ap[oo]=n.current,n.current=e}var Pr={},sn=Dr(Pr),Mn=Dr(!1),xs=Pr;function Ao(n,e){var t=n.type.contextTypes;if(!t)return Pr;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function wn(n){return n=n.childContextTypes,n!=null}function vu(){gt(Mn),gt(sn)}function fx(n,e,t){if(sn.current!==Pr)throw Error(re(168));pt(sn,e),pt(Mn,t)}function jy(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(re(108,qw(n)||"Unknown",r));return Mt({},t,i)}function yu(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Pr,xs=sn.current,pt(sn,n),pt(Mn,Mn.current),!0}function px(n,e,t){var i=n.stateNode;if(!i)throw Error(re(169));t?(n=jy(n,e,xs),i.__reactInternalMemoizedMergedChildContext=n,gt(Mn),gt(sn),pt(sn,n)):gt(Mn),pt(Mn,t)}var Oi=null,xd=!1,Ih=!1;function Xy(n){Oi===null?Oi=[n]:Oi.push(n)}function hb(n){xd=!0,Xy(n)}function Ur(){if(!Ih&&Oi!==null){Ih=!0;var n=0,e=dt;try{var t=Oi;for(dt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Oi=null,xd=!1}catch(r){throw Oi!==null&&(Oi=Oi.slice(n+1)),xy(em,Ur),r}finally{dt=e,Ih=!1}}return null}var ao=[],lo=0,_u=null,Su=0,Gn=[],Wn=0,vs=null,zi=1,Vi="";function Qr(n,e){ao[lo++]=Su,ao[lo++]=_u,_u=n,Su=e}function Yy(n,e,t){Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,vs=n;var i=zi;n=Vi;var r=32-si(i)-1;i&=~(1<<r),t+=1;var s=32-si(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,zi=1<<32-si(e)+r|t<<r|i,Vi=s+n}else zi=1<<s|t<<r|i,Vi=n}function cm(n){n.return!==null&&(Qr(n,1),Yy(n,1,0))}function um(n){for(;n===_u;)_u=ao[--lo],ao[lo]=null,Su=ao[--lo],ao[lo]=null;for(;n===vs;)vs=Gn[--Wn],Gn[Wn]=null,Vi=Gn[--Wn],Gn[Wn]=null,zi=Gn[--Wn],Gn[Wn]=null}var Dn=null,Ln=null,xt=!1,ii=null;function $y(n,e){var t=jn(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function mx(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=br(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=vs!==null?{id:zi,overflow:Vi}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=jn(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Dn=n,Ln=null,!0):!1;default:return!1}}function lp(n){return(n.mode&1)!==0&&(n.flags&128)===0}function cp(n){if(xt){var e=Ln;if(e){var t=e;if(!mx(n,e)){if(lp(n))throw Error(re(418));e=br(t.nextSibling);var i=Dn;e&&mx(n,e)?$y(i,t):(n.flags=n.flags&-4097|2,xt=!1,Dn=n)}}else{if(lp(n))throw Error(re(418));n.flags=n.flags&-4097|2,xt=!1,Dn=n}}}function gx(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Dn=n}function Kl(n){if(n!==Dn)return!1;if(!xt)return gx(n),xt=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!rp(n.type,n.memoizedProps)),e&&(e=Ln)){if(lp(n))throw qy(),Error(re(418));for(;e;)$y(n,e),e=br(e.nextSibling)}if(gx(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(re(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Ln=br(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Ln=null}}else Ln=Dn?br(n.stateNode.nextSibling):null;return!0}function qy(){for(var n=Ln;n;)n=br(n.nextSibling)}function Co(){Ln=Dn=null,xt=!1}function dm(n){ii===null?ii=[n]:ii.push(n)}var fb=er.ReactCurrentBatchConfig;function Jo(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(re(309));var i=t.stateNode}if(!i)throw Error(re(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(re(284));if(!t._owner)throw Error(re(290,n))}return n}function Jl(n,e){throw n=Object.prototype.toString.call(e),Error(re(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function xx(n){var e=n._init;return e(n._payload)}function Zy(n){function e(f,v){if(n){var x=f.deletions;x===null?(f.deletions=[v],f.flags|=16):x.push(v)}}function t(f,v){if(!n)return null;for(;v!==null;)e(f,v),v=v.sibling;return null}function i(f,v){for(f=new Map;v!==null;)v.key!==null?f.set(v.key,v):f.set(v.index,v),v=v.sibling;return f}function r(f,v){return f=Cr(f,v),f.index=0,f.sibling=null,f}function s(f,v,x){return f.index=x,n?(x=f.alternate,x!==null?(x=x.index,x<v?(f.flags|=2,v):x):(f.flags|=2,v)):(f.flags|=1048576,v)}function o(f){return n&&f.alternate===null&&(f.flags|=2),f}function a(f,v,x,_){return v===null||v.tag!==6?(v=Fh(x,f.mode,_),v.return=f,v):(v=r(v,x),v.return=f,v)}function l(f,v,x,_){var R=x.type;return R===to?u(f,v,x.props.children,_,x.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&xx(R)===v.type)?(_=r(v,x.props),_.ref=Jo(f,v,x),_.return=f,_):(_=ou(x.type,x.key,x.props,null,f.mode,_),_.ref=Jo(f,v,x),_.return=f,_)}function c(f,v,x,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=Bh(x,f.mode,_),v.return=f,v):(v=r(v,x.children||[]),v.return=f,v)}function u(f,v,x,_,R){return v===null||v.tag!==7?(v=hs(x,f.mode,_,R),v.return=f,v):(v=r(v,x),v.return=f,v)}function d(f,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Fh(""+v,f.mode,x),v.return=f,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vl:return x=ou(v.type,v.key,v.props,null,f.mode,x),x.ref=Jo(f,null,v),x.return=f,x;case eo:return v=Bh(v,f.mode,x),v.return=f,v;case fr:var _=v._init;return d(f,_(v._payload),x)}if(ga(v)||Yo(v))return v=hs(v,f.mode,x,null),v.return=f,v;Jl(f,v)}return null}function h(f,v,x,_){var R=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return R!==null?null:a(f,v,""+x,_);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Vl:return x.key===R?l(f,v,x,_):null;case eo:return x.key===R?c(f,v,x,_):null;case fr:return R=x._init,h(f,v,R(x._payload),_)}if(ga(x)||Yo(x))return R!==null?null:u(f,v,x,_,null);Jl(f,x)}return null}function p(f,v,x,_,R){if(typeof _=="string"&&_!==""||typeof _=="number")return f=f.get(x)||null,a(v,f,""+_,R);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Vl:return f=f.get(_.key===null?x:_.key)||null,l(v,f,_,R);case eo:return f=f.get(_.key===null?x:_.key)||null,c(v,f,_,R);case fr:var M=_._init;return p(f,v,x,M(_._payload),R)}if(ga(_)||Yo(_))return f=f.get(x)||null,u(v,f,_,R,null);Jl(v,_)}return null}function m(f,v,x,_){for(var R=null,M=null,T=v,A=v=0,E=null;T!==null&&A<x.length;A++){T.index>A?(E=T,T=null):E=T.sibling;var w=h(f,T,x[A],_);if(w===null){T===null&&(T=E);break}n&&T&&w.alternate===null&&e(f,T),v=s(w,v,A),M===null?R=w:M.sibling=w,M=w,T=E}if(A===x.length)return t(f,T),xt&&Qr(f,A),R;if(T===null){for(;A<x.length;A++)T=d(f,x[A],_),T!==null&&(v=s(T,v,A),M===null?R=T:M.sibling=T,M=T);return xt&&Qr(f,A),R}for(T=i(f,T);A<x.length;A++)E=p(T,f,A,x[A],_),E!==null&&(n&&E.alternate!==null&&T.delete(E.key===null?A:E.key),v=s(E,v,A),M===null?R=E:M.sibling=E,M=E);return n&&T.forEach(function(L){return e(f,L)}),xt&&Qr(f,A),R}function y(f,v,x,_){var R=Yo(x);if(typeof R!="function")throw Error(re(150));if(x=R.call(x),x==null)throw Error(re(151));for(var M=R=null,T=v,A=v=0,E=null,w=x.next();T!==null&&!w.done;A++,w=x.next()){T.index>A?(E=T,T=null):E=T.sibling;var L=h(f,T,w.value,_);if(L===null){T===null&&(T=E);break}n&&T&&L.alternate===null&&e(f,T),v=s(L,v,A),M===null?R=L:M.sibling=L,M=L,T=E}if(w.done)return t(f,T),xt&&Qr(f,A),R;if(T===null){for(;!w.done;A++,w=x.next())w=d(f,w.value,_),w!==null&&(v=s(w,v,A),M===null?R=w:M.sibling=w,M=w);return xt&&Qr(f,A),R}for(T=i(f,T);!w.done;A++,w=x.next())w=p(T,f,A,w.value,_),w!==null&&(n&&w.alternate!==null&&T.delete(w.key===null?A:w.key),v=s(w,v,A),M===null?R=w:M.sibling=w,M=w);return n&&T.forEach(function(V){return e(f,V)}),xt&&Qr(f,A),R}function g(f,v,x,_){if(typeof x=="object"&&x!==null&&x.type===to&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Vl:e:{for(var R=x.key,M=v;M!==null;){if(M.key===R){if(R=x.type,R===to){if(M.tag===7){t(f,M.sibling),v=r(M,x.props.children),v.return=f,f=v;break e}}else if(M.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&xx(R)===M.type){t(f,M.sibling),v=r(M,x.props),v.ref=Jo(f,M,x),v.return=f,f=v;break e}t(f,M);break}else e(f,M);M=M.sibling}x.type===to?(v=hs(x.props.children,f.mode,_,x.key),v.return=f,f=v):(_=ou(x.type,x.key,x.props,null,f.mode,_),_.ref=Jo(f,v,x),_.return=f,f=_)}return o(f);case eo:e:{for(M=x.key;v!==null;){if(v.key===M)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){t(f,v.sibling),v=r(v,x.children||[]),v.return=f,f=v;break e}else{t(f,v);break}else e(f,v);v=v.sibling}v=Bh(x,f.mode,_),v.return=f,f=v}return o(f);case fr:return M=x._init,g(f,v,M(x._payload),_)}if(ga(x))return m(f,v,x,_);if(Yo(x))return y(f,v,x,_);Jl(f,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(t(f,v.sibling),v=r(v,x),v.return=f,f=v):(t(f,v),v=Fh(x,f.mode,_),v.return=f,f=v),o(f)):t(f,v)}return g}var Ro=Zy(!0),Ky=Zy(!1),Mu=Dr(null),wu=null,co=null,hm=null;function fm(){hm=co=wu=null}function pm(n){var e=Mu.current;gt(Mu),n._currentValue=e}function up(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Mo(n,e){wu=n,hm=co=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(_n=!0),n.firstContext=null)}function $n(n){var e=n._currentValue;if(hm!==n)if(n={context:n,memoizedValue:e,next:null},co===null){if(wu===null)throw Error(re(308));co=n,wu.dependencies={lanes:0,firstContext:n}}else co=co.next=n;return e}var ss=null;function mm(n){ss===null?ss=[n]:ss.push(n)}function Jy(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,mm(e)):(t.next=r.next,r.next=t),e.interleaved=t,$i(n,i)}function $i(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var pr=!1;function gm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qy(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Gi(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Er(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,tt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,$i(n,t)}return r=i.interleaved,r===null?(e.next=e,mm(i)):(e.next=r.next,r.next=e),i.interleaved=e,$i(n,t)}function eu(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tm(n,t)}}function vx(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function bu(n,e,t,i){var r=n.updateQueue;pr=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,p=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=n,y=a;switch(h=e,p=t,y.tag){case 1:if(m=y.payload,typeof m=="function"){d=m.call(p,d,h);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,d,h):m,h==null)break e;d=Mt({},d,h);break e;case 2:pr=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=d):u=u.next=p,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);_s|=o,n.lanes=o,n.memoizedState=d}}function yx(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(re(191,r));r.call(i)}}}var Al={},Mi=Dr(Al),Za=Dr(Al),Ka=Dr(Al);function os(n){if(n===Al)throw Error(re(174));return n}function xm(n,e){switch(pt(Ka,e),pt(Za,n),pt(Mi,Al),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Wf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Wf(e,n)}gt(Mi),pt(Mi,e)}function Po(){gt(Mi),gt(Za),gt(Ka)}function e_(n){os(Ka.current);var e=os(Mi.current),t=Wf(e,n.type);e!==t&&(pt(Za,n),pt(Mi,t))}function vm(n){Za.current===n&&(gt(Mi),gt(Za))}var yt=Dr(0);function Eu(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Nh=[];function ym(){for(var n=0;n<Nh.length;n++)Nh[n]._workInProgressVersionPrimary=null;Nh.length=0}var tu=er.ReactCurrentDispatcher,Lh=er.ReactCurrentBatchConfig,ys=0,St=null,Ot=null,Ht=null,Tu=!1,Ta=!1,Ja=0,pb=0;function Kt(){throw Error(re(321))}function _m(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!ai(n[t],e[t]))return!1;return!0}function Sm(n,e,t,i,r,s){if(ys=s,St=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,tu.current=n===null||n.memoizedState===null?vb:yb,n=t(i,r),Ta){s=0;do{if(Ta=!1,Ja=0,25<=s)throw Error(re(301));s+=1,Ht=Ot=null,e.updateQueue=null,tu.current=_b,n=t(i,r)}while(Ta)}if(tu.current=Au,e=Ot!==null&&Ot.next!==null,ys=0,Ht=Ot=St=null,Tu=!1,e)throw Error(re(300));return n}function Mm(){var n=Ja!==0;return Ja=0,n}function mi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function qn(){if(Ot===null){var n=St.alternate;n=n!==null?n.memoizedState:null}else n=Ot.next;var e=Ht===null?St.memoizedState:Ht.next;if(e!==null)Ht=e,Ot=n;else{if(n===null)throw Error(re(310));Ot=n,n={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function Qa(n,e){return typeof e=="function"?e(n):e}function Dh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=Ot,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((ys&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,o=i):l=l.next=d,St.lanes|=u,_s|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,ai(i,e.memoizedState)||(_n=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,St.lanes|=s,_s|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Uh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);ai(s,e.memoizedState)||(_n=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function t_(){}function n_(n,e){var t=St,i=qn(),r=e(),s=!ai(i.memoizedState,r);if(s&&(i.memoizedState=r,_n=!0),i=i.queue,wm(s_.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Ht!==null&&Ht.memoizedState.tag&1){if(t.flags|=2048,el(9,r_.bind(null,t,i,r,e),void 0,null),Wt===null)throw Error(re(349));ys&30||i_(t,e,r)}return r}function i_(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function r_(n,e,t,i){e.value=t,e.getSnapshot=i,o_(e)&&a_(n)}function s_(n,e,t){return t(function(){o_(e)&&a_(n)})}function o_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ai(n,t)}catch{return!0}}function a_(n){var e=$i(n,1);e!==null&&oi(e,n,1,-1)}function _x(n){var e=mi();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:n},e.queue=n,n=n.dispatch=xb.bind(null,St,n),[e.memoizedState,n]}function el(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function l_(){return qn().memoizedState}function nu(n,e,t,i){var r=mi();St.flags|=n,r.memoizedState=el(1|e,t,void 0,i===void 0?null:i)}function vd(n,e,t,i){var r=qn();i=i===void 0?null:i;var s=void 0;if(Ot!==null){var o=Ot.memoizedState;if(s=o.destroy,i!==null&&_m(i,o.deps)){r.memoizedState=el(e,t,s,i);return}}St.flags|=n,r.memoizedState=el(1|e,t,s,i)}function Sx(n,e){return nu(8390656,8,n,e)}function wm(n,e){return vd(2048,8,n,e)}function c_(n,e){return vd(4,2,n,e)}function u_(n,e){return vd(4,4,n,e)}function d_(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function h_(n,e,t){return t=t!=null?t.concat([n]):null,vd(4,4,d_.bind(null,e,n),t)}function bm(){}function f_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&_m(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function p_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&_m(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function m_(n,e,t){return ys&21?(ai(t,e)||(t=_y(),St.lanes|=t,_s|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,_n=!0),n.memoizedState=t)}function mb(n,e){var t=dt;dt=t!==0&&4>t?t:4,n(!0);var i=Lh.transition;Lh.transition={};try{n(!1),e()}finally{dt=t,Lh.transition=i}}function g_(){return qn().memoizedState}function gb(n,e,t){var i=Ar(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},x_(n))v_(e,t);else if(t=Jy(n,e,t,i),t!==null){var r=hn();oi(t,n,i,r),y_(t,e,i)}}function xb(n,e,t){var i=Ar(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(x_(n))v_(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,ai(a,o)){var l=e.interleaved;l===null?(r.next=r,mm(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=Jy(n,e,r,i),t!==null&&(r=hn(),oi(t,n,i,r),y_(t,e,i))}}function x_(n){var e=n.alternate;return n===St||e!==null&&e===St}function v_(n,e){Ta=Tu=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function y_(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tm(n,t)}}var Au={readContext:$n,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},vb={readContext:$n,useCallback:function(n,e){return mi().memoizedState=[n,e===void 0?null:e],n},useContext:$n,useEffect:Sx,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,nu(4194308,4,d_.bind(null,e,n),t)},useLayoutEffect:function(n,e){return nu(4194308,4,n,e)},useInsertionEffect:function(n,e){return nu(4,2,n,e)},useMemo:function(n,e){var t=mi();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=mi();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=gb.bind(null,St,n),[i.memoizedState,n]},useRef:function(n){var e=mi();return n={current:n},e.memoizedState=n},useState:_x,useDebugValue:bm,useDeferredValue:function(n){return mi().memoizedState=n},useTransition:function(){var n=_x(!1),e=n[0];return n=mb.bind(null,n[1]),mi().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=St,r=mi();if(xt){if(t===void 0)throw Error(re(407));t=t()}else{if(t=e(),Wt===null)throw Error(re(349));ys&30||i_(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Sx(s_.bind(null,i,s,n),[n]),i.flags|=2048,el(9,r_.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=mi(),e=Wt.identifierPrefix;if(xt){var t=Vi,i=zi;t=(i&~(1<<32-si(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ja++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=pb++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},yb={readContext:$n,useCallback:f_,useContext:$n,useEffect:wm,useImperativeHandle:h_,useInsertionEffect:c_,useLayoutEffect:u_,useMemo:p_,useReducer:Dh,useRef:l_,useState:function(){return Dh(Qa)},useDebugValue:bm,useDeferredValue:function(n){var e=qn();return m_(e,Ot.memoizedState,n)},useTransition:function(){var n=Dh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1},_b={readContext:$n,useCallback:f_,useContext:$n,useEffect:wm,useImperativeHandle:h_,useInsertionEffect:c_,useLayoutEffect:u_,useMemo:p_,useReducer:Uh,useRef:l_,useState:function(){return Uh(Qa)},useDebugValue:bm,useDeferredValue:function(n){var e=qn();return Ot===null?e.memoizedState=n:m_(e,Ot.memoizedState,n)},useTransition:function(){var n=Uh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1};function ti(n,e){if(n&&n.defaultProps){e=Mt({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function dp(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Mt({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var yd={isMounted:function(n){return(n=n._reactInternals)?As(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=hn(),i=Ar(n),r=Gi(t,i);r.tag=2,e!=null&&(r.callback=e),e=Er(n,r,i),e!==null&&(oi(e,n,i,t),eu(e,n,i))}};function Mx(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Xa(t,i)||!Xa(r,s):!0}function __(n,e,t){var i=!1,r=Pr,s=e.contextType;return typeof s=="object"&&s!==null?s=$n(s):(r=wn(e)?xs:sn.current,i=e.contextTypes,s=(i=i!=null)?Ao(n,r):Pr),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yd,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function wx(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&yd.enqueueReplaceState(e,e.state,null)}function hp(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},gm(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=$n(s):(s=wn(e)?xs:sn.current,r.context=Ao(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(dp(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&yd.enqueueReplaceState(r,r.state,null),bu(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Io(n,e){try{var t="",i=e;do t+=$w(i),i=i.return;while(i);var r=t}catch(s){r=`
37
+ `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{gh=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?ma(n):""}function $w(n){switch(n.tag){case 5:return ma(n.type);case 16:return ma("Lazy");case 13:return ma("Suspense");case 19:return ma("SuspenseList");case 0:case 2:case 15:return n=xh(n.type,!1),n;case 11:return n=xh(n.type.render,!1),n;case 1:return n=xh(n.type,!0),n;default:return""}}function Bf(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case to:return"Fragment";case eo:return"Portal";case kf:return"Profiler";case Zp:return"StrictMode";case Of:return"Suspense";case Ff:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case Qv:return(n.displayName||"Context")+".Consumer";case Jv:return(n._context.displayName||"Context")+".Provider";case Kp:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Jp:return e=n.displayName||null,e!==null?e:Bf(n.type)||"Memo";case fr:e=n._payload,n=n._init;try{return Bf(n(e))}catch{}}return null}function qw(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Bf(e);case 8:return e===Zp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Rr(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ty(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Zw(n){var e=ty(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Hl(n){n._valueTracker||(n._valueTracker=Zw(n))}function ny(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=ty(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function cu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function zf(n,e){var t=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zg(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Rr(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function iy(n,e){e=e.checked,e!=null&&qp(n,"checked",e,!1)}function Vf(n,e){iy(n,e);var t=Rr(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Hf(n,e.type,t):e.hasOwnProperty("defaultValue")&&Hf(n,e.type,Rr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Vg(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Hf(n,e,t){(e!=="number"||cu(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ga=Array.isArray;function vo(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Rr(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function Gf(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(re(91));return Mt({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Hg(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(re(92));if(ga(t)){if(1<t.length)throw Error(re(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Rr(t)}}function ry(n,e){var t=Rr(e.value),i=Rr(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function Gg(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function sy(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Wf(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?sy(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var Gl,oy=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(Gl=Gl||document.createElement("div"),Gl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Gl.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function za(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Sa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Kw=["Webkit","ms","Moz","O"];Object.keys(Sa).forEach(function(n){Kw.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Sa[e]=Sa[n]})});function ay(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Sa.hasOwnProperty(n)&&Sa[n]?(""+e).trim():e+"px"}function ly(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=ay(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var Jw=Mt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function jf(n,e){if(e){if(Jw[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function Xf(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Yf=null;function Qp(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var $f=null,yo=null,_o=null;function Wg(n){if(n=Tl(n)){if(typeof $f!="function")throw Error(re(280));var e=n.stateNode;e&&(e=gd(e),$f(n.stateNode,n.type,e))}}function cy(n){yo?_o?_o.push(n):_o=[n]:yo=n}function uy(){if(yo){var n=yo,e=_o;if(_o=yo=null,Wg(n),e)for(n=0;n<e.length;n++)Wg(e[n])}}function dy(n,e){return n(e)}function hy(){}var vh=!1;function fy(n,e,t){if(vh)return n(e,t);vh=!0;try{return dy(n,e,t)}finally{vh=!1,(yo!==null||_o!==null)&&(hy(),uy())}}function Va(n,e){var t=n.stateNode;if(t===null)return null;var i=gd(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(re(231,e,typeof t));return t}var qf=!1;if(Xi)try{var $o={};Object.defineProperty($o,"passive",{get:function(){qf=!0}}),window.addEventListener("test",$o,$o),window.removeEventListener("test",$o,$o)}catch{qf=!1}function Qw(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var Ma=!1,uu=null,du=!1,Zf=null,e1={onError:function(n){Ma=!0,uu=n}};function t1(n,e,t,i,r,s,o,a,l){Ma=!1,uu=null,Qw.apply(e1,arguments)}function n1(n,e,t,i,r,s,o,a,l){if(t1.apply(this,arguments),Ma){if(Ma){var c=uu;Ma=!1,uu=null}else throw Error(re(198));du||(du=!0,Zf=c)}}function As(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function py(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function jg(n){if(As(n)!==n)throw Error(re(188))}function i1(n){var e=n.alternate;if(!e){if(e=As(n),e===null)throw Error(re(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return jg(r),n;if(s===i)return jg(r),e;s=s.sibling}throw Error(re(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(re(189))}}if(t.alternate!==i)throw Error(re(190))}if(t.tag!==3)throw Error(re(188));return t.stateNode.current===t?n:e}function my(n){return n=i1(n),n!==null?gy(n):null}function gy(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=gy(n);if(e!==null)return e;n=n.sibling}return null}var xy=kn.unstable_scheduleCallback,Xg=kn.unstable_cancelCallback,r1=kn.unstable_shouldYield,s1=kn.unstable_requestPaint,Pt=kn.unstable_now,o1=kn.unstable_getCurrentPriorityLevel,em=kn.unstable_ImmediatePriority,vy=kn.unstable_UserBlockingPriority,hu=kn.unstable_NormalPriority,a1=kn.unstable_LowPriority,yy=kn.unstable_IdlePriority,hd=null,Si=null;function l1(n){if(Si&&typeof Si.onCommitFiberRoot=="function")try{Si.onCommitFiberRoot(hd,n,void 0,(n.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:d1,c1=Math.log,u1=Math.LN2;function d1(n){return n>>>=0,n===0?32:31-(c1(n)/u1|0)|0}var Wl=64,jl=4194304;function xa(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function fu(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=xa(a):(s&=o,s!==0&&(i=xa(s)))}else o=t&~r,o!==0?i=xa(o):s!==0&&(i=xa(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-si(e),r=1<<t,i|=n[t],e&=~r;return i}function h1(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function f1(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-si(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=h1(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function Kf(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function _y(){var n=Wl;return Wl<<=1,!(Wl&4194240)&&(Wl=64),n}function yh(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function bl(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-si(e),n[e]=t}function p1(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-si(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function tm(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-si(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var dt=0;function Sy(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var My,nm,wy,by,Ey,Jf=!1,Xl=[],Sr=null,Mr=null,wr=null,Ha=new Map,Ga=new Map,gr=[],m1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yg(n,e){switch(n){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":Ha.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ga.delete(e.pointerId)}}function qo(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Tl(e),e!==null&&nm(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function g1(n,e,t,i,r){switch(e){case"focusin":return Sr=qo(Sr,n,e,t,i,r),!0;case"dragenter":return Mr=qo(Mr,n,e,t,i,r),!0;case"mouseover":return wr=qo(wr,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return Ha.set(s,qo(Ha.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Ga.set(s,qo(Ga.get(s)||null,n,e,t,i,r)),!0}return!1}function Ty(n){var e=rs(n.target);if(e!==null){var t=As(e);if(t!==null){if(e=t.tag,e===13){if(e=py(t),e!==null){n.blockedOn=e,Ey(n.priority,function(){wy(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Kc(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Qf(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);Yf=i,t.target.dispatchEvent(i),Yf=null}else return e=Tl(t),e!==null&&nm(e),n.blockedOn=t,!1;e.shift()}return!0}function $g(n,e,t){Kc(n)&&t.delete(e)}function x1(){Jf=!1,Sr!==null&&Kc(Sr)&&(Sr=null),Mr!==null&&Kc(Mr)&&(Mr=null),wr!==null&&Kc(wr)&&(wr=null),Ha.forEach($g),Ga.forEach($g)}function Zo(n,e){n.blockedOn===e&&(n.blockedOn=null,Jf||(Jf=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,x1)))}function Wa(n){function e(r){return Zo(r,n)}if(0<Xl.length){Zo(Xl[0],n);for(var t=1;t<Xl.length;t++){var i=Xl[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Sr!==null&&Zo(Sr,n),Mr!==null&&Zo(Mr,n),wr!==null&&Zo(wr,n),Ha.forEach(e),Ga.forEach(e),t=0;t<gr.length;t++)i=gr[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<gr.length&&(t=gr[0],t.blockedOn===null);)Ty(t),t.blockedOn===null&&gr.shift()}var So=er.ReactCurrentBatchConfig,pu=!0;function v1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=1,im(n,e,t,i)}finally{dt=r,So.transition=s}}function y1(n,e,t,i){var r=dt,s=So.transition;So.transition=null;try{dt=4,im(n,e,t,i)}finally{dt=r,So.transition=s}}function im(n,e,t,i){if(pu){var r=Qf(n,e,t,i);if(r===null)Rh(n,e,i,mu,t),Yg(n,i);else if(g1(r,n,e,t,i))i.stopPropagation();else if(Yg(n,i),e&4&&-1<m1.indexOf(n)){for(;r!==null;){var s=Tl(r);if(s!==null&&My(s),s=Qf(n,e,t,i),s===null&&Rh(n,e,i,mu,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Rh(n,e,i,null,t)}}var mu=null;function Qf(n,e,t,i){if(mu=null,n=Qp(i),n=rs(n),n!==null)if(e=As(n),e===null)n=null;else if(t=e.tag,t===13){if(n=py(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return mu=n,null}function Ay(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(o1()){case em:return 1;case vy:return 4;case hu:case a1:return 16;case yy:return 536870912;default:return 16}default:return 16}}var yr=null,rm=null,Jc=null;function Cy(){if(Jc)return Jc;var n,e=rm,t=e.length,i,r="value"in yr?yr.value:yr.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return Jc=r.slice(n,1<i?1-i:void 0)}function Qc(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Yl(){return!0}function qg(){return!1}function Bn(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Yl:qg,this.isPropagationStopped=qg,this}return Mt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Yl)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),e}var Bo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sm=Bn(Bo),El=Mt({},Bo,{view:0,detail:0}),_1=Bn(El),_h,Sh,Ko,fd=Mt({},El,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:om,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ko&&(Ko&&n.type==="mousemove"?(_h=n.screenX-Ko.screenX,Sh=n.screenY-Ko.screenY):Sh=_h=0,Ko=n),_h)},movementY:function(n){return"movementY"in n?n.movementY:Sh}}),Zg=Bn(fd),S1=Mt({},fd,{dataTransfer:0}),M1=Bn(S1),w1=Mt({},El,{relatedTarget:0}),Mh=Bn(w1),b1=Mt({},Bo,{animationName:0,elapsedTime:0,pseudoElement:0}),E1=Bn(b1),T1=Mt({},Bo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),A1=Bn(T1),C1=Mt({},Bo,{data:0}),Kg=Bn(C1),R1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},I1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function N1(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=I1[n])?!!e[n]:!1}function om(){return N1}var L1=Mt({},El,{key:function(n){if(n.key){var e=R1[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Qc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?P1[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:om,charCode:function(n){return n.type==="keypress"?Qc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Qc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),D1=Bn(L1),U1=Mt({},fd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jg=Bn(U1),k1=Mt({},El,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:om}),O1=Bn(k1),F1=Mt({},Bo,{propertyName:0,elapsedTime:0,pseudoElement:0}),B1=Bn(F1),z1=Mt({},fd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),V1=Bn(z1),H1=[9,13,27,32],am=Xi&&"CompositionEvent"in window,wa=null;Xi&&"documentMode"in document&&(wa=document.documentMode);var G1=Xi&&"TextEvent"in window&&!wa,Ry=Xi&&(!am||wa&&8<wa&&11>=wa),Qg=" ",ex=!1;function Py(n,e){switch(n){case"keyup":return H1.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var no=!1;function W1(n,e){switch(n){case"compositionend":return Iy(e);case"keypress":return e.which!==32?null:(ex=!0,Qg);case"textInput":return n=e.data,n===Qg&&ex?null:n;default:return null}}function j1(n,e){if(no)return n==="compositionend"||!am&&Py(n,e)?(n=Cy(),Jc=rm=yr=null,no=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Ry&&e.locale!=="ko"?null:e.data;default:return null}}var X1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function tx(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!X1[n.type]:e==="textarea"}function Ny(n,e,t,i){cy(i),e=gu(e,"onChange"),0<e.length&&(t=new sm("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var ba=null,ja=null;function Y1(n){Gy(n,0)}function pd(n){var e=so(n);if(ny(e))return n}function $1(n,e){if(n==="change")return e}var Ly=!1;if(Xi){var wh;if(Xi){var bh="oninput"in document;if(!bh){var nx=document.createElement("div");nx.setAttribute("oninput","return;"),bh=typeof nx.oninput=="function"}wh=bh}else wh=!1;Ly=wh&&(!document.documentMode||9<document.documentMode)}function ix(){ba&&(ba.detachEvent("onpropertychange",Dy),ja=ba=null)}function Dy(n){if(n.propertyName==="value"&&pd(ja)){var e=[];Ny(e,ja,n,Qp(n)),fy(Y1,e)}}function q1(n,e,t){n==="focusin"?(ix(),ba=e,ja=t,ba.attachEvent("onpropertychange",Dy)):n==="focusout"&&ix()}function Z1(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return pd(ja)}function K1(n,e){if(n==="click")return pd(e)}function J1(n,e){if(n==="input"||n==="change")return pd(e)}function Q1(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var ai=typeof Object.is=="function"?Object.is:Q1;function Xa(n,e){if(ai(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!Uf.call(e,r)||!ai(n[r],e[r]))return!1}return!0}function rx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function sx(n,e){var t=rx(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=rx(t)}}function Uy(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Uy(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function ky(){for(var n=window,e=cu();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=cu(n.document)}return e}function lm(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function eb(n){var e=ky(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Uy(t.ownerDocument.documentElement,t)){if(i!==null&&lm(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=sx(t,s);var o=sx(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var tb=Xi&&"documentMode"in document&&11>=document.documentMode,io=null,ep=null,Ea=null,tp=!1;function ox(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;tp||io==null||io!==cu(i)||(i=io,"selectionStart"in i&&lm(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ea&&Xa(Ea,i)||(Ea=i,i=gu(ep,"onSelect"),0<i.length&&(e=new sm("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=io)))}function $l(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var ro={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionend:$l("Transition","TransitionEnd")},Eh={},Oy={};Xi&&(Oy=document.createElement("div").style,"AnimationEvent"in window||(delete ro.animationend.animation,delete ro.animationiteration.animation,delete ro.animationstart.animation),"TransitionEvent"in window||delete ro.transitionend.transition);function md(n){if(Eh[n])return Eh[n];if(!ro[n])return n;var e=ro[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in Oy)return Eh[n]=e[t];return n}var Fy=md("animationend"),By=md("animationiteration"),zy=md("animationstart"),Vy=md("transitionend"),Hy=new Map,ax="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Lr(n,e){Hy.set(n,e),Ts(e,[n])}for(var Th=0;Th<ax.length;Th++){var Ah=ax[Th],nb=Ah.toLowerCase(),ib=Ah[0].toUpperCase()+Ah.slice(1);Lr(nb,"on"+ib)}Lr(Fy,"onAnimationEnd");Lr(By,"onAnimationIteration");Lr(zy,"onAnimationStart");Lr("dblclick","onDoubleClick");Lr("focusin","onFocus");Lr("focusout","onBlur");Lr(Vy,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ts("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rb=new Set("cancel close invalid load scroll toggle".split(" ").concat(va));function lx(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,n1(i,e,void 0,n),n.currentTarget=null}function Gy(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;lx(r,a,c),s=l}}}if(du)throw n=Zf,du=!1,Zf=null,n}function mt(n,e){var t=e[op];t===void 0&&(t=e[op]=new Set);var i=n+"__bubble";t.has(i)||(Wy(e,n,2,!1),t.add(i))}function Ch(n,e,t){var i=0;e&&(i|=4),Wy(t,n,i,e)}var ql="_reactListening"+Math.random().toString(36).slice(2);function Ya(n){if(!n[ql]){n[ql]=!0,Kv.forEach(function(t){t!=="selectionchange"&&(rb.has(t)||Ch(t,!1,n),Ch(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[ql]||(e[ql]=!0,Ch("selectionchange",!1,e))}}function Wy(n,e,t,i){switch(Ay(e)){case 1:var r=v1;break;case 4:r=y1;break;default:r=im}t=r.bind(null,e,t,n),r=void 0,!qf||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Rh(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=rs(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}fy(function(){var c=s,u=Qp(t),d=[];e:{var h=Hy.get(n);if(h!==void 0){var p=sm,m=n;switch(n){case"keypress":if(Qc(t)===0)break e;case"keydown":case"keyup":p=D1;break;case"focusin":m="focus",p=Mh;break;case"focusout":m="blur",p=Mh;break;case"beforeblur":case"afterblur":p=Mh;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=M1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=O1;break;case Fy:case By:case zy:p=E1;break;case Vy:p=B1;break;case"scroll":p=_1;break;case"wheel":p=V1;break;case"copy":case"cut":case"paste":p=A1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Jg}var y=(e&4)!==0,x=!y&&n==="scroll",f=y?h!==null?h+"Capture":null:h;y=[];for(var v=c,g;v!==null;){g=v;var _=g.stateNode;if(g.tag===5&&_!==null&&(g=_,f!==null&&(_=Va(v,f),_!=null&&y.push($a(v,_,g)))),x)break;v=v.return}0<y.length&&(h=new p(h,m,null,t,u),d.push({event:h,listeners:y}))}}if(!(e&7)){e:{if(h=n==="mouseover"||n==="pointerover",p=n==="mouseout"||n==="pointerout",h&&t!==Yf&&(m=t.relatedTarget||t.fromElement)&&(rs(m)||m[Yi]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=t.relatedTarget||t.toElement,p=c,m=m?rs(m):null,m!==null&&(x=As(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(y=Zg,_="onMouseLeave",f="onMouseEnter",v="mouse",(n==="pointerout"||n==="pointerover")&&(y=Jg,_="onPointerLeave",f="onPointerEnter",v="pointer"),x=p==null?h:so(p),g=m==null?h:so(m),h=new y(_,v+"leave",p,t,u),h.target=x,h.relatedTarget=g,_=null,rs(u)===c&&(y=new y(f,v+"enter",m,t,u),y.target=g,y.relatedTarget=x,_=y),x=_,p&&m)t:{for(y=p,f=m,v=0,g=y;g;g=Ns(g))v++;for(g=0,_=f;_;_=Ns(_))g++;for(;0<v-g;)y=Ns(y),v--;for(;0<g-v;)f=Ns(f),g--;for(;v--;){if(y===f||f!==null&&y===f.alternate)break t;y=Ns(y),f=Ns(f)}y=null}else y=null;p!==null&&cx(d,h,p,y,!1),m!==null&&x!==null&&cx(d,x,m,y,!0)}}e:{if(h=c?so(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var R=$1;else if(tx(h))if(Ly)R=J1;else{R=Z1;var w=q1}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(R=K1);if(R&&(R=R(n,c))){Ny(d,R,t,u);break e}w&&w(n,h,c),n==="focusout"&&(w=h._wrapperState)&&w.controlled&&h.type==="number"&&Hf(h,"number",h.value)}switch(w=c?so(c):window,n){case"focusin":(tx(w)||w.contentEditable==="true")&&(io=w,ep=c,Ea=null);break;case"focusout":Ea=ep=io=null;break;case"mousedown":tp=!0;break;case"contextmenu":case"mouseup":case"dragend":tp=!1,ox(d,t,u);break;case"selectionchange":if(tb)break;case"keydown":case"keyup":ox(d,t,u)}var A;if(am)e:{switch(n){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else no?Py(n,t)&&(b="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(b="onCompositionStart");b&&(Ry&&t.locale!=="ko"&&(no||b!=="onCompositionStart"?b==="onCompositionEnd"&&no&&(A=Cy()):(yr=u,rm="value"in yr?yr.value:yr.textContent,no=!0)),w=gu(c,b),0<w.length&&(b=new Kg(b,n,null,t,u),d.push({event:b,listeners:w}),A?b.data=A:(A=Iy(t),A!==null&&(b.data=A)))),(A=G1?W1(n,t):j1(n,t))&&(c=gu(c,"onBeforeInput"),0<c.length&&(u=new Kg("onBeforeInput","beforeinput",null,t,u),d.push({event:u,listeners:c}),u.data=A))}Gy(d,e)})}function $a(n,e,t){return{instance:n,listener:e,currentTarget:t}}function gu(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=Va(n,t),s!=null&&i.unshift($a(n,s,r)),s=Va(n,e),s!=null&&i.push($a(n,s,r))),n=n.return}return i}function Ns(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function cx(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=Va(t,s),l!=null&&o.unshift($a(t,l,a))):r||(l=Va(t,s),l!=null&&o.push($a(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var sb=/\r\n?/g,ob=/\u0000|\uFFFD/g;function ux(n){return(typeof n=="string"?n:""+n).replace(sb,`
38
+ `).replace(ob,"")}function Zl(n,e,t){if(e=ux(e),ux(n)!==e&&t)throw Error(re(425))}function xu(){}var np=null,ip=null;function rp(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var sp=typeof setTimeout=="function"?setTimeout:void 0,ab=typeof clearTimeout=="function"?clearTimeout:void 0,dx=typeof Promise=="function"?Promise:void 0,lb=typeof queueMicrotask=="function"?queueMicrotask:typeof dx<"u"?function(n){return dx.resolve(null).then(n).catch(cb)}:sp;function cb(n){setTimeout(function(){throw n})}function Ph(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),Wa(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);Wa(e)}function br(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function hx(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var zo=Math.random().toString(36).slice(2),xi="__reactFiber$"+zo,qa="__reactProps$"+zo,Yi="__reactContainer$"+zo,op="__reactEvents$"+zo,ub="__reactListeners$"+zo,db="__reactHandles$"+zo;function rs(n){var e=n[xi];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Yi]||t[xi]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=hx(n);n!==null;){if(t=n[xi])return t;n=hx(n)}return e}n=t,t=n.parentNode}return null}function Tl(n){return n=n[xi]||n[Yi],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function so(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(re(33))}function gd(n){return n[qa]||null}var ap=[],oo=-1;function Dr(n){return{current:n}}function gt(n){0>oo||(n.current=ap[oo],ap[oo]=null,oo--)}function pt(n,e){oo++,ap[oo]=n.current,n.current=e}var Pr={},sn=Dr(Pr),Mn=Dr(!1),xs=Pr;function Ao(n,e){var t=n.type.contextTypes;if(!t)return Pr;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function wn(n){return n=n.childContextTypes,n!=null}function vu(){gt(Mn),gt(sn)}function fx(n,e,t){if(sn.current!==Pr)throw Error(re(168));pt(sn,e),pt(Mn,t)}function jy(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(re(108,qw(n)||"Unknown",r));return Mt({},t,i)}function yu(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Pr,xs=sn.current,pt(sn,n),pt(Mn,Mn.current),!0}function px(n,e,t){var i=n.stateNode;if(!i)throw Error(re(169));t?(n=jy(n,e,xs),i.__reactInternalMemoizedMergedChildContext=n,gt(Mn),gt(sn),pt(sn,n)):gt(Mn),pt(Mn,t)}var Oi=null,xd=!1,Ih=!1;function Xy(n){Oi===null?Oi=[n]:Oi.push(n)}function hb(n){xd=!0,Xy(n)}function Ur(){if(!Ih&&Oi!==null){Ih=!0;var n=0,e=dt;try{var t=Oi;for(dt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Oi=null,xd=!1}catch(r){throw Oi!==null&&(Oi=Oi.slice(n+1)),xy(em,Ur),r}finally{dt=e,Ih=!1}}return null}var ao=[],lo=0,_u=null,Su=0,Gn=[],Wn=0,vs=null,zi=1,Vi="";function Qr(n,e){ao[lo++]=Su,ao[lo++]=_u,_u=n,Su=e}function Yy(n,e,t){Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,vs=n;var i=zi;n=Vi;var r=32-si(i)-1;i&=~(1<<r),t+=1;var s=32-si(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,zi=1<<32-si(e)+r|t<<r|i,Vi=s+n}else zi=1<<s|t<<r|i,Vi=n}function cm(n){n.return!==null&&(Qr(n,1),Yy(n,1,0))}function um(n){for(;n===_u;)_u=ao[--lo],ao[lo]=null,Su=ao[--lo],ao[lo]=null;for(;n===vs;)vs=Gn[--Wn],Gn[Wn]=null,Vi=Gn[--Wn],Gn[Wn]=null,zi=Gn[--Wn],Gn[Wn]=null}var Dn=null,Ln=null,xt=!1,ii=null;function $y(n,e){var t=jn(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function mx(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=br(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,Dn=n,Ln=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=vs!==null?{id:zi,overflow:Vi}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=jn(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,Dn=n,Ln=null,!0):!1;default:return!1}}function lp(n){return(n.mode&1)!==0&&(n.flags&128)===0}function cp(n){if(xt){var e=Ln;if(e){var t=e;if(!mx(n,e)){if(lp(n))throw Error(re(418));e=br(t.nextSibling);var i=Dn;e&&mx(n,e)?$y(i,t):(n.flags=n.flags&-4097|2,xt=!1,Dn=n)}}else{if(lp(n))throw Error(re(418));n.flags=n.flags&-4097|2,xt=!1,Dn=n}}}function gx(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Dn=n}function Kl(n){if(n!==Dn)return!1;if(!xt)return gx(n),xt=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!rp(n.type,n.memoizedProps)),e&&(e=Ln)){if(lp(n))throw qy(),Error(re(418));for(;e;)$y(n,e),e=br(e.nextSibling)}if(gx(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(re(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Ln=br(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Ln=null}}else Ln=Dn?br(n.stateNode.nextSibling):null;return!0}function qy(){for(var n=Ln;n;)n=br(n.nextSibling)}function Co(){Ln=Dn=null,xt=!1}function dm(n){ii===null?ii=[n]:ii.push(n)}var fb=er.ReactCurrentBatchConfig;function Jo(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(re(309));var i=t.stateNode}if(!i)throw Error(re(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(re(284));if(!t._owner)throw Error(re(290,n))}return n}function Jl(n,e){throw n=Object.prototype.toString.call(e),Error(re(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function xx(n){var e=n._init;return e(n._payload)}function Zy(n){function e(f,v){if(n){var g=f.deletions;g===null?(f.deletions=[v],f.flags|=16):g.push(v)}}function t(f,v){if(!n)return null;for(;v!==null;)e(f,v),v=v.sibling;return null}function i(f,v){for(f=new Map;v!==null;)v.key!==null?f.set(v.key,v):f.set(v.index,v),v=v.sibling;return f}function r(f,v){return f=Cr(f,v),f.index=0,f.sibling=null,f}function s(f,v,g){return f.index=g,n?(g=f.alternate,g!==null?(g=g.index,g<v?(f.flags|=2,v):g):(f.flags|=2,v)):(f.flags|=1048576,v)}function o(f){return n&&f.alternate===null&&(f.flags|=2),f}function a(f,v,g,_){return v===null||v.tag!==6?(v=Fh(g,f.mode,_),v.return=f,v):(v=r(v,g),v.return=f,v)}function l(f,v,g,_){var R=g.type;return R===to?u(f,v,g.props.children,_,g.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&xx(R)===v.type)?(_=r(v,g.props),_.ref=Jo(f,v,g),_.return=f,_):(_=ou(g.type,g.key,g.props,null,f.mode,_),_.ref=Jo(f,v,g),_.return=f,_)}function c(f,v,g,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==g.containerInfo||v.stateNode.implementation!==g.implementation?(v=Bh(g,f.mode,_),v.return=f,v):(v=r(v,g.children||[]),v.return=f,v)}function u(f,v,g,_,R){return v===null||v.tag!==7?(v=hs(g,f.mode,_,R),v.return=f,v):(v=r(v,g),v.return=f,v)}function d(f,v,g){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Fh(""+v,f.mode,g),v.return=f,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vl:return g=ou(v.type,v.key,v.props,null,f.mode,g),g.ref=Jo(f,null,v),g.return=f,g;case eo:return v=Bh(v,f.mode,g),v.return=f,v;case fr:var _=v._init;return d(f,_(v._payload),g)}if(ga(v)||Yo(v))return v=hs(v,f.mode,g,null),v.return=f,v;Jl(f,v)}return null}function h(f,v,g,_){var R=v!==null?v.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return R!==null?null:a(f,v,""+g,_);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Vl:return g.key===R?l(f,v,g,_):null;case eo:return g.key===R?c(f,v,g,_):null;case fr:return R=g._init,h(f,v,R(g._payload),_)}if(ga(g)||Yo(g))return R!==null?null:u(f,v,g,_,null);Jl(f,g)}return null}function p(f,v,g,_,R){if(typeof _=="string"&&_!==""||typeof _=="number")return f=f.get(g)||null,a(v,f,""+_,R);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Vl:return f=f.get(_.key===null?g:_.key)||null,l(v,f,_,R);case eo:return f=f.get(_.key===null?g:_.key)||null,c(v,f,_,R);case fr:var w=_._init;return p(f,v,g,w(_._payload),R)}if(ga(_)||Yo(_))return f=f.get(g)||null,u(v,f,_,R,null);Jl(v,_)}return null}function m(f,v,g,_){for(var R=null,w=null,A=v,b=v=0,E=null;A!==null&&b<g.length;b++){A.index>b?(E=A,A=null):E=A.sibling;var M=h(f,A,g[b],_);if(M===null){A===null&&(A=E);break}n&&A&&M.alternate===null&&e(f,A),v=s(M,v,b),w===null?R=M:w.sibling=M,w=M,A=E}if(b===g.length)return t(f,A),xt&&Qr(f,b),R;if(A===null){for(;b<g.length;b++)A=d(f,g[b],_),A!==null&&(v=s(A,v,b),w===null?R=A:w.sibling=A,w=A);return xt&&Qr(f,b),R}for(A=i(f,A);b<g.length;b++)E=p(A,f,b,g[b],_),E!==null&&(n&&E.alternate!==null&&A.delete(E.key===null?b:E.key),v=s(E,v,b),w===null?R=E:w.sibling=E,w=E);return n&&A.forEach(function(L){return e(f,L)}),xt&&Qr(f,b),R}function y(f,v,g,_){var R=Yo(g);if(typeof R!="function")throw Error(re(150));if(g=R.call(g),g==null)throw Error(re(151));for(var w=R=null,A=v,b=v=0,E=null,M=g.next();A!==null&&!M.done;b++,M=g.next()){A.index>b?(E=A,A=null):E=A.sibling;var L=h(f,A,M.value,_);if(L===null){A===null&&(A=E);break}n&&A&&L.alternate===null&&e(f,A),v=s(L,v,b),w===null?R=L:w.sibling=L,w=L,A=E}if(M.done)return t(f,A),xt&&Qr(f,b),R;if(A===null){for(;!M.done;b++,M=g.next())M=d(f,M.value,_),M!==null&&(v=s(M,v,b),w===null?R=M:w.sibling=M,w=M);return xt&&Qr(f,b),R}for(A=i(f,A);!M.done;b++,M=g.next())M=p(A,f,b,M.value,_),M!==null&&(n&&M.alternate!==null&&A.delete(M.key===null?b:M.key),v=s(M,v,b),w===null?R=M:w.sibling=M,w=M);return n&&A.forEach(function(V){return e(f,V)}),xt&&Qr(f,b),R}function x(f,v,g,_){if(typeof g=="object"&&g!==null&&g.type===to&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Vl:e:{for(var R=g.key,w=v;w!==null;){if(w.key===R){if(R=g.type,R===to){if(w.tag===7){t(f,w.sibling),v=r(w,g.props.children),v.return=f,f=v;break e}}else if(w.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===fr&&xx(R)===w.type){t(f,w.sibling),v=r(w,g.props),v.ref=Jo(f,w,g),v.return=f,f=v;break e}t(f,w);break}else e(f,w);w=w.sibling}g.type===to?(v=hs(g.props.children,f.mode,_,g.key),v.return=f,f=v):(_=ou(g.type,g.key,g.props,null,f.mode,_),_.ref=Jo(f,v,g),_.return=f,f=_)}return o(f);case eo:e:{for(w=g.key;v!==null;){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){t(f,v.sibling),v=r(v,g.children||[]),v.return=f,f=v;break e}else{t(f,v);break}else e(f,v);v=v.sibling}v=Bh(g,f.mode,_),v.return=f,f=v}return o(f);case fr:return w=g._init,x(f,v,w(g._payload),_)}if(ga(g))return m(f,v,g,_);if(Yo(g))return y(f,v,g,_);Jl(f,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(t(f,v.sibling),v=r(v,g),v.return=f,f=v):(t(f,v),v=Fh(g,f.mode,_),v.return=f,f=v),o(f)):t(f,v)}return x}var Ro=Zy(!0),Ky=Zy(!1),Mu=Dr(null),wu=null,co=null,hm=null;function fm(){hm=co=wu=null}function pm(n){var e=Mu.current;gt(Mu),n._currentValue=e}function up(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Mo(n,e){wu=n,hm=co=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(_n=!0),n.firstContext=null)}function $n(n){var e=n._currentValue;if(hm!==n)if(n={context:n,memoizedValue:e,next:null},co===null){if(wu===null)throw Error(re(308));co=n,wu.dependencies={lanes:0,firstContext:n}}else co=co.next=n;return e}var ss=null;function mm(n){ss===null?ss=[n]:ss.push(n)}function Jy(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,mm(e)):(t.next=r.next,r.next=t),e.interleaved=t,$i(n,i)}function $i(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var pr=!1;function gm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qy(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Gi(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Er(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,tt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,$i(n,t)}return r=i.interleaved,r===null?(e.next=e,mm(i)):(e.next=r.next,r.next=e),i.interleaved=e,$i(n,t)}function eu(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tm(n,t)}}function vx(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function bu(n,e,t,i){var r=n.updateQueue;pr=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,p=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=n,y=a;switch(h=e,p=t,y.tag){case 1:if(m=y.payload,typeof m=="function"){d=m.call(p,d,h);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,d,h):m,h==null)break e;d=Mt({},d,h);break e;case 2:pr=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=d):u=u.next=p,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);_s|=o,n.lanes=o,n.memoizedState=d}}function yx(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(re(191,r));r.call(i)}}}var Al={},Mi=Dr(Al),Za=Dr(Al),Ka=Dr(Al);function os(n){if(n===Al)throw Error(re(174));return n}function xm(n,e){switch(pt(Ka,e),pt(Za,n),pt(Mi,Al),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Wf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Wf(e,n)}gt(Mi),pt(Mi,e)}function Po(){gt(Mi),gt(Za),gt(Ka)}function e_(n){os(Ka.current);var e=os(Mi.current),t=Wf(e,n.type);e!==t&&(pt(Za,n),pt(Mi,t))}function vm(n){Za.current===n&&(gt(Mi),gt(Za))}var yt=Dr(0);function Eu(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Nh=[];function ym(){for(var n=0;n<Nh.length;n++)Nh[n]._workInProgressVersionPrimary=null;Nh.length=0}var tu=er.ReactCurrentDispatcher,Lh=er.ReactCurrentBatchConfig,ys=0,St=null,Ot=null,Ht=null,Tu=!1,Ta=!1,Ja=0,pb=0;function Kt(){throw Error(re(321))}function _m(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!ai(n[t],e[t]))return!1;return!0}function Sm(n,e,t,i,r,s){if(ys=s,St=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,tu.current=n===null||n.memoizedState===null?vb:yb,n=t(i,r),Ta){s=0;do{if(Ta=!1,Ja=0,25<=s)throw Error(re(301));s+=1,Ht=Ot=null,e.updateQueue=null,tu.current=_b,n=t(i,r)}while(Ta)}if(tu.current=Au,e=Ot!==null&&Ot.next!==null,ys=0,Ht=Ot=St=null,Tu=!1,e)throw Error(re(300));return n}function Mm(){var n=Ja!==0;return Ja=0,n}function mi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function qn(){if(Ot===null){var n=St.alternate;n=n!==null?n.memoizedState:null}else n=Ot.next;var e=Ht===null?St.memoizedState:Ht.next;if(e!==null)Ht=e,Ot=n;else{if(n===null)throw Error(re(310));Ot=n,n={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Ht===null?St.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function Qa(n,e){return typeof e=="function"?e(n):e}function Dh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=Ot,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((ys&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,o=i):l=l.next=d,St.lanes|=u,_s|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,ai(i,e.memoizedState)||(_n=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,St.lanes|=s,_s|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Uh(n){var e=qn(),t=e.queue;if(t===null)throw Error(re(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);ai(s,e.memoizedState)||(_n=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function t_(){}function n_(n,e){var t=St,i=qn(),r=e(),s=!ai(i.memoizedState,r);if(s&&(i.memoizedState=r,_n=!0),i=i.queue,wm(s_.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||Ht!==null&&Ht.memoizedState.tag&1){if(t.flags|=2048,el(9,r_.bind(null,t,i,r,e),void 0,null),Wt===null)throw Error(re(349));ys&30||i_(t,e,r)}return r}function i_(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function r_(n,e,t,i){e.value=t,e.getSnapshot=i,o_(e)&&a_(n)}function s_(n,e,t){return t(function(){o_(e)&&a_(n)})}function o_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!ai(n,t)}catch{return!0}}function a_(n){var e=$i(n,1);e!==null&&oi(e,n,1,-1)}function _x(n){var e=mi();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:n},e.queue=n,n=n.dispatch=xb.bind(null,St,n),[e.memoizedState,n]}function el(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=St.updateQueue,e===null?(e={lastEffect:null,stores:null},St.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function l_(){return qn().memoizedState}function nu(n,e,t,i){var r=mi();St.flags|=n,r.memoizedState=el(1|e,t,void 0,i===void 0?null:i)}function vd(n,e,t,i){var r=qn();i=i===void 0?null:i;var s=void 0;if(Ot!==null){var o=Ot.memoizedState;if(s=o.destroy,i!==null&&_m(i,o.deps)){r.memoizedState=el(e,t,s,i);return}}St.flags|=n,r.memoizedState=el(1|e,t,s,i)}function Sx(n,e){return nu(8390656,8,n,e)}function wm(n,e){return vd(2048,8,n,e)}function c_(n,e){return vd(4,2,n,e)}function u_(n,e){return vd(4,4,n,e)}function d_(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function h_(n,e,t){return t=t!=null?t.concat([n]):null,vd(4,4,d_.bind(null,e,n),t)}function bm(){}function f_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&_m(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function p_(n,e){var t=qn();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&_m(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function m_(n,e,t){return ys&21?(ai(t,e)||(t=_y(),St.lanes|=t,_s|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,_n=!0),n.memoizedState=t)}function mb(n,e){var t=dt;dt=t!==0&&4>t?t:4,n(!0);var i=Lh.transition;Lh.transition={};try{n(!1),e()}finally{dt=t,Lh.transition=i}}function g_(){return qn().memoizedState}function gb(n,e,t){var i=Ar(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},x_(n))v_(e,t);else if(t=Jy(n,e,t,i),t!==null){var r=hn();oi(t,n,i,r),y_(t,e,i)}}function xb(n,e,t){var i=Ar(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(x_(n))v_(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,ai(a,o)){var l=e.interleaved;l===null?(r.next=r,mm(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=Jy(n,e,r,i),t!==null&&(r=hn(),oi(t,n,i,r),y_(t,e,i))}}function x_(n){var e=n.alternate;return n===St||e!==null&&e===St}function v_(n,e){Ta=Tu=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function y_(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tm(n,t)}}var Au={readContext:$n,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},vb={readContext:$n,useCallback:function(n,e){return mi().memoizedState=[n,e===void 0?null:e],n},useContext:$n,useEffect:Sx,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,nu(4194308,4,d_.bind(null,e,n),t)},useLayoutEffect:function(n,e){return nu(4194308,4,n,e)},useInsertionEffect:function(n,e){return nu(4,2,n,e)},useMemo:function(n,e){var t=mi();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=mi();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=gb.bind(null,St,n),[i.memoizedState,n]},useRef:function(n){var e=mi();return n={current:n},e.memoizedState=n},useState:_x,useDebugValue:bm,useDeferredValue:function(n){return mi().memoizedState=n},useTransition:function(){var n=_x(!1),e=n[0];return n=mb.bind(null,n[1]),mi().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=St,r=mi();if(xt){if(t===void 0)throw Error(re(407));t=t()}else{if(t=e(),Wt===null)throw Error(re(349));ys&30||i_(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Sx(s_.bind(null,i,s,n),[n]),i.flags|=2048,el(9,r_.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=mi(),e=Wt.identifierPrefix;if(xt){var t=Vi,i=zi;t=(i&~(1<<32-si(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ja++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=pb++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},yb={readContext:$n,useCallback:f_,useContext:$n,useEffect:wm,useImperativeHandle:h_,useInsertionEffect:c_,useLayoutEffect:u_,useMemo:p_,useReducer:Dh,useRef:l_,useState:function(){return Dh(Qa)},useDebugValue:bm,useDeferredValue:function(n){var e=qn();return m_(e,Ot.memoizedState,n)},useTransition:function(){var n=Dh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1},_b={readContext:$n,useCallback:f_,useContext:$n,useEffect:wm,useImperativeHandle:h_,useInsertionEffect:c_,useLayoutEffect:u_,useMemo:p_,useReducer:Uh,useRef:l_,useState:function(){return Uh(Qa)},useDebugValue:bm,useDeferredValue:function(n){var e=qn();return Ot===null?e.memoizedState=n:m_(e,Ot.memoizedState,n)},useTransition:function(){var n=Uh(Qa)[0],e=qn().memoizedState;return[n,e]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1};function ti(n,e){if(n&&n.defaultProps){e=Mt({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function dp(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Mt({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var yd={isMounted:function(n){return(n=n._reactInternals)?As(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=hn(),r=Ar(n),s=Gi(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Er(n,s,r),e!==null&&(oi(e,n,r,i),eu(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=hn(),i=Ar(n),r=Gi(t,i);r.tag=2,e!=null&&(r.callback=e),e=Er(n,r,i),e!==null&&(oi(e,n,i,t),eu(e,n,i))}};function Mx(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Xa(t,i)||!Xa(r,s):!0}function __(n,e,t){var i=!1,r=Pr,s=e.contextType;return typeof s=="object"&&s!==null?s=$n(s):(r=wn(e)?xs:sn.current,i=e.contextTypes,s=(i=i!=null)?Ao(n,r):Pr),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yd,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function wx(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&yd.enqueueReplaceState(e,e.state,null)}function hp(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},gm(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=$n(s):(s=wn(e)?xs:sn.current,r.context=Ao(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(dp(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&yd.enqueueReplaceState(r,r.state,null),bu(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Io(n,e){try{var t="",i=e;do t+=$w(i),i=i.return;while(i);var r=t}catch(s){r=`
39
39
  Error generating stack: `+s.message+`
40
- `+s.stack}return{value:n,source:e,stack:r,digest:null}}function kh(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function fp(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var Sb=typeof WeakMap=="function"?WeakMap:Map;function S_(n,e,t){t=Gi(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){Ru||(Ru=!0,wp=i),fp(n,e)},t}function M_(n,e,t){t=Gi(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){fp(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){fp(n,e),typeof i!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function bx(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new Sb;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Ub.bind(null,n,e,t),e.then(n,n))}function Ex(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Tx(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Gi(-1,1),e.tag=2,Er(t,e,1))),t.lanes|=1),n)}var Mb=er.ReactCurrentOwner,_n=!1;function cn(n,e,t,i){e.child=n===null?Ky(e,null,t,i):Ro(e,n.child,t,i)}function Ax(n,e,t,i,r){t=t.render;var s=e.ref;return Mo(e,r),i=Sm(n,e,t,i,s,r),t=Mm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&t&&cm(e),e.flags|=1,cn(n,e,i,r),e.child)}function Cx(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Nm(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,w_(n,e,s,i,r)):(n=ou(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Xa,t(o,i)&&n.ref===e.ref)return qi(n,e,r)}return e.flags|=1,n=Cr(s,i),n.ref=e.ref,n.return=e,e.child=n}function w_(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Xa(s,i)&&n.ref===e.ref)if(_n=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(_n=!0);else return e.lanes=n.lanes,qi(n,e,r)}return pp(n,e,t,i,r)}function b_(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(ho,In),In|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,pt(ho,In),In|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,pt(ho,In),In|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,pt(ho,In),In|=i;return cn(n,e,r,t),e.child}function E_(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function pp(n,e,t,i,r){var s=wn(t)?xs:sn.current;return s=Ao(e,s),Mo(e,r),t=Sm(n,e,t,i,s,r),i=Mm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&i&&cm(e),e.flags|=1,cn(n,e,t,r),e.child)}function Rx(n,e,t,i,r){if(wn(t)){var s=!0;yu(e)}else s=!1;if(Mo(e,r),e.stateNode===null)iu(n,e),__(e,t,i),hp(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=$n(c):(c=wn(t)?xs:sn.current,c=Ao(e,c));var u=t.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&wx(e,o,i,c),pr=!1;var h=e.memoizedState;o.state=h,bu(e,i,o,r),l=e.memoizedState,a!==i||h!==l||Mn.current||pr?(typeof u=="function"&&(dp(e,t,u,i),l=e.memoizedState),(a=pr||Mx(e,t,a,i,h,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Qy(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:ti(e.type,a),o.props=c,d=e.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=$n(l):(l=wn(t)?xs:sn.current,l=Ao(e,l));var p=t.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||h!==l)&&wx(e,o,i,l),pr=!1,h=e.memoizedState,o.state=h,bu(e,i,o,r);var m=e.memoizedState;a!==d||h!==m||Mn.current||pr?(typeof p=="function"&&(dp(e,t,p,i),m=e.memoizedState),(c=pr||Mx(e,t,c,i,h,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=m),o.props=i,o.state=m,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),i=!1)}return mp(n,e,t,i,s,r)}function mp(n,e,t,i,r,s){E_(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&px(e,t,!1),qi(n,e,s);i=e.stateNode,Mb.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Ro(e,n.child,null,s),e.child=Ro(e,null,a,s)):cn(n,e,a,s),e.memoizedState=i.state,r&&px(e,t,!0),e.child}function T_(n){var e=n.stateNode;e.pendingContext?fx(n,e.pendingContext,e.pendingContext!==e.context):e.context&&fx(n,e.context,!1),xm(n,e.containerInfo)}function Px(n,e,t,i,r){return Co(),dm(r),e.flags|=256,cn(n,e,t,i),e.child}var gp={dehydrated:null,treeContext:null,retryLane:0};function xp(n){return{baseLanes:n,cachePool:null,transitions:null}}function A_(n,e,t){var i=e.pendingProps,r=yt.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),pt(yt,r&1),n===null)return cp(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Md(o,i,0,null),n=hs(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=xp(t),e.memoizedState=gp,n):Em(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return wb(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Cr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Cr(a,s):(s=hs(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?xp(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=gp,i}return s=n.child,n=s.sibling,i=Cr(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Em(n,e){return e=Md({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Ql(n,e,t,i){return i!==null&&dm(i),Ro(e,n.child,null,t),n=Em(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function wb(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=kh(Error(re(422))),Ql(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=Md({mode:"visible",children:i.children},r,0,null),s=hs(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ro(e,n.child,null,o),e.child.memoizedState=xp(o),e.memoizedState=gp,s);if(!(e.mode&1))return Ql(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(re(419)),i=kh(s,i,void 0),Ql(n,e,o,i)}if(a=(o&n.childLanes)!==0,_n||a){if(i=Wt,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,$i(n,r),oi(i,n,r,-1))}return Im(),i=kh(Error(re(421))),Ql(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=kb.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Ln=br(r.nextSibling),Dn=e,xt=!0,ii=null,n!==null&&(Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,zi=n.id,Vi=n.overflow,vs=e),e=Em(e,i.children),e.flags|=4096,e)}function Ix(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),up(n.return,e,t)}function Oh(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function C_(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(cn(n,e,i.children,t),i=yt.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ix(n,t,e);else if(n.tag===19)Ix(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(pt(yt,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Eu(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Oh(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Eu(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Oh(e,!0,t,null,s);break;case"together":Oh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function iu(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function qi(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),_s|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(re(153));if(e.child!==null){for(n=e.child,t=Cr(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Cr(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function bb(n,e,t){switch(e.tag){case 3:T_(e),Co();break;case 5:e_(e);break;case 1:wn(e.type)&&yu(e);break;case 4:xm(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;pt(Mu,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(pt(yt,yt.current&1),e.flags|=128,null):t&e.child.childLanes?A_(n,e,t):(pt(yt,yt.current&1),n=qi(n,e,t),n!==null?n.sibling:null);pt(yt,yt.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return C_(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),pt(yt,yt.current),i)break;return null;case 22:case 23:return e.lanes=0,b_(n,e,t)}return qi(n,e,t)}var R_,vp,P_,I_;R_=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};vp=function(){};P_=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,os(Mi.current);var s=null;switch(t){case"input":r=zf(n,r),i=zf(n,i),s=[];break;case"select":r=Mt({},r,{value:void 0}),i=Mt({},i,{value:void 0}),s=[];break;case"textarea":r=Gf(n,r),i=Gf(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=xu)}jf(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ba.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ba.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&mt("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};I_=function(n,e,t,i){t!==i&&(e.flags|=4)};function Qo(n,e){if(!xt)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Jt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Eb(n,e,t){var i=e.pendingProps;switch(um(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(e),null;case 1:return wn(e.type)&&vu(),Jt(e),null;case 3:return i=e.stateNode,Po(),gt(Mn),gt(sn),ym(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Kl(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ii!==null&&(Tp(ii),ii=null))),vp(n,e),Jt(e),null;case 5:vm(e);var r=os(Ka.current);if(t=e.type,n!==null&&e.stateNode!=null)P_(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(re(166));return Jt(e),null}if(n=os(Mi.current),Kl(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[xi]=e,i[qa]=s,n=(e.mode&1)!==0,t){case"dialog":mt("cancel",i),mt("close",i);break;case"iframe":case"object":case"embed":mt("load",i);break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],i);break;case"source":mt("error",i);break;case"img":case"image":case"link":mt("error",i),mt("load",i);break;case"details":mt("toggle",i);break;case"input":zg(i,s),mt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},mt("invalid",i);break;case"textarea":Hg(i,s),mt("invalid",i)}jf(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",""+a]):Ba.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&mt("scroll",i)}switch(t){case"input":Hl(i),Vg(i,s,!0);break;case"textarea":Hl(i),Gg(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=xu)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=sy(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[xi]=e,n[qa]=i,R_(n,e,!1,!1),e.stateNode=n;e:{switch(o=Xf(t,i),t){case"dialog":mt("cancel",n),mt("close",n),r=i;break;case"iframe":case"object":case"embed":mt("load",n),r=i;break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],n);r=i;break;case"source":mt("error",n),r=i;break;case"img":case"image":case"link":mt("error",n),mt("load",n),r=i;break;case"details":mt("toggle",n),r=i;break;case"input":zg(n,i),r=zf(n,i),mt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Mt({},i,{value:void 0}),mt("invalid",n);break;case"textarea":Hg(n,i),r=Gf(n,i),mt("invalid",n);break;default:r=i}jf(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?ly(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&oy(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&za(n,l):typeof l=="number"&&za(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ba.hasOwnProperty(s)?l!=null&&s==="onScroll"&&mt("scroll",n):l!=null&&qp(n,s,l,o))}switch(t){case"input":Hl(n),Vg(n,i,!1);break;case"textarea":Hl(n),Gg(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Rr(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?vo(n,!!i.multiple,s,!1):i.defaultValue!=null&&vo(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=xu)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Jt(e),null;case 6:if(n&&e.stateNode!=null)I_(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(re(166));if(t=os(Ka.current),os(Mi.current),Kl(e)){if(i=e.stateNode,t=e.memoizedProps,i[xi]=e,(s=i.nodeValue!==t)&&(n=Dn,n!==null))switch(n.tag){case 3:Zl(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Zl(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[xi]=e,e.stateNode=i}return Jt(e),null;case 13:if(gt(yt),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xt&&Ln!==null&&e.mode&1&&!(e.flags&128))qy(),Co(),e.flags|=98560,s=!1;else if(s=Kl(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(re(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[xi]=e}else Co(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Jt(e),s=!1}else ii!==null&&(Tp(ii),ii=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||yt.current&1?Ft===0&&(Ft=3):Im())),e.updateQueue!==null&&(e.flags|=4),Jt(e),null);case 4:return Po(),vp(n,e),n===null&&Ya(e.stateNode.containerInfo),Jt(e),null;case 10:return pm(e.type._context),Jt(e),null;case 17:return wn(e.type)&&vu(),Jt(e),null;case 19:if(gt(yt),s=e.memoizedState,s===null)return Jt(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Qo(s,!1);else{if(Ft!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=Eu(n),o!==null){for(e.flags|=128,Qo(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return pt(yt,yt.current&1|2),e.child}n=n.sibling}s.tail!==null&&Pt()>No&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304)}else{if(!i)if(n=Eu(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Qo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xt)return Jt(e),null}else 2*Pt()-s.renderingStartTime>No&&t!==1073741824&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Pt(),e.sibling=null,t=yt.current,pt(yt,i?t&1|2:t&1),e):(Jt(e),null);case 22:case 23:return Pm(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?In&1073741824&&(Jt(e),e.subtreeFlags&6&&(e.flags|=8192)):Jt(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function Tb(n,e){switch(um(e),e.tag){case 1:return wn(e.type)&&vu(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Po(),gt(Mn),gt(sn),ym(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return vm(e),null;case 13:if(gt(yt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(re(340));Co()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gt(yt),null;case 4:return Po(),null;case 10:return pm(e.type._context),null;case 22:case 23:return Pm(),null;case 24:return null;default:return null}}var ec=!1,nn=!1,Ab=typeof WeakSet=="function"?WeakSet:Set,Me=null;function uo(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Tt(n,e,i)}else t.current=null}function yp(n,e,t){try{t()}catch(i){Tt(n,e,i)}}var Nx=!1;function Cb(n,e){if(np=pu,n=ky(),lm(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=n,h=null;t:for(;;){for(var p;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)h=d,d=p;for(;;){if(d===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(p=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(ip={focusedElem:n,selectionRange:t},pu=!1,Me=e;Me!==null;)if(e=Me,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Me=n;else for(;Me!==null;){e=Me;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,g=m.memoizedState,f=e.stateNode,v=f.getSnapshotBeforeUpdate(e.elementType===e.type?y:ti(e.type,y),g);f.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(_){Tt(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Me=n;break}Me=e.return}return m=Nx,Nx=!1,m}function Aa(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&yp(e,t,s)}r=r.next}while(r!==i)}}function _d(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function _p(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function N_(n){var e=n.alternate;e!==null&&(n.alternate=null,N_(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[xi],delete e[qa],delete e[op],delete e[ub],delete e[db])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function L_(n){return n.tag===5||n.tag===3||n.tag===4}function Lx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||L_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Sp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=xu));else if(i!==4&&(n=n.child,n!==null))for(Sp(n,e,t),n=n.sibling;n!==null;)Sp(n,e,t),n=n.sibling}function Mp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Mp(n,e,t),n=n.sibling;n!==null;)Mp(n,e,t),n=n.sibling}var Yt=null,ni=!1;function ir(n,e,t){for(t=t.child;t!==null;)D_(n,e,t),t=t.sibling}function D_(n,e,t){if(Si&&typeof Si.onCommitFiberUnmount=="function")try{Si.onCommitFiberUnmount(hd,t)}catch{}switch(t.tag){case 5:nn||uo(t,e);case 6:var i=Yt,r=ni;Yt=null,ir(n,e,t),Yt=i,ni=r,Yt!==null&&(ni?(n=Yt,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Yt.removeChild(t.stateNode));break;case 18:Yt!==null&&(ni?(n=Yt,t=t.stateNode,n.nodeType===8?Ph(n.parentNode,t):n.nodeType===1&&Ph(n,t),Wa(n)):Ph(Yt,t.stateNode));break;case 4:i=Yt,r=ni,Yt=t.stateNode.containerInfo,ni=!0,ir(n,e,t),Yt=i,ni=r;break;case 0:case 11:case 14:case 15:if(!nn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&yp(t,e,o),r=r.next}while(r!==i)}ir(n,e,t);break;case 1:if(!nn&&(uo(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Tt(t,e,a)}ir(n,e,t);break;case 21:ir(n,e,t);break;case 22:t.mode&1?(nn=(i=nn)||t.memoizedState!==null,ir(n,e,t),nn=i):ir(n,e,t);break;default:ir(n,e,t)}}function Dx(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Ab),e.forEach(function(i){var r=Ob.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Kn(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Yt=a.stateNode,ni=!1;break e;case 3:Yt=a.stateNode.containerInfo,ni=!0;break e;case 4:Yt=a.stateNode.containerInfo,ni=!0;break e}a=a.return}if(Yt===null)throw Error(re(160));D_(s,o,r),Yt=null,ni=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Tt(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)U_(e,n),e=e.sibling}function U_(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Kn(e,n),fi(n),i&4){try{Aa(3,n,n.return),_d(3,n)}catch(y){Tt(n,n.return,y)}try{Aa(5,n,n.return)}catch(y){Tt(n,n.return,y)}}break;case 1:Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return);break;case 5:if(Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return),n.flags&32){var r=n.stateNode;try{za(r,"")}catch(y){Tt(n,n.return,y)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&iy(r,s),Xf(a,o);var c=Xf(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?ly(r,d):u==="dangerouslySetInnerHTML"?oy(r,d):u==="children"?za(r,d):qp(r,u,d,c)}switch(a){case"input":Vf(r,s);break;case"textarea":ry(r,s);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vo(r,!!s.multiple,p,!1):h!==!!s.multiple&&(s.defaultValue!=null?vo(r,!!s.multiple,s.defaultValue,!0):vo(r,!!s.multiple,s.multiple?[]:"",!1))}r[qa]=s}catch(y){Tt(n,n.return,y)}}break;case 6:if(Kn(e,n),fi(n),i&4){if(n.stateNode===null)throw Error(re(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(y){Tt(n,n.return,y)}}break;case 3:if(Kn(e,n),fi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Wa(e.containerInfo)}catch(y){Tt(n,n.return,y)}break;case 4:Kn(e,n),fi(n);break;case 13:Kn(e,n),fi(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Cm=Pt())),i&4&&Dx(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?(nn=(c=nn)||u,Kn(e,n),nn=c):Kn(e,n),fi(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(Me=n,u=n.child;u!==null;){for(d=Me=u;Me!==null;){switch(h=Me,p=h.child,h.tag){case 0:case 11:case 14:case 15:Aa(4,h,h.return);break;case 1:uo(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){i=h,t=h.return;try{e=i,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(y){Tt(i,t,y)}}break;case 5:uo(h,h.return);break;case 22:if(h.memoizedState!==null){kx(d);continue}}p!==null?(p.return=h,Me=p):kx(d)}u=u.sibling}e:for(u=null,d=n;;){if(d.tag===5){if(u===null){u=d;try{r=d.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=ay("display",o))}catch(y){Tt(n,n.return,y)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(y){Tt(n,n.return,y)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===n)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===n)break e;for(;d.sibling===null;){if(d.return===null||d.return===n)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Kn(e,n),fi(n),i&4&&Dx(n);break;case 21:break;default:Kn(e,n),fi(n)}}function fi(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(L_(t)){var i=t;break e}t=t.return}throw Error(re(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(za(r,""),i.flags&=-33);var s=Lx(n);Mp(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Lx(n);Sp(n,a,o);break;default:throw Error(re(161))}}catch(l){Tt(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Rb(n,e,t){Me=n,k_(n)}function k_(n,e,t){for(var i=(n.mode&1)!==0;Me!==null;){var r=Me,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||ec;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||nn;a=ec;var c=nn;if(ec=o,(nn=l)&&!c)for(Me=r;Me!==null;)o=Me,l=o.child,o.tag===22&&o.memoizedState!==null?Ox(r):l!==null?(l.return=o,Me=l):Ox(r);for(;s!==null;)Me=s,k_(s),s=s.sibling;Me=r,ec=a,nn=c}Ux(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Me=s):Ux(n)}}function Ux(n){for(;Me!==null;){var e=Me;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nn||_d(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!nn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:ti(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&yx(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}yx(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Wa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}nn||e.flags&512&&_p(e)}catch(h){Tt(e,e.return,h)}}if(e===n){Me=null;break}if(t=e.sibling,t!==null){t.return=e.return,Me=t;break}Me=e.return}}function kx(n){for(;Me!==null;){var e=Me;if(e===n){Me=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Me=t;break}Me=e.return}}function Ox(n){for(;Me!==null;){var e=Me;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{_d(4,e)}catch(l){Tt(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Tt(e,r,l)}}var s=e.return;try{_p(e)}catch(l){Tt(e,s,l)}break;case 5:var o=e.return;try{_p(e)}catch(l){Tt(e,o,l)}}}catch(l){Tt(e,e.return,l)}if(e===n){Me=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Me=a;break}Me=e.return}}var Pb=Math.ceil,Cu=er.ReactCurrentDispatcher,Tm=er.ReactCurrentOwner,Yn=er.ReactCurrentBatchConfig,tt=0,Wt=null,Dt=null,qt=0,In=0,ho=Dr(0),Ft=0,tl=null,_s=0,Sd=0,Am=0,Ca=null,yn=null,Cm=0,No=1/0,ki=null,Ru=!1,wp=null,Tr=null,tc=!1,_r=null,Pu=0,Ra=0,bp=null,ru=-1,su=0;function hn(){return tt&6?Pt():ru!==-1?ru:ru=Pt()}function Ar(n){return n.mode&1?tt&2&&qt!==0?qt&-qt:fb.transition!==null?(su===0&&(su=_y()),su):(n=dt,n!==0||(n=window.event,n=n===void 0?16:Ay(n.type)),n):1}function oi(n,e,t,i){if(50<Ra)throw Ra=0,bp=null,Error(re(185));bl(n,t,i),(!(tt&2)||n!==Wt)&&(n===Wt&&(!(tt&2)&&(Sd|=t),Ft===4&&xr(n,qt)),bn(n,i),t===1&&tt===0&&!(e.mode&1)&&(No=Pt()+500,xd&&Ur()))}function bn(n,e){var t=n.callbackNode;f1(n,e);var i=fu(n,n===Wt?qt:0);if(i===0)t!==null&&Xg(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&Xg(t),e===1)n.tag===0?hb(Fx.bind(null,n)):Xy(Fx.bind(null,n)),lb(function(){!(tt&6)&&Ur()}),t=null;else{switch(Sy(i)){case 1:t=em;break;case 4:t=vy;break;case 16:t=hu;break;case 536870912:t=yy;break;default:t=hu}t=W_(t,O_.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function O_(n,e){if(ru=-1,su=0,tt&6)throw Error(re(327));var t=n.callbackNode;if(wo()&&n.callbackNode!==t)return null;var i=fu(n,n===Wt?qt:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=Iu(n,i);else{e=i;var r=tt;tt|=2;var s=B_();(Wt!==n||qt!==e)&&(ki=null,No=Pt()+500,ds(n,e));do try{Lb();break}catch(a){F_(n,a)}while(!0);fm(),Cu.current=s,tt=r,Dt!==null?e=0:(Wt=null,qt=0,e=Ft)}if(e!==0){if(e===2&&(r=Kf(n),r!==0&&(i=r,e=Ep(n,r))),e===1)throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;if(e===6)xr(n,i);else{if(r=n.current.alternate,!(i&30)&&!Ib(r)&&(e=Iu(n,i),e===2&&(s=Kf(n),s!==0&&(i=s,e=Ep(n,s))),e===1))throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(re(345));case 2:es(n,yn,ki);break;case 3:if(xr(n,i),(i&130023424)===i&&(e=Cm+500-Pt(),10<e)){if(fu(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){hn(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=sp(es.bind(null,n,yn,ki),e);break}es(n,yn,ki);break;case 4:if(xr(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-si(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Pt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Pb(i/1960))-i,10<i){n.timeoutHandle=sp(es.bind(null,n,yn,ki),i);break}es(n,yn,ki);break;case 5:es(n,yn,ki);break;default:throw Error(re(329))}}}return bn(n,Pt()),n.callbackNode===t?O_.bind(null,n):null}function Ep(n,e){var t=Ca;return n.current.memoizedState.isDehydrated&&(ds(n,e).flags|=256),n=Iu(n,e),n!==2&&(e=yn,yn=t,e!==null&&Tp(e)),n}function Tp(n){yn===null?yn=n:yn.push.apply(yn,n)}function Ib(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!ai(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function xr(n,e){for(e&=~Am,e&=~Sd,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-si(e),i=1<<t;n[t]=-1,e&=~i}}function Fx(n){if(tt&6)throw Error(re(327));wo();var e=fu(n,0);if(!(e&1))return bn(n,Pt()),null;var t=Iu(n,e);if(n.tag!==0&&t===2){var i=Kf(n);i!==0&&(e=i,t=Ep(n,i))}if(t===1)throw t=tl,ds(n,0),xr(n,e),bn(n,Pt()),t;if(t===6)throw Error(re(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,es(n,yn,ki),bn(n,Pt()),null}function Rm(n,e){var t=tt;tt|=1;try{return n(e)}finally{tt=t,tt===0&&(No=Pt()+500,xd&&Ur())}}function Ss(n){_r!==null&&_r.tag===0&&!(tt&6)&&wo();var e=tt;tt|=1;var t=Yn.transition,i=dt;try{if(Yn.transition=null,dt=1,n)return n()}finally{dt=i,Yn.transition=t,tt=e,!(tt&6)&&Ur()}}function Pm(){In=ho.current,gt(ho)}function ds(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,ab(t)),Dt!==null)for(t=Dt.return;t!==null;){var i=t;switch(um(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&vu();break;case 3:Po(),gt(Mn),gt(sn),ym();break;case 5:vm(i);break;case 4:Po();break;case 13:gt(yt);break;case 19:gt(yt);break;case 10:pm(i.type._context);break;case 22:case 23:Pm()}t=t.return}if(Wt=n,Dt=n=Cr(n.current,null),qt=In=e,Ft=0,tl=null,Am=Sd=_s=0,yn=Ca=null,ss!==null){for(e=0;e<ss.length;e++)if(t=ss[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}ss=null}return n}function F_(n,e){do{var t=Dt;try{if(fm(),tu.current=Au,Tu){for(var i=St.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Tu=!1}if(ys=0,Ht=Ot=St=null,Ta=!1,Ja=0,Tm.current=null,t===null||t.return===null){Ft=1,tl=e,Dt=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=qt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Ex(o);if(p!==null){p.flags&=-257,Tx(p,o,a,s,e),p.mode&1&&bx(s,c,e),e=p,l=c;var m=e.updateQueue;if(m===null){var y=new Set;y.add(l),e.updateQueue=y}else m.add(l);break e}else{if(!(e&1)){bx(s,c,e),Im();break e}l=Error(re(426))}}else if(xt&&a.mode&1){var g=Ex(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),Tx(g,o,a,s,e),dm(Io(l,a));break e}}s=l=Io(l,a),Ft!==4&&(Ft=2),Ca===null?Ca=[s]:Ca.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var f=S_(s,l,e);vx(s,f);break e;case 1:a=l;var v=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Tr===null||!Tr.has(x)))){s.flags|=65536,e&=-e,s.lanes|=e;var _=M_(s,a,e);vx(s,_);break e}}s=s.return}while(s!==null)}V_(t)}catch(R){e=R,Dt===t&&t!==null&&(Dt=t=t.return);continue}break}while(!0)}function B_(){var n=Cu.current;return Cu.current=Au,n===null?Au:n}function Im(){(Ft===0||Ft===3||Ft===2)&&(Ft=4),Wt===null||!(_s&268435455)&&!(Sd&268435455)||xr(Wt,qt)}function Iu(n,e){var t=tt;tt|=2;var i=B_();(Wt!==n||qt!==e)&&(ki=null,ds(n,e));do try{Nb();break}catch(r){F_(n,r)}while(!0);if(fm(),tt=t,Cu.current=i,Dt!==null)throw Error(re(261));return Wt=null,qt=0,Ft}function Nb(){for(;Dt!==null;)z_(Dt)}function Lb(){for(;Dt!==null&&!r1();)z_(Dt)}function z_(n){var e=G_(n.alternate,n,In);n.memoizedProps=n.pendingProps,e===null?V_(n):Dt=e,Tm.current=null}function V_(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Tb(t,e),t!==null){t.flags&=32767,Dt=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Ft=6,Dt=null;return}}else if(t=Eb(t,e,In),t!==null){Dt=t;return}if(e=e.sibling,e!==null){Dt=e;return}Dt=e=n}while(e!==null);Ft===0&&(Ft=5)}function es(n,e,t){var i=dt,r=Yn.transition;try{Yn.transition=null,dt=1,Db(n,e,t,i)}finally{Yn.transition=r,dt=i}return null}function Db(n,e,t,i){do wo();while(_r!==null);if(tt&6)throw Error(re(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(re(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(p1(n,s),n===Wt&&(Dt=Wt=null,qt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||tc||(tc=!0,W_(hu,function(){return wo(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=Yn.transition,Yn.transition=null;var o=dt;dt=1;var a=tt;tt|=4,Tm.current=null,Cb(n,t),U_(t,n),eb(ip),pu=!!np,ip=np=null,n.current=t,Rb(t),s1(),tt=a,dt=o,Yn.transition=s}else n.current=t;if(tc&&(tc=!1,_r=n,Pu=r),s=n.pendingLanes,s===0&&(Tr=null),l1(t.stateNode),bn(n,Pt()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(Ru)throw Ru=!1,n=wp,wp=null,n;return Pu&1&&n.tag!==0&&wo(),s=n.pendingLanes,s&1?n===bp?Ra++:(Ra=0,bp=n):Ra=0,Ur(),null}function wo(){if(_r!==null){var n=Sy(Pu),e=Yn.transition,t=dt;try{if(Yn.transition=null,dt=16>n?16:n,_r===null)var i=!1;else{if(n=_r,_r=null,Pu=0,tt&6)throw Error(re(331));var r=tt;for(tt|=4,Me=n.current;Me!==null;){var s=Me,o=s.child;if(Me.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(Me=c;Me!==null;){var u=Me;switch(u.tag){case 0:case 11:case 15:Aa(8,u,s)}var d=u.child;if(d!==null)d.return=u,Me=d;else for(;Me!==null;){u=Me;var h=u.sibling,p=u.return;if(N_(u),u===c){Me=null;break}if(h!==null){h.return=p,Me=h;break}Me=p}}}var m=s.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var g=y.sibling;y.sibling=null,y=g}while(y!==null)}}Me=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Me=o;else e:for(;Me!==null;){if(s=Me,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Aa(9,s,s.return)}var f=s.sibling;if(f!==null){f.return=s.return,Me=f;break e}Me=s.return}}var v=n.current;for(Me=v;Me!==null;){o=Me;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,Me=x;else e:for(o=v;Me!==null;){if(a=Me,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_d(9,a)}}catch(R){Tt(a,a.return,R)}if(a===o){Me=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,Me=_;break e}Me=a.return}}if(tt=r,Ur(),Si&&typeof Si.onPostCommitFiberRoot=="function")try{Si.onPostCommitFiberRoot(hd,n)}catch{}i=!0}return i}finally{dt=t,Yn.transition=e}}return!1}function Bx(n,e,t){e=Io(t,e),e=S_(n,e,1),n=Er(n,e,1),e=hn(),n!==null&&(bl(n,1,e),bn(n,e))}function Tt(n,e,t){if(n.tag===3)Bx(n,n,t);else for(;e!==null;){if(e.tag===3){Bx(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Tr===null||!Tr.has(i))){n=Io(t,n),n=M_(e,n,1),e=Er(e,n,1),n=hn(),e!==null&&(bl(e,1,n),bn(e,n));break}}e=e.return}}function Ub(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=hn(),n.pingedLanes|=n.suspendedLanes&t,Wt===n&&(qt&t)===t&&(Ft===4||Ft===3&&(qt&130023424)===qt&&500>Pt()-Cm?ds(n,0):Am|=t),bn(n,e)}function H_(n,e){e===0&&(n.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var t=hn();n=$i(n,e),n!==null&&(bl(n,e,t),bn(n,t))}function kb(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),H_(n,t)}function Ob(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(re(314))}i!==null&&i.delete(e),H_(n,t)}var G_;G_=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mn.current)_n=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _n=!1,bb(n,e,t);_n=!!(n.flags&131072)}else _n=!1,xt&&e.flags&1048576&&Yy(e,Su,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;iu(n,e),n=e.pendingProps;var r=Ao(e,sn.current);Mo(e,t),r=Sm(null,e,i,n,r,t);var s=Mm();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wn(i)?(s=!0,yu(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,gm(e),r.updater=yd,e.stateNode=r,r._reactInternals=e,hp(e,i,n,t),e=mp(null,e,i,!0,s,t)):(e.tag=0,xt&&s&&cm(e),cn(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(iu(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Bb(i),n=ti(i,n),r){case 0:e=pp(null,e,i,n,t);break e;case 1:e=Rx(null,e,i,n,t);break e;case 11:e=Ax(null,e,i,n,t);break e;case 14:e=Cx(null,e,i,ti(i.type,n),t);break e}throw Error(re(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),pp(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Rx(n,e,i,r,t);case 3:e:{if(T_(e),n===null)throw Error(re(387));i=e.pendingProps,s=e.memoizedState,r=s.element,Qy(n,e),bu(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Io(Error(re(423)),e),e=Px(n,e,i,t,r);break e}else if(i!==r){r=Io(Error(re(424)),e),e=Px(n,e,i,t,r);break e}else for(Ln=br(e.stateNode.containerInfo.firstChild),Dn=e,xt=!0,ii=null,t=Ky(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Co(),i===r){e=qi(n,e,t);break e}cn(n,e,i,t)}e=e.child}return e;case 5:return e_(e),n===null&&cp(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,rp(i,r)?o=null:s!==null&&rp(i,s)&&(e.flags|=32),E_(n,e),cn(n,e,o,t),e.child;case 6:return n===null&&cp(e),null;case 13:return A_(n,e,t);case 4:return xm(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Ro(e,null,i,t):cn(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Ax(n,e,i,r,t);case 7:return cn(n,e,e.pendingProps,t),e.child;case 8:return cn(n,e,e.pendingProps.children,t),e.child;case 12:return cn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,pt(Mu,i._currentValue),i._currentValue=o,s!==null)if(ai(s.value,o)){if(s.children===r.children&&!Mn.current){e=qi(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Gi(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),up(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),up(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}cn(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Mo(e,t),r=$n(r),i=i(r),e.flags|=1,cn(n,e,i,t),e.child;case 14:return i=e.type,r=ti(i,e.pendingProps),r=ti(i.type,r),Cx(n,e,i,r,t);case 15:return w_(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),iu(n,e),e.tag=1,wn(i)?(n=!0,yu(e)):n=!1,Mo(e,t),__(e,i,r),hp(e,i,r,t),mp(null,e,i,!0,n,t);case 19:return C_(n,e,t);case 22:return b_(n,e,t)}throw Error(re(156,e.tag))};function W_(n,e){return xy(n,e)}function Fb(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(n,e,t,i){return new Fb(n,e,t,i)}function Nm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Bb(n){if(typeof n=="function")return Nm(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Kp)return 11;if(n===Jp)return 14}return 2}function Cr(n,e){var t=n.alternate;return t===null?(t=jn(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function ou(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Nm(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case to:return hs(t.children,r,s,e);case Zp:o=8,r|=8;break;case kf:return n=jn(12,t,e,r|2),n.elementType=kf,n.lanes=s,n;case Of:return n=jn(13,t,e,r),n.elementType=Of,n.lanes=s,n;case Ff:return n=jn(19,t,e,r),n.elementType=Ff,n.lanes=s,n;case ey:return Md(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Jv:o=10;break e;case Qv:o=9;break e;case Kp:o=11;break e;case Jp:o=14;break e;case fr:o=16,i=null;break e}throw Error(re(130,n==null?n:typeof n,""))}return e=jn(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function hs(n,e,t,i){return n=jn(7,n,i,e),n.lanes=t,n}function Md(n,e,t,i){return n=jn(22,n,i,e),n.elementType=ey,n.lanes=t,n.stateNode={isHidden:!1},n}function Fh(n,e,t){return n=jn(6,n,null,e),n.lanes=t,n}function Bh(n,e,t){return e=jn(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function zb(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yh(0),this.expirationTimes=yh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yh(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Lm(n,e,t,i,r,s,o,a,l){return n=new zb(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jn(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},gm(s),n}function Vb(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:eo,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function j_(n){if(!n)return Pr;n=n._reactInternals;e:{if(As(n)!==n||n.tag!==1)throw Error(re(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(re(171))}if(n.tag===1){var t=n.type;if(wn(t))return jy(n,t,e)}return e}function X_(n,e,t,i,r,s,o,a,l){return n=Lm(t,i,!0,n,r,s,o,a,l),n.context=j_(null),t=n.current,i=hn(),r=Ar(t),s=Gi(i,r),s.callback=e??null,Er(t,s,r),n.current.lanes=r,bl(n,r,i),bn(n,i),n}function wd(n,e,t,i){var r=e.current,s=hn(),o=Ar(r);return t=j_(t),e.context===null?e.context=t:e.pendingContext=t,e=Gi(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Er(r,e,o),n!==null&&(oi(n,r,o,s),eu(n,r,o)),o}function Nu(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function zx(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Dm(n,e){zx(n,e),(n=n.alternate)&&zx(n,e)}function Hb(){return null}var Y_=typeof reportError=="function"?reportError:function(n){console.error(n)};function Um(n){this._internalRoot=n}bd.prototype.render=Um.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(re(409));wd(n,e,null,null)};bd.prototype.unmount=Um.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Ss(function(){wd(null,n,null,null)}),e[Yi]=null}};function bd(n){this._internalRoot=n}bd.prototype.unstable_scheduleHydration=function(n){if(n){var e=by();n={blockedOn:null,target:n,priority:e};for(var t=0;t<gr.length&&e!==0&&e<gr[t].priority;t++);gr.splice(t,0,n),t===0&&Ty(n)}};function km(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Ed(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Vx(){}function Gb(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=Nu(o);s.call(c)}}var o=X_(e,i,n,0,null,!1,!1,"",Vx);return n._reactRootContainer=o,n[Yi]=o.current,Ya(n.nodeType===8?n.parentNode:n),Ss(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=Nu(l);a.call(c)}}var l=Lm(n,0,!1,null,null,!1,!1,"",Vx);return n._reactRootContainer=l,n[Yi]=l.current,Ya(n.nodeType===8?n.parentNode:n),Ss(function(){wd(e,l,t,i)}),l}function Td(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=Nu(o);a.call(l)}}wd(e,o,n,r)}else o=Gb(t,e,n,r,i);return Nu(o)}My=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=xa(e.pendingLanes);t!==0&&(tm(e,t|1),bn(e,Pt()),!(tt&6)&&(No=Pt()+500,Ur()))}break;case 13:Ss(function(){var i=$i(n,1);if(i!==null){var r=hn();oi(i,n,1,r)}}),Dm(n,1)}};nm=function(n){if(n.tag===13){var e=$i(n,134217728);if(e!==null){var t=hn();oi(e,n,134217728,t)}Dm(n,134217728)}};wy=function(n){if(n.tag===13){var e=Ar(n),t=$i(n,e);if(t!==null){var i=hn();oi(t,n,e,i)}Dm(n,e)}};by=function(){return dt};Ey=function(n,e){var t=dt;try{return dt=n,e()}finally{dt=t}};$f=function(n,e,t){switch(e){case"input":if(Vf(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=gd(i);if(!r)throw Error(re(90));ny(i),Vf(i,r)}}}break;case"textarea":ry(n,t);break;case"select":e=t.value,e!=null&&vo(n,!!t.multiple,e,!1)}};dy=Rm;hy=Ss;var Wb={usingClientEntryPoint:!1,Events:[Tl,so,gd,cy,uy,Rm]},ea={findFiberByHostInstance:rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jb={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:er.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=my(n),n===null?null:n.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||Hb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{hd=nc.inject(jb),Si=nc}catch{}}Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wb;Fn.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!km(e))throw Error(re(200));return Vb(n,e,null,t)};Fn.createRoot=function(n,e){if(!km(n))throw Error(re(299));var t=!1,i="",r=Y_;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Lm(n,1,!1,null,null,t,!1,i,r),n[Yi]=e.current,Ya(n.nodeType===8?n.parentNode:n),new Um(e)};Fn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(re(188)):(n=Object.keys(n).join(","),Error(re(268,n)));return n=my(e),n=n===null?null:n.stateNode,n};Fn.flushSync=function(n){return Ss(n)};Fn.hydrate=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!0,t)};Fn.hydrateRoot=function(n,e,t){if(!km(n))throw Error(re(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=Y_;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=X_(e,null,n,1,t??null,r,!1,s,o),n[Yi]=e.current,Ya(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new bd(e)};Fn.render=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!1,t)};Fn.unmountComponentAtNode=function(n){if(!Ed(n))throw Error(re(40));return n._reactRootContainer?(Ss(function(){Td(null,null,n,!1,function(){n._reactRootContainer=null,n[Yi]=null})}),!0):!1};Fn.unstable_batchedUpdates=Rm;Fn.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Ed(t))throw Error(re(200));if(n==null||n._reactInternals===void 0)throw Error(re(38));return Td(n,e,t,!1,i)};Fn.version="18.3.1-next-f1338f8080-20240426";function $_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($_)}catch(n){console.error(n)}}$_(),$v.exports=Fn;var Xb=$v.exports,q_,Hx=Xb;q_=Hx.createRoot,Hx.hydrateRoot;const Yb="modulepreload",$b=function(n){return"/"+n},Gx={},Om=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(l=>{if(l=$b(l),l in Gx)return;Gx[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Yb,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((h,p)=>{d.addEventListener("load",h),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},qb={},Wx=n=>{let e;const t=new Set,i=(u,d)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const p=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(t.add(u),()=>t.delete(u)),destroy:()=>{(qb?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,r,l);return l},Zb=n=>n?Wx(n):Wx;var Z_={exports:{}},K_={},J_={exports:{}},Q_={};/**
40
+ `+s.stack}return{value:n,source:e,stack:r,digest:null}}function kh(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function fp(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var Sb=typeof WeakMap=="function"?WeakMap:Map;function S_(n,e,t){t=Gi(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){Ru||(Ru=!0,wp=i),fp(n,e)},t}function M_(n,e,t){t=Gi(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){fp(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){fp(n,e),typeof i!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function bx(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new Sb;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Ub.bind(null,n,e,t),e.then(n,n))}function Ex(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Tx(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Gi(-1,1),e.tag=2,Er(t,e,1))),t.lanes|=1),n)}var Mb=er.ReactCurrentOwner,_n=!1;function cn(n,e,t,i){e.child=n===null?Ky(e,null,t,i):Ro(e,n.child,t,i)}function Ax(n,e,t,i,r){t=t.render;var s=e.ref;return Mo(e,r),i=Sm(n,e,t,i,s,r),t=Mm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&t&&cm(e),e.flags|=1,cn(n,e,i,r),e.child)}function Cx(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Nm(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,w_(n,e,s,i,r)):(n=ou(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Xa,t(o,i)&&n.ref===e.ref)return qi(n,e,r)}return e.flags|=1,n=Cr(s,i),n.ref=e.ref,n.return=e,e.child=n}function w_(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Xa(s,i)&&n.ref===e.ref)if(_n=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(_n=!0);else return e.lanes=n.lanes,qi(n,e,r)}return pp(n,e,t,i,r)}function b_(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(ho,In),In|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,pt(ho,In),In|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,pt(ho,In),In|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,pt(ho,In),In|=i;return cn(n,e,r,t),e.child}function E_(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function pp(n,e,t,i,r){var s=wn(t)?xs:sn.current;return s=Ao(e,s),Mo(e,r),t=Sm(n,e,t,i,s,r),i=Mm(),n!==null&&!_n?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,qi(n,e,r)):(xt&&i&&cm(e),e.flags|=1,cn(n,e,t,r),e.child)}function Rx(n,e,t,i,r){if(wn(t)){var s=!0;yu(e)}else s=!1;if(Mo(e,r),e.stateNode===null)iu(n,e),__(e,t,i),hp(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=$n(c):(c=wn(t)?xs:sn.current,c=Ao(e,c));var u=t.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&wx(e,o,i,c),pr=!1;var h=e.memoizedState;o.state=h,bu(e,i,o,r),l=e.memoizedState,a!==i||h!==l||Mn.current||pr?(typeof u=="function"&&(dp(e,t,u,i),l=e.memoizedState),(a=pr||Mx(e,t,a,i,h,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Qy(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:ti(e.type,a),o.props=c,d=e.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=$n(l):(l=wn(t)?xs:sn.current,l=Ao(e,l));var p=t.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||h!==l)&&wx(e,o,i,l),pr=!1,h=e.memoizedState,o.state=h,bu(e,i,o,r);var m=e.memoizedState;a!==d||h!==m||Mn.current||pr?(typeof p=="function"&&(dp(e,t,p,i),m=e.memoizedState),(c=pr||Mx(e,t,c,i,h,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=m),o.props=i,o.state=m,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),i=!1)}return mp(n,e,t,i,s,r)}function mp(n,e,t,i,r,s){E_(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&px(e,t,!1),qi(n,e,s);i=e.stateNode,Mb.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Ro(e,n.child,null,s),e.child=Ro(e,null,a,s)):cn(n,e,a,s),e.memoizedState=i.state,r&&px(e,t,!0),e.child}function T_(n){var e=n.stateNode;e.pendingContext?fx(n,e.pendingContext,e.pendingContext!==e.context):e.context&&fx(n,e.context,!1),xm(n,e.containerInfo)}function Px(n,e,t,i,r){return Co(),dm(r),e.flags|=256,cn(n,e,t,i),e.child}var gp={dehydrated:null,treeContext:null,retryLane:0};function xp(n){return{baseLanes:n,cachePool:null,transitions:null}}function A_(n,e,t){var i=e.pendingProps,r=yt.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),pt(yt,r&1),n===null)return cp(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Md(o,i,0,null),n=hs(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=xp(t),e.memoizedState=gp,n):Em(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return wb(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Cr(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Cr(a,s):(s=hs(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?xp(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=gp,i}return s=n.child,n=s.sibling,i=Cr(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Em(n,e){return e=Md({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Ql(n,e,t,i){return i!==null&&dm(i),Ro(e,n.child,null,t),n=Em(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function wb(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=kh(Error(re(422))),Ql(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=Md({mode:"visible",children:i.children},r,0,null),s=hs(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Ro(e,n.child,null,o),e.child.memoizedState=xp(o),e.memoizedState=gp,s);if(!(e.mode&1))return Ql(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(re(419)),i=kh(s,i,void 0),Ql(n,e,o,i)}if(a=(o&n.childLanes)!==0,_n||a){if(i=Wt,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,$i(n,r),oi(i,n,r,-1))}return Im(),i=kh(Error(re(421))),Ql(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=kb.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,Ln=br(r.nextSibling),Dn=e,xt=!0,ii=null,n!==null&&(Gn[Wn++]=zi,Gn[Wn++]=Vi,Gn[Wn++]=vs,zi=n.id,Vi=n.overflow,vs=e),e=Em(e,i.children),e.flags|=4096,e)}function Ix(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),up(n.return,e,t)}function Oh(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function C_(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(cn(n,e,i.children,t),i=yt.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ix(n,t,e);else if(n.tag===19)Ix(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(pt(yt,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Eu(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),Oh(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Eu(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}Oh(e,!0,t,null,s);break;case"together":Oh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function iu(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function qi(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),_s|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(re(153));if(e.child!==null){for(n=e.child,t=Cr(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Cr(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function bb(n,e,t){switch(e.tag){case 3:T_(e),Co();break;case 5:e_(e);break;case 1:wn(e.type)&&yu(e);break;case 4:xm(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;pt(Mu,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(pt(yt,yt.current&1),e.flags|=128,null):t&e.child.childLanes?A_(n,e,t):(pt(yt,yt.current&1),n=qi(n,e,t),n!==null?n.sibling:null);pt(yt,yt.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return C_(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),pt(yt,yt.current),i)break;return null;case 22:case 23:return e.lanes=0,b_(n,e,t)}return qi(n,e,t)}var R_,vp,P_,I_;R_=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};vp=function(){};P_=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,os(Mi.current);var s=null;switch(t){case"input":r=zf(n,r),i=zf(n,i),s=[];break;case"select":r=Mt({},r,{value:void 0}),i=Mt({},i,{value:void 0}),s=[];break;case"textarea":r=Gf(n,r),i=Gf(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=xu)}jf(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Ba.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Ba.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&mt("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};I_=function(n,e,t,i){t!==i&&(e.flags|=4)};function Qo(n,e){if(!xt)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Jt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Eb(n,e,t){var i=e.pendingProps;switch(um(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(e),null;case 1:return wn(e.type)&&vu(),Jt(e),null;case 3:return i=e.stateNode,Po(),gt(Mn),gt(sn),ym(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Kl(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ii!==null&&(Tp(ii),ii=null))),vp(n,e),Jt(e),null;case 5:vm(e);var r=os(Ka.current);if(t=e.type,n!==null&&e.stateNode!=null)P_(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(re(166));return Jt(e),null}if(n=os(Mi.current),Kl(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[xi]=e,i[qa]=s,n=(e.mode&1)!==0,t){case"dialog":mt("cancel",i),mt("close",i);break;case"iframe":case"object":case"embed":mt("load",i);break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],i);break;case"source":mt("error",i);break;case"img":case"image":case"link":mt("error",i),mt("load",i);break;case"details":mt("toggle",i);break;case"input":zg(i,s),mt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},mt("invalid",i);break;case"textarea":Hg(i,s),mt("invalid",i)}jf(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Zl(i.textContent,a,n),r=["children",""+a]):Ba.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&mt("scroll",i)}switch(t){case"input":Hl(i),Vg(i,s,!0);break;case"textarea":Hl(i),Gg(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=xu)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=sy(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[xi]=e,n[qa]=i,R_(n,e,!1,!1),e.stateNode=n;e:{switch(o=Xf(t,i),t){case"dialog":mt("cancel",n),mt("close",n),r=i;break;case"iframe":case"object":case"embed":mt("load",n),r=i;break;case"video":case"audio":for(r=0;r<va.length;r++)mt(va[r],n);r=i;break;case"source":mt("error",n),r=i;break;case"img":case"image":case"link":mt("error",n),mt("load",n),r=i;break;case"details":mt("toggle",n),r=i;break;case"input":zg(n,i),r=zf(n,i),mt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Mt({},i,{value:void 0}),mt("invalid",n);break;case"textarea":Hg(n,i),r=Gf(n,i),mt("invalid",n);break;default:r=i}jf(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?ly(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&oy(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&za(n,l):typeof l=="number"&&za(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ba.hasOwnProperty(s)?l!=null&&s==="onScroll"&&mt("scroll",n):l!=null&&qp(n,s,l,o))}switch(t){case"input":Hl(n),Vg(n,i,!1);break;case"textarea":Hl(n),Gg(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Rr(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?vo(n,!!i.multiple,s,!1):i.defaultValue!=null&&vo(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=xu)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Jt(e),null;case 6:if(n&&e.stateNode!=null)I_(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(re(166));if(t=os(Ka.current),os(Mi.current),Kl(e)){if(i=e.stateNode,t=e.memoizedProps,i[xi]=e,(s=i.nodeValue!==t)&&(n=Dn,n!==null))switch(n.tag){case 3:Zl(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Zl(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[xi]=e,e.stateNode=i}return Jt(e),null;case 13:if(gt(yt),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(xt&&Ln!==null&&e.mode&1&&!(e.flags&128))qy(),Co(),e.flags|=98560,s=!1;else if(s=Kl(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(re(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[xi]=e}else Co(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Jt(e),s=!1}else ii!==null&&(Tp(ii),ii=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||yt.current&1?Ft===0&&(Ft=3):Im())),e.updateQueue!==null&&(e.flags|=4),Jt(e),null);case 4:return Po(),vp(n,e),n===null&&Ya(e.stateNode.containerInfo),Jt(e),null;case 10:return pm(e.type._context),Jt(e),null;case 17:return wn(e.type)&&vu(),Jt(e),null;case 19:if(gt(yt),s=e.memoizedState,s===null)return Jt(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Qo(s,!1);else{if(Ft!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=Eu(n),o!==null){for(e.flags|=128,Qo(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return pt(yt,yt.current&1|2),e.child}n=n.sibling}s.tail!==null&&Pt()>No&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304)}else{if(!i)if(n=Eu(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Qo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xt)return Jt(e),null}else 2*Pt()-s.renderingStartTime>No&&t!==1073741824&&(e.flags|=128,i=!0,Qo(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Pt(),e.sibling=null,t=yt.current,pt(yt,i?t&1|2:t&1),e):(Jt(e),null);case 22:case 23:return Pm(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?In&1073741824&&(Jt(e),e.subtreeFlags&6&&(e.flags|=8192)):Jt(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function Tb(n,e){switch(um(e),e.tag){case 1:return wn(e.type)&&vu(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Po(),gt(Mn),gt(sn),ym(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return vm(e),null;case 13:if(gt(yt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(re(340));Co()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return gt(yt),null;case 4:return Po(),null;case 10:return pm(e.type._context),null;case 22:case 23:return Pm(),null;case 24:return null;default:return null}}var ec=!1,nn=!1,Ab=typeof WeakSet=="function"?WeakSet:Set,Me=null;function uo(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Tt(n,e,i)}else t.current=null}function yp(n,e,t){try{t()}catch(i){Tt(n,e,i)}}var Nx=!1;function Cb(n,e){if(np=pu,n=ky(),lm(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=n,h=null;t:for(;;){for(var p;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)h=d,d=p;for(;;){if(d===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(p=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(ip={focusedElem:n,selectionRange:t},pu=!1,Me=e;Me!==null;)if(e=Me,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Me=n;else for(;Me!==null;){e=Me;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,x=m.memoizedState,f=e.stateNode,v=f.getSnapshotBeforeUpdate(e.elementType===e.type?y:ti(e.type,y),x);f.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(_){Tt(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Me=n;break}Me=e.return}return m=Nx,Nx=!1,m}function Aa(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&yp(e,t,s)}r=r.next}while(r!==i)}}function _d(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function _p(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function N_(n){var e=n.alternate;e!==null&&(n.alternate=null,N_(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[xi],delete e[qa],delete e[op],delete e[ub],delete e[db])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function L_(n){return n.tag===5||n.tag===3||n.tag===4}function Lx(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||L_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Sp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=xu));else if(i!==4&&(n=n.child,n!==null))for(Sp(n,e,t),n=n.sibling;n!==null;)Sp(n,e,t),n=n.sibling}function Mp(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Mp(n,e,t),n=n.sibling;n!==null;)Mp(n,e,t),n=n.sibling}var Yt=null,ni=!1;function ir(n,e,t){for(t=t.child;t!==null;)D_(n,e,t),t=t.sibling}function D_(n,e,t){if(Si&&typeof Si.onCommitFiberUnmount=="function")try{Si.onCommitFiberUnmount(hd,t)}catch{}switch(t.tag){case 5:nn||uo(t,e);case 6:var i=Yt,r=ni;Yt=null,ir(n,e,t),Yt=i,ni=r,Yt!==null&&(ni?(n=Yt,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Yt.removeChild(t.stateNode));break;case 18:Yt!==null&&(ni?(n=Yt,t=t.stateNode,n.nodeType===8?Ph(n.parentNode,t):n.nodeType===1&&Ph(n,t),Wa(n)):Ph(Yt,t.stateNode));break;case 4:i=Yt,r=ni,Yt=t.stateNode.containerInfo,ni=!0,ir(n,e,t),Yt=i,ni=r;break;case 0:case 11:case 14:case 15:if(!nn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&yp(t,e,o),r=r.next}while(r!==i)}ir(n,e,t);break;case 1:if(!nn&&(uo(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Tt(t,e,a)}ir(n,e,t);break;case 21:ir(n,e,t);break;case 22:t.mode&1?(nn=(i=nn)||t.memoizedState!==null,ir(n,e,t),nn=i):ir(n,e,t);break;default:ir(n,e,t)}}function Dx(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Ab),e.forEach(function(i){var r=Ob.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Kn(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Yt=a.stateNode,ni=!1;break e;case 3:Yt=a.stateNode.containerInfo,ni=!0;break e;case 4:Yt=a.stateNode.containerInfo,ni=!0;break e}a=a.return}if(Yt===null)throw Error(re(160));D_(s,o,r),Yt=null,ni=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){Tt(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)U_(e,n),e=e.sibling}function U_(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Kn(e,n),fi(n),i&4){try{Aa(3,n,n.return),_d(3,n)}catch(y){Tt(n,n.return,y)}try{Aa(5,n,n.return)}catch(y){Tt(n,n.return,y)}}break;case 1:Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return);break;case 5:if(Kn(e,n),fi(n),i&512&&t!==null&&uo(t,t.return),n.flags&32){var r=n.stateNode;try{za(r,"")}catch(y){Tt(n,n.return,y)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&iy(r,s),Xf(a,o);var c=Xf(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?ly(r,d):u==="dangerouslySetInnerHTML"?oy(r,d):u==="children"?za(r,d):qp(r,u,d,c)}switch(a){case"input":Vf(r,s);break;case"textarea":ry(r,s);break;case"select":var h=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vo(r,!!s.multiple,p,!1):h!==!!s.multiple&&(s.defaultValue!=null?vo(r,!!s.multiple,s.defaultValue,!0):vo(r,!!s.multiple,s.multiple?[]:"",!1))}r[qa]=s}catch(y){Tt(n,n.return,y)}}break;case 6:if(Kn(e,n),fi(n),i&4){if(n.stateNode===null)throw Error(re(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(y){Tt(n,n.return,y)}}break;case 3:if(Kn(e,n),fi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Wa(e.containerInfo)}catch(y){Tt(n,n.return,y)}break;case 4:Kn(e,n),fi(n);break;case 13:Kn(e,n),fi(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Cm=Pt())),i&4&&Dx(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?(nn=(c=nn)||u,Kn(e,n),nn=c):Kn(e,n),fi(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(Me=n,u=n.child;u!==null;){for(d=Me=u;Me!==null;){switch(h=Me,p=h.child,h.tag){case 0:case 11:case 14:case 15:Aa(4,h,h.return);break;case 1:uo(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){i=h,t=h.return;try{e=i,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(y){Tt(i,t,y)}}break;case 5:uo(h,h.return);break;case 22:if(h.memoizedState!==null){kx(d);continue}}p!==null?(p.return=h,Me=p):kx(d)}u=u.sibling}e:for(u=null,d=n;;){if(d.tag===5){if(u===null){u=d;try{r=d.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=ay("display",o))}catch(y){Tt(n,n.return,y)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(y){Tt(n,n.return,y)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===n)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===n)break e;for(;d.sibling===null;){if(d.return===null||d.return===n)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Kn(e,n),fi(n),i&4&&Dx(n);break;case 21:break;default:Kn(e,n),fi(n)}}function fi(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(L_(t)){var i=t;break e}t=t.return}throw Error(re(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(za(r,""),i.flags&=-33);var s=Lx(n);Mp(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=Lx(n);Sp(n,a,o);break;default:throw Error(re(161))}}catch(l){Tt(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Rb(n,e,t){Me=n,k_(n)}function k_(n,e,t){for(var i=(n.mode&1)!==0;Me!==null;){var r=Me,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||ec;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||nn;a=ec;var c=nn;if(ec=o,(nn=l)&&!c)for(Me=r;Me!==null;)o=Me,l=o.child,o.tag===22&&o.memoizedState!==null?Ox(r):l!==null?(l.return=o,Me=l):Ox(r);for(;s!==null;)Me=s,k_(s),s=s.sibling;Me=r,ec=a,nn=c}Ux(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,Me=s):Ux(n)}}function Ux(n){for(;Me!==null;){var e=Me;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nn||_d(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!nn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:ti(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&yx(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}yx(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Wa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}nn||e.flags&512&&_p(e)}catch(h){Tt(e,e.return,h)}}if(e===n){Me=null;break}if(t=e.sibling,t!==null){t.return=e.return,Me=t;break}Me=e.return}}function kx(n){for(;Me!==null;){var e=Me;if(e===n){Me=null;break}var t=e.sibling;if(t!==null){t.return=e.return,Me=t;break}Me=e.return}}function Ox(n){for(;Me!==null;){var e=Me;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{_d(4,e)}catch(l){Tt(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){Tt(e,r,l)}}var s=e.return;try{_p(e)}catch(l){Tt(e,s,l)}break;case 5:var o=e.return;try{_p(e)}catch(l){Tt(e,o,l)}}}catch(l){Tt(e,e.return,l)}if(e===n){Me=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Me=a;break}Me=e.return}}var Pb=Math.ceil,Cu=er.ReactCurrentDispatcher,Tm=er.ReactCurrentOwner,Yn=er.ReactCurrentBatchConfig,tt=0,Wt=null,Dt=null,qt=0,In=0,ho=Dr(0),Ft=0,tl=null,_s=0,Sd=0,Am=0,Ca=null,yn=null,Cm=0,No=1/0,ki=null,Ru=!1,wp=null,Tr=null,tc=!1,_r=null,Pu=0,Ra=0,bp=null,ru=-1,su=0;function hn(){return tt&6?Pt():ru!==-1?ru:ru=Pt()}function Ar(n){return n.mode&1?tt&2&&qt!==0?qt&-qt:fb.transition!==null?(su===0&&(su=_y()),su):(n=dt,n!==0||(n=window.event,n=n===void 0?16:Ay(n.type)),n):1}function oi(n,e,t,i){if(50<Ra)throw Ra=0,bp=null,Error(re(185));bl(n,t,i),(!(tt&2)||n!==Wt)&&(n===Wt&&(!(tt&2)&&(Sd|=t),Ft===4&&xr(n,qt)),bn(n,i),t===1&&tt===0&&!(e.mode&1)&&(No=Pt()+500,xd&&Ur()))}function bn(n,e){var t=n.callbackNode;f1(n,e);var i=fu(n,n===Wt?qt:0);if(i===0)t!==null&&Xg(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&Xg(t),e===1)n.tag===0?hb(Fx.bind(null,n)):Xy(Fx.bind(null,n)),lb(function(){!(tt&6)&&Ur()}),t=null;else{switch(Sy(i)){case 1:t=em;break;case 4:t=vy;break;case 16:t=hu;break;case 536870912:t=yy;break;default:t=hu}t=W_(t,O_.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function O_(n,e){if(ru=-1,su=0,tt&6)throw Error(re(327));var t=n.callbackNode;if(wo()&&n.callbackNode!==t)return null;var i=fu(n,n===Wt?qt:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=Iu(n,i);else{e=i;var r=tt;tt|=2;var s=B_();(Wt!==n||qt!==e)&&(ki=null,No=Pt()+500,ds(n,e));do try{Lb();break}catch(a){F_(n,a)}while(!0);fm(),Cu.current=s,tt=r,Dt!==null?e=0:(Wt=null,qt=0,e=Ft)}if(e!==0){if(e===2&&(r=Kf(n),r!==0&&(i=r,e=Ep(n,r))),e===1)throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;if(e===6)xr(n,i);else{if(r=n.current.alternate,!(i&30)&&!Ib(r)&&(e=Iu(n,i),e===2&&(s=Kf(n),s!==0&&(i=s,e=Ep(n,s))),e===1))throw t=tl,ds(n,0),xr(n,i),bn(n,Pt()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(re(345));case 2:es(n,yn,ki);break;case 3:if(xr(n,i),(i&130023424)===i&&(e=Cm+500-Pt(),10<e)){if(fu(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){hn(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=sp(es.bind(null,n,yn,ki),e);break}es(n,yn,ki);break;case 4:if(xr(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-si(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=Pt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Pb(i/1960))-i,10<i){n.timeoutHandle=sp(es.bind(null,n,yn,ki),i);break}es(n,yn,ki);break;case 5:es(n,yn,ki);break;default:throw Error(re(329))}}}return bn(n,Pt()),n.callbackNode===t?O_.bind(null,n):null}function Ep(n,e){var t=Ca;return n.current.memoizedState.isDehydrated&&(ds(n,e).flags|=256),n=Iu(n,e),n!==2&&(e=yn,yn=t,e!==null&&Tp(e)),n}function Tp(n){yn===null?yn=n:yn.push.apply(yn,n)}function Ib(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!ai(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function xr(n,e){for(e&=~Am,e&=~Sd,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-si(e),i=1<<t;n[t]=-1,e&=~i}}function Fx(n){if(tt&6)throw Error(re(327));wo();var e=fu(n,0);if(!(e&1))return bn(n,Pt()),null;var t=Iu(n,e);if(n.tag!==0&&t===2){var i=Kf(n);i!==0&&(e=i,t=Ep(n,i))}if(t===1)throw t=tl,ds(n,0),xr(n,e),bn(n,Pt()),t;if(t===6)throw Error(re(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,es(n,yn,ki),bn(n,Pt()),null}function Rm(n,e){var t=tt;tt|=1;try{return n(e)}finally{tt=t,tt===0&&(No=Pt()+500,xd&&Ur())}}function Ss(n){_r!==null&&_r.tag===0&&!(tt&6)&&wo();var e=tt;tt|=1;var t=Yn.transition,i=dt;try{if(Yn.transition=null,dt=1,n)return n()}finally{dt=i,Yn.transition=t,tt=e,!(tt&6)&&Ur()}}function Pm(){In=ho.current,gt(ho)}function ds(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,ab(t)),Dt!==null)for(t=Dt.return;t!==null;){var i=t;switch(um(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&vu();break;case 3:Po(),gt(Mn),gt(sn),ym();break;case 5:vm(i);break;case 4:Po();break;case 13:gt(yt);break;case 19:gt(yt);break;case 10:pm(i.type._context);break;case 22:case 23:Pm()}t=t.return}if(Wt=n,Dt=n=Cr(n.current,null),qt=In=e,Ft=0,tl=null,Am=Sd=_s=0,yn=Ca=null,ss!==null){for(e=0;e<ss.length;e++)if(t=ss[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}ss=null}return n}function F_(n,e){do{var t=Dt;try{if(fm(),tu.current=Au,Tu){for(var i=St.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Tu=!1}if(ys=0,Ht=Ot=St=null,Ta=!1,Ja=0,Tm.current=null,t===null||t.return===null){Ft=1,tl=e,Dt=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=qt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Ex(o);if(p!==null){p.flags&=-257,Tx(p,o,a,s,e),p.mode&1&&bx(s,c,e),e=p,l=c;var m=e.updateQueue;if(m===null){var y=new Set;y.add(l),e.updateQueue=y}else m.add(l);break e}else{if(!(e&1)){bx(s,c,e),Im();break e}l=Error(re(426))}}else if(xt&&a.mode&1){var x=Ex(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Tx(x,o,a,s,e),dm(Io(l,a));break e}}s=l=Io(l,a),Ft!==4&&(Ft=2),Ca===null?Ca=[s]:Ca.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var f=S_(s,l,e);vx(s,f);break e;case 1:a=l;var v=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Tr===null||!Tr.has(g)))){s.flags|=65536,e&=-e,s.lanes|=e;var _=M_(s,a,e);vx(s,_);break e}}s=s.return}while(s!==null)}V_(t)}catch(R){e=R,Dt===t&&t!==null&&(Dt=t=t.return);continue}break}while(!0)}function B_(){var n=Cu.current;return Cu.current=Au,n===null?Au:n}function Im(){(Ft===0||Ft===3||Ft===2)&&(Ft=4),Wt===null||!(_s&268435455)&&!(Sd&268435455)||xr(Wt,qt)}function Iu(n,e){var t=tt;tt|=2;var i=B_();(Wt!==n||qt!==e)&&(ki=null,ds(n,e));do try{Nb();break}catch(r){F_(n,r)}while(!0);if(fm(),tt=t,Cu.current=i,Dt!==null)throw Error(re(261));return Wt=null,qt=0,Ft}function Nb(){for(;Dt!==null;)z_(Dt)}function Lb(){for(;Dt!==null&&!r1();)z_(Dt)}function z_(n){var e=G_(n.alternate,n,In);n.memoizedProps=n.pendingProps,e===null?V_(n):Dt=e,Tm.current=null}function V_(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Tb(t,e),t!==null){t.flags&=32767,Dt=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Ft=6,Dt=null;return}}else if(t=Eb(t,e,In),t!==null){Dt=t;return}if(e=e.sibling,e!==null){Dt=e;return}Dt=e=n}while(e!==null);Ft===0&&(Ft=5)}function es(n,e,t){var i=dt,r=Yn.transition;try{Yn.transition=null,dt=1,Db(n,e,t,i)}finally{Yn.transition=r,dt=i}return null}function Db(n,e,t,i){do wo();while(_r!==null);if(tt&6)throw Error(re(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(re(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(p1(n,s),n===Wt&&(Dt=Wt=null,qt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||tc||(tc=!0,W_(hu,function(){return wo(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=Yn.transition,Yn.transition=null;var o=dt;dt=1;var a=tt;tt|=4,Tm.current=null,Cb(n,t),U_(t,n),eb(ip),pu=!!np,ip=np=null,n.current=t,Rb(t),s1(),tt=a,dt=o,Yn.transition=s}else n.current=t;if(tc&&(tc=!1,_r=n,Pu=r),s=n.pendingLanes,s===0&&(Tr=null),l1(t.stateNode),bn(n,Pt()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(Ru)throw Ru=!1,n=wp,wp=null,n;return Pu&1&&n.tag!==0&&wo(),s=n.pendingLanes,s&1?n===bp?Ra++:(Ra=0,bp=n):Ra=0,Ur(),null}function wo(){if(_r!==null){var n=Sy(Pu),e=Yn.transition,t=dt;try{if(Yn.transition=null,dt=16>n?16:n,_r===null)var i=!1;else{if(n=_r,_r=null,Pu=0,tt&6)throw Error(re(331));var r=tt;for(tt|=4,Me=n.current;Me!==null;){var s=Me,o=s.child;if(Me.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(Me=c;Me!==null;){var u=Me;switch(u.tag){case 0:case 11:case 15:Aa(8,u,s)}var d=u.child;if(d!==null)d.return=u,Me=d;else for(;Me!==null;){u=Me;var h=u.sibling,p=u.return;if(N_(u),u===c){Me=null;break}if(h!==null){h.return=p,Me=h;break}Me=p}}}var m=s.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var x=y.sibling;y.sibling=null,y=x}while(y!==null)}}Me=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Me=o;else e:for(;Me!==null;){if(s=Me,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Aa(9,s,s.return)}var f=s.sibling;if(f!==null){f.return=s.return,Me=f;break e}Me=s.return}}var v=n.current;for(Me=v;Me!==null;){o=Me;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,Me=g;else e:for(o=v;Me!==null;){if(a=Me,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_d(9,a)}}catch(R){Tt(a,a.return,R)}if(a===o){Me=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,Me=_;break e}Me=a.return}}if(tt=r,Ur(),Si&&typeof Si.onPostCommitFiberRoot=="function")try{Si.onPostCommitFiberRoot(hd,n)}catch{}i=!0}return i}finally{dt=t,Yn.transition=e}}return!1}function Bx(n,e,t){e=Io(t,e),e=S_(n,e,1),n=Er(n,e,1),e=hn(),n!==null&&(bl(n,1,e),bn(n,e))}function Tt(n,e,t){if(n.tag===3)Bx(n,n,t);else for(;e!==null;){if(e.tag===3){Bx(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Tr===null||!Tr.has(i))){n=Io(t,n),n=M_(e,n,1),e=Er(e,n,1),n=hn(),e!==null&&(bl(e,1,n),bn(e,n));break}}e=e.return}}function Ub(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=hn(),n.pingedLanes|=n.suspendedLanes&t,Wt===n&&(qt&t)===t&&(Ft===4||Ft===3&&(qt&130023424)===qt&&500>Pt()-Cm?ds(n,0):Am|=t),bn(n,e)}function H_(n,e){e===0&&(n.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var t=hn();n=$i(n,e),n!==null&&(bl(n,e,t),bn(n,t))}function kb(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),H_(n,t)}function Ob(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(re(314))}i!==null&&i.delete(e),H_(n,t)}var G_;G_=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Mn.current)_n=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _n=!1,bb(n,e,t);_n=!!(n.flags&131072)}else _n=!1,xt&&e.flags&1048576&&Yy(e,Su,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;iu(n,e),n=e.pendingProps;var r=Ao(e,sn.current);Mo(e,t),r=Sm(null,e,i,n,r,t);var s=Mm();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wn(i)?(s=!0,yu(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,gm(e),r.updater=yd,e.stateNode=r,r._reactInternals=e,hp(e,i,n,t),e=mp(null,e,i,!0,s,t)):(e.tag=0,xt&&s&&cm(e),cn(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(iu(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Bb(i),n=ti(i,n),r){case 0:e=pp(null,e,i,n,t);break e;case 1:e=Rx(null,e,i,n,t);break e;case 11:e=Ax(null,e,i,n,t);break e;case 14:e=Cx(null,e,i,ti(i.type,n),t);break e}throw Error(re(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),pp(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Rx(n,e,i,r,t);case 3:e:{if(T_(e),n===null)throw Error(re(387));i=e.pendingProps,s=e.memoizedState,r=s.element,Qy(n,e),bu(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Io(Error(re(423)),e),e=Px(n,e,i,t,r);break e}else if(i!==r){r=Io(Error(re(424)),e),e=Px(n,e,i,t,r);break e}else for(Ln=br(e.stateNode.containerInfo.firstChild),Dn=e,xt=!0,ii=null,t=Ky(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Co(),i===r){e=qi(n,e,t);break e}cn(n,e,i,t)}e=e.child}return e;case 5:return e_(e),n===null&&cp(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,rp(i,r)?o=null:s!==null&&rp(i,s)&&(e.flags|=32),E_(n,e),cn(n,e,o,t),e.child;case 6:return n===null&&cp(e),null;case 13:return A_(n,e,t);case 4:return xm(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Ro(e,null,i,t):cn(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),Ax(n,e,i,r,t);case 7:return cn(n,e,e.pendingProps,t),e.child;case 8:return cn(n,e,e.pendingProps.children,t),e.child;case 12:return cn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,pt(Mu,i._currentValue),i._currentValue=o,s!==null)if(ai(s.value,o)){if(s.children===r.children&&!Mn.current){e=qi(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Gi(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),up(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),up(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}cn(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Mo(e,t),r=$n(r),i=i(r),e.flags|=1,cn(n,e,i,t),e.child;case 14:return i=e.type,r=ti(i,e.pendingProps),r=ti(i.type,r),Cx(n,e,i,r,t);case 15:return w_(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ti(i,r),iu(n,e),e.tag=1,wn(i)?(n=!0,yu(e)):n=!1,Mo(e,t),__(e,i,r),hp(e,i,r,t),mp(null,e,i,!0,n,t);case 19:return C_(n,e,t);case 22:return b_(n,e,t)}throw Error(re(156,e.tag))};function W_(n,e){return xy(n,e)}function Fb(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(n,e,t,i){return new Fb(n,e,t,i)}function Nm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Bb(n){if(typeof n=="function")return Nm(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Kp)return 11;if(n===Jp)return 14}return 2}function Cr(n,e){var t=n.alternate;return t===null?(t=jn(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function ou(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Nm(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case to:return hs(t.children,r,s,e);case Zp:o=8,r|=8;break;case kf:return n=jn(12,t,e,r|2),n.elementType=kf,n.lanes=s,n;case Of:return n=jn(13,t,e,r),n.elementType=Of,n.lanes=s,n;case Ff:return n=jn(19,t,e,r),n.elementType=Ff,n.lanes=s,n;case ey:return Md(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Jv:o=10;break e;case Qv:o=9;break e;case Kp:o=11;break e;case Jp:o=14;break e;case fr:o=16,i=null;break e}throw Error(re(130,n==null?n:typeof n,""))}return e=jn(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function hs(n,e,t,i){return n=jn(7,n,i,e),n.lanes=t,n}function Md(n,e,t,i){return n=jn(22,n,i,e),n.elementType=ey,n.lanes=t,n.stateNode={isHidden:!1},n}function Fh(n,e,t){return n=jn(6,n,null,e),n.lanes=t,n}function Bh(n,e,t){return e=jn(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function zb(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yh(0),this.expirationTimes=yh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yh(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Lm(n,e,t,i,r,s,o,a,l){return n=new zb(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jn(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},gm(s),n}function Vb(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:eo,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function j_(n){if(!n)return Pr;n=n._reactInternals;e:{if(As(n)!==n||n.tag!==1)throw Error(re(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(re(171))}if(n.tag===1){var t=n.type;if(wn(t))return jy(n,t,e)}return e}function X_(n,e,t,i,r,s,o,a,l){return n=Lm(t,i,!0,n,r,s,o,a,l),n.context=j_(null),t=n.current,i=hn(),r=Ar(t),s=Gi(i,r),s.callback=e??null,Er(t,s,r),n.current.lanes=r,bl(n,r,i),bn(n,i),n}function wd(n,e,t,i){var r=e.current,s=hn(),o=Ar(r);return t=j_(t),e.context===null?e.context=t:e.pendingContext=t,e=Gi(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Er(r,e,o),n!==null&&(oi(n,r,o,s),eu(n,r,o)),o}function Nu(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function zx(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Dm(n,e){zx(n,e),(n=n.alternate)&&zx(n,e)}function Hb(){return null}var Y_=typeof reportError=="function"?reportError:function(n){console.error(n)};function Um(n){this._internalRoot=n}bd.prototype.render=Um.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(re(409));wd(n,e,null,null)};bd.prototype.unmount=Um.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Ss(function(){wd(null,n,null,null)}),e[Yi]=null}};function bd(n){this._internalRoot=n}bd.prototype.unstable_scheduleHydration=function(n){if(n){var e=by();n={blockedOn:null,target:n,priority:e};for(var t=0;t<gr.length&&e!==0&&e<gr[t].priority;t++);gr.splice(t,0,n),t===0&&Ty(n)}};function km(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Ed(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Vx(){}function Gb(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=Nu(o);s.call(c)}}var o=X_(e,i,n,0,null,!1,!1,"",Vx);return n._reactRootContainer=o,n[Yi]=o.current,Ya(n.nodeType===8?n.parentNode:n),Ss(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=Nu(l);a.call(c)}}var l=Lm(n,0,!1,null,null,!1,!1,"",Vx);return n._reactRootContainer=l,n[Yi]=l.current,Ya(n.nodeType===8?n.parentNode:n),Ss(function(){wd(e,l,t,i)}),l}function Td(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=Nu(o);a.call(l)}}wd(e,o,n,r)}else o=Gb(t,e,n,r,i);return Nu(o)}My=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=xa(e.pendingLanes);t!==0&&(tm(e,t|1),bn(e,Pt()),!(tt&6)&&(No=Pt()+500,Ur()))}break;case 13:Ss(function(){var i=$i(n,1);if(i!==null){var r=hn();oi(i,n,1,r)}}),Dm(n,1)}};nm=function(n){if(n.tag===13){var e=$i(n,134217728);if(e!==null){var t=hn();oi(e,n,134217728,t)}Dm(n,134217728)}};wy=function(n){if(n.tag===13){var e=Ar(n),t=$i(n,e);if(t!==null){var i=hn();oi(t,n,e,i)}Dm(n,e)}};by=function(){return dt};Ey=function(n,e){var t=dt;try{return dt=n,e()}finally{dt=t}};$f=function(n,e,t){switch(e){case"input":if(Vf(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=gd(i);if(!r)throw Error(re(90));ny(i),Vf(i,r)}}}break;case"textarea":ry(n,t);break;case"select":e=t.value,e!=null&&vo(n,!!t.multiple,e,!1)}};dy=Rm;hy=Ss;var Wb={usingClientEntryPoint:!1,Events:[Tl,so,gd,cy,uy,Rm]},ea={findFiberByHostInstance:rs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jb={bundleType:ea.bundleType,version:ea.version,rendererPackageName:ea.rendererPackageName,rendererConfig:ea.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:er.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=my(n),n===null?null:n.stateNode},findFiberByHostInstance:ea.findFiberByHostInstance||Hb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{hd=nc.inject(jb),Si=nc}catch{}}Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wb;Fn.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!km(e))throw Error(re(200));return Vb(n,e,null,t)};Fn.createRoot=function(n,e){if(!km(n))throw Error(re(299));var t=!1,i="",r=Y_;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=Lm(n,1,!1,null,null,t,!1,i,r),n[Yi]=e.current,Ya(n.nodeType===8?n.parentNode:n),new Um(e)};Fn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(re(188)):(n=Object.keys(n).join(","),Error(re(268,n)));return n=my(e),n=n===null?null:n.stateNode,n};Fn.flushSync=function(n){return Ss(n)};Fn.hydrate=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!0,t)};Fn.hydrateRoot=function(n,e,t){if(!km(n))throw Error(re(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=Y_;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=X_(e,null,n,1,t??null,r,!1,s,o),n[Yi]=e.current,Ya(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new bd(e)};Fn.render=function(n,e,t){if(!Ed(e))throw Error(re(200));return Td(null,n,e,!1,t)};Fn.unmountComponentAtNode=function(n){if(!Ed(n))throw Error(re(40));return n._reactRootContainer?(Ss(function(){Td(null,null,n,!1,function(){n._reactRootContainer=null,n[Yi]=null})}),!0):!1};Fn.unstable_batchedUpdates=Rm;Fn.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!Ed(t))throw Error(re(200));if(n==null||n._reactInternals===void 0)throw Error(re(38));return Td(n,e,t,!1,i)};Fn.version="18.3.1-next-f1338f8080-20240426";function $_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($_)}catch(n){console.error(n)}}$_(),$v.exports=Fn;var Xb=$v.exports,q_,Hx=Xb;q_=Hx.createRoot,Hx.hydrateRoot;const Yb="modulepreload",$b=function(n){return"/"+n},Gx={},Om=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(l=>{if(l=$b(l),l in Gx)return;Gx[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Yb,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((h,p)=>{d.addEventListener("load",h),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},qb={},Wx=n=>{let e;const t=new Set,i=(u,d)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const p=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(t.add(u),()=>t.delete(u)),destroy:()=>{(qb?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,r,l);return l},Zb=n=>n?Wx(n):Wx;var Z_={exports:{}},K_={},J_={exports:{}},Q_={};/**
41
41
  * @license React
42
42
  * use-sync-external-store-shim.production.js
43
43
  *
@@ -45,7 +45,7 @@ Error generating stack: `+s.message+`
45
45
  *
46
46
  * This source code is licensed under the MIT license found in the
47
47
  * LICENSE file in the root directory of this source tree.
48
- */var Lo=Ie;function Kb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Jb=typeof Object.is=="function"?Object.is:Kb,Qb=Lo.useState,eE=Lo.useEffect,tE=Lo.useLayoutEffect,nE=Lo.useDebugValue;function iE(n,e){var t=e(),i=Qb({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return tE(function(){r.value=t,r.getSnapshot=e,zh(r)&&s({inst:r})},[n,t,e]),eE(function(){return zh(r)&&s({inst:r}),n(function(){zh(r)&&s({inst:r})})},[n]),nE(t),t}function zh(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Jb(n,t)}catch{return!0}}function rE(n,e){return e()}var sE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rE:iE;Q_.useSyncExternalStore=Lo.useSyncExternalStore!==void 0?Lo.useSyncExternalStore:sE;J_.exports=Q_;var oE=J_.exports;/**
48
+ */var Lo=Pe;function Kb(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Jb=typeof Object.is=="function"?Object.is:Kb,Qb=Lo.useState,eE=Lo.useEffect,tE=Lo.useLayoutEffect,nE=Lo.useDebugValue;function iE(n,e){var t=e(),i=Qb({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return tE(function(){r.value=t,r.getSnapshot=e,zh(r)&&s({inst:r})},[n,t,e]),eE(function(){return zh(r)&&s({inst:r}),n(function(){zh(r)&&s({inst:r})})},[n]),nE(t),t}function zh(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Jb(n,t)}catch{return!0}}function rE(n,e){return e()}var sE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rE:iE;Q_.useSyncExternalStore=Lo.useSyncExternalStore!==void 0?Lo.useSyncExternalStore:sE;J_.exports=Q_;var oE=J_.exports;/**
49
49
  * @license React
50
50
  * use-sync-external-store-shim/with-selector.production.js
51
51
  *
@@ -53,13 +53,13 @@ Error generating stack: `+s.message+`
53
53
  *
54
54
  * This source code is licensed under the MIT license found in the
55
55
  * LICENSE file in the root directory of this source tree.
56
- */var Ad=Ie,aE=oE;function lE(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var cE=typeof Object.is=="function"?Object.is:lE,uE=aE.useSyncExternalStore,dE=Ad.useRef,hE=Ad.useEffect,fE=Ad.useMemo,pE=Ad.useDebugValue;K_.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=dE(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=fE(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&o.hasValue){var m=o.value;if(r(m,p))return d=m}return d=p}if(m=d,cE(u,p))return m;var y=i(p);return r!==void 0&&r(m,y)?(u=p,m):(u=p,d=y)}var c=!1,u,d,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,r]);var a=uE(n,s[0],s[1]);return hE(function(){o.hasValue=!0,o.value=a},[a]),pE(a),a};Z_.exports=K_;var mE=Z_.exports;const gE=kv(mE),eS={},{useDebugValue:xE}=Uw,{useSyncExternalStoreWithSelector:vE}=gE;let jx=!1;const yE=n=>n;function _E(n,e=yE,t){(eS?"production":void 0)!=="production"&&t&&!jx&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),jx=!0);const i=vE(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return xE(i),i}const Xx=n=>{(eS?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?Zb(n):n,t=(i,r)=>_E(e,i,r);return Object.assign(t,e),t},SE=n=>n?Xx(n):Xx,ME="solix.notifications.v1";function wE(){try{return localStorage.getItem(ME)==="off"?"off":"on"}catch{return"on"}}let Yx=!1;async function bE(){if(typeof Notification>"u")return"denied";if(Notification.permission!=="default"||Yx)return Notification.permission;Yx=!0;try{return await Notification.requestPermission()}catch{return"denied"}}async function EE(n){if(!(wE()==="off"||typeof Notification>"u"||typeof document<"u"&&!document.hidden||await bE()!=="granted"))try{new Notification(n.title,{body:n.body,tag:n.tag})}catch{}}const TE="solix.sound.v1";let Vh=null;function AE(){try{if(localStorage.getItem(TE)!=="on"||typeof window>"u")return;if(!Vh){const r=window.AudioContext||window.webkitAudioContext;if(!r)return;Vh=new r}const n=Vh,e=n.createOscillator(),t=n.createGain();e.connect(t),t.connect(n.destination),e.type="sine",e.frequency.value=880,t.gain.value=1e-4;const i=n.currentTime;t.gain.exponentialRampToValueAtTime(.06,i+.01),t.gain.exponentialRampToValueAtTime(1e-4,i+.35),e.start(i),e.stop(i+.4)}catch{}}function $x(n,e,t,i){const r={},s={},a=[];for(const l of n){if(l.ts>e)break;switch(l.type){case"session_started":{const c=t[l.sessionId];if(!c)continue;r[l.sessionId]={...c,status:"idle"};break}case"session_terminated":{delete r[l.sessionId];break}case"mission_started":{if(!l.missionId)continue;const c=i[l.missionId],u=r[l.sessionId];u&&(r[l.sessionId]={...u,status:"active",currentMissionId:l.missionId}),c&&(s[l.missionId]={...c,status:"active"});break}case"mission_completed":{if(!l.missionId)continue;const c=r[l.sessionId],u=i[l.missionId];c&&c.currentMissionId===l.missionId&&(r[l.sessionId]={...c,status:"idle",currentMissionId:void 0,lastCompletedMissionId:l.missionId}),u&&(s[l.missionId]={...u,status:"completed"});break}case"tool_call":{e-l.ts<=2e3&&a.push({id:`tc-${l.ts}-${l.sessionId}`,sessionId:l.sessionId,tool:l.toolName??"tool",args:{},startedAt:l.ts,status:"ok",receivedAt:l.ts});break}}}return{derivedSessions:r,derivedMissions:s,derivedToolCalls:a}}const qx={active:!1,loading:!1,events:[],earliestMs:0,latestMs:0,currentMs:0,playing:!1,speed:4,derivedSessions:{},derivedMissions:{},derivedToolCalls:[]},Zx=2e3,tS="solix.motion.v1",nS="solix.viewMode.v1";function CE(){try{return localStorage.getItem(tS)==="1"}catch{return!1}}function Kx(n){try{localStorage.setItem(tS,n?"1":"0")}catch{}}function RE(){try{const n=localStorage.getItem(nS);return n==="list"||n==="missions"||n==="galaxy"?n:"galaxy"}catch{return"galaxy"}}function Jx(n){try{localStorage.setItem(nS,n)}catch{}}const Ee=SE((n,e)=>({connected:!1,projects:{},sessions:{},missions:{},advisors:{},skills:{},chatBySessionId:{},recentToolCalls:[],pendingPermissions:{},selectedSessionId:null,selectedAdvisorId:null,selectedSkillId:null,motionEnabled:CE(),viewMode:RE(),playback:qx,toasts:[],setConnected:t=>n({connected:t}),applyMessage:t=>{switch(t.type){case"snapshot":{const i={};for(const l of t.projects)i[l.id]=l;const r={};for(const l of t.sessions)r[l.id]=l;const s={};for(const l of t.missions)s[l.id]=l;const o={};for(const l of t.advisors)o[l.id]=l;const a={};for(const l of t.skills)a[l.id]=l;n({projects:i,sessions:r,missions:s,advisors:o,skills:a});break}case"advisor_upsert":{n(i=>({advisors:{...i.advisors,[t.advisor.id]:t.advisor}}));break}case"skill_upsert":{n(i=>({skills:{...i.skills,[t.skill.id]:t.skill}}));break}case"galaxy_imported":{const i=`${Date.now()}-galaxy`;n(r=>({toasts:[...r.toasts,{id:i,level:"info",message:`Imported galaxy: ${t.manifest.name}`}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}case"session_upsert":{n(i=>({sessions:{...i.sessions,[t.session.id]:t.session}}));break}case"session_remove":{n(i=>{const r={...i.sessions};return delete r[t.sessionId],{sessions:r}});break}case"mission_upsert":{n(i=>({missions:{...i.missions,[t.mission.id]:t.mission}}));break}case"tool_call":{const i={...t.toolCall,receivedAt:Date.now()};n(r=>({recentToolCalls:[...r.recentToolCalls,i].slice(-200)})),setTimeout(()=>{n(r=>({recentToolCalls:r.recentToolCalls.filter(s=>Date.now()-s.receivedAt<Zx)}))},Zx+50);break}case"permission_request":{const i={requestId:t.requestId,sessionId:t.sessionId,tool:t.tool,args:t.args,receivedAt:Date.now()};n(a=>({pendingPermissions:{...a.pendingPermissions,[t.requestId]:i}}));const r=e().sessions[t.sessionId],s=(r==null?void 0:r.name)??t.sessionId.slice(0,8),o=(()=>{const a=Object.keys(t.args)[0];if(!a)return"";const l=t.args[a],c=typeof l=="string"?l:JSON.stringify(l);return`: ${c.length>60?c.slice(0,60)+"…":c}`})();EE({title:`${s} needs you`,body:`${t.tool}${o}`,tag:`solix-perm-${t.sessionId}`,whenHidden:!0}),AE();break}case"context_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,contextUsagePct:t.usagePct}}}:i});break}case"chat_delta":{const i={...t.delta,receivedAt:Date.now()};n(r=>{const a=[...(r.chatBySessionId[t.sessionId]??[]).filter(l=>l.messageId!==i.messageId),i].slice(-200);return{chatBySessionId:{...r.chatBySessionId,[t.sessionId]:a}}});break}case"toast":{const i=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(r=>({toasts:[...r.toasts,{id:i,level:t.level,message:t.message}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}}},selectSession:t=>n({selectedSessionId:t,selectedAdvisorId:t?null:e().selectedAdvisorId,selectedSkillId:t?null:e().selectedSkillId}),selectAdvisor:t=>n({selectedAdvisorId:t,selectedSessionId:t?null:e().selectedSessionId,selectedSkillId:t?null:e().selectedSkillId}),selectSkill:t=>n({selectedSkillId:t,selectedSessionId:t?null:e().selectedSessionId,selectedAdvisorId:t?null:e().selectedAdvisorId}),dismissToast:t=>n(i=>({toasts:i.toasts.filter(r=>r.id!==t)})),resolvePermission:(t,i)=>{const r=e().send;r({type:"permission_response",requestId:t,approved:i}),n(s=>{const o={...s.pendingPermissions};return delete o[t],{pendingPermissions:o}})},invokeAdvisor:(t,i)=>{const r=e().send,s=e().selectedSessionId??void 0;r({type:"invoke_advisor",advisorId:t,targetSessionId:s,prompt:i})},pinAdvisor:t=>{e().send({type:"pin_advisor",advisorId:t})},unpinAdvisor:t=>{e().send({type:"unpin_advisor",advisorId:t})},sendPromptTo:(t,i)=>{if(!i.trim())return;e().send({type:"send_prompt",sessionId:t,text:i});const r={messageId:`pending-${Date.now()}`,role:"user",content:i,ts:Date.now(),done:!0,receivedAt:Date.now()};n(s=>({chatBySessionId:{...s.chatBySessionId,[t]:[...s.chatBySessionId[t]??[],r].slice(-200)}}))},launchTask:(t,i,r,s)=>{e().send({type:"launch_session",cwd:t,model:i,initialPrompt:r,worktreeBranch:s==null?void 0:s.worktreeBranch,worktreeBaseRef:s==null?void 0:s.worktreeBaseRef})},selectedSessionIds:new Set,toggleSessionSelection:t=>{n(i=>{const r=new Set(i.selectedSessionIds);return r.has(t)?r.delete(t):r.add(t),{selectedSessionIds:r}})},clearSessionSelection:()=>{n({selectedSessionIds:new Set})},terminateSessions:t=>{const i=e().send;for(const r of t)i({type:"terminate_session",sessionId:r});n({selectedSessionIds:new Set})},setMotionEnabled:t=>{Kx(t),n({motionEnabled:t})},toggleMotion:()=>{const t=!e().motionEnabled;Kx(t),n({motionEnabled:t})},setViewMode:t=>{Jx(t),n({viewMode:t})},toggleViewMode:()=>{const t=["galaxy","list","missions"],i=e().viewMode,r=t.indexOf(i),s=t[(r+1)%t.length]??"galaxy";Jx(s),n({viewMode:s})},enterPlayback:(t,i,r)=>{const s=i;n(o=>({playback:{...o.playback,active:!0,loading:!1,events:t,earliestMs:i,latestMs:r,currentMs:s,playing:!1,...$x(t,s,e().sessions,e().missions)}}))},exitPlayback:()=>n({playback:qx}),setPlaybackTime:t=>{n(i=>{const r=Math.max(i.playback.earliestMs,Math.min(t,i.playback.latestMs));return{playback:{...i.playback,currentMs:r,...$x(i.playback.events,r,e().sessions,e().missions)}}})},setPlaybackSpeed:t=>n(i=>({playback:{...i.playback,speed:t}})),setPlaybackPlaying:t=>n(i=>({playback:{...i.playback,playing:t}})),setPlaybackLoading:t=>n(i=>({playback:{...i.playback,loading:t}})),send:()=>{},attachSocket:t=>n({send:t})}));function Fm(n){return n.playback.active?n.playback.derivedSessions:n.sessions}function iS(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind!=="advisor")}function PE(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind==="advisor")}function z3(n,e){return Object.values(Fm(n)).filter(t=>t.parentSessionId===e)}function V3(n){return Object.values(n.advisors).filter(e=>e.enabled)}function H3(n){return Object.values(n.skills)}function IE(n){switch(n){case"opus":return"#a855f7";case"sonnet":return"#3b82f6";case"haiku":return"#06b6d4";case"default":return"#94a3b8";default:return"#94a3b8"}}function G3(n){switch(n){case"active":return{color:"#fde68a",intensity:.3};case"awaiting_permission":return{color:"#ef4444",intensity:.5};case"awaiting_input":return{color:"#f59e0b",intensity:.25};case"plan_review":return{color:"#a78bfa",intensity:.2};case"error":return{color:"#dc2626",intensity:.3};case"spawning":return{color:"#ffffff",intensity:.2};case"idle":default:return{color:"#1e293b",intensity:.05}}}function rS(n){switch(n){case"active":return"Active";case"awaiting_permission":return"Permission";case"awaiting_input":return"Awaiting input";case"plan_review":return"Plan review";case"error":return"Error";case"spawning":return"Spawning";case"terminated":return"Terminated";case"idle":default:return"Idle"}}function NE(n,e,t){const i=[];let r=30;switch(n.status){case"error":r=0,i.push("In error state");break;case"plan_review":case"awaiting_input":r=15,i.push(`Status: ${n.status}`);break;case"awaiting_permission":r=12,i.push("Awaiting permission");break;case"terminated":r=5,i.push("Terminated");break;default:r=30}const s=Math.max(0,30-t*15);t>0&&i.push(`${t} pending permission${t===1?"":"s"}`);const a=25*Math.max(0,1-n.contextUsagePct/100);n.contextUsagePct>=90?i.push(`Context at ${n.contextUsagePct.toFixed(0)}%`):n.contextUsagePct>=80&&i.push(`Context warm (${n.contextUsagePct.toFixed(0)}%)`);let l=0;if(e&&e.status==="active"){const u=e.metrics.toolCallCount;l=Math.min(15,u*2)}else e&&e.status==="completed"&&(l=15);return{score:Math.round(Math.max(0,Math.min(100,r+s+a+l))),reasons:i}}function LE(n){return n>=75?"#10b981":n>=50?"#fbbf24":n>=25?"#f97316":"#ef4444"}const Bm={active:"The agent is currently working — emitting tool calls or generating output.",idle:"No mission running. The agent is waiting for the next prompt or has been quiet for a while.",spawning:"The agent process just started. It will transition to active within a second or two.",awaiting_permission:"The agent paused to ask permission for a sensitive tool call. Approve or deny in the Decision Queue.",awaiting_input:"The agent finished what it could and is waiting for your next prompt.",plan_review:"The agent produced a plan and is waiting for your approval before executing.",error:"The agent crashed or hit an unrecoverable error. Look at the SidePanel transcript for details.",terminated:"The agent process exited. No more activity will come from this session.",subagent:"A child agent spawned by another session (typically via the Task tool). Rendered as a moon orbiting the parent planet.",advisor:"A long-lived specialist agent (Compass, Forge, Lumen, Argus, Sentinel, …) with its own AGENT.md describing its role.",pinned:"An advisor that's always running. Pinned advisors orbit close to the sun in the inner ring."},Qx={awaiting_permission:0,awaiting_input:1,plan_review:2,error:3,active:4,spawning:5,idle:6,terminated:7};function DE(){const n=Ee(iS),e=Ee(PE),t=Ee(_=>_.projects),i=Ee(_=>_.missions),r=Ee(_=>_.pendingPermissions),s=Ee(_=>_.selectSession),o=Ee(_=>_.selectedSessionIds),a=Ee(_=>_.toggleSessionSelection),l=Ee(_=>_.clearSessionSelection),c=Ee(_=>_.terminateSessions),[u,d]=Ie.useState("needs"),[h,p]=Ie.useState("asc"),m=Ie.useMemo(()=>{const _=[...n,...e],R=new Set(Object.values(r).map(M=>M.sessionId));return _.map(M=>{const T=M.currentMissionId?i[M.currentMissionId]:void 0,A=Object.values(r).filter(L=>L.sessionId===M.id).length,{score:E,reasons:w}=NE(M,T,A);return{session:M,project:t[M.projectId],mission:T,needsAttention:R.has(M.id)||M.status==="awaiting_permission"||M.status==="awaiting_input"||M.status==="plan_review",health:E,healthReasons:w}})},[n,e,t,i,r]),y=Ie.useMemo(()=>{var R;const _=new Map;for(const M of m){const T=((R=M.project)==null?void 0:R.id)??"_",A=_.get(T);A?A.rows.push(M):_.set(T,{project:M.project,rows:[M]})}return[..._.values()].sort((M,T)=>{var A,E;return(((A=T.project)==null?void 0:A.lastActiveAt)??0)-(((E=M.project)==null?void 0:E.lastActiveAt)??0)})},[m]),g=(_,R)=>{var T,A;const M=h==="asc"?1:-1;switch(u){case"name":return((_.session.name??_.session.id)>(R.session.name??R.session.id)?1:-1)*M;case"status":return((Qx[_.session.status]??99)-(Qx[R.session.status]??99))*M;case"progress":return((((T=_.mission)==null?void 0:T.metrics.toolCallCount)??0)-(((A=R.mission)==null?void 0:A.metrics.toolCallCount)??0))*M;case"context":return(_.session.contextUsagePct-R.session.contextUsagePct)*M;case"lastActivity":return(_.session.updatedAt-R.session.updatedAt)*M;case"needs":return _.needsAttention===R.needsAttention?0:_.needsAttention?-1*M:1*M;case"health":return(_.health-R.health)*M}},f=_=>{u===_?p(h==="asc"?"desc":"asc"):(d(_),p(_==="lastActivity"?"desc":"asc"))},v=_=>u!==_?"":h==="asc"?" ▲":" ▼",x=o.size;return S.jsxs("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-20 px-6 z-0",children:[x>0&&S.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 pointer-events-auto",children:S.jsxs("div",{className:"rounded-full border border-solix-accent/60 bg-solix-panel/95 backdrop-blur shadow-2xl px-4 py-2 flex items-center gap-3",children:[S.jsxs("span",{className:"text-xs text-slate-200 font-mono",children:[x," selected"]}),S.jsx("button",{onClick:()=>c([...o]),className:"text-xs px-3 py-1 rounded border border-solix-danger text-solix-danger hover:bg-solix-danger/15",children:"Terminate"}),S.jsx("button",{onClick:l,className:"text-xs text-slate-400 hover:text-slate-200",children:"Clear"})]})}),S.jsxs("div",{className:"max-w-6xl mx-auto",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest mb-3",children:["List view · ",m.length," agent",m.length===1?"":"s"]}),m.length===0?S.jsxs("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:["No agents yet. Run ",S.jsx("code",{children:"claude"})," in any terminal — a row will appear here within a second."]}):y.map(({project:_,rows:R})=>{const M=[...R].sort(g),T=(_==null?void 0:_.name)??"(unassigned)";return S.jsxs("section",{className:"mb-8 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:T}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[R.length," agent",R.length===1?"":"s"]})]}),(_==null?void 0:_.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:_.cwd})]}),S.jsxs("table",{className:"w-full text-sm",children:[S.jsx("thead",{className:"bg-black/30 text-[10px] uppercase tracking-wide text-slate-500",children:S.jsxs("tr",{children:[S.jsx(Ri,{children:S.jsx("input",{type:"checkbox","aria-label":"Select all in project",checked:M.length>0&&M.every(A=>o.has(A.session.id)),onChange:A=>{A.stopPropagation();const E=M.every(w=>o.has(w.session.id));for(const w of M){const L=o.has(w.session.id);(E&&L||!E&&!L)&&a(w.session.id)}},className:"cursor-pointer"})}),S.jsxs(Ri,{onClick:()=>f("needs"),children:["● ",v("needs")]}),S.jsxs(Ri,{onClick:()=>f("name"),children:["Agent",v("name")]}),S.jsx(Ri,{children:"Advisor"}),S.jsxs(Ri,{onClick:()=>f("status"),children:["Status",v("status")]}),S.jsxs(Ri,{onClick:()=>f("health"),numeric:!0,children:["Health",v("health")]}),S.jsxs(Ri,{onClick:()=>f("progress"),children:["Mission · tools",v("progress")]}),S.jsxs(Ri,{onClick:()=>f("context"),numeric:!0,children:["Context",v("context")]}),S.jsxs(Ri,{onClick:()=>f("lastActivity"),numeric:!0,children:["Last activity",v("lastActivity")]})]})}),S.jsx("tbody",{children:M.map(A=>S.jsxs("tr",{onClick:()=>s(A.session.id),className:`border-t border-solix-border hover:bg-solix-border/20 cursor-pointer ${A.needsAttention?"bg-solix-danger/5":""} ${o.has(A.session.id)?"bg-solix-accent/5":""}`,children:[S.jsx("td",{className:"px-3 py-2",onClick:E=>E.stopPropagation(),children:S.jsx("input",{type:"checkbox","aria-label":"Select agent",checked:o.has(A.session.id),onChange:()=>a(A.session.id),className:"cursor-pointer"})}),S.jsx("td",{className:"px-3 py-2",children:A.needsAttention?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-danger solix-pulse"}):A.session.status==="active"?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-ok"}):S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-slate-600"})}),S.jsx("td",{className:"px-3 py-2",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:IE(A.session.model)},title:String(A.session.model)}),S.jsx("span",{className:"text-slate-100 font-medium",children:A.session.name??A.session.id.slice(0,8)}),A.session.kind==="advisor"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-amber-300",children:"advisor"}),A.session.wrapperSocketPath&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-solix-accent",title:"Wrapped by `solix run` — UI composer is enabled",children:"wrapped"}),A.session.worktreePath&&S.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded border border-solix-accent/40 text-solix-accent",title:A.session.worktreePath,children:["⌥",UE(A.session.worktreePath)]})]})}),S.jsx("td",{className:"px-3 py-2 text-xs",children:S.jsx(OE,{session:A.session,mission:A.mission})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300",title:Bm[A.session.status]??void 0,children:rS(A.session.status)}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(FE,{score:A.health,reasons:A.healthReasons})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300 truncate max-w-xs",children:A.mission?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"text-slate-100",children:A.mission.shortName}),S.jsxs("span",{className:"text-slate-500 ml-1",children:["· ",A.mission.metrics.toolCallCount," tools"]})]}):S.jsx("span",{className:"text-slate-500 italic",children:"idle"})}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(BE,{pct:A.session.contextUsagePct})}),S.jsx("td",{className:"px-3 py-2 text-right text-[11px] text-slate-500 font-mono",children:zE(A.session.updatedAt)})]},A.session.id))})]})]},(_==null?void 0:_.id)??"_")})]})]})}function UE(n){const e=n.split("/").filter(Boolean);return e[e.length-1]??n}const kE=/^\[Acting as ([^\s—]+)/;function OE({session:n,mission:e}){var s;const t=Ee(o=>o.advisors);let i,r=!1;if(n.advisorRole)i=Object.values(t).find(o=>o.id===n.advisorRole);else if(e!=null&&e.prompt){const o=e.prompt.match(kE),a=(s=o==null?void 0:o[1])==null?void 0:s.toLowerCase();a&&(i=Object.values(t).find(l=>l.codename.toLowerCase()===a),r=!0)}return i?S.jsxs("span",{className:`inline-flex items-center gap-1 ${r?"opacity-60":""}`,title:i.description,children:[S.jsx("span",{style:{color:i.color},children:i.glyph}),S.jsx("span",{className:"text-slate-200",children:i.codename})]}):S.jsx("span",{className:"text-slate-700",children:"—"})}function Ri({children:n,onClick:e,numeric:t}){return S.jsx("th",{onClick:e,className:`px-3 py-2 select-none ${t?"text-right":"text-left"} ${e?"cursor-pointer hover:text-slate-300":""}`,children:n})}function FE({score:n,reasons:e}){const t=LE(n);return S.jsxs("div",{className:"relative inline-flex items-center gap-2 group",children:[S.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:t},children:n}),S.jsx("div",{className:"w-16 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${Math.max(2,n)}%`,background:t}})}),S.jsxs("div",{className:"pointer-events-none absolute right-0 top-full mt-1 z-50 hidden group-hover:block w-64 rounded border border-solix-border bg-solix-panel/95 backdrop-blur p-2 text-left shadow-xl",children:[S.jsxs("div",{className:"flex items-center justify-between mb-1",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-400",children:"Health"}),S.jsxs("span",{className:"text-xs font-bold",style:{color:t},children:[n,"/100"]})]}),e.length===0?S.jsx("div",{className:"text-[11px] text-slate-400 italic",children:"All four bands healthy: stable status, no pending decisions, context budget, mission progress."}):S.jsx("ul",{className:"space-y-0.5",children:e.map(i=>S.jsxs("li",{className:"text-[11px] text-slate-200 leading-snug",children:["· ",i]},i))})]})]})}function BE({pct:n}){const e=n>=90?"bg-solix-danger":n>=80?"bg-solix-warn":"bg-solix-accent";return S.jsxs("div",{className:"inline-flex items-center gap-2",children:[S.jsxs("span",{className:"text-[11px] text-slate-400 font-mono",children:[n.toFixed(0),"%"]}),S.jsx("div",{className:"w-20 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${e}`,style:{width:`${Math.min(100,n)}%`}})})]})}function zE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const r=Math.floor(i/60);return r<24?`${r}h`:new Date(n).toLocaleDateString()}function VE(){const n=Ee(l=>l.missions),e=Ee(l=>l.sessions),t=Ee(l=>l.projects),i=Ee(l=>l.selectSession),[r,s]=Ie.useState("all"),o=Ie.useMemo(()=>{const l=Object.values(n).sort((c,u)=>u.startedAt-c.startedAt);return r==="all"?l:l.filter(c=>c.status===r)},[n,r]),a=Ie.useMemo(()=>{const l=new Map;for(const c of o){const u=e[c.sessionId],d=u?t[u.projectId]:void 0,h=(d==null?void 0:d.id)??"_",p=l.get(h);p?p.missions.push(c):l.set(h,{project:d,missions:[c]})}return[...l.values()].sort((c,u)=>{var d,h;return(((d=u.missions[0])==null?void 0:d.startedAt)??0)-(((h=c.missions[0])==null?void 0:h.startedAt)??0)})},[o,e,t]);return S.jsx("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-8 px-6 z-0",children:S.jsxs("div",{className:"max-w-4xl mx-auto",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest",children:["Missions · ",o.length]}),S.jsx("div",{className:"flex items-center gap-1.5",children:["all","active","completed","failed","cancelled"].map(l=>S.jsx("button",{onClick:()=>s(l),className:`text-[10px] px-2 py-0.5 rounded border ${r===l?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:l},l))})]}),o.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:"No missions yet. Send a prompt to a Claude Code session and a mission card will appear here."}):a.map(({project:l,missions:c})=>{const u=(l==null?void 0:l.name)??"(unassigned)";return S.jsxs("section",{className:"mb-6 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:u}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[c.length," mission",c.length===1?"":"s"]})]}),(l==null?void 0:l.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:l.cwd})]}),S.jsx("ul",{className:"divide-y divide-solix-border",children:c.map(d=>{const h=e[d.sessionId];return S.jsx("li",{children:S.jsxs("button",{onClick:()=>i(d.sessionId),className:"w-full text-left p-4 hover:bg-solix-border/20 cursor-pointer block",children:[S.jsxs("div",{className:"flex items-start justify-between gap-3",children:[S.jsxs("div",{className:"min-w-0 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:d.shortName}),S.jsx(HE,{status:d.status})]}),S.jsx("div",{className:"mt-1 text-xs text-slate-400 line-clamp-2",children:d.prompt}),d.longSummary&&S.jsx("div",{className:"mt-1 text-xs text-slate-300 italic",children:d.longSummary}),d.status==="failed"&&d.errorSummary&&S.jsxs("div",{className:"mt-1 text-xs text-solix-danger italic line-clamp-2",children:["error: ",d.errorSummary]})]}),S.jsxs("div",{className:"text-right text-[10px] text-slate-500 font-mono whitespace-nowrap",children:[WE(d.startedAt),d.metrics.durationMs!==void 0&&S.jsxs("div",{children:[(d.metrics.durationMs/1e3).toFixed(1),"s"]})]})]}),S.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-slate-500",children:[h&&S.jsxs("span",{children:["agent:"," ",S.jsx("span",{className:"text-slate-300",children:h.name??h.id.slice(0,8)})]}),S.jsxs("span",{children:[d.metrics.toolCallCount," tools"]}),S.jsxs("span",{title:Bm.subagent,children:[d.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[d.filesTouched.length," files"]})]}),d.filesTouched.length>0&&S.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[d.filesTouched.slice(0,6).map(p=>S.jsx("span",{className:"text-[10px] font-mono text-slate-400 bg-black/30 border border-solix-border rounded px-1.5 py-0.5",children:GE(p)},p)),d.filesTouched.length>6&&S.jsxs("span",{className:"text-[10px] text-slate-500",children:["+",d.filesTouched.length-6]})]})]})},d.id)})})]},(l==null?void 0:l.id)??"_")})]})})}function HE({status:n}){const e=n==="active"?"border-solix-warn text-solix-warn":n==="completed"?"border-solix-ok text-solix-ok":n==="failed"?"border-solix-danger text-solix-danger":"border-solix-border text-slate-400";return S.jsx("span",{className:`text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${e}`,children:n})}function GE(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function WE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;const i=Math.floor(t/60);if(i<60)return`${i}m ago`;const r=Math.floor(i/60);return r<24?`${r}h ago`:new Date(n).toLocaleDateString()}function jE({onOpenGalaxy:n,onNewTask:e,onOpenTimeline:t,onOpenHelp:i}={}){const r=Ee(u=>u.connected),s=Ee(iS),o=Ee(u=>u.viewMode),a=Ee(u=>u.playback.active),l=Ee(u=>u.exitPlayback),c=s.reduce((u,d)=>(d.status==="active"?u.active+=1:d.status==="awaiting_permission"||d.status==="awaiting_input"||d.status==="plan_review"?u.attention+=1:d.status==="idle"&&(u.idle+=1),u),{active:0,idle:0,attention:0});return S.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-4 z-40",children:[S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3",children:[S.jsx("div",{className:"text-xl font-bold tracking-widest text-solix-accent",children:"SOLIX"}),S.jsx("div",{className:"hidden md:block text-xs text-slate-400",children:"a solar-system command center"}),S.jsx("div",{className:`ml-1 sm:ml-3 px-2 py-1 rounded text-[10px] border ${r?"border-solix-ok text-solix-ok":"border-solix-danger text-solix-danger solix-pulse"}`,children:r?"CONNECTED":"OFFLINE"}),a&&S.jsxs("button",{onClick:l,className:"ml-2 px-2 py-1 rounded text-[10px] border border-solix-accent text-solix-accent solix-pulse hover:bg-solix-accent/15 cursor-pointer flex items-center gap-1.5",title:"Exit Timeline Playback (Esc)","aria-label":"Exit playback",children:[S.jsx("span",{children:"▸ PLAYBACK"}),S.jsx("span",{className:"opacity-70",children:"· exit ✕"})]})]}),S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3 text-xs",children:[S.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[S.jsx(Hh,{label:"active",value:c.active,color:"text-solix-ok"}),S.jsx(Hh,{label:"attention",value:c.attention,color:"text-solix-warn"}),S.jsx(Hh,{label:"idle",value:c.idle,color:"text-slate-400"})]}),S.jsx(XE,{viewMode:o}),t&&S.jsx("button",{onClick:t,className:"hidden sm:inline-block px-2 py-1 rounded bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30",title:"Timeline playback (T)",children:"⏱ Timeline"}),e&&S.jsx("button",{onClick:e,className:"px-2 py-1 rounded bg-solix-ok/15 border border-solix-ok/40 text-solix-ok hover:bg-solix-ok/25",title:"Launch a new Claude Code task (L)",children:"+ Task"}),n&&S.jsx("button",{onClick:n,className:"px-2 py-1 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent hover:bg-solix-accent/25",title:"Galaxy: export and import (G)",children:"⌬ Galaxy"}),i&&S.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30 text-sm",title:"Help (?)","aria-label":"Help",children:"?"})]})]})}function XE({viewMode:n}){const e=Ee(i=>i.setViewMode),t=[{mode:"galaxy",label:"🪐"},{mode:"list",label:"☰"},{mode:"missions",label:"◎"}];return S.jsx("div",{className:"inline-flex rounded border border-solix-border bg-solix-panel overflow-hidden",children:t.map(i=>S.jsxs("button",{onClick:()=>e(i.mode),className:`px-2 py-1 text-xs ${n===i.mode?"bg-solix-border/50 text-white":"text-slate-400 hover:text-slate-100"}`,title:`${i.mode} view (V)`,children:[i.label," ",S.jsx("span",{className:"hidden sm:inline capitalize",children:i.mode})]},i.mode))})}function Hh({label:n,value:e,color:t}){return S.jsxs("div",{className:"px-2 py-1 rounded bg-solix-panel border border-solix-border",children:[S.jsx("span",{className:`font-bold ${t}`,children:e}),S.jsx("span",{className:"ml-1 opacity-60 uppercase tracking-wide",children:n})]})}function YE(){const n=Ee(t=>t.toasts),e=Ee(t=>t.dismissToast);return S.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col gap-2 z-30",children:n.map(t=>S.jsx("button",{onClick:()=>e(t.id),className:`pointer-events-auto px-3 py-2 rounded text-xs border max-w-md text-left ${t.level==="error"?"bg-solix-danger/10 border-solix-danger text-solix-danger":t.level==="warn"?"bg-solix-warn/10 border-solix-warn text-solix-warn":"bg-solix-panel border-solix-border text-slate-200"}`,children:t.message},t.id))})}const e0="solix.welcome.dismissed.v1";function $E({onOpenGalaxy:n,forceOpen:e=!1,onClose:t}){const[i,r]=Ie.useState(!1),s=Ee(u=>u.advisors),o=Ee(u=>Object.keys(u.skills).length),a=Ee(u=>Object.keys(u.sessions).length);if(Ie.useEffect(()=>{try{r(localStorage.getItem(e0)==="1")}catch{}},[]),!e&&(i||a>0))return null;const l=()=>{try{localStorage.setItem(e0,"1")}catch{}r(!0),t==null||t()},c=Object.values(s).filter(u=>u.enabled).sort((u,d)=>u.codename.localeCompare(d.codename));return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto max-w-xl w-full mx-4 rounded-xl border border-solix-accent/40 bg-solix-panel/95 backdrop-blur-md shadow-2xl",children:[S.jsxs("div",{className:"px-6 pt-5 pb-3 border-b border-solix-border",children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"welcome"}),S.jsx("div",{className:"text-2xl font-bold mt-1",children:"Solix — your agent solar system"}),S.jsx("div",{className:"text-sm text-slate-400 mt-1",children:"Mission control for Claude Code. Each agent orbits the sun; each click is a conversation with one of your planets."})]}),S.jsxs("div",{className:"px-6 py-4 space-y-3 text-sm text-slate-300",children:[S.jsx(ta,{n:1,title:"Run a Claude Code session",body:S.jsxs(S.Fragment,{children:["Open a terminal anywhere and run"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude"}),". A planet will appear here within a second."]})}),S.jsx(ta,{n:2,title:"Or seed the demo state",body:S.jsxs(S.Fragment,{children:["In another terminal:"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix demo"}),". You'll get 3 planets, a moon, a permission flare, and a pinned advisor — without running Claude Code."]})}),S.jsx(ta,{n:3,title:"Meet the advisor crew",body:S.jsxs(S.Fragment,{children:[c.length>0?`${c.length} crew members loaded. Click any in the inner ring to read their role and invoke them on the focused planet.`:"Crew loading…",c.length>0&&S.jsx("ul",{className:"mt-2 space-y-1",children:c.map(u=>S.jsxs("li",{className:"flex items-baseline gap-2",children:[S.jsxs("span",{className:"font-mono text-xs",style:{color:u.color},children:[u.glyph," ",u.codename]}),S.jsx("span",{className:"text-slate-500 text-xs",children:"—"}),S.jsx("span",{className:"text-slate-300 text-xs",children:u.name})]},u.id))})]})}),S.jsx(ta,{n:4,title:"Browse the asteroid belt",body:S.jsxs(S.Fragment,{children:["Each asteroid is a Skill (",o," discovered). Click one to read its SKILL.md and see which advisors require it."]})}),S.jsx(ta,{n:5,title:"Share your galaxy",body:S.jsxs(S.Fragment,{children:["Press"," ",S.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px]",children:"G"})," ","or click ",S.jsx("span",{className:"text-solix-accent",children:"⌬ Galaxy"})," ","in the top bar to export, import, publish, or install a galaxy from a registry."]})})]}),S.jsxs("div",{className:"px-6 pb-3 pt-1",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-1.5",children:"Keyboard shortcuts"}),S.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-slate-400",children:[S.jsx(pi,{k:"V",children:"cycle Galaxy → List → Missions"}),S.jsx(pi,{k:"G",children:"toggle Galaxy panel"}),S.jsx(pi,{k:"L",children:"new task"}),S.jsx(pi,{k:"T",children:"timeline"}),S.jsx(pi,{k:"M",children:"jump to Missions"}),S.jsx(pi,{k:"Y",children:"approve top decision"}),S.jsx(pi,{k:"N",children:"deny top decision"}),S.jsx(pi,{k:"Space",children:"play / pause orbits"}),S.jsx(pi,{k:"?",children:"re-open this help"}),S.jsx(pi,{k:"Esc",children:"close panels / exit playback"})]}),S.jsx("div",{className:"text-[10px] text-slate-500 italic mt-2",children:"If clicks feel stuck, a third-party screen overlay (note-taker, recorder) may be intercepting. Quit it temporarily, or use the shortcuts above."})]}),S.jsxs("div",{className:"px-6 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:()=>{n(),l()},className:"px-3 py-1.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent text-xs hover:bg-solix-accent/25",children:"Open Galaxy panel"}),S.jsx("div",{className:"flex-1"}),S.jsx("button",{onClick:l,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Got it"})]})]})})}function pi({k:n,children:e}){return S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px] font-mono text-slate-300",children:n}),S.jsx("span",{className:"truncate",children:e})]})}function ta({n,title:e,body:t}){return S.jsxs("div",{className:"flex gap-3",children:[S.jsx("div",{className:"shrink-0 w-6 h-6 rounded-full bg-solix-accent/20 border border-solix-accent/40 text-solix-accent text-xs flex items-center justify-center",children:n}),S.jsxs("div",{children:[S.jsx("div",{className:"text-slate-100 font-medium text-sm",children:e}),S.jsx("div",{className:"text-slate-400 text-xs mt-0.5 leading-relaxed",children:t})]})]})}function qE(n,e,t,i){const r=Gh(i,"command"),s=Gh(i,"file_path"),o=Gh(i,"url");if(t==="Bash"&&r){if(/\brm\s+-rf\b/i.test(r)||/\bsudo\b/i.test(r))return{severity:"danger",text:"Destructive command. Deny unless you have already confirmed the diff."};if(/--no-verify\b/.test(r))return{severity:"warn",text:"Skipping pre-commit hooks. Investigate the failure first."};if(/git\s+push.*--force\b/.test(r))return{severity:"danger",text:"Force-push. Confirm no one else has pushed since."};if(/git\s+push/.test(r)&&/\b(main|master|prod|production)\b/.test(r))return{severity:"warn",text:"Pushing to main/prod. Confirm the diff first."};if(/git\s+reset\s+--hard\b/.test(r))return{severity:"warn",text:"Hard reset will discard uncommitted changes. Stash first if unsure."}}if((t==="Edit"||t==="Write"||t==="MultiEdit")&&s){if(/\.env(\b|\.|\/)|credentials\.json|\.pem$|\.key$/i.test(s))return{severity:"danger",text:"Editing a secrets file. Make sure the agent really needs to."};if(/(^|\/)\.git\//.test(s))return{severity:"warn",text:"Editing inside .git/. Almost certainly a mistake."}}if(t==="WebFetch"&&o){if(/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)/.test(o))return null;if(/^http:\/\//.test(o))return{severity:"info",text:"Plain HTTP fetch. OK for known internal hosts."}}return n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Run /compact before continuing.`}:null}function ZE(n,e){return n.status==="error"?{severity:"danger",text:"Session is in error state. Check the chat tab and consider restarting."}:n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Compact the conversation before the next prompt.`}:n.contextUsagePct>=80?{severity:"info",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Watch out — output quality drops past 90.`}:e&&e.status==="active"&&e.metrics.toolCallCount===0&&Date.now()-e.startedAt>5*60*1e3?{severity:"info",text:"Active mission with no tool calls in 5+ minutes. Agent may be stuck."}:null}function Gh(n,e){const t=n[e];return typeof t=="string"?t:null}function KE(){const n=Ee(u=>u.pendingPermissions),e=Ee(u=>u.sessions),t=Ee(u=>u.missions),i=Ee(u=>u.resolvePermission),r=Ee(u=>u.selectSession),s=Object.values(n).sort((u,d)=>d.receivedAt-u.receivedAt),[o,a]=Ie.useState(!1),l=s.length;Ie.useEffect(()=>{l>0&&a(!1)},[l]);const c=u=>{r(u),a(!0)};return l===0?S.jsx("div",{className:"absolute top-20 right-4 z-30 pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/60 backdrop-blur px-3 py-1 text-[10px] text-slate-500 flex items-center gap-2",children:[S.jsx("span",{className:"uppercase tracking-widest",children:"decisions"}),S.jsx("span",{className:"font-bold",children:"0"}),S.jsx("span",{className:"italic opacity-80",children:"— all clear"})]})}):S.jsxs("div",{className:"absolute top-20 right-4 z-30 w-80 flex flex-col gap-2 pointer-events-none",children:[S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-2 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-widest text-slate-400",children:"Decisions"}),S.jsx("span",{className:"text-xs font-bold text-solix-danger",children:l})]}),S.jsx("button",{onClick:()=>a(u=>!u),className:"text-[10px] text-slate-400 hover:text-slate-100",children:o?"show":"hide"})]}),!o&&s.map(u=>{const d=e[u.sessionId],h=d!=null&&d.currentMissionId?t[d.currentMissionId]:void 0;return S.jsx(JE,{session:d,mission:h,tool:u.tool,args:u.args,onApprove:()=>i(u.requestId,!0),onDeny:()=>i(u.requestId,!1),onAsk:()=>c(u.sessionId)},u.requestId)})]})}function JE({session:n,mission:e,tool:t,args:i,onApprove:r,onDeny:s,onAsk:o}){const a=(n==null?void 0:n.name)??(n==null?void 0:n.id.slice(0,8))??"unknown agent",l=n!=null&&n.cwd?nT(n.cwd):"",c=n?qE(n,e,t,i):null;return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-danger/10 p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:a}),l&&S.jsx("div",{className:"text-[10px] text-slate-500 truncate ml-2 max-w-[55%]",children:l})]}),e&&S.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 italic truncate",children:["mission: ",e.shortName]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:[S.jsx("span",{className:"font-semibold",children:t}),S.jsx("span",{className:"ml-1 text-slate-300 text-xs break-words",children:iT(i)})]}),S.jsx(QE,{tool:t,args:i}),c&&S.jsx(tT,{suggestion:c}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:r,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Approve · Y"}),S.jsx("button",{onClick:s,className:"flex-1 py-1.5 rounded bg-solix-danger/20 border border-solix-danger text-solix-danger text-xs hover:bg-solix-danger/30",children:"Deny · N"}),S.jsx("button",{onClick:o,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",title:"Open chat with this agent for context",children:"Ask"})]})]})}function QE({tool:n,args:e}){const[t,i]=Ie.useState(!1);if(n==="Bash"){const r=rr(e,"command")??"",s=rr(e,"description");return r?S.jsxs(Wh,{label:"will run",children:[S.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-slate-100",children:r}),s&&S.jsx("div",{className:"mt-1 text-[10px] text-slate-500 italic",children:s})]}):null}if(n==="Edit"||n==="NotebookEdit"){const r=rr(e,"file_path")??rr(e,"notebook_path"),s=rr(e,"old_string"),o=rr(e,"new_string");return!r&&!s&&!o?null:S.jsxs(Wh,{label:"patch",children:[r&&S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(jh,{sign:"-",text:s,expanded:t,colorClass:"text-solix-danger bg-solix-danger/10"}),o&&S.jsx(jh,{sign:"+",text:o,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),(Xh(s)||Xh(o))&&S.jsx("button",{onClick:()=>i(a=>!a),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]})}if(n==="Write"){const r=rr(e,"file_path"),s=rr(e,"content")??"";return r?S.jsxs(Wh,{label:"will write",children:[S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(jh,{sign:"+",text:s,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),Xh(s)&&S.jsx("button",{onClick:()=>i(o=>!o),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]}):null}return null}function Wh({label:n,children:e}){return S.jsxs("div",{className:"mt-2 rounded border border-solix-border bg-black/30 px-2 py-1.5",children:[S.jsx("div",{className:"text-[9px] uppercase tracking-wider text-slate-500 mb-1",children:n}),e]})}function jh({sign:n,text:e,expanded:t,colorClass:i}){const r=t?e:eT(e,240);return S.jsxs("pre",{className:`mt-1 px-1.5 py-1 rounded text-[11px] font-mono whitespace-pre-wrap break-words ${i}`,children:[S.jsx("span",{className:"opacity-50 mr-1",children:n}),r]})}function rr(n,e){const t=n[e];return typeof t=="string"?t:void 0}function Xh(n){return!!(n&&n.length>240)}function eT(n,e){if(n.length<=e)return n;const t=Math.floor((e-3)/2);return`${n.slice(0,t)}
56
+ */var Ad=Pe,aE=oE;function lE(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var cE=typeof Object.is=="function"?Object.is:lE,uE=aE.useSyncExternalStore,dE=Ad.useRef,hE=Ad.useEffect,fE=Ad.useMemo,pE=Ad.useDebugValue;K_.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=dE(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=fE(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&o.hasValue){var m=o.value;if(r(m,p))return d=m}return d=p}if(m=d,cE(u,p))return m;var y=i(p);return r!==void 0&&r(m,y)?(u=p,m):(u=p,d=y)}var c=!1,u,d,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,r]);var a=uE(n,s[0],s[1]);return hE(function(){o.hasValue=!0,o.value=a},[a]),pE(a),a};Z_.exports=K_;var mE=Z_.exports;const gE=kv(mE),eS={},{useDebugValue:xE}=Uw,{useSyncExternalStoreWithSelector:vE}=gE;let jx=!1;const yE=n=>n;function _E(n,e=yE,t){(eS?"production":void 0)!=="production"&&t&&!jx&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),jx=!0);const i=vE(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return xE(i),i}const Xx=n=>{(eS?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?Zb(n):n,t=(i,r)=>_E(e,i,r);return Object.assign(t,e),t},SE=n=>n?Xx(n):Xx,ME="solix.notifications.v1";function wE(){try{return localStorage.getItem(ME)==="off"?"off":"on"}catch{return"on"}}let Yx=!1;async function bE(){if(typeof Notification>"u")return"denied";if(Notification.permission!=="default"||Yx)return Notification.permission;Yx=!0;try{return await Notification.requestPermission()}catch{return"denied"}}async function EE(n){if(!(wE()==="off"||typeof Notification>"u"||typeof document<"u"&&!document.hidden||await bE()!=="granted"))try{new Notification(n.title,{body:n.body,tag:n.tag})}catch{}}const TE="solix.sound.v1";let Vh=null;function AE(){try{if(localStorage.getItem(TE)!=="on"||typeof window>"u")return;if(!Vh){const r=window.AudioContext||window.webkitAudioContext;if(!r)return;Vh=new r}const n=Vh,e=n.createOscillator(),t=n.createGain();e.connect(t),t.connect(n.destination),e.type="sine",e.frequency.value=880,t.gain.value=1e-4;const i=n.currentTime;t.gain.exponentialRampToValueAtTime(.06,i+.01),t.gain.exponentialRampToValueAtTime(1e-4,i+.35),e.start(i),e.stop(i+.4)}catch{}}function $x(n,e,t,i){const r={},s={},a=[];for(const l of n){if(l.ts>e)break;switch(l.type){case"session_started":{const c=t[l.sessionId];if(!c)continue;r[l.sessionId]={...c,status:"idle"};break}case"session_terminated":{delete r[l.sessionId];break}case"mission_started":{if(!l.missionId)continue;const c=i[l.missionId],u=r[l.sessionId];u&&(r[l.sessionId]={...u,status:"active",currentMissionId:l.missionId}),c&&(s[l.missionId]={...c,status:"active"});break}case"mission_completed":{if(!l.missionId)continue;const c=r[l.sessionId],u=i[l.missionId];c&&c.currentMissionId===l.missionId&&(r[l.sessionId]={...c,status:"idle",currentMissionId:void 0,lastCompletedMissionId:l.missionId}),u&&(s[l.missionId]={...u,status:"completed"});break}case"tool_call":{e-l.ts<=2e3&&a.push({id:`tc-${l.ts}-${l.sessionId}`,sessionId:l.sessionId,tool:l.toolName??"tool",args:{},startedAt:l.ts,status:"ok",receivedAt:l.ts});break}}}return{derivedSessions:r,derivedMissions:s,derivedToolCalls:a}}const qx={active:!1,loading:!1,events:[],earliestMs:0,latestMs:0,currentMs:0,playing:!1,speed:4,derivedSessions:{},derivedMissions:{},derivedToolCalls:[]},Zx=2e3,tS="solix.motion.v1",nS="solix.viewMode.v1";function CE(){try{return localStorage.getItem(tS)==="1"}catch{return!1}}function Kx(n){try{localStorage.setItem(tS,n?"1":"0")}catch{}}function RE(){try{const n=localStorage.getItem(nS);return n==="list"||n==="missions"||n==="galaxy"?n:"galaxy"}catch{return"galaxy"}}function Jx(n){try{localStorage.setItem(nS,n)}catch{}}const Ee=SE((n,e)=>({connected:!1,projects:{},sessions:{},missions:{},advisors:{},skills:{},chatBySessionId:{},recentToolCalls:[],pendingPermissions:{},selectedSessionId:null,selectedAdvisorId:null,selectedSkillId:null,motionEnabled:CE(),viewMode:RE(),playback:qx,toasts:[],setConnected:t=>n({connected:t}),applyMessage:t=>{switch(t.type){case"snapshot":{const i={};for(const l of t.projects)i[l.id]=l;const r={};for(const l of t.sessions)r[l.id]=l;const s={};for(const l of t.missions)s[l.id]=l;const o={};for(const l of t.advisors)o[l.id]=l;const a={};for(const l of t.skills)a[l.id]=l;n({projects:i,sessions:r,missions:s,advisors:o,skills:a});break}case"advisor_upsert":{n(i=>({advisors:{...i.advisors,[t.advisor.id]:t.advisor}}));break}case"skill_upsert":{n(i=>({skills:{...i.skills,[t.skill.id]:t.skill}}));break}case"galaxy_imported":{const i=`${Date.now()}-galaxy`;n(r=>({toasts:[...r.toasts,{id:i,level:"info",message:`Imported galaxy: ${t.manifest.name}`}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}case"session_upsert":{n(i=>({sessions:{...i.sessions,[t.session.id]:t.session}}));break}case"session_remove":{n(i=>{const r={...i.sessions};return delete r[t.sessionId],{sessions:r}});break}case"mission_upsert":{n(i=>({missions:{...i.missions,[t.mission.id]:t.mission}}));break}case"tool_call":{const i={...t.toolCall,receivedAt:Date.now()};n(r=>({recentToolCalls:[...r.recentToolCalls,i].slice(-200)})),setTimeout(()=>{n(r=>({recentToolCalls:r.recentToolCalls.filter(s=>Date.now()-s.receivedAt<Zx)}))},Zx+50);break}case"permission_request":{const i={requestId:t.requestId,sessionId:t.sessionId,tool:t.tool,args:t.args,receivedAt:Date.now()};n(a=>({pendingPermissions:{...a.pendingPermissions,[t.requestId]:i}}));const r=e().sessions[t.sessionId],s=(r==null?void 0:r.name)??t.sessionId.slice(0,8),o=(()=>{const a=Object.keys(t.args)[0];if(!a)return"";const l=t.args[a],c=typeof l=="string"?l:JSON.stringify(l);return`: ${c.length>60?c.slice(0,60)+"…":c}`})();EE({title:`${s} needs you`,body:`${t.tool}${o}`,tag:`solix-perm-${t.sessionId}`,whenHidden:!0}),AE();break}case"context_update":{n(i=>{const r=i.sessions[t.sessionId];return r?{sessions:{...i.sessions,[t.sessionId]:{...r,contextUsagePct:t.usagePct}}}:i});break}case"chat_delta":{const i={...t.delta,receivedAt:Date.now()};n(r=>{const a=[...(r.chatBySessionId[t.sessionId]??[]).filter(l=>l.messageId!==i.messageId),i].slice(-200);return{chatBySessionId:{...r.chatBySessionId,[t.sessionId]:a}}});break}case"toast":{const i=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(r=>({toasts:[...r.toasts,{id:i,level:t.level,message:t.message}].slice(-6)})),setTimeout(()=>e().dismissToast(i),5e3);break}}},selectSession:t=>n({selectedSessionId:t,selectedAdvisorId:t?null:e().selectedAdvisorId,selectedSkillId:t?null:e().selectedSkillId}),selectAdvisor:t=>n({selectedAdvisorId:t,selectedSessionId:t?null:e().selectedSessionId,selectedSkillId:t?null:e().selectedSkillId}),selectSkill:t=>n({selectedSkillId:t,selectedSessionId:t?null:e().selectedSessionId,selectedAdvisorId:t?null:e().selectedAdvisorId}),dismissToast:t=>n(i=>({toasts:i.toasts.filter(r=>r.id!==t)})),resolvePermission:(t,i)=>{const r=e().send;r({type:"permission_response",requestId:t,approved:i}),n(s=>{const o={...s.pendingPermissions};return delete o[t],{pendingPermissions:o}})},invokeAdvisor:(t,i)=>{const r=e().send,s=e().selectedSessionId??void 0;r({type:"invoke_advisor",advisorId:t,targetSessionId:s,prompt:i})},pinAdvisor:t=>{e().send({type:"pin_advisor",advisorId:t})},unpinAdvisor:t=>{e().send({type:"unpin_advisor",advisorId:t})},sendPromptTo:(t,i)=>{if(!i.trim())return;e().send({type:"send_prompt",sessionId:t,text:i});const r={messageId:`pending-${Date.now()}`,role:"user",content:i,ts:Date.now(),done:!0,receivedAt:Date.now()};n(s=>({chatBySessionId:{...s.chatBySessionId,[t]:[...s.chatBySessionId[t]??[],r].slice(-200)}}))},launchTask:(t,i,r,s)=>{e().send({type:"launch_session",cwd:t,model:i,initialPrompt:r,worktreeBranch:s==null?void 0:s.worktreeBranch,worktreeBaseRef:s==null?void 0:s.worktreeBaseRef,useAgentView:s==null?void 0:s.useAgentView,agentName:s==null?void 0:s.agentName})},selectedSessionIds:new Set,toggleSessionSelection:t=>{n(i=>{const r=new Set(i.selectedSessionIds);return r.has(t)?r.delete(t):r.add(t),{selectedSessionIds:r}})},clearSessionSelection:()=>{n({selectedSessionIds:new Set})},terminateSessions:t=>{const i=e().send;for(const r of t)i({type:"terminate_session",sessionId:r});n({selectedSessionIds:new Set})},setMotionEnabled:t=>{Kx(t),n({motionEnabled:t})},toggleMotion:()=>{const t=!e().motionEnabled;Kx(t),n({motionEnabled:t})},setViewMode:t=>{Jx(t),n({viewMode:t})},toggleViewMode:()=>{const t=["galaxy","list","missions"],i=e().viewMode,r=t.indexOf(i),s=t[(r+1)%t.length]??"galaxy";Jx(s),n({viewMode:s})},enterPlayback:(t,i,r)=>{const s=i;n(o=>({playback:{...o.playback,active:!0,loading:!1,events:t,earliestMs:i,latestMs:r,currentMs:s,playing:!1,...$x(t,s,e().sessions,e().missions)}}))},exitPlayback:()=>n({playback:qx}),setPlaybackTime:t=>{n(i=>{const r=Math.max(i.playback.earliestMs,Math.min(t,i.playback.latestMs));return{playback:{...i.playback,currentMs:r,...$x(i.playback.events,r,e().sessions,e().missions)}}})},setPlaybackSpeed:t=>n(i=>({playback:{...i.playback,speed:t}})),setPlaybackPlaying:t=>n(i=>({playback:{...i.playback,playing:t}})),setPlaybackLoading:t=>n(i=>({playback:{...i.playback,loading:t}})),send:()=>{},attachSocket:t=>n({send:t})}));function Fm(n){return n.playback.active?n.playback.derivedSessions:n.sessions}function iS(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind!=="advisor")}function PE(n){return Object.values(Fm(n)).filter(e=>!e.parentSessionId&&e.kind==="advisor")}function z3(n,e){return Object.values(Fm(n)).filter(t=>t.parentSessionId===e)}function V3(n){return Object.values(n.advisors).filter(e=>e.enabled)}function H3(n){return Object.values(n.skills)}function IE(n){switch(n){case"opus":return"#a855f7";case"sonnet":return"#3b82f6";case"haiku":return"#06b6d4";case"default":return"#94a3b8";default:return"#94a3b8"}}function G3(n){switch(n){case"active":return{color:"#fde68a",intensity:.3};case"awaiting_permission":return{color:"#ef4444",intensity:.5};case"awaiting_input":return{color:"#f59e0b",intensity:.25};case"plan_review":return{color:"#a78bfa",intensity:.2};case"error":return{color:"#dc2626",intensity:.3};case"spawning":return{color:"#ffffff",intensity:.2};case"idle":default:return{color:"#1e293b",intensity:.05}}}function rS(n){switch(n){case"active":return"Active";case"awaiting_permission":return"Permission";case"awaiting_input":return"Awaiting input";case"plan_review":return"Plan review";case"error":return"Error";case"spawning":return"Spawning";case"terminated":return"Terminated";case"idle":default:return"Idle"}}function NE(n,e,t){const i=[];let r=30;switch(n.status){case"error":r=0,i.push("In error state");break;case"plan_review":case"awaiting_input":r=15,i.push(`Status: ${n.status}`);break;case"awaiting_permission":r=12,i.push("Awaiting permission");break;case"terminated":r=5,i.push("Terminated");break;default:r=30}const s=Math.max(0,30-t*15);t>0&&i.push(`${t} pending permission${t===1?"":"s"}`);const a=25*Math.max(0,1-n.contextUsagePct/100);n.contextUsagePct>=90?i.push(`Context at ${n.contextUsagePct.toFixed(0)}%`):n.contextUsagePct>=80&&i.push(`Context warm (${n.contextUsagePct.toFixed(0)}%)`);let l=0;if(e&&e.status==="active"){const u=e.metrics.toolCallCount;l=Math.min(15,u*2)}else e&&e.status==="completed"&&(l=15);return{score:Math.round(Math.max(0,Math.min(100,r+s+a+l))),reasons:i}}function LE(n){return n>=75?"#10b981":n>=50?"#fbbf24":n>=25?"#f97316":"#ef4444"}const Bm={active:"The agent is currently working — emitting tool calls or generating output.",idle:"No mission running. The agent is waiting for the next prompt or has been quiet for a while.",spawning:"The agent process just started. It will transition to active within a second or two.",awaiting_permission:"The agent paused to ask permission for a sensitive tool call. Approve or deny in the Decision Queue.",awaiting_input:"The agent finished what it could and is waiting for your next prompt.",plan_review:"The agent produced a plan and is waiting for your approval before executing.",error:"The agent crashed or hit an unrecoverable error. Look at the SidePanel transcript for details.",terminated:"The agent process exited. No more activity will come from this session.",subagent:"A child agent spawned by another session (typically via the Task tool). Rendered as a moon orbiting the parent planet.",advisor:"A long-lived specialist agent (Compass, Forge, Lumen, Argus, Sentinel, …) with its own AGENT.md describing its role.",pinned:"An advisor that's always running. Pinned advisors orbit close to the sun in the inner ring."},Qx={awaiting_permission:0,awaiting_input:1,plan_review:2,error:3,active:4,spawning:5,idle:6,terminated:7};function DE(){const n=Ee(iS),e=Ee(PE),t=Ee(_=>_.projects),i=Ee(_=>_.missions),r=Ee(_=>_.pendingPermissions),s=Ee(_=>_.selectSession),o=Ee(_=>_.selectedSessionIds),a=Ee(_=>_.toggleSessionSelection),l=Ee(_=>_.clearSessionSelection),c=Ee(_=>_.terminateSessions),[u,d]=Pe.useState("needs"),[h,p]=Pe.useState("asc"),m=Pe.useMemo(()=>{const _=[...n,...e],R=new Set(Object.values(r).map(w=>w.sessionId));return _.map(w=>{const A=w.currentMissionId?i[w.currentMissionId]:void 0,b=Object.values(r).filter(L=>L.sessionId===w.id).length,{score:E,reasons:M}=NE(w,A,b);return{session:w,project:t[w.projectId],mission:A,needsAttention:R.has(w.id)||w.status==="awaiting_permission"||w.status==="awaiting_input"||w.status==="plan_review",health:E,healthReasons:M}})},[n,e,t,i,r]),y=Pe.useMemo(()=>{var R;const _=new Map;for(const w of m){const A=((R=w.project)==null?void 0:R.id)??"_",b=_.get(A);b?b.rows.push(w):_.set(A,{project:w.project,rows:[w]})}return[..._.values()].sort((w,A)=>{var b,E;return(((b=A.project)==null?void 0:b.lastActiveAt)??0)-(((E=w.project)==null?void 0:E.lastActiveAt)??0)})},[m]),x=(_,R)=>{var A,b;const w=h==="asc"?1:-1;switch(u){case"name":return((_.session.name??_.session.id)>(R.session.name??R.session.id)?1:-1)*w;case"status":return((Qx[_.session.status]??99)-(Qx[R.session.status]??99))*w;case"progress":return((((A=_.mission)==null?void 0:A.metrics.toolCallCount)??0)-(((b=R.mission)==null?void 0:b.metrics.toolCallCount)??0))*w;case"context":return(_.session.contextUsagePct-R.session.contextUsagePct)*w;case"lastActivity":return(_.session.updatedAt-R.session.updatedAt)*w;case"needs":return _.needsAttention===R.needsAttention?0:_.needsAttention?-1*w:1*w;case"health":return(_.health-R.health)*w}},f=_=>{u===_?p(h==="asc"?"desc":"asc"):(d(_),p(_==="lastActivity"?"desc":"asc"))},v=_=>u!==_?"":h==="asc"?" ▲":" ▼",g=o.size;return S.jsxs("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-20 px-6 z-0",children:[g>0&&S.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 pointer-events-auto",children:S.jsxs("div",{className:"rounded-full border border-solix-accent/60 bg-solix-panel/95 backdrop-blur shadow-2xl px-4 py-2 flex items-center gap-3",children:[S.jsxs("span",{className:"text-xs text-slate-200 font-mono",children:[g," selected"]}),S.jsx("button",{onClick:()=>c([...o]),className:"text-xs px-3 py-1 rounded border border-solix-danger text-solix-danger hover:bg-solix-danger/15",children:"Terminate"}),S.jsx("button",{onClick:l,className:"text-xs text-slate-400 hover:text-slate-200",children:"Clear"})]})}),S.jsxs("div",{className:"max-w-6xl mx-auto",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest mb-3",children:["List view · ",m.length," agent",m.length===1?"":"s"]}),m.length===0?S.jsxs("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:["No agents yet. Run ",S.jsx("code",{children:"claude"})," in any terminal — a row will appear here within a second."]}):y.map(({project:_,rows:R})=>{const w=[...R].sort(x),A=(_==null?void 0:_.name)??"(unassigned)";return S.jsxs("section",{className:"mb-8 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:A}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[R.length," agent",R.length===1?"":"s"]})]}),(_==null?void 0:_.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:_.cwd})]}),S.jsxs("table",{className:"w-full text-sm",children:[S.jsx("thead",{className:"bg-black/30 text-[10px] uppercase tracking-wide text-slate-500",children:S.jsxs("tr",{children:[S.jsx(Ri,{children:S.jsx("input",{type:"checkbox","aria-label":"Select all in project",checked:w.length>0&&w.every(b=>o.has(b.session.id)),onChange:b=>{b.stopPropagation();const E=w.every(M=>o.has(M.session.id));for(const M of w){const L=o.has(M.session.id);(E&&L||!E&&!L)&&a(M.session.id)}},className:"cursor-pointer"})}),S.jsxs(Ri,{onClick:()=>f("needs"),children:["● ",v("needs")]}),S.jsxs(Ri,{onClick:()=>f("name"),children:["Agent",v("name")]}),S.jsx(Ri,{children:"Advisor"}),S.jsxs(Ri,{onClick:()=>f("status"),children:["Status",v("status")]}),S.jsxs(Ri,{onClick:()=>f("health"),numeric:!0,children:["Health",v("health")]}),S.jsxs(Ri,{onClick:()=>f("progress"),children:["Mission · tools",v("progress")]}),S.jsxs(Ri,{onClick:()=>f("context"),numeric:!0,children:["Context",v("context")]}),S.jsxs(Ri,{onClick:()=>f("lastActivity"),numeric:!0,children:["Last activity",v("lastActivity")]})]})}),S.jsx("tbody",{children:w.map(b=>{var E;return S.jsxs("tr",{onClick:()=>s(b.session.id),className:`border-t border-solix-border hover:bg-solix-border/20 cursor-pointer ${b.needsAttention?"bg-solix-danger/5":""} ${o.has(b.session.id)?"bg-solix-accent/5":""}`,children:[S.jsx("td",{className:"px-3 py-2",onClick:M=>M.stopPropagation(),children:S.jsx("input",{type:"checkbox","aria-label":"Select agent",checked:o.has(b.session.id),onChange:()=>a(b.session.id),className:"cursor-pointer"})}),S.jsx("td",{className:"px-3 py-2",children:b.needsAttention?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-danger solix-pulse"}):b.session.status==="active"?S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-solix-ok"}):S.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-slate-600"})}),S.jsx("td",{className:"px-3 py-2",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:IE(b.session.model)},title:String(b.session.model)}),S.jsx("span",{className:"text-slate-100 font-medium",children:b.session.name??b.session.id.slice(0,8)}),b.session.kind==="advisor"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-amber-300",children:"advisor"}),b.session.origin==="agentview"&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-cyan-300",title:"Background session managed by Anthropic's Agent View",children:"agent"}),b.session.wrapperSocketPath&&S.jsx("span",{className:"text-[9px] uppercase tracking-wide text-solix-accent",title:"Wrapped by `solix run` — UI composer is enabled",children:"wrapped"}),b.session.worktreePath&&S.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded border border-solix-accent/40 text-solix-accent",title:b.session.worktreePath,children:["⌥",UE(b.session.worktreePath)]})]})}),S.jsx("td",{className:"px-3 py-2 text-xs",children:S.jsx(OE,{session:b.session,mission:b.mission})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300",title:Bm[b.session.status]??void 0,children:rS(b.session.status)}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(FE,{score:b.health,reasons:b.healthReasons})}),S.jsx("td",{className:"px-3 py-2 text-xs text-slate-300 truncate max-w-xs",title:b.session.agentViewSummary??((E=b.mission)==null?void 0:E.shortName)??void 0,children:b.session.agentViewSummary?S.jsx("span",{className:"text-slate-100 italic",children:b.session.agentViewSummary}):b.mission?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"text-slate-100",children:b.mission.shortName}),S.jsxs("span",{className:"text-slate-500 ml-1",children:["· ",b.mission.metrics.toolCallCount," tools"]})]}):S.jsx("span",{className:"text-slate-500 italic",children:"idle"})}),S.jsx("td",{className:"px-3 py-2 text-right",children:S.jsx(BE,{pct:b.session.contextUsagePct})}),S.jsx("td",{className:"px-3 py-2 text-right text-[11px] text-slate-500 font-mono",children:zE(b.session.updatedAt)})]},b.session.id)})})]})]},(_==null?void 0:_.id)??"_")})]})]})}function UE(n){const e=n.split("/").filter(Boolean);return e[e.length-1]??n}const kE=/^\[Acting as ([^\s—]+)/;function OE({session:n,mission:e}){var s;const t=Ee(o=>o.advisors);let i,r=!1;if(n.advisorRole)i=Object.values(t).find(o=>o.id===n.advisorRole);else if(e!=null&&e.prompt){const o=e.prompt.match(kE),a=(s=o==null?void 0:o[1])==null?void 0:s.toLowerCase();a&&(i=Object.values(t).find(l=>l.codename.toLowerCase()===a),r=!0)}return i?S.jsxs("span",{className:`inline-flex items-center gap-1 ${r?"opacity-60":""}`,title:i.description,children:[S.jsx("span",{style:{color:i.color},children:i.glyph}),S.jsx("span",{className:"text-slate-200",children:i.codename})]}):S.jsx("span",{className:"text-slate-700",children:"—"})}function Ri({children:n,onClick:e,numeric:t}){return S.jsx("th",{onClick:e,className:`px-3 py-2 select-none ${t?"text-right":"text-left"} ${e?"cursor-pointer hover:text-slate-300":""}`,children:n})}function FE({score:n,reasons:e}){const t=LE(n);return S.jsxs("div",{className:"relative inline-flex items-center gap-2 group",children:[S.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:t},children:n}),S.jsx("div",{className:"w-16 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:"h-full",style:{width:`${Math.max(2,n)}%`,background:t}})}),S.jsxs("div",{className:"pointer-events-none absolute right-0 top-full mt-1 z-50 hidden group-hover:block w-64 rounded border border-solix-border bg-solix-panel/95 backdrop-blur p-2 text-left shadow-xl",children:[S.jsxs("div",{className:"flex items-center justify-between mb-1",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-wide text-slate-400",children:"Health"}),S.jsxs("span",{className:"text-xs font-bold",style:{color:t},children:[n,"/100"]})]}),e.length===0?S.jsx("div",{className:"text-[11px] text-slate-400 italic",children:"All four bands healthy: stable status, no pending decisions, context budget, mission progress."}):S.jsx("ul",{className:"space-y-0.5",children:e.map(i=>S.jsxs("li",{className:"text-[11px] text-slate-200 leading-snug",children:["· ",i]},i))})]})]})}function BE({pct:n}){const e=n>=90?"bg-solix-danger":n>=80?"bg-solix-warn":"bg-solix-accent";return S.jsxs("div",{className:"inline-flex items-center gap-2",children:[S.jsxs("span",{className:"text-[11px] text-slate-400 font-mono",children:[n.toFixed(0),"%"]}),S.jsx("div",{className:"w-20 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${e}`,style:{width:`${Math.min(100,n)}%`}})})]})}function zE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<60)return`${i}m`;const r=Math.floor(i/60);return r<24?`${r}h`:new Date(n).toLocaleDateString()}function VE(){const n=Ee(l=>l.missions),e=Ee(l=>l.sessions),t=Ee(l=>l.projects),i=Ee(l=>l.selectSession),[r,s]=Pe.useState("all"),o=Pe.useMemo(()=>{const l=Object.values(n).sort((c,u)=>u.startedAt-c.startedAt);return r==="all"?l:l.filter(c=>c.status===r)},[n,r]),a=Pe.useMemo(()=>{const l=new Map;for(const c of o){const u=e[c.sessionId],d=u?t[u.projectId]:void 0,h=(d==null?void 0:d.id)??"_",p=l.get(h);p?p.missions.push(c):l.set(h,{project:d,missions:[c]})}return[...l.values()].sort((c,u)=>{var d,h;return(((d=u.missions[0])==null?void 0:d.startedAt)??0)-(((h=c.missions[0])==null?void 0:h.startedAt)??0)})},[o,e,t]);return S.jsx("div",{className:"absolute inset-0 overflow-y-auto bg-solix-bg pt-20 pb-8 px-6 z-0",children:S.jsxs("div",{className:"max-w-4xl mx-auto",children:[S.jsxs("div",{className:"flex items-center justify-between mb-3",children:[S.jsxs("div",{className:"text-xs text-slate-500 uppercase tracking-widest",children:["Missions · ",o.length]}),S.jsx("div",{className:"flex items-center gap-1.5",children:["all","active","completed","failed","cancelled"].map(l=>S.jsx("button",{onClick:()=>s(l),className:`text-[10px] px-2 py-0.5 rounded border ${r===l?"bg-solix-accent/15 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:l},l))})]}),o.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic py-12 text-center border border-solix-border rounded",children:"No missions yet. Send a prompt to a Claude Code session and a mission card will appear here."}):a.map(({project:l,missions:c})=>{const u=(l==null?void 0:l.name)??"(unassigned)";return S.jsxs("section",{className:"mb-6 rounded border border-solix-border overflow-hidden",children:[S.jsxs("header",{className:"bg-solix-panel/60 px-4 py-2 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:u}),S.jsxs("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-slate-500",children:[c.length," mission",c.length===1?"":"s"]})]}),(l==null?void 0:l.cwd)&&S.jsx("span",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[55%]",children:l.cwd})]}),S.jsx("ul",{className:"divide-y divide-solix-border",children:c.map(d=>{const h=e[d.sessionId];return S.jsx("li",{children:S.jsxs("button",{onClick:()=>i(d.sessionId),className:"w-full text-left p-4 hover:bg-solix-border/20 cursor-pointer block",children:[S.jsxs("div",{className:"flex items-start justify-between gap-3",children:[S.jsxs("div",{className:"min-w-0 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-semibold text-slate-100",children:d.shortName}),S.jsx(HE,{status:d.status})]}),S.jsx("div",{className:"mt-1 text-xs text-slate-400 line-clamp-2",children:d.prompt}),d.longSummary&&S.jsx("div",{className:"mt-1 text-xs text-slate-300 italic",children:d.longSummary}),d.status==="failed"&&d.errorSummary&&S.jsxs("div",{className:"mt-1 text-xs text-solix-danger italic line-clamp-2",children:["error: ",d.errorSummary]})]}),S.jsxs("div",{className:"text-right text-[10px] text-slate-500 font-mono whitespace-nowrap",children:[WE(d.startedAt),d.metrics.durationMs!==void 0&&S.jsxs("div",{children:[(d.metrics.durationMs/1e3).toFixed(1),"s"]})]})]}),S.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-slate-500",children:[h&&S.jsxs("span",{children:["agent:"," ",S.jsx("span",{className:"text-slate-300",children:h.name??h.id.slice(0,8)})]}),S.jsxs("span",{children:[d.metrics.toolCallCount," tools"]}),S.jsxs("span",{title:Bm.subagent,children:[d.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[d.filesTouched.length," files"]})]}),d.filesTouched.length>0&&S.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[d.filesTouched.slice(0,6).map(p=>S.jsx("span",{className:"text-[10px] font-mono text-slate-400 bg-black/30 border border-solix-border rounded px-1.5 py-0.5",children:GE(p)},p)),d.filesTouched.length>6&&S.jsxs("span",{className:"text-[10px] text-slate-500",children:["+",d.filesTouched.length-6]})]})]})},d.id)})})]},(l==null?void 0:l.id)??"_")})]})})}function HE({status:n}){const e=n==="active"?"border-solix-warn text-solix-warn":n==="completed"?"border-solix-ok text-solix-ok":n==="failed"?"border-solix-danger text-solix-danger":"border-solix-border text-slate-400";return S.jsx("span",{className:`text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded border ${e}`,children:n})}function GE(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function WE(n){const e=Date.now()-n;if(e<0)return"now";const t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;const i=Math.floor(t/60);if(i<60)return`${i}m ago`;const r=Math.floor(i/60);return r<24?`${r}h ago`:new Date(n).toLocaleDateString()}function jE({onOpenGalaxy:n,onNewTask:e,onOpenTimeline:t,onOpenHelp:i}={}){const r=Ee(u=>u.connected),s=Ee(iS),o=Ee(u=>u.viewMode),a=Ee(u=>u.playback.active),l=Ee(u=>u.exitPlayback),c=s.reduce((u,d)=>(d.status==="active"?u.active+=1:d.status==="awaiting_permission"||d.status==="awaiting_input"||d.status==="plan_review"?u.attention+=1:d.status==="idle"&&(u.idle+=1),u),{active:0,idle:0,attention:0});return S.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-4 z-40",children:[S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3",children:[S.jsxs("div",{className:"flex items-baseline gap-1.5",children:[S.jsx("div",{className:"text-xl font-bold tracking-widest text-solix-accent",children:"SOLIX"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500",title:"Solix v1.5.0 — built into this UI bundle",children:["v","1.5.0"]})]}),S.jsx("div",{className:"hidden md:block text-xs text-slate-400",children:"a solar-system command center"}),S.jsx("div",{className:`ml-1 sm:ml-3 px-2 py-1 rounded text-[10px] border ${r?"border-solix-ok text-solix-ok":"border-solix-danger text-solix-danger solix-pulse"}`,children:r?"CONNECTED":"OFFLINE"}),a&&S.jsxs("button",{onClick:l,className:"ml-2 px-2 py-1 rounded text-[10px] border border-solix-accent text-solix-accent solix-pulse hover:bg-solix-accent/15 cursor-pointer flex items-center gap-1.5",title:"Exit Timeline Playback (Esc)","aria-label":"Exit playback",children:[S.jsx("span",{children:"▸ PLAYBACK"}),S.jsx("span",{className:"opacity-70",children:"· exit ✕"})]})]}),S.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 sm:gap-3 text-xs",children:[S.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[S.jsx(Hh,{label:"active",value:c.active,color:"text-solix-ok"}),S.jsx(Hh,{label:"attention",value:c.attention,color:"text-solix-warn"}),S.jsx(Hh,{label:"idle",value:c.idle,color:"text-slate-400"})]}),S.jsx(XE,{viewMode:o}),t&&S.jsx("button",{onClick:t,className:"hidden sm:inline-block px-2 py-1 rounded bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30",title:"Timeline playback (T)",children:"⏱ Timeline"}),e&&S.jsx("button",{onClick:e,className:"px-2 py-1 rounded bg-solix-ok/15 border border-solix-ok/40 text-solix-ok hover:bg-solix-ok/25",title:"Launch a new Claude Code task (L)",children:"+ Task"}),n&&S.jsx("button",{onClick:n,className:"px-2 py-1 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent hover:bg-solix-accent/25",title:"Galaxy: export and import (G)",children:"⌬ Galaxy"}),i&&S.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-solix-panel border border-solix-border text-slate-300 hover:text-white hover:bg-solix-border/30 text-sm",title:"Help (?)","aria-label":"Help",children:"?"})]})]})}function XE({viewMode:n}){const e=Ee(i=>i.setViewMode),t=[{mode:"galaxy",label:"🪐"},{mode:"list",label:"☰"},{mode:"missions",label:"◎"}];return S.jsx("div",{className:"inline-flex rounded border border-solix-border bg-solix-panel overflow-hidden",children:t.map(i=>S.jsxs("button",{onClick:()=>e(i.mode),className:`px-2 py-1 text-xs ${n===i.mode?"bg-solix-border/50 text-white":"text-slate-400 hover:text-slate-100"}`,title:`${i.mode} view (V)`,children:[i.label," ",S.jsx("span",{className:"hidden sm:inline capitalize",children:i.mode})]},i.mode))})}function Hh({label:n,value:e,color:t}){return S.jsxs("div",{className:"px-2 py-1 rounded bg-solix-panel border border-solix-border",children:[S.jsx("span",{className:`font-bold ${t}`,children:e}),S.jsx("span",{className:"ml-1 opacity-60 uppercase tracking-wide",children:n})]})}function YE(){const n=Ee(t=>t.toasts),e=Ee(t=>t.dismissToast);return S.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col gap-2 z-30",children:n.map(t=>S.jsx("button",{onClick:()=>e(t.id),className:`pointer-events-auto px-3 py-2 rounded text-xs border max-w-md text-left ${t.level==="error"?"bg-solix-danger/10 border-solix-danger text-solix-danger":t.level==="warn"?"bg-solix-warn/10 border-solix-warn text-solix-warn":"bg-solix-panel border-solix-border text-slate-200"}`,children:t.message},t.id))})}const e0="solix.welcome.dismissed.v1";function $E({onOpenGalaxy:n,forceOpen:e=!1,onClose:t}){const[i,r]=Pe.useState(!1),s=Ee(u=>u.advisors),o=Ee(u=>Object.keys(u.skills).length),a=Ee(u=>Object.keys(u.sessions).length);if(Pe.useEffect(()=>{try{r(localStorage.getItem(e0)==="1")}catch{}},[]),!e&&(i||a>0))return null;const l=()=>{try{localStorage.setItem(e0,"1")}catch{}r(!0),t==null||t()},c=Object.values(s).filter(u=>u.enabled).sort((u,d)=>u.codename.localeCompare(d.codename));return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto max-w-xl w-full mx-4 rounded-xl border border-solix-accent/40 bg-solix-panel/95 backdrop-blur-md shadow-2xl",children:[S.jsxs("div",{className:"px-6 pt-5 pb-3 border-b border-solix-border",children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"welcome"}),S.jsx("div",{className:"text-2xl font-bold mt-1",children:"Solix — your agent solar system"}),S.jsx("div",{className:"text-sm text-slate-400 mt-1",children:"Mission control for Claude Code. Each agent orbits the sun; each click is a conversation with one of your planets."})]}),S.jsxs("div",{className:"px-6 py-4 space-y-3 text-sm text-slate-300",children:[S.jsx(ta,{n:1,title:"Run a Claude Code session",body:S.jsxs(S.Fragment,{children:["Open a terminal anywhere and run"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude"}),". A planet will appear here within a second."]})}),S.jsx(ta,{n:2,title:"Or seed the demo state",body:S.jsxs(S.Fragment,{children:["In another terminal:"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix demo"}),". You'll get 3 planets, a moon, a permission flare, and a pinned advisor — without running Claude Code."]})}),S.jsx(ta,{n:3,title:"Meet the advisor crew",body:S.jsxs(S.Fragment,{children:[c.length>0?`${c.length} crew members loaded. Click any in the inner ring to read their role and invoke them on the focused planet.`:"Crew loading…",c.length>0&&S.jsx("ul",{className:"mt-2 space-y-1",children:c.map(u=>S.jsxs("li",{className:"flex items-baseline gap-2",children:[S.jsxs("span",{className:"font-mono text-xs",style:{color:u.color},children:[u.glyph," ",u.codename]}),S.jsx("span",{className:"text-slate-500 text-xs",children:"—"}),S.jsx("span",{className:"text-slate-300 text-xs",children:u.name})]},u.id))})]})}),S.jsx(ta,{n:4,title:"Browse the asteroid belt",body:S.jsxs(S.Fragment,{children:["Each asteroid is a Skill (",o," discovered). Click one to read its SKILL.md and see which advisors require it."]})}),S.jsx(ta,{n:5,title:"Share your galaxy",body:S.jsxs(S.Fragment,{children:["Press"," ",S.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px]",children:"G"})," ","or click ",S.jsx("span",{className:"text-solix-accent",children:"⌬ Galaxy"})," ","in the top bar to export, import, publish, or install a galaxy from a registry."]})})]}),S.jsxs("div",{className:"px-6 pb-3 pt-1",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-widest text-slate-500 mb-1.5",children:"Keyboard shortcuts"}),S.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-slate-400",children:[S.jsx(pi,{k:"V",children:"cycle Galaxy → List → Missions"}),S.jsx(pi,{k:"G",children:"toggle Galaxy panel"}),S.jsx(pi,{k:"L",children:"new task"}),S.jsx(pi,{k:"T",children:"timeline"}),S.jsx(pi,{k:"M",children:"jump to Missions"}),S.jsx(pi,{k:"Y",children:"approve top decision"}),S.jsx(pi,{k:"N",children:"deny top decision"}),S.jsx(pi,{k:"Space",children:"play / pause orbits"}),S.jsx(pi,{k:"?",children:"re-open this help"}),S.jsx(pi,{k:"Esc",children:"close panels / exit playback"})]}),S.jsx("div",{className:"text-[10px] text-slate-500 italic mt-2",children:"If clicks feel stuck, a third-party screen overlay (note-taker, recorder) may be intercepting. Quit it temporarily, or use the shortcuts above."})]}),S.jsxs("div",{className:"px-6 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:()=>{n(),l()},className:"px-3 py-1.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent text-xs hover:bg-solix-accent/25",children:"Open Galaxy panel"}),S.jsx("div",{className:"flex-1"}),S.jsxs("span",{className:"text-[10px] font-mono text-slate-500 mr-2",children:["Solix v","1.5.0"]}),S.jsx("button",{onClick:l,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Got it"})]})]})})}function pi({k:n,children:e}){return S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-black/50 border border-solix-border text-[10px] font-mono text-slate-300",children:n}),S.jsx("span",{className:"truncate",children:e})]})}function ta({n,title:e,body:t}){return S.jsxs("div",{className:"flex gap-3",children:[S.jsx("div",{className:"shrink-0 w-6 h-6 rounded-full bg-solix-accent/20 border border-solix-accent/40 text-solix-accent text-xs flex items-center justify-center",children:n}),S.jsxs("div",{children:[S.jsx("div",{className:"text-slate-100 font-medium text-sm",children:e}),S.jsx("div",{className:"text-slate-400 text-xs mt-0.5 leading-relaxed",children:t})]})]})}function qE(n,e,t,i){const r=Gh(i,"command"),s=Gh(i,"file_path"),o=Gh(i,"url");if(t==="Bash"&&r){if(/\brm\s+-rf\b/i.test(r)||/\bsudo\b/i.test(r))return{severity:"danger",text:"Destructive command. Deny unless you have already confirmed the diff."};if(/--no-verify\b/.test(r))return{severity:"warn",text:"Skipping pre-commit hooks. Investigate the failure first."};if(/git\s+push.*--force\b/.test(r))return{severity:"danger",text:"Force-push. Confirm no one else has pushed since."};if(/git\s+push/.test(r)&&/\b(main|master|prod|production)\b/.test(r))return{severity:"warn",text:"Pushing to main/prod. Confirm the diff first."};if(/git\s+reset\s+--hard\b/.test(r))return{severity:"warn",text:"Hard reset will discard uncommitted changes. Stash first if unsure."}}if((t==="Edit"||t==="Write"||t==="MultiEdit")&&s){if(/\.env(\b|\.|\/)|credentials\.json|\.pem$|\.key$/i.test(s))return{severity:"danger",text:"Editing a secrets file. Make sure the agent really needs to."};if(/(^|\/)\.git\//.test(s))return{severity:"warn",text:"Editing inside .git/. Almost certainly a mistake."}}if(t==="WebFetch"&&o){if(/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)/.test(o))return null;if(/^http:\/\//.test(o))return{severity:"info",text:"Plain HTTP fetch. OK for known internal hosts."}}return n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Run /compact before continuing.`}:null}function ZE(n,e){return n.status==="error"?{severity:"danger",text:"Session is in error state. Check the chat tab and consider restarting."}:n.contextUsagePct>=90?{severity:"warn",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Compact the conversation before the next prompt.`}:n.contextUsagePct>=80?{severity:"info",text:`Context at ${n.contextUsagePct.toFixed(0)}%. Watch out — output quality drops past 90.`}:e&&e.status==="active"&&e.metrics.toolCallCount===0&&Date.now()-e.startedAt>5*60*1e3?{severity:"info",text:"Active mission with no tool calls in 5+ minutes. Agent may be stuck."}:null}function Gh(n,e){const t=n[e];return typeof t=="string"?t:null}function KE(){const n=Ee(u=>u.pendingPermissions),e=Ee(u=>u.sessions),t=Ee(u=>u.missions),i=Ee(u=>u.resolvePermission),r=Ee(u=>u.selectSession),s=Object.values(n).sort((u,d)=>d.receivedAt-u.receivedAt),[o,a]=Pe.useState(!1),l=s.length;Pe.useEffect(()=>{l>0&&a(!1)},[l]);const c=u=>{r(u),a(!0)};return l===0?S.jsx("div",{className:"absolute top-20 right-4 z-30 pointer-events-none",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/60 backdrop-blur px-3 py-1 text-[10px] text-slate-500 flex items-center gap-2",children:[S.jsx("span",{className:"uppercase tracking-widest",children:"decisions"}),S.jsx("span",{className:"font-bold",children:"0"}),S.jsx("span",{className:"italic opacity-80",children:"— all clear"})]})}):S.jsxs("div",{className:"absolute top-20 right-4 z-30 w-80 flex flex-col gap-2 pointer-events-none",children:[S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-2 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[10px] uppercase tracking-widest text-slate-400",children:"Decisions"}),S.jsx("span",{className:"text-xs font-bold text-solix-danger",children:l})]}),S.jsx("button",{onClick:()=>a(u=>!u),className:"text-[10px] text-slate-400 hover:text-slate-100",children:o?"show":"hide"})]}),!o&&s.map(u=>{const d=e[u.sessionId],h=d!=null&&d.currentMissionId?t[d.currentMissionId]:void 0;return S.jsx(JE,{session:d,mission:h,tool:u.tool,args:u.args,onApprove:()=>i(u.requestId,!0),onDeny:()=>i(u.requestId,!1),onAsk:()=>c(u.sessionId)},u.requestId)})]})}function JE({session:n,mission:e,tool:t,args:i,onApprove:r,onDeny:s,onAsk:o}){const a=(n==null?void 0:n.name)??(n==null?void 0:n.id.slice(0,8))??"unknown agent",l=n!=null&&n.cwd?nT(n.cwd):"",c=n?qE(n,e,t,i):null;return S.jsxs("div",{className:"pointer-events-auto rounded border border-solix-danger bg-solix-danger/10 p-3 backdrop-blur shadow-lg",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-solix-danger",children:a}),l&&S.jsx("div",{className:"text-[10px] text-slate-500 truncate ml-2 max-w-[55%]",children:l})]}),e&&S.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 italic truncate",children:["mission: ",e.shortName]}),S.jsxs("div",{className:"mt-2 text-sm text-slate-100",children:[S.jsx("span",{className:"font-semibold",children:t}),S.jsx("span",{className:"ml-1 text-slate-300 text-xs break-words",children:iT(i)})]}),S.jsx(QE,{tool:t,args:i}),c&&S.jsx(tT,{suggestion:c}),S.jsxs("div",{className:"mt-3 flex gap-1.5",children:[S.jsx("button",{onClick:r,className:"flex-1 py-1.5 rounded bg-solix-ok/20 border border-solix-ok text-solix-ok text-xs hover:bg-solix-ok/30",children:"Approve · Y"}),S.jsx("button",{onClick:s,className:"flex-1 py-1.5 rounded bg-solix-danger/20 border border-solix-danger text-solix-danger text-xs hover:bg-solix-danger/30",children:"Deny · N"}),S.jsx("button",{onClick:o,className:"px-2.5 py-1.5 rounded border border-solix-border text-slate-300 text-xs hover:text-white hover:bg-solix-border/30",title:"Open chat with this agent for context",children:"Ask"})]})]})}function QE({tool:n,args:e}){const[t,i]=Pe.useState(!1);if(n==="Bash"){const r=rr(e,"command")??"",s=rr(e,"description");return r?S.jsxs(Wh,{label:"will run",children:[S.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-slate-100",children:r}),s&&S.jsx("div",{className:"mt-1 text-[10px] text-slate-500 italic",children:s})]}):null}if(n==="Edit"||n==="NotebookEdit"){const r=rr(e,"file_path")??rr(e,"notebook_path"),s=rr(e,"old_string"),o=rr(e,"new_string");return!r&&!s&&!o?null:S.jsxs(Wh,{label:"patch",children:[r&&S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(jh,{sign:"-",text:s,expanded:t,colorClass:"text-solix-danger bg-solix-danger/10"}),o&&S.jsx(jh,{sign:"+",text:o,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),(Xh(s)||Xh(o))&&S.jsx("button",{onClick:()=>i(a=>!a),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]})}if(n==="Write"){const r=rr(e,"file_path"),s=rr(e,"content")??"";return r?S.jsxs(Wh,{label:"will write",children:[S.jsx("div",{className:"font-mono text-[11px] text-solix-accent break-all",children:r}),s&&S.jsx(jh,{sign:"+",text:s,expanded:t,colorClass:"text-solix-ok bg-solix-ok/10"}),Xh(s)&&S.jsx("button",{onClick:()=>i(o=>!o),className:"mt-1 text-[10px] text-slate-400 hover:text-slate-100",children:t?"collapse":"expand"})]}):null}return null}function Wh({label:n,children:e}){return S.jsxs("div",{className:"mt-2 rounded border border-solix-border bg-black/30 px-2 py-1.5",children:[S.jsx("div",{className:"text-[9px] uppercase tracking-wider text-slate-500 mb-1",children:n}),e]})}function jh({sign:n,text:e,expanded:t,colorClass:i}){const r=t?e:eT(e,240);return S.jsxs("pre",{className:`mt-1 px-1.5 py-1 rounded text-[11px] font-mono whitespace-pre-wrap break-words ${i}`,children:[S.jsx("span",{className:"opacity-50 mr-1",children:n}),r]})}function rr(n,e){const t=n[e];return typeof t=="string"?t:void 0}function Xh(n){return!!(n&&n.length>240)}function eT(n,e){if(n.length<=e)return n;const t=Math.floor((e-3)/2);return`${n.slice(0,t)}
57
57
 
58
- ${n.slice(-t)}`}function tT({suggestion:n}){const e=n.severity==="danger"?"text-solix-danger border-solix-danger/40 bg-solix-danger/10":n.severity==="warn"?"text-solix-warn border-solix-warn/40 bg-solix-warn/10":"text-slate-300 border-solix-border bg-black/20";return S.jsxs("div",{className:`mt-2 px-2 py-1 rounded border text-[11px] leading-snug ${e}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),n.text]})}function nT(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function iT(n){const e=Object.keys(n);return e.length?e.slice(0,2).map(i=>{const r=n[i],s=typeof r=="string"?r:JSON.stringify(r);return`${i}=${s.length>40?s.slice(0,40)+"…":s}`}).join(" · "):""}const t0="solix.scenehint.dismissed.v1";function rT(){const n=Ee(o=>o.motionEnabled),e=Ee(o=>o.viewMode),t=Ee(o=>o.toggleMotion),[i,r]=Ie.useState(!0);Ie.useEffect(()=>{try{r(localStorage.getItem(t0)==="1")}catch{}},[]);const s=()=>{try{localStorage.setItem(t0,"1")}catch{}r(!0)};return S.jsxs(S.Fragment,{children:[e==="galaxy"&&!i&&S.jsx("div",{className:"pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 z-20",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-1.5 text-[11px] text-slate-300 flex items-center gap-3",children:[S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"drag"}),"pan"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"scroll"}),"zoom"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"space"}),"pause"]}),S.jsx("button",{onClick:s,className:"ml-1 text-slate-500 hover:text-slate-100","aria-label":"Dismiss hint",children:"✕"})]})}),S.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-20",children:S.jsx("button",{onClick:t,title:`${n?"Pause":"Play"} orbital motion (Space)`,className:`pointer-events-auto w-10 h-10 rounded-full text-base flex items-center justify-center border backdrop-blur transition-colors ${n?"bg-solix-accent/20 border-solix-accent text-solix-accent":"bg-solix-panel/80 border-solix-border text-slate-300 hover:bg-solix-border/40 hover:text-white"}`,children:n?"⏸":"▶"})})]})}/**
58
+ ${n.slice(-t)}`}function tT({suggestion:n}){const e=n.severity==="danger"?"text-solix-danger border-solix-danger/40 bg-solix-danger/10":n.severity==="warn"?"text-solix-warn border-solix-warn/40 bg-solix-warn/10":"text-slate-300 border-solix-border bg-black/20";return S.jsxs("div",{className:`mt-2 px-2 py-1 rounded border text-[11px] leading-snug ${e}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),n.text]})}function nT(n){const e=n.match(/[^/\\]+\/?$/);return e?e[0].replace(/\/$/,""):n}function iT(n){const e=Object.keys(n);return e.length?e.slice(0,2).map(i=>{const r=n[i],s=typeof r=="string"?r:JSON.stringify(r);return`${i}=${s.length>40?s.slice(0,40)+"…":s}`}).join(" · "):""}const t0="solix.scenehint.dismissed.v1";function rT(){const n=Ee(o=>o.motionEnabled),e=Ee(o=>o.viewMode),t=Ee(o=>o.toggleMotion),[i,r]=Pe.useState(!0);Pe.useEffect(()=>{try{r(localStorage.getItem(t0)==="1")}catch{}},[]);const s=()=>{try{localStorage.setItem(t0,"1")}catch{}r(!0)};return S.jsxs(S.Fragment,{children:[e==="galaxy"&&!i&&S.jsx("div",{className:"pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 z-20",children:S.jsxs("div",{className:"pointer-events-auto rounded-full border border-solix-border bg-solix-panel/85 backdrop-blur px-3 py-1.5 text-[11px] text-slate-300 flex items-center gap-3",children:[S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"drag"}),"pan"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"scroll"}),"zoom"]}),S.jsxs("span",{children:[S.jsx("kbd",{className:"px-1 py-0.5 rounded bg-black/40 border border-solix-border text-[10px] mr-1",children:"space"}),"pause"]}),S.jsx("button",{onClick:s,className:"ml-1 text-slate-500 hover:text-slate-100","aria-label":"Dismiss hint",children:"✕"})]})}),S.jsx("div",{className:"pointer-events-none absolute bottom-4 right-4 z-20",children:S.jsx("button",{onClick:t,title:`${n?"Pause":"Play"} orbital motion (Space)`,className:`pointer-events-auto w-10 h-10 rounded-full text-base flex items-center justify-center border backdrop-blur transition-colors ${n?"bg-solix-accent/20 border-solix-accent text-solix-accent":"bg-solix-panel/80 border-solix-border text-slate-300 hover:bg-solix-border/40 hover:text-white"}`,children:n?"⏸":"▶"})})]})}/**
59
59
  * @license
60
60
  * Copyright 2010-2024 Three.js Authors
61
61
  * SPDX-License-Identifier: MIT
62
- */const Cd="168",sT={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},oT={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sS=0,Ap=1,oS=2,aT=3,lT=0,zm=1,aS=2,gi=3,Zi=0,fn=1,vi=2,Wi=0,fs=1,Cp=2,Rp=3,Pp=4,lS=5,vr=100,cS=101,uS=102,dS=103,hS=104,fS=200,pS=201,mS=202,gS=203,Lu=204,Du=205,xS=206,vS=207,yS=208,_S=209,SS=210,MS=211,wS=212,bS=213,ES=214,TS=0,AS=1,CS=2,nl=3,RS=4,PS=5,IS=6,NS=7,Cl=0,LS=1,DS=2,ji=0,US=1,kS=2,OS=3,FS=4,BS=5,zS=6,VS=7,Ip="attached",HS="detached",Rd=300,Ki=301,Ir=302,il=303,rl=304,Vo=306,sl=1e3,Xn=1001,ol=1002,Gt=1003,Vm=1004,cT=1004,fo=1005,uT=1005,Ut=1006,Pa=1007,dT=1007,yi=1008,hT=1008,Ei=1009,Hm=1010,Gm=1011,Do=1012,Pd=1013,Ji=1014,Sn=1015,Ho=1016,Id=1017,Nd=1018,Ms=1020,Wm=35902,jm=1021,Xm=1022,dn=1023,Ym=1024,$m=1025,ps=1026,ws=1027,Ld=1028,Rl=1029,qm=1030,Dd=1031,fT=1032,Ud=1033,Ia=33776,Na=33777,La=33778,Da=33779,Uu=35840,ku=35841,Ou=35842,Fu=35843,Bu=36196,zu=37492,Vu=37496,Hu=37808,Gu=37809,Wu=37810,ju=37811,Xu=37812,Yu=37813,$u=37814,qu=37815,Zu=37816,Ku=37817,Ju=37818,Qu=37819,ed=37820,td=37821,Ua=36492,nd=36494,id=36495,Zm=36283,rd=36284,sd=36285,od=36286,GS=2200,WS=2201,jS=2202,al=2300,ad=2301,au=2302,as=2400,ls=2401,ll=2402,kd=2500,Km=2501,pT=0,mT=1,gT=2,XS=3200,YS=3201,xT=3202,vT=3203,kr=0,$S=1,Fi="",Hn="srgb",tr="srgb-linear",Od="display-p3",Pl="display-p3-linear",cl="linear",ft="srgb",ul="rec709",dl="p3",yT=0,ts=7680,_T=7681,ST=7682,MT=7683,wT=34055,bT=34056,ET=5386,TT=512,AT=513,CT=514,RT=515,PT=516,IT=517,NT=518,Np=519,qS=512,ZS=513,KS=514,Jm=515,JS=516,QS=517,eM=518,tM=519,hl=35044,LT=35048,DT=35040,UT=35045,kT=35049,OT=35041,FT=35046,BT=35050,zT=35042,VT="100",Lp="300 es",_i=2e3,fl=2001;class Ti{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Qt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let n0=1234567;const ms=Math.PI/180,Uo=180/Math.PI;function Un(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[i&255]+Qt[i>>8&255]+Qt[i>>16&255]+Qt[i>>24&255]).toLowerCase()}function At(n,e,t){return Math.max(e,Math.min(t,n))}function Qm(n,e){return(n%e+e)%e}function HT(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function GT(n,e,t){return n!==e?(t-n)/(e-n):0}function ka(n,e,t){return(1-t)*n+t*e}function WT(n,e,t,i){return ka(n,e,1-Math.exp(-t*i))}function jT(n,e=1){return e-Math.abs(Qm(n,e*2)-e)}function XT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function $T(n,e){return n+Math.floor(Math.random()*(e-n+1))}function qT(n,e){return n+Math.random()*(e-n)}function ZT(n){return n*(.5-Math.random())}function KT(n){n!==void 0&&(n0=n);let e=n0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function JT(n){return n*ms}function QT(n){return n*Uo}function eA(n){return(n&n-1)===0&&n!==0}function tA(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function nA(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function iA(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),d=s((e-i)/2),h=o((e-i)/2),p=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*d,l*h,a*c);break;case"YZY":n.set(l*h,a*u,l*d,a*c);break;case"ZXZ":n.set(l*d,l*h,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Xe(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const rA={DEG2RAD:ms,RAD2DEG:Uo,generateUUID:Un,clamp:At,euclideanModulo:Qm,mapLinear:HT,inverseLerp:GT,lerp:ka,damp:WT,pingpong:jT,smoothstep:XT,smootherstep:YT,randInt:$T,randFloat:qT,randFloatSpread:ZT,seededRandom:KT,degToRad:JT,radToDeg:QT,isPowerOfTwo:eA,ceilPowerOfTwo:tA,floorPowerOfTwo:nA,setQuaternionFromProperEuler:iA,normalize:Xe,denormalize:un};class K{constructor(e=0,t=0){K.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class je{constructor(e,t,i,r,s,o,a,l,c){je.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],d=i[7],h=i[2],p=i[5],m=i[8],y=r[0],g=r[3],f=r[6],v=r[1],x=r[4],_=r[7],R=r[2],M=r[5],T=r[8];return s[0]=o*y+a*v+l*R,s[3]=o*g+a*x+l*M,s[6]=o*f+a*_+l*T,s[1]=c*y+u*v+d*R,s[4]=c*g+u*x+d*M,s[7]=c*f+u*_+d*T,s[2]=h*y+p*v+m*R,s[5]=h*g+p*x+m*M,s[8]=h*f+p*_+m*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*o-a*c,h=a*l-u*s,p=c*s-o*l,m=t*d+i*h+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=d*y,e[1]=(r*c-u*i)*y,e[2]=(a*i-r*o)*y,e[3]=h*y,e[4]=(u*t-r*l)*y,e[5]=(r*s-a*t)*y,e[6]=p*y,e[7]=(i*l-c*t)*y,e[8]=(o*t-i*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yh.makeScale(e,t)),this}rotate(e){return this.premultiply(Yh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yh=new je;function nM(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const sA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function po(n,e){return new sA[n](e)}function pl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function iM(){const n=pl("canvas");return n.style.display="block",n}const i0={};function bo(n){n in i0||(i0[n]=!0,console.warn(n))}function oA(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const r0=new je().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),s0=new je().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),na={[tr]:{transfer:cl,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Hn]:{transfer:ft,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Pl]:{transfer:cl,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(s0),fromReference:n=>n.applyMatrix3(r0)},[Od]:{transfer:ft,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(s0),fromReference:n=>n.applyMatrix3(r0).convertLinearToSRGB()}},aA=new Set([tr,Pl]),rt={enabled:!0,_workingColorSpace:tr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!aA.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=na[e].toReference,r=na[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return na[n].primaries},getTransfer:function(n){return n===Fi?cl:na[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(na[e].luminanceCoefficients)}};function Eo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $h(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Ls;class rM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ls===void 0&&(Ls=pl("canvas")),Ls.width=e.width,Ls.height=e.height;const i=Ls.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ls}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Eo(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Eo(t[i]/255)*255):t[i]=Eo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let lA=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:lA++}),this.uuid=Un(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(qh(r[o].image)):s.push(qh(r[o]))}else s=qh(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function qh(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?rM.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let cA=0;class Ct extends Ti{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,i=Xn,r=Xn,s=Ut,o=yi,a=dn,l=Ei,c=Ct.DEFAULT_ANISOTROPY,u=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:cA++}),this.uuid=Un(),this.name="",this.source=new cs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Rd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sl:e.x=e.x-Math.floor(e.x);break;case Xn:e.x=e.x<0?0:1;break;case ol:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case sl:e.y=e.y-Math.floor(e.y);break;case Xn:e.y=e.y<0?0:1;break;case ol:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=Rd;Ct.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],p=l[5],m=l[9],y=l[2],g=l[6],f=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-y)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+y)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,_=(p+1)/2,R=(f+1)/2,M=(u+h)/4,T=(d+y)/4,A=(m+g)/4;return x>_&&x>R?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=M/i,s=T/i):_>R?_<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(_),i=M/r,s=A/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=T/s,r=A/s),this.set(i,r,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(d-y)*(d-y)+(h-u)*(h-u));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(d-y)/v,this.z=(h-u)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class sM extends Ti{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Ct(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new cs(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class li extends sM{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Fd extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class uA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Fd(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class eg extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class dA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new eg(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class En{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],d=i[r+3];const h=s[o+0],p=s[o+1],m=s[o+2],y=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=m,e[t+3]=y;return}if(d!==y||l!==h||c!==p||u!==m){let g=1-a;const f=l*h+c*p+u*m+d*y,v=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const R=Math.sqrt(x),M=Math.atan2(R,f*v);g=Math.sin(g*M)/R,a=Math.sin(a*M)/R}const _=a*v;if(l=l*g+h*_,c=c*g+p*_,u=u*g+m*_,d=d*g+y*_,g===1-a){const R=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=R,c*=R,u*=R,d*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],d=s[o],h=s[o+1],p=s[o+2],m=s[o+3];return e[t]=a*m+u*d+l*p-c*h,e[t+1]=l*m+u*h+c*d-a*p,e[t+2]=c*m+u*p+a*h-l*d,e[t+3]=u*m-a*d-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),d=a(s/2),h=l(i/2),p=l(r/2),m=l(s/2);switch(o){case"XYZ":this._x=h*u*d+c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d-h*p*m;break;case"YXZ":this._x=h*u*d+c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d+h*p*m;break;case"ZXY":this._x=h*u*d-c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d-h*p*m;break;case"ZYX":this._x=h*u*d-c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d+h*p*m;break;case"YZX":this._x=h*u*d+c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d-h*p*m;break;case"XZY":this._x=h*u*d-c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d+h*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=i+a+d;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>d){const p=2*Math.sqrt(1+i-a-d);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>d){const p=2*Math.sqrt(1+a-i-d);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+d-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(At(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*d+this._w*h,this._x=i*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,i=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(o0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(o0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),d=2*(s*i-o*t);return this.x=t+l*c+o*d-a*u,this.y=i+l*u+a*c-s*d,this.z=r+l*d+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Zh.copy(this).projectOnVector(e),this.sub(Zh)}reflect(e){return this.sub(Zh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Zh=new I,o0=new En;class pn{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Jn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Jn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Jn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Jn):Jn.fromBufferAttribute(s,o),Jn.applyMatrix4(e.matrixWorld),this.expandByPoint(Jn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ic.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ic.copy(i.boundingBox)),ic.applyMatrix4(e.matrixWorld),this.union(ic)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Jn),Jn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ia),rc.subVectors(this.max,ia),Ds.subVectors(e.a,ia),Us.subVectors(e.b,ia),ks.subVectors(e.c,ia),sr.subVectors(Us,Ds),or.subVectors(ks,Us),Vr.subVectors(Ds,ks);let t=[0,-sr.z,sr.y,0,-or.z,or.y,0,-Vr.z,Vr.y,sr.z,0,-sr.x,or.z,0,-or.x,Vr.z,0,-Vr.x,-sr.y,sr.x,0,-or.y,or.x,0,-Vr.y,Vr.x,0];return!Kh(t,Ds,Us,ks,rc)||(t=[1,0,0,0,1,0,0,0,1],!Kh(t,Ds,Us,ks,rc))?!1:(sc.crossVectors(sr,or),t=[sc.x,sc.y,sc.z],Kh(t,Ds,Us,ks,rc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Pi=[new I,new I,new I,new I,new I,new I,new I,new I],Jn=new I,ic=new pn,Ds=new I,Us=new I,ks=new I,sr=new I,or=new I,Vr=new I,ia=new I,rc=new I,sc=new I,Hr=new I;function Kh(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Hr.fromArray(n,s);const a=r.x*Math.abs(Hr.x)+r.y*Math.abs(Hr.y)+r.z*Math.abs(Hr.z),l=e.dot(Hr),c=t.dot(Hr),u=i.dot(Hr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const hA=new pn,ra=new I,Jh=new I;class rn{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):hA.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ra.subVectors(e,this.center);const t=ra.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ra,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Jh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ra.copy(e.center).add(Jh)),this.expandByPoint(ra.copy(e.center).sub(Jh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ii=new I,Qh=new I,oc=new I,ar=new I,ef=new I,ac=new I,tf=new I;class Go{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ii)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ii.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ii.copy(this.origin).addScaledVector(this.direction,t),Ii.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Qh.copy(e).add(t).multiplyScalar(.5),oc.copy(t).sub(e).normalize(),ar.copy(this.origin).sub(Qh);const s=e.distanceTo(t)*.5,o=-this.direction.dot(oc),a=ar.dot(this.direction),l=-ar.dot(oc),c=ar.lengthSq(),u=Math.abs(1-o*o);let d,h,p,m;if(u>0)if(d=o*l-a,h=o*a-l,m=s*u,d>=0)if(h>=-m)if(h<=m){const y=1/u;d*=y,h*=y,p=d*(d+o*h+2*a)+h*(o*d+h+2*l)+c}else h=s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;else h<=-m?(d=Math.max(0,-(-o*s+a)),h=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+h*(h+2*l)+c):h<=m?(d=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(d=Math.max(0,-(o*s+a)),h=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+h*(h+2*l)+c);else h=o>0?-s:s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Qh).addScaledVector(oc,h),p}intersectSphere(e,t){Ii.subVectors(e.center,this.origin);const i=Ii.dot(this.direction),r=Ii.dot(Ii)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(a=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ii)!==null}intersectTriangle(e,t,i,r,s){ef.subVectors(t,e),ac.subVectors(i,e),tf.crossVectors(ef,ac);let o=this.direction.dot(tf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ar.subVectors(this.origin,e);const l=a*this.direction.dot(ac.crossVectors(ar,ac));if(l<0)return null;const c=a*this.direction.dot(ef.cross(ar));if(c<0||l+c>o)return null;const u=-a*ar.dot(tf);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,g){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,g)}set(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,g){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=d,f[14]=h,f[3]=p,f[7]=m,f[11]=y,f[15]=g,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 ke().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Os.setFromMatrixColumn(e,0).length(),s=1/Os.setFromMatrixColumn(e,1).length(),o=1/Os.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*d,m=a*u,y=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=p+m*c,t[5]=h-y*c,t[9]=-a*l,t[2]=y-h*c,t[6]=m+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*d,m=c*u,y=c*d;t[0]=h+y*a,t[4]=m*a-p,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=p*a-m,t[6]=y+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*d,m=c*u,y=c*d;t[0]=h-y*a,t[4]=-o*d,t[8]=m+p*a,t[1]=p+m*a,t[5]=o*u,t[9]=y-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*d,m=a*u,y=a*d;t[0]=l*u,t[4]=m*c-p,t[8]=h*c+y,t[1]=l*d,t[5]=y*c+h,t[9]=p*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,m=a*l,y=a*c;t[0]=l*u,t[4]=y-h*d,t[8]=m*d+p,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*d+m,t[10]=h-y*d}else if(e.order==="XZY"){const h=o*l,p=o*c,m=a*l,y=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+y,t[5]=o*u,t[9]=p*d-m,t[2]=m*d-p,t[6]=a*u,t[10]=y*d+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fA,e,pA)}lookAt(e,t,i){const r=this.elements;return Rn.subVectors(e,t),Rn.lengthSq()===0&&(Rn.z=1),Rn.normalize(),lr.crossVectors(i,Rn),lr.lengthSq()===0&&(Math.abs(i.z)===1?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),lr.crossVectors(i,Rn)),lr.normalize(),lc.crossVectors(Rn,lr),r[0]=lr.x,r[4]=lc.x,r[8]=Rn.x,r[1]=lr.y,r[5]=lc.y,r[9]=Rn.y,r[2]=lr.z,r[6]=lc.z,r[10]=Rn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],d=i[5],h=i[9],p=i[13],m=i[2],y=i[6],g=i[10],f=i[14],v=i[3],x=i[7],_=i[11],R=i[15],M=r[0],T=r[4],A=r[8],E=r[12],w=r[1],L=r[5],V=r[9],F=r[13],G=r[2],Y=r[6],W=r[10],ne=r[14],D=r[3],X=r[7],Q=r[11],oe=r[15];return s[0]=o*M+a*w+l*G+c*D,s[4]=o*T+a*L+l*Y+c*X,s[8]=o*A+a*V+l*W+c*Q,s[12]=o*E+a*F+l*ne+c*oe,s[1]=u*M+d*w+h*G+p*D,s[5]=u*T+d*L+h*Y+p*X,s[9]=u*A+d*V+h*W+p*Q,s[13]=u*E+d*F+h*ne+p*oe,s[2]=m*M+y*w+g*G+f*D,s[6]=m*T+y*L+g*Y+f*X,s[10]=m*A+y*V+g*W+f*Q,s[14]=m*E+y*F+g*ne+f*oe,s[3]=v*M+x*w+_*G+R*D,s[7]=v*T+x*L+_*Y+R*X,s[11]=v*A+x*V+_*W+R*Q,s[15]=v*E+x*F+_*ne+R*oe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],p=e[14],m=e[3],y=e[7],g=e[11],f=e[15];return m*(+s*l*d-r*c*d-s*a*h+i*c*h+r*a*p-i*l*p)+y*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+g*(+t*c*d-t*a*p-s*o*d+i*o*p+s*a*u-i*c*u)+f*(-r*a*u-t*l*d+t*a*h+r*o*d-i*o*h+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],p=e[11],m=e[12],y=e[13],g=e[14],f=e[15],v=d*g*c-y*h*c+y*l*p-a*g*p-d*l*f+a*h*f,x=m*h*c-u*g*c-m*l*p+o*g*p+u*l*f-o*h*f,_=u*y*c-m*d*c+m*a*p-o*y*p-u*a*f+o*d*f,R=m*d*l-u*y*l-m*a*h+o*y*h+u*a*g-o*d*g,M=t*v+i*x+r*_+s*R;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/M;return e[0]=v*T,e[1]=(y*h*s-d*g*s-y*r*p+i*g*p+d*r*f-i*h*f)*T,e[2]=(a*g*s-y*l*s+y*r*c-i*g*c-a*r*f+i*l*f)*T,e[3]=(d*l*s-a*h*s-d*r*c+i*h*c+a*r*p-i*l*p)*T,e[4]=x*T,e[5]=(u*g*s-m*h*s+m*r*p-t*g*p-u*r*f+t*h*f)*T,e[6]=(m*l*s-o*g*s-m*r*c+t*g*c+o*r*f-t*l*f)*T,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*T,e[8]=_*T,e[9]=(m*d*s-u*y*s-m*i*p+t*y*p+u*i*f-t*d*f)*T,e[10]=(o*y*s-m*a*s+m*i*c-t*y*c-o*i*f+t*a*f)*T,e[11]=(u*a*s-o*d*s-u*i*c+t*d*c+o*i*p-t*a*p)*T,e[12]=R*T,e[13]=(u*y*r-m*d*r+m*i*h-t*y*h-u*i*g+t*d*g)*T,e[14]=(m*a*r-o*y*r-m*i*l+t*y*l+o*i*g-t*a*g)*T,e[15]=(o*d*r-u*a*r+u*i*l-t*d*l-o*i*h+t*a*h)*T,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,d=a+a,h=s*c,p=s*u,m=s*d,y=o*u,g=o*d,f=a*d,v=l*c,x=l*u,_=l*d,R=i.x,M=i.y,T=i.z;return r[0]=(1-(y+f))*R,r[1]=(p+_)*R,r[2]=(m-x)*R,r[3]=0,r[4]=(p-_)*M,r[5]=(1-(h+f))*M,r[6]=(g+v)*M,r[7]=0,r[8]=(m+x)*T,r[9]=(g-v)*T,r[10]=(1-(h+y))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Os.set(r[0],r[1],r[2]).length();const o=Os.set(r[4],r[5],r[6]).length(),a=Os.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qn.copy(this);const c=1/s,u=1/o,d=1/a;return Qn.elements[0]*=c,Qn.elements[1]*=c,Qn.elements[2]*=c,Qn.elements[4]*=u,Qn.elements[5]*=u,Qn.elements[6]*=u,Qn.elements[8]*=d,Qn.elements[9]*=d,Qn.elements[10]*=d,t.setFromRotationMatrix(Qn),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=_i){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),d=(t+e)/(t-e),h=(i+r)/(i-r);let p,m;if(a===_i)p=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===fl)p=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=_i){const l=this.elements,c=1/(t-e),u=1/(i-r),d=1/(o-s),h=(t+e)*c,p=(i+r)*u;let m,y;if(a===_i)m=(o+s)*d,y=-2*d;else if(a===fl)m=s*d,y=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=y,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Os=new I,Qn=new ke,fA=new I(0,0,0),pA=new I(1,1,1),lr=new I,lc=new I,Rn=new I,a0=new ke,l0=new En;class On{constructor(e=0,t=0,i=0,r=On.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],d=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-At(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(At(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return a0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(a0,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return l0.setFromEuler(this),this.setFromQuaternion(l0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class Bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let mA=0;const c0=new I,Fs=new En,Ni=new ke,cc=new I,sa=new I,gA=new I,xA=new En,u0=new I(1,0,0),d0=new I(0,1,0),h0=new I(0,0,1),f0={type:"added"},vA={type:"removed"},Bs={type:"childadded",child:null},nf={type:"childremoved",child:null};class nt extends Ti{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:mA++}),this.uuid=Un(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new I,t=new On,i=new En,r=new I(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ke},normalMatrix:{value:new je}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.multiply(Fs),this}rotateOnWorldAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.premultiply(Fs),this}rotateX(e){return this.rotateOnAxis(u0,e)}rotateY(e){return this.rotateOnAxis(d0,e)}rotateZ(e){return this.rotateOnAxis(h0,e)}translateOnAxis(e,t){return c0.copy(e).applyQuaternion(this.quaternion),this.position.add(c0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(u0,e)}translateY(e){return this.translateOnAxis(d0,e)}translateZ(e){return this.translateOnAxis(h0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ni.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?cc.copy(e):cc.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),sa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ni.lookAt(sa,cc,this.up):Ni.lookAt(cc,sa,this.up),this.quaternion.setFromRotationMatrix(Ni),r&&(Ni.extractRotation(r.matrixWorld),Fs.setFromRotationMatrix(Ni),this.quaternion.premultiply(Fs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(f0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vA),nf.child=e,this.dispatchEvent(nf),nf.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ni.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ni.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ni),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(f0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,e,gA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,xA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),d=o(e.shapes),h=o(e.skeletons),p=o(e.animations),m=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nt.DEFAULT_UP=new I(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ei=new I,Li=new I,rf=new I,Di=new I,zs=new I,Vs=new I,p0=new I,sf=new I,of=new I,af=new I;class Nn{constructor(e=new I,t=new I,i=new I){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ei.subVectors(e,t),r.cross(ei);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ei.subVectors(r,t),Li.subVectors(i,t),rf.subVectors(e,t);const o=ei.dot(ei),a=ei.dot(Li),l=ei.dot(rf),c=Li.dot(Li),u=Li.dot(rf),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const h=1/d,p=(c*l-a*u)*h,m=(o*u-a*l)*h;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Di)===null?!1:Di.x>=0&&Di.y>=0&&Di.x+Di.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Di)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Di.x),l.addScaledVector(o,Di.y),l.addScaledVector(a,Di.z),l)}static isFrontFacing(e,t,i,r){return ei.subVectors(i,t),Li.subVectors(e,t),ei.cross(Li).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ei.subVectors(this.c,this.b),Li.subVectors(this.a,this.b),ei.cross(Li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Nn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;zs.subVectors(r,i),Vs.subVectors(s,i),sf.subVectors(e,i);const l=zs.dot(sf),c=Vs.dot(sf);if(l<=0&&c<=0)return t.copy(i);of.subVectors(e,r);const u=zs.dot(of),d=Vs.dot(of);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(zs,o);af.subVectors(e,s);const p=zs.dot(af),m=Vs.dot(af);if(m>=0&&p<=m)return t.copy(s);const y=p*c-l*m;if(y<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Vs,a);const g=u*m-p*d;if(g<=0&&d-u>=0&&p-m>=0)return p0.subVectors(s,r),a=(d-u)/(d-u+(p-m)),t.copy(r).addScaledVector(p0,a);const f=1/(g+y+h);return o=y*f,a=h*f,t.copy(i).addScaledVector(zs,o).addScaledVector(Vs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const oM={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},cr={h:0,s:0,l:0},uc={h:0,s:0,l:0};function lf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ye{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Hn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=rt.workingColorSpace){return this.r=e,this.g=t,this.b=i,rt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=rt.workingColorSpace){if(e=Qm(e,1),t=At(t,0,1),i=At(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=lf(o,s,e+1/3),this.g=lf(o,s,e),this.b=lf(o,s,e-1/3)}return rt.toWorkingColorSpace(this,r),this}setStyle(e,t=Hn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Hn){const i=oM[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eo(e.r),this.g=Eo(e.g),this.b=Eo(e.b),this}copyLinearToSRGB(e){return this.r=$h(e.r),this.g=$h(e.g),this.b=$h(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Hn){return rt.fromWorkingColorSpace(en.copy(this),e),Math.round(At(en.r*255,0,255))*65536+Math.round(At(en.g*255,0,255))*256+Math.round(At(en.b*255,0,255))}getHexString(e=Hn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.fromWorkingColorSpace(en.copy(this),t);const i=en.r,r=en.g,s=en.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=rt.workingColorSpace){return rt.fromWorkingColorSpace(en.copy(this),t),e.r=en.r,e.g=en.g,e.b=en.b,e}getStyle(e=Hn){rt.fromWorkingColorSpace(en.copy(this),e);const t=en.r,i=en.g,r=en.b;return e!==Hn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(cr),this.setHSL(cr.h+e,cr.s+t,cr.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(cr),e.getHSL(uc);const i=ka(cr.h,uc.h,t),r=ka(cr.s,uc.s,t),s=ka(cr.l,uc.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const en=new ye;ye.NAMES=oM;let yA=0;class on extends Ti{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yA++}),this.uuid=Un(),this.name="",this.type="Material",this.blending=fs,this.side=Zi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Lu,this.blendDst=Du,this.blendEquation=vr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ye(0,0,0),this.blendAlpha=0,this.depthFunc=nl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Np,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ts,this.stencilZFail=ts,this.stencilZPass=ts,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==fs&&(i.blending=this.blending),this.side!==Zi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Lu&&(i.blendSrc=this.blendSrc),this.blendDst!==Du&&(i.blendDst=this.blendDst),this.blendEquation!==vr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==nl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Np&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Or extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ye(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 On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Bi=_A();function _A(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function vn(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=At(n,-65504,65504),Bi.floatView[0]=n;const e=Bi.uint32View[0],t=e>>23&511;return Bi.baseTable[t]+((e&8388607)>>Bi.shiftTable[t])}function ya(n){const e=n>>10;return Bi.uint32View[0]=Bi.mantissaTable[Bi.offsetTable[e]+(n&1023)]+Bi.exponentTable[e],Bi.floatView[0]}const SA={toHalfFloat:vn,fromHalfFloat:ya},Lt=new I,dc=new K;class ht{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Sn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)dc.fromBufferAttribute(this,t),dc.applyMatrix3(e),this.setXY(t,dc.x,dc.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix4(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyNormalMatrix(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.transformDirection(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==hl&&(e.usage=this.usage),e}}class MA extends ht{constructor(e,t,i){super(new Int8Array(e),t,i)}}class wA extends ht{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class bA extends ht{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class EA extends ht{constructor(e,t,i){super(new Int16Array(e),t,i)}}class tg extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class TA extends ht{constructor(e,t,i){super(new Int32Array(e),t,i)}}class ng extends ht{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class AA extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=ya(this.array[e*this.itemSize]);return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=vn(t),this}getY(e){let t=ya(this.array[e*this.itemSize+1]);return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=vn(t),this}getZ(e){let t=ya(this.array[e*this.itemSize+2]);return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=vn(t),this}getW(e){let t=ya(this.array[e*this.itemSize+3]);return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=vn(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this.array[e+3]=vn(s),this}}class Ce extends ht{constructor(e,t,i){super(new Float32Array(e),t,i)}}let CA=0;const Vn=new ke,cf=new nt,Hs=new I,Pn=new pn,oa=new pn,Vt=new I;class $e extends Ti{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CA++}),this.uuid=Un(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nM(e)?ng:tg)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new je().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vn.makeRotationFromQuaternion(e),this.applyMatrix4(Vn),this}rotateX(e){return Vn.makeRotationX(e),this.applyMatrix4(Vn),this}rotateY(e){return Vn.makeRotationY(e),this.applyMatrix4(Vn),this}rotateZ(e){return Vn.makeRotationZ(e),this.applyMatrix4(Vn),this}translate(e,t,i){return Vn.makeTranslation(e,t,i),this.applyMatrix4(Vn),this}scale(e,t,i){return Vn.makeScale(e,t,i),this.applyMatrix4(Vn),this}lookAt(e){return cf.lookAt(e),cf.updateMatrix(),this.applyMatrix4(cf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hs).negate(),this.translate(Hs.x,Hs.y,Hs.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ce(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Pn.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,Pn.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,Pn.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(Pn.min),this.boundingBox.expandByPoint(Pn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 rn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const i=this.boundingSphere.center;if(Pn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];oa.setFromBufferAttribute(a),this.morphTargetsRelative?(Vt.addVectors(Pn.min,oa.min),Pn.expandByPoint(Vt),Vt.addVectors(Pn.max,oa.max),Pn.expandByPoint(Vt)):(Pn.expandByPoint(oa.min),Pn.expandByPoint(oa.max))}Pn.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Vt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Vt.fromBufferAttribute(a,c),l&&(Hs.fromBufferAttribute(e,c),Vt.add(Hs)),r=Math.max(r,i.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ht(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<i.count;A++)a[A]=new I,l[A]=new I;const c=new I,u=new I,d=new I,h=new K,p=new K,m=new K,y=new I,g=new I;function f(A,E,w){c.fromBufferAttribute(i,A),u.fromBufferAttribute(i,E),d.fromBufferAttribute(i,w),h.fromBufferAttribute(s,A),p.fromBufferAttribute(s,E),m.fromBufferAttribute(s,w),u.sub(c),d.sub(c),p.sub(h),m.sub(h);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(y.copy(u).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(L),g.copy(d).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(L),a[A].add(y),a[E].add(y),a[w].add(y),l[A].add(g),l[E].add(g),l[w].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let A=0,E=v.length;A<E;++A){const w=v[A],L=w.start,V=w.count;for(let F=L,G=L+V;F<G;F+=3)f(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const x=new I,_=new I,R=new I,M=new I;function T(A){R.fromBufferAttribute(r,A),M.copy(R);const E=a[A];x.copy(E),x.sub(R.multiplyScalar(R.dot(E))).normalize(),_.crossVectors(M,E);const L=_.dot(l[A])<0?-1:1;o.setXYZW(A,x.x,x.y,x.z,L)}for(let A=0,E=v.length;A<E;++A){const w=v[A],L=w.start,V=w.count;for(let F=L,G=L+V;F<G;F+=3)T(e.getX(F+0)),T(e.getX(F+1)),T(e.getX(F+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ht(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new I,s=new I,o=new I,a=new I,l=new I,c=new I,u=new I,d=new I;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),y=e.getX(h+1),g=e.getX(h+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,y),o.fromBufferAttribute(t,g),u.subVectors(o,s),d.subVectors(r,s),u.cross(d),a.fromBufferAttribute(i,m),l.fromBufferAttribute(i,y),c.fromBufferAttribute(i,g),a.add(u),l.add(u),c.add(u),i.setXYZ(m,a.x,a.y,a.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),u.subVectors(o,s),d.subVectors(r,s),u.cross(d),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Vt.fromBufferAttribute(e,t),Vt.normalize(),e.setXYZ(t,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,d=a.normalized,h=new c.constructor(l.length*u);let p=0,m=0;for(let y=0,g=l.length;y<g;y++){a.isInterleavedBufferAttribute?p=l[y]*a.data.stride+a.offset:p=l[y]*u;for(let f=0;f<u;f++)h[m++]=c[p++]}return new ht(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new $e,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,d=c.length;u<d;u++){const h=c[u],p=e(h,i);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const p=c[d];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,p=d.length;h<p;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const m0=new ke,Gr=new Go,hc=new rn,g0=new I,Gs=new I,Ws=new I,js=new I,uf=new I,fc=new I,pc=new K,mc=new K,gc=new K,x0=new I,v0=new I,y0=new I,xc=new I,vc=new I;class kt extends nt{constructor(e=new $e,t=new Or){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){fc.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],d=s[l];u!==0&&(uf.fromBufferAttribute(d,e),o?fc.addScaledVector(uf,u):fc.addScaledVector(uf.sub(t),u))}t.add(fc)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),hc.copy(i.boundingSphere),hc.applyMatrix4(s),Gr.copy(e.ray).recast(e.near),!(hc.containsPoint(Gr.origin)===!1&&(Gr.intersectSphere(hc,g0)===null||Gr.origin.distanceToSquared(g0)>(e.far-e.near)**2))&&(m0.copy(s).invert(),Gr.copy(e.ray).applyMatrix4(m0),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,y=h.length;m<y;m++){const g=h[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),x=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,R=x;_<R;_+=3){const M=a.getX(_),T=a.getX(_+1),A=a.getX(_+2);r=yc(this,f,e,i,c,u,d,M,T,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(a.count,p.start+p.count);for(let g=m,f=y;g<f;g+=3){const v=a.getX(g),x=a.getX(g+1),_=a.getX(g+2);r=yc(this,o,e,i,c,u,d,v,x,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,y=h.length;m<y;m++){const g=h[m],f=o[g.materialIndex],v=Math.max(g.start,p.start),x=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let _=v,R=x;_<R;_+=3){const M=_,T=_+1,A=_+2;r=yc(this,f,e,i,c,u,d,M,T,A),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(l.count,p.start+p.count);for(let g=m,f=y;g<f;g+=3){const v=g,x=g+1,_=g+2;r=yc(this,o,e,i,c,u,d,v,x,_),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function RA(n,e,t,i,r,s,o,a){let l;if(e.side===fn?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Zi,a),l===null)return null;vc.copy(a),vc.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(vc);return c<t.near||c>t.far?null:{distance:c,point:vc.clone(),object:n}}function yc(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Gs),n.getVertexPosition(l,Ws),n.getVertexPosition(c,js);const u=RA(n,e,t,i,Gs,Ws,js,xc);if(u){r&&(pc.fromBufferAttribute(r,a),mc.fromBufferAttribute(r,l),gc.fromBufferAttribute(r,c),u.uv=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new K)),s&&(pc.fromBufferAttribute(s,a),mc.fromBufferAttribute(s,l),gc.fromBufferAttribute(s,c),u.uv1=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new K)),o&&(x0.fromBufferAttribute(o,a),v0.fromBufferAttribute(o,l),y0.fromBufferAttribute(o,c),u.normal=Nn.getInterpolation(xc,Gs,Ws,js,x0,v0,y0,new I),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new I,materialIndex:0};Nn.getNormal(Gs,Ws,js,d.normal),u.face=d}return u}class Cs extends $e{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],d=[];let h=0,p=0;m("z","y","x",-1,-1,i,t,e,o,s,0),m("z","y","x",1,-1,i,t,-e,o,s,1),m("x","z","y",1,1,e,i,t,r,o,2),m("x","z","y",1,-1,e,i,-t,r,o,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Ce(c,3)),this.setAttribute("normal",new Ce(u,3)),this.setAttribute("uv",new Ce(d,2));function m(y,g,f,v,x,_,R,M,T,A,E){const w=_/T,L=R/A,V=_/2,F=R/2,G=M/2,Y=T+1,W=A+1;let ne=0,D=0;const X=new I;for(let Q=0;Q<W;Q++){const oe=Q*L-F;for(let Re=0;Re<Y;Re++){const Ke=Re*w-V;X[y]=Ke*v,X[g]=oe*x,X[f]=G,c.push(X.x,X.y,X.z),X[y]=0,X[g]=0,X[f]=M>0?1:-1,u.push(X.x,X.y,X.z),d.push(Re/T),d.push(1-Q/A),ne+=1}}for(let Q=0;Q<A;Q++)for(let oe=0;oe<T;oe++){const Re=h+oe+Y*Q,Ke=h+oe+Y*(Q+1),j=h+(oe+1)+Y*(Q+1),se=h+(oe+1)+Y*Q;l.push(Re,Ke,se),l.push(Ke,j,se),D+=6}a.addGroup(p,D,E),p+=D,h+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ko(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function ln(n){const e={};for(let t=0;t<n.length;t++){const i=ko(n[t]);for(const r in i)e[r]=i[r]}return e}function PA(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function aM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const lM={clone:ko,merge:ln};var IA=`void main() {
62
+ */const Cd="168",sT={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},oT={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sS=0,Ap=1,oS=2,aT=3,lT=0,zm=1,aS=2,gi=3,Zi=0,fn=1,vi=2,Wi=0,fs=1,Cp=2,Rp=3,Pp=4,lS=5,vr=100,cS=101,uS=102,dS=103,hS=104,fS=200,pS=201,mS=202,gS=203,Lu=204,Du=205,xS=206,vS=207,yS=208,_S=209,SS=210,MS=211,wS=212,bS=213,ES=214,TS=0,AS=1,CS=2,nl=3,RS=4,PS=5,IS=6,NS=7,Cl=0,LS=1,DS=2,ji=0,US=1,kS=2,OS=3,FS=4,BS=5,zS=6,VS=7,Ip="attached",HS="detached",Rd=300,Ki=301,Ir=302,il=303,rl=304,Vo=306,sl=1e3,Xn=1001,ol=1002,Gt=1003,Vm=1004,cT=1004,fo=1005,uT=1005,Ut=1006,Pa=1007,dT=1007,yi=1008,hT=1008,Ei=1009,Hm=1010,Gm=1011,Do=1012,Pd=1013,Ji=1014,Sn=1015,Ho=1016,Id=1017,Nd=1018,Ms=1020,Wm=35902,jm=1021,Xm=1022,dn=1023,Ym=1024,$m=1025,ps=1026,ws=1027,Ld=1028,Rl=1029,qm=1030,Dd=1031,fT=1032,Ud=1033,Ia=33776,Na=33777,La=33778,Da=33779,Uu=35840,ku=35841,Ou=35842,Fu=35843,Bu=36196,zu=37492,Vu=37496,Hu=37808,Gu=37809,Wu=37810,ju=37811,Xu=37812,Yu=37813,$u=37814,qu=37815,Zu=37816,Ku=37817,Ju=37818,Qu=37819,ed=37820,td=37821,Ua=36492,nd=36494,id=36495,Zm=36283,rd=36284,sd=36285,od=36286,GS=2200,WS=2201,jS=2202,al=2300,ad=2301,au=2302,as=2400,ls=2401,ll=2402,kd=2500,Km=2501,pT=0,mT=1,gT=2,XS=3200,YS=3201,xT=3202,vT=3203,kr=0,$S=1,Fi="",Hn="srgb",tr="srgb-linear",Od="display-p3",Pl="display-p3-linear",cl="linear",ft="srgb",ul="rec709",dl="p3",yT=0,ts=7680,_T=7681,ST=7682,MT=7683,wT=34055,bT=34056,ET=5386,TT=512,AT=513,CT=514,RT=515,PT=516,IT=517,NT=518,Np=519,qS=512,ZS=513,KS=514,Jm=515,JS=516,QS=517,eM=518,tM=519,hl=35044,LT=35048,DT=35040,UT=35045,kT=35049,OT=35041,FT=35046,BT=35050,zT=35042,VT="100",Lp="300 es",_i=2e3,fl=2001;class Ti{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Qt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let n0=1234567;const ms=Math.PI/180,Uo=180/Math.PI;function Un(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[i&255]+Qt[i>>8&255]+Qt[i>>16&255]+Qt[i>>24&255]).toLowerCase()}function At(n,e,t){return Math.max(e,Math.min(t,n))}function Qm(n,e){return(n%e+e)%e}function HT(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function GT(n,e,t){return n!==e?(t-n)/(e-n):0}function ka(n,e,t){return(1-t)*n+t*e}function WT(n,e,t,i){return ka(n,e,1-Math.exp(-t*i))}function jT(n,e=1){return e-Math.abs(Qm(n,e*2)-e)}function XT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function YT(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function $T(n,e){return n+Math.floor(Math.random()*(e-n+1))}function qT(n,e){return n+Math.random()*(e-n)}function ZT(n){return n*(.5-Math.random())}function KT(n){n!==void 0&&(n0=n);let e=n0+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function JT(n){return n*ms}function QT(n){return n*Uo}function eA(n){return(n&n-1)===0&&n!==0}function tA(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function nA(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function iA(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),d=s((e-i)/2),h=o((e-i)/2),p=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*d,l*h,a*c);break;case"YZY":n.set(l*h,a*u,l*d,a*c);break;case"ZXZ":n.set(l*d,l*h,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Xe(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const rA={DEG2RAD:ms,RAD2DEG:Uo,generateUUID:Un,clamp:At,euclideanModulo:Qm,mapLinear:HT,inverseLerp:GT,lerp:ka,damp:WT,pingpong:jT,smoothstep:XT,smootherstep:YT,randInt:$T,randFloat:qT,randFloatSpread:ZT,seededRandom:KT,degToRad:JT,radToDeg:QT,isPowerOfTwo:eA,ceilPowerOfTwo:tA,floorPowerOfTwo:nA,setQuaternionFromProperEuler:iA,normalize:Xe,denormalize:un};class K{constructor(e=0,t=0){K.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class je{constructor(e,t,i,r,s,o,a,l,c){je.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],d=i[7],h=i[2],p=i[5],m=i[8],y=r[0],x=r[3],f=r[6],v=r[1],g=r[4],_=r[7],R=r[2],w=r[5],A=r[8];return s[0]=o*y+a*v+l*R,s[3]=o*x+a*g+l*w,s[6]=o*f+a*_+l*A,s[1]=c*y+u*v+d*R,s[4]=c*x+u*g+d*w,s[7]=c*f+u*_+d*A,s[2]=h*y+p*v+m*R,s[5]=h*x+p*g+m*w,s[8]=h*f+p*_+m*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*o-a*c,h=a*l-u*s,p=c*s-o*l,m=t*d+i*h+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=d*y,e[1]=(r*c-u*i)*y,e[2]=(a*i-r*o)*y,e[3]=h*y,e[4]=(u*t-r*l)*y,e[5]=(r*s-a*t)*y,e[6]=p*y,e[7]=(i*l-c*t)*y,e[8]=(o*t-i*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yh.makeScale(e,t)),this}rotate(e){return this.premultiply(Yh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yh=new je;function nM(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const sA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function po(n,e){return new sA[n](e)}function pl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function iM(){const n=pl("canvas");return n.style.display="block",n}const i0={};function bo(n){n in i0||(i0[n]=!0,console.warn(n))}function oA(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const r0=new je().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),s0=new je().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),na={[tr]:{transfer:cl,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Hn]:{transfer:ft,primaries:ul,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Pl]:{transfer:cl,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(s0),fromReference:n=>n.applyMatrix3(r0)},[Od]:{transfer:ft,primaries:dl,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(s0),fromReference:n=>n.applyMatrix3(r0).convertLinearToSRGB()}},aA=new Set([tr,Pl]),rt={enabled:!0,_workingColorSpace:tr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!aA.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=na[e].toReference,r=na[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return na[n].primaries},getTransfer:function(n){return n===Fi?cl:na[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(na[e].luminanceCoefficients)}};function Eo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $h(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Ls;class rM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ls===void 0&&(Ls=pl("canvas")),Ls.width=e.width,Ls.height=e.height;const i=Ls.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ls}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=pl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Eo(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Eo(t[i]/255)*255):t[i]=Eo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let lA=0;class cs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:lA++}),this.uuid=Un(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(qh(r[o].image)):s.push(qh(r[o]))}else s=qh(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function qh(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?rM.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let cA=0;class Ct extends Ti{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,i=Xn,r=Xn,s=Ut,o=yi,a=dn,l=Ei,c=Ct.DEFAULT_ANISOTROPY,u=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:cA++}),this.uuid=Un(),this.name="",this.source=new cs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new je,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Rd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sl:e.x=e.x-Math.floor(e.x);break;case Xn:e.x=e.x<0?0:1;break;case ol:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case sl:e.y=e.y-Math.floor(e.y);break;case Xn:e.y=e.y<0?0:1;break;case ol:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=Rd;Ct.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],p=l[5],m=l[9],y=l[2],x=l[6],f=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-y)<.01&&Math.abs(m-x)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+y)<.1&&Math.abs(m+x)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const g=(c+1)/2,_=(p+1)/2,R=(f+1)/2,w=(u+h)/4,A=(d+y)/4,b=(m+x)/4;return g>_&&g>R?g<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(g),r=w/i,s=A/i):_>R?_<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(_),i=w/r,s=b/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=A/s,r=b/s),this.set(i,r,s,t),this}let v=Math.sqrt((x-m)*(x-m)+(d-y)*(d-y)+(h-u)*(h-u));return Math.abs(v)<.001&&(v=1),this.x=(x-m)/v,this.y=(d-y)/v,this.z=(h-u)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class sM extends Ti{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ut,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Ct(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new cs(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class li extends sM{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Fd extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class uA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Fd(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class eg extends Ct{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=Xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class dA extends li{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new eg(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class En{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],d=i[r+3];const h=s[o+0],p=s[o+1],m=s[o+2],y=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=m,e[t+3]=y;return}if(d!==y||l!==h||c!==p||u!==m){let x=1-a;const f=l*h+c*p+u*m+d*y,v=f>=0?1:-1,g=1-f*f;if(g>Number.EPSILON){const R=Math.sqrt(g),w=Math.atan2(R,f*v);x=Math.sin(x*w)/R,a=Math.sin(a*w)/R}const _=a*v;if(l=l*x+h*_,c=c*x+p*_,u=u*x+m*_,d=d*x+y*_,x===1-a){const R=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=R,c*=R,u*=R,d*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],d=s[o],h=s[o+1],p=s[o+2],m=s[o+3];return e[t]=a*m+u*d+l*p-c*h,e[t+1]=l*m+u*h+c*d-a*p,e[t+2]=c*m+u*p+a*h-l*d,e[t+3]=u*m-a*d-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),d=a(s/2),h=l(i/2),p=l(r/2),m=l(s/2);switch(o){case"XYZ":this._x=h*u*d+c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d-h*p*m;break;case"YXZ":this._x=h*u*d+c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d+h*p*m;break;case"ZXY":this._x=h*u*d-c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d-h*p*m;break;case"ZYX":this._x=h*u*d-c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d+h*p*m;break;case"YZX":this._x=h*u*d+c*p*m,this._y=c*p*d+h*u*m,this._z=c*u*m-h*p*d,this._w=c*u*d-h*p*m;break;case"XZY":this._x=h*u*d-c*p*m,this._y=c*p*d-h*u*m,this._z=c*u*m+h*p*d,this._w=c*u*d+h*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=i+a+d;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>d){const p=2*Math.sqrt(1+i-a-d);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>d){const p=2*Math.sqrt(1+a-i-d);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+d-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(At(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*d+this._w*h,this._x=i*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,i=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(o0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(o0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),d=2*(s*i-o*t);return this.x=t+l*c+o*d-a*u,this.y=i+l*u+a*c-s*d,this.z=r+l*d+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Zh.copy(this).projectOnVector(e),this.sub(Zh)}reflect(e){return this.sub(Zh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(At(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Zh=new I,o0=new En;class pn{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Jn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Jn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Jn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Jn):Jn.fromBufferAttribute(s,o),Jn.applyMatrix4(e.matrixWorld),this.expandByPoint(Jn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ic.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ic.copy(i.boundingBox)),ic.applyMatrix4(e.matrixWorld),this.union(ic)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Jn),Jn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ia),rc.subVectors(this.max,ia),Ds.subVectors(e.a,ia),Us.subVectors(e.b,ia),ks.subVectors(e.c,ia),sr.subVectors(Us,Ds),or.subVectors(ks,Us),Vr.subVectors(Ds,ks);let t=[0,-sr.z,sr.y,0,-or.z,or.y,0,-Vr.z,Vr.y,sr.z,0,-sr.x,or.z,0,-or.x,Vr.z,0,-Vr.x,-sr.y,sr.x,0,-or.y,or.x,0,-Vr.y,Vr.x,0];return!Kh(t,Ds,Us,ks,rc)||(t=[1,0,0,0,1,0,0,0,1],!Kh(t,Ds,Us,ks,rc))?!1:(sc.crossVectors(sr,or),t=[sc.x,sc.y,sc.z],Kh(t,Ds,Us,ks,rc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Pi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Pi=[new I,new I,new I,new I,new I,new I,new I,new I],Jn=new I,ic=new pn,Ds=new I,Us=new I,ks=new I,sr=new I,or=new I,Vr=new I,ia=new I,rc=new I,sc=new I,Hr=new I;function Kh(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Hr.fromArray(n,s);const a=r.x*Math.abs(Hr.x)+r.y*Math.abs(Hr.y)+r.z*Math.abs(Hr.z),l=e.dot(Hr),c=t.dot(Hr),u=i.dot(Hr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const hA=new pn,ra=new I,Jh=new I;class rn{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):hA.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ra.subVectors(e,this.center);const t=ra.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ra,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Jh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ra.copy(e.center).add(Jh)),this.expandByPoint(ra.copy(e.center).sub(Jh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ii=new I,Qh=new I,oc=new I,ar=new I,ef=new I,ac=new I,tf=new I;class Go{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ii)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ii.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ii.copy(this.origin).addScaledVector(this.direction,t),Ii.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Qh.copy(e).add(t).multiplyScalar(.5),oc.copy(t).sub(e).normalize(),ar.copy(this.origin).sub(Qh);const s=e.distanceTo(t)*.5,o=-this.direction.dot(oc),a=ar.dot(this.direction),l=-ar.dot(oc),c=ar.lengthSq(),u=Math.abs(1-o*o);let d,h,p,m;if(u>0)if(d=o*l-a,h=o*a-l,m=s*u,d>=0)if(h>=-m)if(h<=m){const y=1/u;d*=y,h*=y,p=d*(d+o*h+2*a)+h*(o*d+h+2*l)+c}else h=s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;else h<=-m?(d=Math.max(0,-(-o*s+a)),h=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+h*(h+2*l)+c):h<=m?(d=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(d=Math.max(0,-(o*s+a)),h=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+h*(h+2*l)+c);else h=o>0?-s:s,d=Math.max(0,-(o*h+a)),p=-d*d+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Qh).addScaledVector(oc,h),p}intersectSphere(e,t){Ii.subVectors(e.center,this.origin);const i=Ii.dot(this.direction),r=Ii.dot(Ii)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),d>=0?(a=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(a=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ii)!==null}intersectTriangle(e,t,i,r,s){ef.subVectors(t,e),ac.subVectors(i,e),tf.crossVectors(ef,ac);let o=this.direction.dot(tf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ar.subVectors(this.origin,e);const l=a*this.direction.dot(ac.crossVectors(ar,ac));if(l<0)return null;const c=a*this.direction.dot(ef.cross(ar));if(c<0||l+c>o)return null;const u=-a*ar.dot(tf);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,x){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,x)}set(e,t,i,r,s,o,a,l,c,u,d,h,p,m,y,x){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=d,f[14]=h,f[3]=p,f[7]=m,f[11]=y,f[15]=x,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 ke().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Os.setFromMatrixColumn(e,0).length(),s=1/Os.setFromMatrixColumn(e,1).length(),o=1/Os.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*d,m=a*u,y=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=p+m*c,t[5]=h-y*c,t[9]=-a*l,t[2]=y-h*c,t[6]=m+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*d,m=c*u,y=c*d;t[0]=h+y*a,t[4]=m*a-p,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=p*a-m,t[6]=y+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*d,m=c*u,y=c*d;t[0]=h-y*a,t[4]=-o*d,t[8]=m+p*a,t[1]=p+m*a,t[5]=o*u,t[9]=y-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*d,m=a*u,y=a*d;t[0]=l*u,t[4]=m*c-p,t[8]=h*c+y,t[1]=l*d,t[5]=y*c+h,t[9]=p*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,m=a*l,y=a*c;t[0]=l*u,t[4]=y-h*d,t[8]=m*d+p,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*d+m,t[10]=h-y*d}else if(e.order==="XZY"){const h=o*l,p=o*c,m=a*l,y=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+y,t[5]=o*u,t[9]=p*d-m,t[2]=m*d-p,t[6]=a*u,t[10]=y*d+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fA,e,pA)}lookAt(e,t,i){const r=this.elements;return Rn.subVectors(e,t),Rn.lengthSq()===0&&(Rn.z=1),Rn.normalize(),lr.crossVectors(i,Rn),lr.lengthSq()===0&&(Math.abs(i.z)===1?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),lr.crossVectors(i,Rn)),lr.normalize(),lc.crossVectors(Rn,lr),r[0]=lr.x,r[4]=lc.x,r[8]=Rn.x,r[1]=lr.y,r[5]=lc.y,r[9]=Rn.y,r[2]=lr.z,r[6]=lc.z,r[10]=Rn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],d=i[5],h=i[9],p=i[13],m=i[2],y=i[6],x=i[10],f=i[14],v=i[3],g=i[7],_=i[11],R=i[15],w=r[0],A=r[4],b=r[8],E=r[12],M=r[1],L=r[5],V=r[9],F=r[13],G=r[2],X=r[6],W=r[10],ne=r[14],D=r[3],Y=r[7],Q=r[11],oe=r[15];return s[0]=o*w+a*M+l*G+c*D,s[4]=o*A+a*L+l*X+c*Y,s[8]=o*b+a*V+l*W+c*Q,s[12]=o*E+a*F+l*ne+c*oe,s[1]=u*w+d*M+h*G+p*D,s[5]=u*A+d*L+h*X+p*Y,s[9]=u*b+d*V+h*W+p*Q,s[13]=u*E+d*F+h*ne+p*oe,s[2]=m*w+y*M+x*G+f*D,s[6]=m*A+y*L+x*X+f*Y,s[10]=m*b+y*V+x*W+f*Q,s[14]=m*E+y*F+x*ne+f*oe,s[3]=v*w+g*M+_*G+R*D,s[7]=v*A+g*L+_*X+R*Y,s[11]=v*b+g*V+_*W+R*Q,s[15]=v*E+g*F+_*ne+R*oe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],p=e[14],m=e[3],y=e[7],x=e[11],f=e[15];return m*(+s*l*d-r*c*d-s*a*h+i*c*h+r*a*p-i*l*p)+y*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+x*(+t*c*d-t*a*p-s*o*d+i*o*p+s*a*u-i*c*u)+f*(-r*a*u-t*l*d+t*a*h+r*o*d-i*o*h+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],p=e[11],m=e[12],y=e[13],x=e[14],f=e[15],v=d*x*c-y*h*c+y*l*p-a*x*p-d*l*f+a*h*f,g=m*h*c-u*x*c-m*l*p+o*x*p+u*l*f-o*h*f,_=u*y*c-m*d*c+m*a*p-o*y*p-u*a*f+o*d*f,R=m*d*l-u*y*l-m*a*h+o*y*h+u*a*x-o*d*x,w=t*v+i*g+r*_+s*R;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/w;return e[0]=v*A,e[1]=(y*h*s-d*x*s-y*r*p+i*x*p+d*r*f-i*h*f)*A,e[2]=(a*x*s-y*l*s+y*r*c-i*x*c-a*r*f+i*l*f)*A,e[3]=(d*l*s-a*h*s-d*r*c+i*h*c+a*r*p-i*l*p)*A,e[4]=g*A,e[5]=(u*x*s-m*h*s+m*r*p-t*x*p-u*r*f+t*h*f)*A,e[6]=(m*l*s-o*x*s-m*r*c+t*x*c+o*r*f-t*l*f)*A,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*A,e[8]=_*A,e[9]=(m*d*s-u*y*s-m*i*p+t*y*p+u*i*f-t*d*f)*A,e[10]=(o*y*s-m*a*s+m*i*c-t*y*c-o*i*f+t*a*f)*A,e[11]=(u*a*s-o*d*s-u*i*c+t*d*c+o*i*p-t*a*p)*A,e[12]=R*A,e[13]=(u*y*r-m*d*r+m*i*h-t*y*h-u*i*x+t*d*x)*A,e[14]=(m*a*r-o*y*r-m*i*l+t*y*l+o*i*x-t*a*x)*A,e[15]=(o*d*r-u*a*r+u*i*l-t*d*l-o*i*h+t*a*h)*A,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,d=a+a,h=s*c,p=s*u,m=s*d,y=o*u,x=o*d,f=a*d,v=l*c,g=l*u,_=l*d,R=i.x,w=i.y,A=i.z;return r[0]=(1-(y+f))*R,r[1]=(p+_)*R,r[2]=(m-g)*R,r[3]=0,r[4]=(p-_)*w,r[5]=(1-(h+f))*w,r[6]=(x+v)*w,r[7]=0,r[8]=(m+g)*A,r[9]=(x-v)*A,r[10]=(1-(h+y))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Os.set(r[0],r[1],r[2]).length();const o=Os.set(r[4],r[5],r[6]).length(),a=Os.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Qn.copy(this);const c=1/s,u=1/o,d=1/a;return Qn.elements[0]*=c,Qn.elements[1]*=c,Qn.elements[2]*=c,Qn.elements[4]*=u,Qn.elements[5]*=u,Qn.elements[6]*=u,Qn.elements[8]*=d,Qn.elements[9]*=d,Qn.elements[10]*=d,t.setFromRotationMatrix(Qn),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=_i){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),d=(t+e)/(t-e),h=(i+r)/(i-r);let p,m;if(a===_i)p=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===fl)p=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=_i){const l=this.elements,c=1/(t-e),u=1/(i-r),d=1/(o-s),h=(t+e)*c,p=(i+r)*u;let m,y;if(a===_i)m=(o+s)*d,y=-2*d;else if(a===fl)m=s*d,y=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=y,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Os=new I,Qn=new ke,fA=new I(0,0,0),pA=new I(1,1,1),lr=new I,lc=new I,Rn=new I,a0=new ke,l0=new En;class On{constructor(e=0,t=0,i=0,r=On.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],d=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(At(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-At(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(At(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-At(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(At(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-At(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return a0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(a0,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return l0.setFromEuler(this),this.setFromQuaternion(l0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class Bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let mA=0;const c0=new I,Fs=new En,Ni=new ke,cc=new I,sa=new I,gA=new I,xA=new En,u0=new I(1,0,0),d0=new I(0,1,0),h0=new I(0,0,1),f0={type:"added"},vA={type:"removed"},Bs={type:"childadded",child:null},nf={type:"childremoved",child:null};class nt extends Ti{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:mA++}),this.uuid=Un(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new I,t=new On,i=new En,r=new I(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ke},normalMatrix:{value:new je}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.multiply(Fs),this}rotateOnWorldAxis(e,t){return Fs.setFromAxisAngle(e,t),this.quaternion.premultiply(Fs),this}rotateX(e){return this.rotateOnAxis(u0,e)}rotateY(e){return this.rotateOnAxis(d0,e)}rotateZ(e){return this.rotateOnAxis(h0,e)}translateOnAxis(e,t){return c0.copy(e).applyQuaternion(this.quaternion),this.position.add(c0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(u0,e)}translateY(e){return this.translateOnAxis(d0,e)}translateZ(e){return this.translateOnAxis(h0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ni.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?cc.copy(e):cc.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),sa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ni.lookAt(sa,cc,this.up):Ni.lookAt(cc,sa,this.up),this.quaternion.setFromRotationMatrix(Ni),r&&(Ni.extractRotation(r.matrixWorld),Fs.setFromRotationMatrix(Ni),this.quaternion.premultiply(Fs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(f0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vA),nf.child=e,this.dispatchEvent(nf),nf.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ni.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ni.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ni),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(f0),Bs.child=e,this.dispatchEvent(Bs),Bs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,e,gA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sa,xA,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),d=o(e.shapes),h=o(e.skeletons),p=o(e.animations),m=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}nt.DEFAULT_UP=new I(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ei=new I,Li=new I,rf=new I,Di=new I,zs=new I,Vs=new I,p0=new I,sf=new I,of=new I,af=new I;class Nn{constructor(e=new I,t=new I,i=new I){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ei.subVectors(e,t),r.cross(ei);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ei.subVectors(r,t),Li.subVectors(i,t),rf.subVectors(e,t);const o=ei.dot(ei),a=ei.dot(Li),l=ei.dot(rf),c=Li.dot(Li),u=Li.dot(rf),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const h=1/d,p=(c*l-a*u)*h,m=(o*u-a*l)*h;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Di)===null?!1:Di.x>=0&&Di.y>=0&&Di.x+Di.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Di)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Di.x),l.addScaledVector(o,Di.y),l.addScaledVector(a,Di.z),l)}static isFrontFacing(e,t,i,r){return ei.subVectors(i,t),Li.subVectors(e,t),ei.cross(Li).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ei.subVectors(this.c,this.b),Li.subVectors(this.a,this.b),ei.cross(Li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Nn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;zs.subVectors(r,i),Vs.subVectors(s,i),sf.subVectors(e,i);const l=zs.dot(sf),c=Vs.dot(sf);if(l<=0&&c<=0)return t.copy(i);of.subVectors(e,r);const u=zs.dot(of),d=Vs.dot(of);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(zs,o);af.subVectors(e,s);const p=zs.dot(af),m=Vs.dot(af);if(m>=0&&p<=m)return t.copy(s);const y=p*c-l*m;if(y<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Vs,a);const x=u*m-p*d;if(x<=0&&d-u>=0&&p-m>=0)return p0.subVectors(s,r),a=(d-u)/(d-u+(p-m)),t.copy(r).addScaledVector(p0,a);const f=1/(x+y+h);return o=y*f,a=h*f,t.copy(i).addScaledVector(zs,o).addScaledVector(Vs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const oM={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},cr={h:0,s:0,l:0},uc={h:0,s:0,l:0};function lf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ye{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Hn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=rt.workingColorSpace){return this.r=e,this.g=t,this.b=i,rt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=rt.workingColorSpace){if(e=Qm(e,1),t=At(t,0,1),i=At(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=lf(o,s,e+1/3),this.g=lf(o,s,e),this.b=lf(o,s,e-1/3)}return rt.toWorkingColorSpace(this,r),this}setStyle(e,t=Hn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Hn){const i=oM[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Eo(e.r),this.g=Eo(e.g),this.b=Eo(e.b),this}copyLinearToSRGB(e){return this.r=$h(e.r),this.g=$h(e.g),this.b=$h(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Hn){return rt.fromWorkingColorSpace(en.copy(this),e),Math.round(At(en.r*255,0,255))*65536+Math.round(At(en.g*255,0,255))*256+Math.round(At(en.b*255,0,255))}getHexString(e=Hn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.fromWorkingColorSpace(en.copy(this),t);const i=en.r,r=en.g,s=en.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=rt.workingColorSpace){return rt.fromWorkingColorSpace(en.copy(this),t),e.r=en.r,e.g=en.g,e.b=en.b,e}getStyle(e=Hn){rt.fromWorkingColorSpace(en.copy(this),e);const t=en.r,i=en.g,r=en.b;return e!==Hn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(cr),this.setHSL(cr.h+e,cr.s+t,cr.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(cr),e.getHSL(uc);const i=ka(cr.h,uc.h,t),r=ka(cr.s,uc.s,t),s=ka(cr.l,uc.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const en=new ye;ye.NAMES=oM;let yA=0;class on extends Ti{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yA++}),this.uuid=Un(),this.name="",this.type="Material",this.blending=fs,this.side=Zi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Lu,this.blendDst=Du,this.blendEquation=vr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ye(0,0,0),this.blendAlpha=0,this.depthFunc=nl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Np,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ts,this.stencilZFail=ts,this.stencilZPass=ts,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==fs&&(i.blending=this.blending),this.side!==Zi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Lu&&(i.blendSrc=this.blendSrc),this.blendDst!==Du&&(i.blendDst=this.blendDst),this.blendEquation!==vr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==nl&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Np&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Or extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ye(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 On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Bi=_A();function _A(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function vn(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=At(n,-65504,65504),Bi.floatView[0]=n;const e=Bi.uint32View[0],t=e>>23&511;return Bi.baseTable[t]+((e&8388607)>>Bi.shiftTable[t])}function ya(n){const e=n>>10;return Bi.uint32View[0]=Bi.mantissaTable[Bi.offsetTable[e]+(n&1023)]+Bi.exponentTable[e],Bi.floatView[0]}const SA={toHalfFloat:vn,fromHalfFloat:ya},Lt=new I,dc=new K;class ht{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Sn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)dc.fromBufferAttribute(this,t),dc.applyMatrix3(e),this.setXY(t,dc.x,dc.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix4(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.applyNormalMatrix(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Lt.fromBufferAttribute(this,t),Lt.transformDirection(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==hl&&(e.usage=this.usage),e}}class MA extends ht{constructor(e,t,i){super(new Int8Array(e),t,i)}}class wA extends ht{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class bA extends ht{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class EA extends ht{constructor(e,t,i){super(new Int16Array(e),t,i)}}class tg extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class TA extends ht{constructor(e,t,i){super(new Int32Array(e),t,i)}}class ng extends ht{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class AA extends ht{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=ya(this.array[e*this.itemSize]);return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize]=vn(t),this}getY(e){let t=ya(this.array[e*this.itemSize+1]);return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+1]=vn(t),this}getZ(e){let t=ya(this.array[e*this.itemSize+2]);return this.normalized&&(t=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+2]=vn(t),this}getW(e){let t=ya(this.array[e*this.itemSize+3]);return this.normalized&&(t=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.array[e*this.itemSize+3]=vn(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.array[e+0]=vn(t),this.array[e+1]=vn(i),this.array[e+2]=vn(r),this.array[e+3]=vn(s),this}}class Ce extends ht{constructor(e,t,i){super(new Float32Array(e),t,i)}}let CA=0;const Vn=new ke,cf=new nt,Hs=new I,Pn=new pn,oa=new pn,Vt=new I;class $e extends Ti{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:CA++}),this.uuid=Un(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nM(e)?ng:tg)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new je().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vn.makeRotationFromQuaternion(e),this.applyMatrix4(Vn),this}rotateX(e){return Vn.makeRotationX(e),this.applyMatrix4(Vn),this}rotateY(e){return Vn.makeRotationY(e),this.applyMatrix4(Vn),this}rotateZ(e){return Vn.makeRotationZ(e),this.applyMatrix4(Vn),this}translate(e,t,i){return Vn.makeTranslation(e,t,i),this.applyMatrix4(Vn),this}scale(e,t,i){return Vn.makeScale(e,t,i),this.applyMatrix4(Vn),this}lookAt(e){return cf.lookAt(e),cf.updateMatrix(),this.applyMatrix4(cf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hs).negate(),this.translate(Hs.x,Hs.y,Hs.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ce(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Pn.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,Pn.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,Pn.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(Pn.min),this.boundingBox.expandByPoint(Pn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 rn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const i=this.boundingSphere.center;if(Pn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];oa.setFromBufferAttribute(a),this.morphTargetsRelative?(Vt.addVectors(Pn.min,oa.min),Pn.expandByPoint(Vt),Vt.addVectors(Pn.max,oa.max),Pn.expandByPoint(Vt)):(Pn.expandByPoint(oa.min),Pn.expandByPoint(oa.max))}Pn.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Vt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Vt.fromBufferAttribute(a,c),l&&(Hs.fromBufferAttribute(e,c),Vt.add(Hs)),r=Math.max(r,i.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ht(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let b=0;b<i.count;b++)a[b]=new I,l[b]=new I;const c=new I,u=new I,d=new I,h=new K,p=new K,m=new K,y=new I,x=new I;function f(b,E,M){c.fromBufferAttribute(i,b),u.fromBufferAttribute(i,E),d.fromBufferAttribute(i,M),h.fromBufferAttribute(s,b),p.fromBufferAttribute(s,E),m.fromBufferAttribute(s,M),u.sub(c),d.sub(c),p.sub(h),m.sub(h);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(y.copy(u).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(L),x.copy(d).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(L),a[b].add(y),a[E].add(y),a[M].add(y),l[b].add(x),l[E].add(x),l[M].add(x))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let b=0,E=v.length;b<E;++b){const M=v[b],L=M.start,V=M.count;for(let F=L,G=L+V;F<G;F+=3)f(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const g=new I,_=new I,R=new I,w=new I;function A(b){R.fromBufferAttribute(r,b),w.copy(R);const E=a[b];g.copy(E),g.sub(R.multiplyScalar(R.dot(E))).normalize(),_.crossVectors(w,E);const L=_.dot(l[b])<0?-1:1;o.setXYZW(b,g.x,g.y,g.z,L)}for(let b=0,E=v.length;b<E;++b){const M=v[b],L=M.start,V=M.count;for(let F=L,G=L+V;F<G;F+=3)A(e.getX(F+0)),A(e.getX(F+1)),A(e.getX(F+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ht(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new I,s=new I,o=new I,a=new I,l=new I,c=new I,u=new I,d=new I;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),y=e.getX(h+1),x=e.getX(h+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,y),o.fromBufferAttribute(t,x),u.subVectors(o,s),d.subVectors(r,s),u.cross(d),a.fromBufferAttribute(i,m),l.fromBufferAttribute(i,y),c.fromBufferAttribute(i,x),a.add(u),l.add(u),c.add(u),i.setXYZ(m,a.x,a.y,a.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(x,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),u.subVectors(o,s),d.subVectors(r,s),u.cross(d),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Vt.fromBufferAttribute(e,t),Vt.normalize(),e.setXYZ(t,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,d=a.normalized,h=new c.constructor(l.length*u);let p=0,m=0;for(let y=0,x=l.length;y<x;y++){a.isInterleavedBufferAttribute?p=l[y]*a.data.stride+a.offset:p=l[y]*u;for(let f=0;f<u;f++)h[m++]=c[p++]}return new ht(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new $e,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,d=c.length;u<d;u++){const h=c[u],p=e(h,i);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const p=c[d];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,p=d.length;h<p;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const m0=new ke,Gr=new Go,hc=new rn,g0=new I,Gs=new I,Ws=new I,js=new I,uf=new I,fc=new I,pc=new K,mc=new K,gc=new K,x0=new I,v0=new I,y0=new I,xc=new I,vc=new I;class kt extends nt{constructor(e=new $e,t=new Or){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){fc.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],d=s[l];u!==0&&(uf.fromBufferAttribute(d,e),o?fc.addScaledVector(uf,u):fc.addScaledVector(uf.sub(t),u))}t.add(fc)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),hc.copy(i.boundingSphere),hc.applyMatrix4(s),Gr.copy(e.ray).recast(e.near),!(hc.containsPoint(Gr.origin)===!1&&(Gr.intersectSphere(hc,g0)===null||Gr.origin.distanceToSquared(g0)>(e.far-e.near)**2))&&(m0.copy(s).invert(),Gr.copy(e.ray).applyMatrix4(m0),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,y=h.length;m<y;m++){const x=h[m],f=o[x.materialIndex],v=Math.max(x.start,p.start),g=Math.min(a.count,Math.min(x.start+x.count,p.start+p.count));for(let _=v,R=g;_<R;_+=3){const w=a.getX(_),A=a.getX(_+1),b=a.getX(_+2);r=yc(this,f,e,i,c,u,d,w,A,b),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=x.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(a.count,p.start+p.count);for(let x=m,f=y;x<f;x+=3){const v=a.getX(x),g=a.getX(x+1),_=a.getX(x+2);r=yc(this,o,e,i,c,u,d,v,g,_),r&&(r.faceIndex=Math.floor(x/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,y=h.length;m<y;m++){const x=h[m],f=o[x.materialIndex],v=Math.max(x.start,p.start),g=Math.min(l.count,Math.min(x.start+x.count,p.start+p.count));for(let _=v,R=g;_<R;_+=3){const w=_,A=_+1,b=_+2;r=yc(this,f,e,i,c,u,d,w,A,b),r&&(r.faceIndex=Math.floor(_/3),r.face.materialIndex=x.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),y=Math.min(l.count,p.start+p.count);for(let x=m,f=y;x<f;x+=3){const v=x,g=x+1,_=x+2;r=yc(this,o,e,i,c,u,d,v,g,_),r&&(r.faceIndex=Math.floor(x/3),t.push(r))}}}}function RA(n,e,t,i,r,s,o,a){let l;if(e.side===fn?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Zi,a),l===null)return null;vc.copy(a),vc.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(vc);return c<t.near||c>t.far?null:{distance:c,point:vc.clone(),object:n}}function yc(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Gs),n.getVertexPosition(l,Ws),n.getVertexPosition(c,js);const u=RA(n,e,t,i,Gs,Ws,js,xc);if(u){r&&(pc.fromBufferAttribute(r,a),mc.fromBufferAttribute(r,l),gc.fromBufferAttribute(r,c),u.uv=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new K)),s&&(pc.fromBufferAttribute(s,a),mc.fromBufferAttribute(s,l),gc.fromBufferAttribute(s,c),u.uv1=Nn.getInterpolation(xc,Gs,Ws,js,pc,mc,gc,new K)),o&&(x0.fromBufferAttribute(o,a),v0.fromBufferAttribute(o,l),y0.fromBufferAttribute(o,c),u.normal=Nn.getInterpolation(xc,Gs,Ws,js,x0,v0,y0,new I),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new I,materialIndex:0};Nn.getNormal(Gs,Ws,js,d.normal),u.face=d}return u}class Cs extends $e{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],d=[];let h=0,p=0;m("z","y","x",-1,-1,i,t,e,o,s,0),m("z","y","x",1,-1,i,t,-e,o,s,1),m("x","z","y",1,1,e,i,t,r,o,2),m("x","z","y",1,-1,e,i,-t,r,o,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Ce(c,3)),this.setAttribute("normal",new Ce(u,3)),this.setAttribute("uv",new Ce(d,2));function m(y,x,f,v,g,_,R,w,A,b,E){const M=_/A,L=R/b,V=_/2,F=R/2,G=w/2,X=A+1,W=b+1;let ne=0,D=0;const Y=new I;for(let Q=0;Q<W;Q++){const oe=Q*L-F;for(let Re=0;Re<X;Re++){const Ke=Re*M-V;Y[y]=Ke*v,Y[x]=oe*g,Y[f]=G,c.push(Y.x,Y.y,Y.z),Y[y]=0,Y[x]=0,Y[f]=w>0?1:-1,u.push(Y.x,Y.y,Y.z),d.push(Re/A),d.push(1-Q/b),ne+=1}}for(let Q=0;Q<b;Q++)for(let oe=0;oe<A;oe++){const Re=h+oe+X*Q,Ke=h+oe+X*(Q+1),j=h+(oe+1)+X*(Q+1),se=h+(oe+1)+X*Q;l.push(Re,Ke,se),l.push(Ke,j,se),D+=6}a.addGroup(p,D,E),p+=D,h+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ko(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function ln(n){const e={};for(let t=0;t<n.length;t++){const i=ko(n[t]);for(const r in i)e[r]=i[r]}return e}function PA(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function aM(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const lM={clone:ko,merge:ln};var IA=`void main() {
63
63
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
64
64
  }`,NA=`void main() {
65
65
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -98,7 +98,7 @@ ${n.slice(-t)}`}function tT({suggestion:n}){const e=n.severity==="danger"?"text-
98
98
  gl_FragColor = texture2D( tEquirect, sampleUV );
99
99
 
100
100
  }
101
- `},r=new Cs(5,5,5),s=new ci({name:"CubemapFromEquirect",uniforms:ko(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fn,blending:Wi});s.uniforms.tEquirect.value=t;const o=new kt(r,s),a=t.minFilter;return t.minFilter===yi&&(t.minFilter=Ut),new cM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const df=new I,LA=new I,DA=new je;class mr{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=df.subVectors(i,t).cross(LA.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(df),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||DA.getNormalMatrix(e),r=this.coplanarPoint(df).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Wr=new rn,_c=new I;class Nl{constructor(e=new mr,t=new mr,i=new mr,r=new mr,s=new mr,o=new mr){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=_i){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],p=r[8],m=r[9],y=r[10],g=r[11],f=r[12],v=r[13],x=r[14],_=r[15];if(i[0].setComponents(l-s,h-c,g-p,_-f).normalize(),i[1].setComponents(l+s,h+c,g+p,_+f).normalize(),i[2].setComponents(l+o,h+u,g+m,_+v).normalize(),i[3].setComponents(l-o,h-u,g-m,_-v).normalize(),i[4].setComponents(l-a,h-d,g-y,_-x).normalize(),t===_i)i[5].setComponents(l+a,h+d,g+y,_+x).normalize();else if(t===fl)i[5].setComponents(a,d,y,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Wr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wr)}intersectsSprite(e){return Wr.center.set(0,0,0),Wr.radius=.7071067811865476,Wr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wr)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(_c.x=r.normal.x>0?e.max.x:e.min.x,_c.y=r.normal.y>0?e.max.y:e.min.y,_c.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_c)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function dM(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function UA(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,d=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:d}}function i(a,l,c){const u=l.array,d=l._updateRange,h=l.updateRanges;if(n.bindBuffer(c,a),d.count===-1&&h.length===0&&n.bufferSubData(c,0,u),h.length!==0){for(let p=0,m=h.length;p<m;p++){const y=h[p];n.bufferSubData(c,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}l.clearUpdateRanges()}d.count!==-1&&(n.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class Wo extends $e{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,d=e/a,h=t/l,p=[],m=[],y=[],g=[];for(let f=0;f<u;f++){const v=f*h-o;for(let x=0;x<c;x++){const _=x*d-s;m.push(_,-v,0),y.push(0,0,1),g.push(x/a),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<a;v++){const x=v+c*f,_=v+c*(f+1),R=v+1+c*(f+1),M=v+1+c*f;p.push(x,_,M),p.push(_,R,M)}this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(y,3)),this.setAttribute("uv",new Ce(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wo(e.width,e.height,e.widthSegments,e.heightSegments)}}var kA=`#ifdef USE_ALPHAHASH
101
+ `},r=new Cs(5,5,5),s=new ci({name:"CubemapFromEquirect",uniforms:ko(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fn,blending:Wi});s.uniforms.tEquirect.value=t;const o=new kt(r,s),a=t.minFilter;return t.minFilter===yi&&(t.minFilter=Ut),new cM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const df=new I,LA=new I,DA=new je;class mr{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=df.subVectors(i,t).cross(LA.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(df),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||DA.getNormalMatrix(e),r=this.coplanarPoint(df).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Wr=new rn,_c=new I;class Nl{constructor(e=new mr,t=new mr,i=new mr,r=new mr,s=new mr,o=new mr){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=_i){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],p=r[8],m=r[9],y=r[10],x=r[11],f=r[12],v=r[13],g=r[14],_=r[15];if(i[0].setComponents(l-s,h-c,x-p,_-f).normalize(),i[1].setComponents(l+s,h+c,x+p,_+f).normalize(),i[2].setComponents(l+o,h+u,x+m,_+v).normalize(),i[3].setComponents(l-o,h-u,x-m,_-v).normalize(),i[4].setComponents(l-a,h-d,x-y,_-g).normalize(),t===_i)i[5].setComponents(l+a,h+d,x+y,_+g).normalize();else if(t===fl)i[5].setComponents(a,d,y,g).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Wr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wr)}intersectsSprite(e){return Wr.center.set(0,0,0),Wr.radius=.7071067811865476,Wr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wr)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(_c.x=r.normal.x>0?e.max.x:e.min.x,_c.y=r.normal.y>0?e.max.y:e.min.y,_c.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_c)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function dM(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function UA(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,d=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:d}}function i(a,l,c){const u=l.array,d=l._updateRange,h=l.updateRanges;if(n.bindBuffer(c,a),d.count===-1&&h.length===0&&n.bufferSubData(c,0,u),h.length!==0){for(let p=0,m=h.length;p<m;p++){const y=h[p];n.bufferSubData(c,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}l.clearUpdateRanges()}d.count!==-1&&(n.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class Wo extends $e{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,d=e/a,h=t/l,p=[],m=[],y=[],x=[];for(let f=0;f<u;f++){const v=f*h-o;for(let g=0;g<c;g++){const _=g*d-s;m.push(_,-v,0),y.push(0,0,1),x.push(g/a),x.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<a;v++){const g=v+c*f,_=v+c*(f+1),R=v+1+c*(f+1),w=v+1+c*f;p.push(g,_,w),p.push(_,R,w)}this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(y,3)),this.setAttribute("uv",new Ce(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wo(e.width,e.height,e.widthSegments,e.heightSegments)}}var kA=`#ifdef USE_ALPHAHASH
102
102
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
103
103
  #endif`,OA=`#ifdef USE_ALPHAHASH
104
104
  const float ALPHA_HASH_SCALE = 0.05;
@@ -3643,7 +3643,7 @@ void main() {
3643
3643
  #include <tonemapping_fragment>
3644
3644
  #include <colorspace_fragment>
3645
3645
  #include <fog_fragment>
3646
- }`,Ye={alphahash_fragment:kA,alphahash_pars_fragment:OA,alphamap_fragment:FA,alphamap_pars_fragment:BA,alphatest_fragment:zA,alphatest_pars_fragment:VA,aomap_fragment:HA,aomap_pars_fragment:GA,batching_pars_vertex:WA,batching_vertex:jA,begin_vertex:XA,beginnormal_vertex:YA,bsdfs:$A,iridescence_fragment:qA,bumpmap_pars_fragment:ZA,clipping_planes_fragment:KA,clipping_planes_pars_fragment:JA,clipping_planes_pars_vertex:QA,clipping_planes_vertex:eC,color_fragment:tC,color_pars_fragment:nC,color_pars_vertex:iC,color_vertex:rC,common:sC,cube_uv_reflection_fragment:oC,defaultnormal_vertex:aC,displacementmap_pars_vertex:lC,displacementmap_vertex:cC,emissivemap_fragment:uC,emissivemap_pars_fragment:dC,colorspace_fragment:hC,colorspace_pars_fragment:fC,envmap_fragment:pC,envmap_common_pars_fragment:mC,envmap_pars_fragment:gC,envmap_pars_vertex:xC,envmap_physical_pars_fragment:CC,envmap_vertex:vC,fog_vertex:yC,fog_pars_vertex:_C,fog_fragment:SC,fog_pars_fragment:MC,gradientmap_pars_fragment:wC,lightmap_pars_fragment:bC,lights_lambert_fragment:EC,lights_lambert_pars_fragment:TC,lights_pars_begin:AC,lights_toon_fragment:RC,lights_toon_pars_fragment:PC,lights_phong_fragment:IC,lights_phong_pars_fragment:NC,lights_physical_fragment:LC,lights_physical_pars_fragment:DC,lights_fragment_begin:UC,lights_fragment_maps:kC,lights_fragment_end:OC,logdepthbuf_fragment:FC,logdepthbuf_pars_fragment:BC,logdepthbuf_pars_vertex:zC,logdepthbuf_vertex:VC,map_fragment:HC,map_pars_fragment:GC,map_particle_fragment:WC,map_particle_pars_fragment:jC,metalnessmap_fragment:XC,metalnessmap_pars_fragment:YC,morphinstance_vertex:$C,morphcolor_vertex:qC,morphnormal_vertex:ZC,morphtarget_pars_vertex:KC,morphtarget_vertex:JC,normal_fragment_begin:QC,normal_fragment_maps:eR,normal_pars_fragment:tR,normal_pars_vertex:nR,normal_vertex:iR,normalmap_pars_fragment:rR,clearcoat_normal_fragment_begin:sR,clearcoat_normal_fragment_maps:oR,clearcoat_pars_fragment:aR,iridescence_pars_fragment:lR,opaque_fragment:cR,packing:uR,premultiplied_alpha_fragment:dR,project_vertex:hR,dithering_fragment:fR,dithering_pars_fragment:pR,roughnessmap_fragment:mR,roughnessmap_pars_fragment:gR,shadowmap_pars_fragment:xR,shadowmap_pars_vertex:vR,shadowmap_vertex:yR,shadowmask_pars_fragment:_R,skinbase_vertex:SR,skinning_pars_vertex:MR,skinning_vertex:wR,skinnormal_vertex:bR,specularmap_fragment:ER,specularmap_pars_fragment:TR,tonemapping_fragment:AR,tonemapping_pars_fragment:CR,transmission_fragment:RR,transmission_pars_fragment:PR,uv_pars_fragment:IR,uv_pars_vertex:NR,uv_vertex:LR,worldpos_vertex:DR,background_vert:UR,background_frag:kR,backgroundCube_vert:OR,backgroundCube_frag:FR,cube_vert:BR,cube_frag:zR,depth_vert:VR,depth_frag:HR,distanceRGBA_vert:GR,distanceRGBA_frag:WR,equirect_vert:jR,equirect_frag:XR,linedashed_vert:YR,linedashed_frag:$R,meshbasic_vert:qR,meshbasic_frag:ZR,meshlambert_vert:KR,meshlambert_frag:JR,meshmatcap_vert:QR,meshmatcap_frag:eP,meshnormal_vert:tP,meshnormal_frag:nP,meshphong_vert:iP,meshphong_frag:rP,meshphysical_vert:sP,meshphysical_frag:oP,meshtoon_vert:aP,meshtoon_frag:lP,points_vert:cP,points_frag:uP,shadow_vert:dP,shadow_frag:hP,sprite_vert:fP,sprite_frag:pP},fe={common:{diffuse:{value:new ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new je}},envmap:{envMap:{value:null},envMapRotation:{value:new je},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new je},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ye(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 ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new ye(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}}},ri={basic:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new ye(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new ye(0)},specular:{value:new ye(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:ln([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:ln([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new ye(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:ln([fe.points,fe.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:ln([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:ln([fe.common,fe.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:ln([fe.sprite,fe.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new je}},vertexShader:Ye.backgroundCube_vert,fragmentShader:Ye.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:ln([fe.common,fe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:ln([fe.lights,fe.fog,{color:{value:new ye(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};ri.physical={uniforms:ln([ri.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new je},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new je},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new je},sheen:{value:0},sheenColor:{value:new ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new je},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new je},attenuationDistance:{value:0},attenuationColor:{value:new ye(0)},specularColor:{value:new ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new je},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new je}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};const Sc={r:0,b:0,g:0},jr=new On,mP=new ke;function gP(n,e,t,i,r,s,o){const a=new ye(0);let l=s===!0?0:1,c,u,d=null,h=0,p=null;function m(v){let x=v.isScene===!0?v.background:null;return x&&x.isTexture&&(x=(v.backgroundBlurriness>0?t:e).get(x)),x}function y(v){let x=!1;const _=m(v);_===null?f(a,l):_&&_.isColor&&(f(_,1),x=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,o):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||x)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,x){const _=m(x);_&&(_.isCubeTexture||_.mapping===Vo)?(u===void 0&&(u=new kt(new Cs(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:ko(ri.backgroundCube.uniforms),vertexShader:ri.backgroundCube.vertexShader,fragmentShader:ri.backgroundCube.fragmentShader,side:fn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,M,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),jr.copy(x.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=_,u.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(mP.makeRotationFromEuler(jr)),u.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,(d!==_||h!==_.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,d=_,h=_.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new kt(new Wo(2,2),new ci({name:"BackgroundMaterial",uniforms:ko(ri.background.uniforms),vertexShader:ri.background.vertexShader,fragmentShader:ri.background.fragmentShader,side:Zi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(d!==_||h!==_.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,d=_,h=_.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function f(v,x){v.getRGB(Sc,aM(n)),i.buffers.color.setClear(Sc.r,Sc.g,Sc.b,x,o)}return{getClearColor:function(){return a},setClearColor:function(v,x=1){a.set(v),l=x,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,f(a,l)},render:y,addToRenderList:g}}function xP(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(w,L,V,F,G){let Y=!1;const W=d(F,V,L);s!==W&&(s=W,c(s.object)),Y=p(w,F,V,G),Y&&m(w,F,V,G),G!==null&&e.update(G,n.ELEMENT_ARRAY_BUFFER),(Y||o)&&(o=!1,_(w,L,V,F),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return n.createVertexArray()}function c(w){return n.bindVertexArray(w)}function u(w){return n.deleteVertexArray(w)}function d(w,L,V){const F=V.wireframe===!0;let G=i[w.id];G===void 0&&(G={},i[w.id]=G);let Y=G[L.id];Y===void 0&&(Y={},G[L.id]=Y);let W=Y[F];return W===void 0&&(W=h(l()),Y[F]=W),W}function h(w){const L=[],V=[],F=[];for(let G=0;G<t;G++)L[G]=0,V[G]=0,F[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:V,attributeDivisors:F,object:w,attributes:{},index:null}}function p(w,L,V,F){const G=s.attributes,Y=L.attributes;let W=0;const ne=V.getAttributes();for(const D in ne)if(ne[D].location>=0){const Q=G[D];let oe=Y[D];if(oe===void 0&&(D==="instanceMatrix"&&w.instanceMatrix&&(oe=w.instanceMatrix),D==="instanceColor"&&w.instanceColor&&(oe=w.instanceColor)),Q===void 0||Q.attribute!==oe||oe&&Q.data!==oe.data)return!0;W++}return s.attributesNum!==W||s.index!==F}function m(w,L,V,F){const G={},Y=L.attributes;let W=0;const ne=V.getAttributes();for(const D in ne)if(ne[D].location>=0){let Q=Y[D];Q===void 0&&(D==="instanceMatrix"&&w.instanceMatrix&&(Q=w.instanceMatrix),D==="instanceColor"&&w.instanceColor&&(Q=w.instanceColor));const oe={};oe.attribute=Q,Q&&Q.data&&(oe.data=Q.data),G[D]=oe,W++}s.attributes=G,s.attributesNum=W,s.index=F}function y(){const w=s.newAttributes;for(let L=0,V=w.length;L<V;L++)w[L]=0}function g(w){f(w,0)}function f(w,L){const V=s.newAttributes,F=s.enabledAttributes,G=s.attributeDivisors;V[w]=1,F[w]===0&&(n.enableVertexAttribArray(w),F[w]=1),G[w]!==L&&(n.vertexAttribDivisor(w,L),G[w]=L)}function v(){const w=s.newAttributes,L=s.enabledAttributes;for(let V=0,F=L.length;V<F;V++)L[V]!==w[V]&&(n.disableVertexAttribArray(V),L[V]=0)}function x(w,L,V,F,G,Y,W){W===!0?n.vertexAttribIPointer(w,L,V,G,Y):n.vertexAttribPointer(w,L,V,F,G,Y)}function _(w,L,V,F){y();const G=F.attributes,Y=V.getAttributes(),W=L.defaultAttributeValues;for(const ne in Y){const D=Y[ne];if(D.location>=0){let X=G[ne];if(X===void 0&&(ne==="instanceMatrix"&&w.instanceMatrix&&(X=w.instanceMatrix),ne==="instanceColor"&&w.instanceColor&&(X=w.instanceColor)),X!==void 0){const Q=X.normalized,oe=X.itemSize,Re=e.get(X);if(Re===void 0)continue;const Ke=Re.buffer,j=Re.type,se=Re.bytesPerElement,xe=j===n.INT||j===n.UNSIGNED_INT||X.gpuType===Pd;if(X.isInterleavedBufferAttribute){const de=X.data,De=de.stride,He=X.offset;if(de.isInstancedInterleavedBuffer){for(let Be=0;Be<D.locationSize;Be++)f(D.location+Be,de.meshPerAttribute);w.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let Be=0;Be<D.locationSize;Be++)g(D.location+Be);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let Be=0;Be<D.locationSize;Be++)x(D.location+Be,oe/D.locationSize,j,Q,De*se,(He+oe/D.locationSize*Be)*se,xe)}else{if(X.isInstancedBufferAttribute){for(let de=0;de<D.locationSize;de++)f(D.location+de,X.meshPerAttribute);w.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=X.meshPerAttribute*X.count)}else for(let de=0;de<D.locationSize;de++)g(D.location+de);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let de=0;de<D.locationSize;de++)x(D.location+de,oe/D.locationSize,j,Q,oe*se,oe/D.locationSize*de*se,xe)}}else if(W!==void 0){const Q=W[ne];if(Q!==void 0)switch(Q.length){case 2:n.vertexAttrib2fv(D.location,Q);break;case 3:n.vertexAttrib3fv(D.location,Q);break;case 4:n.vertexAttrib4fv(D.location,Q);break;default:n.vertexAttrib1fv(D.location,Q)}}}}v()}function R(){A();for(const w in i){const L=i[w];for(const V in L){const F=L[V];for(const G in F)u(F[G].object),delete F[G];delete L[V]}delete i[w]}}function M(w){if(i[w.id]===void 0)return;const L=i[w.id];for(const V in L){const F=L[V];for(const G in F)u(F[G].object),delete F[G];delete L[V]}delete i[w.id]}function T(w){for(const L in i){const V=i[L];if(V[w.id]===void 0)continue;const F=V[w.id];for(const G in F)u(F[G].object),delete F[G];delete V[w.id]}}function A(){E(),o=!0,s!==r&&(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:A,resetDefaultState:E,dispose:R,releaseStatesOfGeometry:M,releaseStatesOfProgram:T,initAttributes:y,enableAttribute:g,disableUnusedAttributes:v}}function vP(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function o(c,u,d){d!==0&&(n.drawArraysInstanced(i,c,u,d),t.update(u,i,d))}function a(c,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,d);let p=0;for(let m=0;m<d;m++)p+=u[m];t.update(p,i,1)}function l(c,u,d,h){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<c.length;m++)o(c[m],u[m],h[m]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,h,0,d);let m=0;for(let y=0;y<d;y++)m+=u[y];for(let y=0;y<h.length;y++)t.update(m,i,h[y])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function yP(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const M=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(M.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(M){return!(M!==dn&&i.convert(M)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(M){const T=M===Ho&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(M!==Ei&&i.convert(M)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&M!==Sn&&!T)}function l(M){if(M==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";M="mediump"}return M==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),y=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),f=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),x=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=p>0,R=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:y,maxAttributes:g,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:_,maxSamples:R}}function _P(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new mr,a=new je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const p=d.length!==0||h||i!==0||r;return r=h,i=d.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,p){const m=d.clippingPlanes,y=d.clipIntersection,g=d.clipShadows,f=n.get(d);if(!r||m===null||m.length===0||s&&!g)s?u(null):c();else{const v=s?0:i,x=v*4;let _=f.clippingState||null;l.value=_,_=u(m,h,x,p);for(let R=0;R!==x;++R)_[R]=t[R];f.clippingState=_,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,h,p,m){const y=d!==null?d.length:0;let g=null;if(y!==0){if(g=l.value,m!==!0||g===null){const f=p+y*4,v=h.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length<f)&&(g=new Float32Array(f));for(let x=0,_=p;x!==y;++x,_+=4)o.copy(d[x]).applyMatrix4(v,a),o.normal.toArray(g,_),g[_+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,g}}function SP(n){let e=new WeakMap;function t(o,a){return a===il?o.mapping=Ki:a===rl&&(o.mapping=Ir),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===il||a===rl)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new uM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Vd extends zd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const mo=4,M0=[.125,.215,.35,.446,.526,.582],is=20,hf=new Vd,w0=new ye;let ff=null,pf=0,mf=0,gf=!1;const ns=(1+Math.sqrt(5))/2,$s=1/ns,b0=[new I(-ns,$s,0),new I(ns,$s,0),new I(-$s,0,ns),new I($s,0,ns),new I(0,ns,-$s),new I(0,ns,$s),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)];class Dp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){ff=this._renderer.getRenderTarget(),pf=this._renderer.getActiveCubeFace(),mf=this._renderer.getActiveMipmapLevel(),gf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=A0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=T0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ff,pf,mf),this._renderer.xr.enabled=gf,e.scissorTest=!1,Mc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ki||e.mapping===Ir?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ff=this._renderer.getRenderTarget(),pf=this._renderer.getActiveCubeFace(),mf=this._renderer.getActiveMipmapLevel(),gf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Ut,minFilter:Ut,generateMipmaps:!1,type:Ho,format:dn,colorSpace:tr,depthBuffer:!1},r=E0(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=E0(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=MP(s)),this._blurMaterial=wP(s,e,t)}return r}_compileMaterial(e){const t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,hf)}_sceneToCubeUV(e,t,i,r){const a=new $t(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,h=u.toneMapping;u.getClearColor(w0),u.toneMapping=ji,u.autoClear=!1;const p=new Or({name:"PMREM.Background",side:fn,depthWrite:!1,depthTest:!1}),m=new kt(new Cs,p);let y=!1;const g=e.background;g?g.isColor&&(p.color.copy(g),e.background=null,y=!0):(p.color.copy(w0),y=!0);for(let f=0;f<6;f++){const v=f%3;v===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):v===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const x=this._cubeSize;Mc(r,v*x,f>2?x:0,x,x),u.setRenderTarget(r),y&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ki||e.mapping===Ir;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=A0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=T0());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Mc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,hf)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=b0[(r-s-1)%b0.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new kt(this._lodPlanes[r],c),h=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*is-1),y=s/m,g=isFinite(s)?1+Math.floor(u*y):is;g>is&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${is}`);const f=[];let v=0;for(let T=0;T<is;++T){const A=T/y,E=Math.exp(-A*A/2);f.push(E),T===0?v+=E:T<g&&(v+=2*E)}for(let T=0;T<f.length;T++)f[T]=f[T]/v;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=f,h.latitudinal.value=o==="latitudinal",a&&(h.poleAxis.value=a);const{_lodMax:x}=this;h.dTheta.value=m,h.mipInt.value=x-i;const _=this._sizeLods[r],R=3*_*(r>x-mo?r-x+mo:0),M=4*(this._cubeSize-_);Mc(t,R,M,3*_,2*_),l.setRenderTarget(t),l.render(d,hf)}}function MP(n){const e=[],t=[],i=[];let r=n;const s=n-mo+1+M0.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-mo?l=M0[o-n+mo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,m=6,y=3,g=2,f=1,v=new Float32Array(y*m*p),x=new Float32Array(g*m*p),_=new Float32Array(f*m*p);for(let M=0;M<p;M++){const T=M%3*2/3-1,A=M>2?0:-1,E=[T,A,0,T+2/3,A,0,T+2/3,A+1,0,T,A,0,T+2/3,A+1,0,T,A+1,0];v.set(E,y*m*M),x.set(h,g*m*M);const w=[M,M,M,M,M,M];_.set(w,f*m*M)}const R=new $e;R.setAttribute("position",new ht(v,y)),R.setAttribute("uv",new ht(x,g)),R.setAttribute("faceIndex",new ht(_,f)),e.push(R),r>mo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function E0(n,e,t){const i=new li(n,e,t);return i.texture.mapping=Vo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Mc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function wP(n,e,t){const i=new Float32Array(is),r=new I(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ig(),fragmentShader:`
3646
+ }`,Ye={alphahash_fragment:kA,alphahash_pars_fragment:OA,alphamap_fragment:FA,alphamap_pars_fragment:BA,alphatest_fragment:zA,alphatest_pars_fragment:VA,aomap_fragment:HA,aomap_pars_fragment:GA,batching_pars_vertex:WA,batching_vertex:jA,begin_vertex:XA,beginnormal_vertex:YA,bsdfs:$A,iridescence_fragment:qA,bumpmap_pars_fragment:ZA,clipping_planes_fragment:KA,clipping_planes_pars_fragment:JA,clipping_planes_pars_vertex:QA,clipping_planes_vertex:eC,color_fragment:tC,color_pars_fragment:nC,color_pars_vertex:iC,color_vertex:rC,common:sC,cube_uv_reflection_fragment:oC,defaultnormal_vertex:aC,displacementmap_pars_vertex:lC,displacementmap_vertex:cC,emissivemap_fragment:uC,emissivemap_pars_fragment:dC,colorspace_fragment:hC,colorspace_pars_fragment:fC,envmap_fragment:pC,envmap_common_pars_fragment:mC,envmap_pars_fragment:gC,envmap_pars_vertex:xC,envmap_physical_pars_fragment:CC,envmap_vertex:vC,fog_vertex:yC,fog_pars_vertex:_C,fog_fragment:SC,fog_pars_fragment:MC,gradientmap_pars_fragment:wC,lightmap_pars_fragment:bC,lights_lambert_fragment:EC,lights_lambert_pars_fragment:TC,lights_pars_begin:AC,lights_toon_fragment:RC,lights_toon_pars_fragment:PC,lights_phong_fragment:IC,lights_phong_pars_fragment:NC,lights_physical_fragment:LC,lights_physical_pars_fragment:DC,lights_fragment_begin:UC,lights_fragment_maps:kC,lights_fragment_end:OC,logdepthbuf_fragment:FC,logdepthbuf_pars_fragment:BC,logdepthbuf_pars_vertex:zC,logdepthbuf_vertex:VC,map_fragment:HC,map_pars_fragment:GC,map_particle_fragment:WC,map_particle_pars_fragment:jC,metalnessmap_fragment:XC,metalnessmap_pars_fragment:YC,morphinstance_vertex:$C,morphcolor_vertex:qC,morphnormal_vertex:ZC,morphtarget_pars_vertex:KC,morphtarget_vertex:JC,normal_fragment_begin:QC,normal_fragment_maps:eR,normal_pars_fragment:tR,normal_pars_vertex:nR,normal_vertex:iR,normalmap_pars_fragment:rR,clearcoat_normal_fragment_begin:sR,clearcoat_normal_fragment_maps:oR,clearcoat_pars_fragment:aR,iridescence_pars_fragment:lR,opaque_fragment:cR,packing:uR,premultiplied_alpha_fragment:dR,project_vertex:hR,dithering_fragment:fR,dithering_pars_fragment:pR,roughnessmap_fragment:mR,roughnessmap_pars_fragment:gR,shadowmap_pars_fragment:xR,shadowmap_pars_vertex:vR,shadowmap_vertex:yR,shadowmask_pars_fragment:_R,skinbase_vertex:SR,skinning_pars_vertex:MR,skinning_vertex:wR,skinnormal_vertex:bR,specularmap_fragment:ER,specularmap_pars_fragment:TR,tonemapping_fragment:AR,tonemapping_pars_fragment:CR,transmission_fragment:RR,transmission_pars_fragment:PR,uv_pars_fragment:IR,uv_pars_vertex:NR,uv_vertex:LR,worldpos_vertex:DR,background_vert:UR,background_frag:kR,backgroundCube_vert:OR,backgroundCube_frag:FR,cube_vert:BR,cube_frag:zR,depth_vert:VR,depth_frag:HR,distanceRGBA_vert:GR,distanceRGBA_frag:WR,equirect_vert:jR,equirect_frag:XR,linedashed_vert:YR,linedashed_frag:$R,meshbasic_vert:qR,meshbasic_frag:ZR,meshlambert_vert:KR,meshlambert_frag:JR,meshmatcap_vert:QR,meshmatcap_frag:eP,meshnormal_vert:tP,meshnormal_frag:nP,meshphong_vert:iP,meshphong_frag:rP,meshphysical_vert:sP,meshphysical_frag:oP,meshtoon_vert:aP,meshtoon_frag:lP,points_vert:cP,points_frag:uP,shadow_vert:dP,shadow_frag:hP,sprite_vert:fP,sprite_frag:pP},fe={common:{diffuse:{value:new ye(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new je}},envmap:{envMap:{value:null},envMapRotation:{value:new je},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new je}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new je}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new je},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new je},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new je},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new je}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new je}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new je}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ye(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 ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0},uvTransform:{value:new je}},sprite:{diffuse:{value:new ye(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new je},alphaMap:{value:null},alphaMapTransform:{value:new je},alphaTest:{value:0}}},ri={basic:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new ye(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:ln([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new ye(0)},specular:{value:new ye(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:ln([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:ln([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new ye(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:ln([fe.points,fe.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:ln([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:ln([fe.common,fe.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:ln([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:ln([fe.sprite,fe.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new je},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new je}},vertexShader:Ye.backgroundCube_vert,fragmentShader:Ye.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:ln([fe.common,fe.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:ln([fe.lights,fe.fog,{color:{value:new ye(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};ri.physical={uniforms:ln([ri.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new je},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new je},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new je},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new je},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new je},sheen:{value:0},sheenColor:{value:new ye(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new je},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new je},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new je},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new je},attenuationDistance:{value:0},attenuationColor:{value:new ye(0)},specularColor:{value:new ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new je},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new je},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new je}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};const Sc={r:0,b:0,g:0},jr=new On,mP=new ke;function gP(n,e,t,i,r,s,o){const a=new ye(0);let l=s===!0?0:1,c,u,d=null,h=0,p=null;function m(v){let g=v.isScene===!0?v.background:null;return g&&g.isTexture&&(g=(v.backgroundBlurriness>0?t:e).get(g)),g}function y(v){let g=!1;const _=m(v);_===null?f(a,l):_&&_.isColor&&(f(_,1),g=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?i.buffers.color.setClear(0,0,0,1,o):R==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||g)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function x(v,g){const _=m(g);_&&(_.isCubeTexture||_.mapping===Vo)?(u===void 0&&(u=new kt(new Cs(1,1,1),new ci({name:"BackgroundCubeMaterial",uniforms:ko(ri.backgroundCube.uniforms),vertexShader:ri.backgroundCube.vertexShader,fragmentShader:ri.backgroundCube.fragmentShader,side:fn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,w,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),jr.copy(g.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=_,u.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(mP.makeRotationFromEuler(jr)),u.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,(d!==_||h!==_.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,d=_,h=_.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new kt(new Wo(2,2),new ci({name:"BackgroundMaterial",uniforms:ko(ri.background.uniforms),vertexShader:ri.background.vertexShader,fragmentShader:ri.background.fragmentShader,side:Zi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=rt.getTransfer(_.colorSpace)!==ft,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(d!==_||h!==_.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,d=_,h=_.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function f(v,g){v.getRGB(Sc,aM(n)),i.buffers.color.setClear(Sc.r,Sc.g,Sc.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(v,g=1){a.set(v),l=g,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,f(a,l)},render:y,addToRenderList:x}}function xP(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(M,L,V,F,G){let X=!1;const W=d(F,V,L);s!==W&&(s=W,c(s.object)),X=p(M,F,V,G),X&&m(M,F,V,G),G!==null&&e.update(G,n.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,_(M,L,V,F),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function d(M,L,V){const F=V.wireframe===!0;let G=i[M.id];G===void 0&&(G={},i[M.id]=G);let X=G[L.id];X===void 0&&(X={},G[L.id]=X);let W=X[F];return W===void 0&&(W=h(l()),X[F]=W),W}function h(M){const L=[],V=[],F=[];for(let G=0;G<t;G++)L[G]=0,V[G]=0,F[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:V,attributeDivisors:F,object:M,attributes:{},index:null}}function p(M,L,V,F){const G=s.attributes,X=L.attributes;let W=0;const ne=V.getAttributes();for(const D in ne)if(ne[D].location>=0){const Q=G[D];let oe=X[D];if(oe===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(oe=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(oe=M.instanceColor)),Q===void 0||Q.attribute!==oe||oe&&Q.data!==oe.data)return!0;W++}return s.attributesNum!==W||s.index!==F}function m(M,L,V,F){const G={},X=L.attributes;let W=0;const ne=V.getAttributes();for(const D in ne)if(ne[D].location>=0){let Q=X[D];Q===void 0&&(D==="instanceMatrix"&&M.instanceMatrix&&(Q=M.instanceMatrix),D==="instanceColor"&&M.instanceColor&&(Q=M.instanceColor));const oe={};oe.attribute=Q,Q&&Q.data&&(oe.data=Q.data),G[D]=oe,W++}s.attributes=G,s.attributesNum=W,s.index=F}function y(){const M=s.newAttributes;for(let L=0,V=M.length;L<V;L++)M[L]=0}function x(M){f(M,0)}function f(M,L){const V=s.newAttributes,F=s.enabledAttributes,G=s.attributeDivisors;V[M]=1,F[M]===0&&(n.enableVertexAttribArray(M),F[M]=1),G[M]!==L&&(n.vertexAttribDivisor(M,L),G[M]=L)}function v(){const M=s.newAttributes,L=s.enabledAttributes;for(let V=0,F=L.length;V<F;V++)L[V]!==M[V]&&(n.disableVertexAttribArray(V),L[V]=0)}function g(M,L,V,F,G,X,W){W===!0?n.vertexAttribIPointer(M,L,V,G,X):n.vertexAttribPointer(M,L,V,F,G,X)}function _(M,L,V,F){y();const G=F.attributes,X=V.getAttributes(),W=L.defaultAttributeValues;for(const ne in X){const D=X[ne];if(D.location>=0){let Y=G[ne];if(Y===void 0&&(ne==="instanceMatrix"&&M.instanceMatrix&&(Y=M.instanceMatrix),ne==="instanceColor"&&M.instanceColor&&(Y=M.instanceColor)),Y!==void 0){const Q=Y.normalized,oe=Y.itemSize,Re=e.get(Y);if(Re===void 0)continue;const Ke=Re.buffer,j=Re.type,se=Re.bytesPerElement,xe=j===n.INT||j===n.UNSIGNED_INT||Y.gpuType===Pd;if(Y.isInterleavedBufferAttribute){const de=Y.data,De=de.stride,He=Y.offset;if(de.isInstancedInterleavedBuffer){for(let Be=0;Be<D.locationSize;Be++)f(D.location+Be,de.meshPerAttribute);M.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let Be=0;Be<D.locationSize;Be++)x(D.location+Be);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let Be=0;Be<D.locationSize;Be++)g(D.location+Be,oe/D.locationSize,j,Q,De*se,(He+oe/D.locationSize*Be)*se,xe)}else{if(Y.isInstancedBufferAttribute){for(let de=0;de<D.locationSize;de++)f(D.location+de,Y.meshPerAttribute);M.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let de=0;de<D.locationSize;de++)x(D.location+de);n.bindBuffer(n.ARRAY_BUFFER,Ke);for(let de=0;de<D.locationSize;de++)g(D.location+de,oe/D.locationSize,j,Q,oe*se,oe/D.locationSize*de*se,xe)}}else if(W!==void 0){const Q=W[ne];if(Q!==void 0)switch(Q.length){case 2:n.vertexAttrib2fv(D.location,Q);break;case 3:n.vertexAttrib3fv(D.location,Q);break;case 4:n.vertexAttrib4fv(D.location,Q);break;default:n.vertexAttrib1fv(D.location,Q)}}}}v()}function R(){b();for(const M in i){const L=i[M];for(const V in L){const F=L[V];for(const G in F)u(F[G].object),delete F[G];delete L[V]}delete i[M]}}function w(M){if(i[M.id]===void 0)return;const L=i[M.id];for(const V in L){const F=L[V];for(const G in F)u(F[G].object),delete F[G];delete L[V]}delete i[M.id]}function A(M){for(const L in i){const V=i[L];if(V[M.id]===void 0)continue;const F=V[M.id];for(const G in F)u(F[G].object),delete F[G];delete V[M.id]}}function b(){E(),o=!0,s!==r&&(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:b,resetDefaultState:E,dispose:R,releaseStatesOfGeometry:w,releaseStatesOfProgram:A,initAttributes:y,enableAttribute:x,disableUnusedAttributes:v}}function vP(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function o(c,u,d){d!==0&&(n.drawArraysInstanced(i,c,u,d),t.update(u,i,d))}function a(c,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,d);let p=0;for(let m=0;m<d;m++)p+=u[m];t.update(p,i,1)}function l(c,u,d,h){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<c.length;m++)o(c[m],u[m],h[m]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,h,0,d);let m=0;for(let y=0;y<d;y++)m+=u[y];for(let y=0;y<h.length;y++)t.update(m,i,h[y])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function yP(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(w){return!(w!==dn&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(w){const A=w===Ho&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Ei&&i.convert(w)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==Sn&&!A)}function l(w){if(w==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),y=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),x=n.getParameter(n.MAX_VERTEX_ATTRIBS),f=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),g=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=p>0,R=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:y,maxAttributes:x,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:_,maxSamples:R}}function _P(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new mr,a=new je,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const p=d.length!==0||h||i!==0||r;return r=h,i=d.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,p){const m=d.clippingPlanes,y=d.clipIntersection,x=d.clipShadows,f=n.get(d);if(!r||m===null||m.length===0||s&&!x)s?u(null):c();else{const v=s?0:i,g=v*4;let _=f.clippingState||null;l.value=_,_=u(m,h,g,p);for(let R=0;R!==g;++R)_[R]=t[R];f.clippingState=_,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,h,p,m){const y=d!==null?d.length:0;let x=null;if(y!==0){if(x=l.value,m!==!0||x===null){const f=p+y*4,v=h.matrixWorldInverse;a.getNormalMatrix(v),(x===null||x.length<f)&&(x=new Float32Array(f));for(let g=0,_=p;g!==y;++g,_+=4)o.copy(d[g]).applyMatrix4(v,a),o.normal.toArray(x,_),x[_+3]=o.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,x}}function SP(n){let e=new WeakMap;function t(o,a){return a===il?o.mapping=Ki:a===rl&&(o.mapping=Ir),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===il||a===rl)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new uM(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Vd extends zd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const mo=4,M0=[.125,.215,.35,.446,.526,.582],is=20,hf=new Vd,w0=new ye;let ff=null,pf=0,mf=0,gf=!1;const ns=(1+Math.sqrt(5))/2,$s=1/ns,b0=[new I(-ns,$s,0),new I(ns,$s,0),new I(-$s,0,ns),new I($s,0,ns),new I(0,ns,-$s),new I(0,ns,$s),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)];class Dp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){ff=this._renderer.getRenderTarget(),pf=this._renderer.getActiveCubeFace(),mf=this._renderer.getActiveMipmapLevel(),gf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=A0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=T0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ff,pf,mf),this._renderer.xr.enabled=gf,e.scissorTest=!1,Mc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ki||e.mapping===Ir?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ff=this._renderer.getRenderTarget(),pf=this._renderer.getActiveCubeFace(),mf=this._renderer.getActiveMipmapLevel(),gf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Ut,minFilter:Ut,generateMipmaps:!1,type:Ho,format:dn,colorSpace:tr,depthBuffer:!1},r=E0(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=E0(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=MP(s)),this._blurMaterial=wP(s,e,t)}return r}_compileMaterial(e){const t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,hf)}_sceneToCubeUV(e,t,i,r){const a=new $t(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,h=u.toneMapping;u.getClearColor(w0),u.toneMapping=ji,u.autoClear=!1;const p=new Or({name:"PMREM.Background",side:fn,depthWrite:!1,depthTest:!1}),m=new kt(new Cs,p);let y=!1;const x=e.background;x?x.isColor&&(p.color.copy(x),e.background=null,y=!0):(p.color.copy(w0),y=!0);for(let f=0;f<6;f++){const v=f%3;v===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):v===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const g=this._cubeSize;Mc(r,v*g,f>2?g:0,g,g),u.setRenderTarget(r),y&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=x}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ki||e.mapping===Ir;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=A0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=T0());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Mc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,hf)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=b0[(r-s-1)%b0.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new kt(this._lodPlanes[r],c),h=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*is-1),y=s/m,x=isFinite(s)?1+Math.floor(u*y):is;x>is&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${is}`);const f=[];let v=0;for(let A=0;A<is;++A){const b=A/y,E=Math.exp(-b*b/2);f.push(E),A===0?v+=E:A<x&&(v+=2*E)}for(let A=0;A<f.length;A++)f[A]=f[A]/v;h.envMap.value=e.texture,h.samples.value=x,h.weights.value=f,h.latitudinal.value=o==="latitudinal",a&&(h.poleAxis.value=a);const{_lodMax:g}=this;h.dTheta.value=m,h.mipInt.value=g-i;const _=this._sizeLods[r],R=3*_*(r>g-mo?r-g+mo:0),w=4*(this._cubeSize-_);Mc(t,R,w,3*_,2*_),l.setRenderTarget(t),l.render(d,hf)}}function MP(n){const e=[],t=[],i=[];let r=n;const s=n-mo+1+M0.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-mo?l=M0[o-n+mo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,m=6,y=3,x=2,f=1,v=new Float32Array(y*m*p),g=new Float32Array(x*m*p),_=new Float32Array(f*m*p);for(let w=0;w<p;w++){const A=w%3*2/3-1,b=w>2?0:-1,E=[A,b,0,A+2/3,b,0,A+2/3,b+1,0,A,b,0,A+2/3,b+1,0,A,b+1,0];v.set(E,y*m*w),g.set(h,x*m*w);const M=[w,w,w,w,w,w];_.set(M,f*m*w)}const R=new $e;R.setAttribute("position",new ht(v,y)),R.setAttribute("uv",new ht(g,x)),R.setAttribute("faceIndex",new ht(_,f)),e.push(R),r>mo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function E0(n,e,t){const i=new li(n,e,t);return i.texture.mapping=Vo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Mc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function wP(n,e,t){const i=new Float32Array(is),r=new I(0,1,0);return new ci({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ig(),fragmentShader:`
3647
3647
 
3648
3648
  precision mediump float;
3649
3649
  precision mediump int;
@@ -3793,7 +3793,7 @@ void main() {
3793
3793
  gl_Position = vec4( position, 1.0 );
3794
3794
 
3795
3795
  }
3796
- `}function bP(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===il||l===rl,u=l===Ki||l===Ir;if(c||u){let d=e.get(a);const h=d!==void 0?d.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new Dp(n)),d=c?t.fromEquirectangular(a,d):t.fromCubemap(a,d),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),d.texture;if(d!==void 0)return d.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new Dp(n)),d=c?t.fromEquirectangular(a):t.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function EP(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&bo("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function TP(n,e,t,i){const r={},s=new WeakMap;function o(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const m in h.attributes)e.remove(h.attributes[m]);for(const m in h.morphAttributes){const y=h.morphAttributes[m];for(let g=0,f=y.length;g<f;g++)e.remove(y[g])}h.removeEventListener("dispose",o),delete r[h.id];const p=s.get(h);p&&(e.remove(p),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(d,h){return r[h.id]===!0||(h.addEventListener("dispose",o),r[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const m in h)e.update(h[m],n.ARRAY_BUFFER);const p=d.morphAttributes;for(const m in p){const y=p[m];for(let g=0,f=y.length;g<f;g++)e.update(y[g],n.ARRAY_BUFFER)}}function c(d){const h=[],p=d.index,m=d.attributes.position;let y=0;if(p!==null){const v=p.array;y=p.version;for(let x=0,_=v.length;x<_;x+=3){const R=v[x+0],M=v[x+1],T=v[x+2];h.push(R,M,M,T,T,R)}}else if(m!==void 0){const v=m.array;y=m.version;for(let x=0,_=v.length/3-1;x<_;x+=3){const R=x+0,M=x+1,T=x+2;h.push(R,M,M,T,T,R)}}else return;const g=new(nM(h)?ng:tg)(h,1);g.version=y;const f=s.get(d);f&&e.remove(f),s.set(d,g)}function u(d){const h=s.get(d);if(h){const p=d.index;p!==null&&h.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:a,update:l,getWireframeAttribute:u}}function AP(n,e,t){let i;function r(h){i=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function l(h,p){n.drawElements(i,p,s,h*o),t.update(p,i,1)}function c(h,p,m){m!==0&&(n.drawElementsInstanced(i,p,s,h*o,m),t.update(p,i,m))}function u(h,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,s,h,0,m);let g=0;for(let f=0;f<m;f++)g+=p[f];t.update(g,i,1)}function d(h,p,m,y){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let f=0;f<h.length;f++)c(h[f]/o,p[f],y[f]);else{g.multiDrawElementsInstancedWEBGL(i,p,0,s,h,0,y,0,m);let f=0;for(let v=0;v<m;v++)f+=p[v];for(let v=0;v<y.length;v++)t.update(f,i,y[v])}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function CP(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function RP(n,e,t){const i=new WeakMap,r=new ct;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,d=u!==void 0?u.length:0;let h=i.get(a);if(h===void 0||h.count!==d){let E=function(){T.dispose(),i.delete(a),a.removeEventListener("dispose",E)};h!==void 0&&h.texture.dispose();const p=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],f=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let x=0;p===!0&&(x=1),m===!0&&(x=2),y===!0&&(x=3);let _=a.attributes.position.count*x,R=1;_>e.maxTextureSize&&(R=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const M=new Float32Array(_*R*4*d),T=new Fd(M,_,R,d);T.type=Sn,T.needsUpdate=!0;const A=x*4;for(let w=0;w<d;w++){const L=g[w],V=f[w],F=v[w],G=_*R*4*w;for(let Y=0;Y<L.count;Y++){const W=Y*A;p===!0&&(r.fromBufferAttribute(L,Y),M[G+W+0]=r.x,M[G+W+1]=r.y,M[G+W+2]=r.z,M[G+W+3]=0),m===!0&&(r.fromBufferAttribute(V,Y),M[G+W+4]=r.x,M[G+W+5]=r.y,M[G+W+6]=r.z,M[G+W+7]=0),y===!0&&(r.fromBufferAttribute(F,Y),M[G+W+8]=r.x,M[G+W+9]=r.y,M[G+W+10]=r.z,M[G+W+11]=F.itemSize===4?r.w:1)}}h={count:d,texture:T,size:new K(_,R)},i.set(a,h),a.addEventListener("dispose",E)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let p=0;for(let y=0;y<c.length;y++)p+=c[y];const m=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:s}}function PP(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;r.get(h)!==c&&(h.update(),r.set(h,c))}return d}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class rg extends Ct{constructor(e,t,i,r,s,o,a,l,c,u=ps){if(u!==ps&&u!==ws)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ps&&(i=Ji),i===void 0&&u===ws&&(i=Ms),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Gt,this.minFilter=l!==void 0?l:Gt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const hM=new Ct,C0=new rg(1,1),fM=new Fd,pM=new eg,mM=new Il,R0=[],P0=[],I0=new Float32Array(16),N0=new Float32Array(9),L0=new Float32Array(4);function jo(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=R0[r];if(s===void 0&&(s=new Float32Array(r),R0[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Bt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function zt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Hd(n,e){let t=P0[e];t===void 0&&(t=new Int32Array(e),P0[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function IP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function NP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2fv(this.addr,e),zt(t,e)}}function LP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Bt(t,e))return;n.uniform3fv(this.addr,e),zt(t,e)}}function DP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4fv(this.addr,e),zt(t,e)}}function UP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;L0.set(i),n.uniformMatrix2fv(this.addr,!1,L0),zt(t,i)}}function kP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;N0.set(i),n.uniformMatrix3fv(this.addr,!1,N0),zt(t,i)}}function OP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;I0.set(i),n.uniformMatrix4fv(this.addr,!1,I0),zt(t,i)}}function FP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function BP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2iv(this.addr,e),zt(t,e)}}function zP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3iv(this.addr,e),zt(t,e)}}function VP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4iv(this.addr,e),zt(t,e)}}function HP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function GP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2uiv(this.addr,e),zt(t,e)}}function WP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3uiv(this.addr,e),zt(t,e)}}function jP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4uiv(this.addr,e),zt(t,e)}}function XP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(C0.compareFunction=Jm,s=C0):s=hM,t.setTexture2D(e||s,r)}function YP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||pM,r)}function $P(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||mM,r)}function qP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||fM,r)}function ZP(n){switch(n){case 5126:return IP;case 35664:return NP;case 35665:return LP;case 35666:return DP;case 35674:return UP;case 35675:return kP;case 35676:return OP;case 5124:case 35670:return FP;case 35667:case 35671:return BP;case 35668:case 35672:return zP;case 35669:case 35673:return VP;case 5125:return HP;case 36294:return GP;case 36295:return WP;case 36296:return jP;case 35678:case 36198:case 36298:case 36306:case 35682:return XP;case 35679:case 36299:case 36307:return YP;case 35680:case 36300:case 36308:case 36293:return $P;case 36289:case 36303:case 36311:case 36292:return qP}}function KP(n,e){n.uniform1fv(this.addr,e)}function JP(n,e){const t=jo(e,this.size,2);n.uniform2fv(this.addr,t)}function QP(n,e){const t=jo(e,this.size,3);n.uniform3fv(this.addr,t)}function e2(n,e){const t=jo(e,this.size,4);n.uniform4fv(this.addr,t)}function t2(n,e){const t=jo(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function n2(n,e){const t=jo(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function i2(n,e){const t=jo(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function r2(n,e){n.uniform1iv(this.addr,e)}function s2(n,e){n.uniform2iv(this.addr,e)}function o2(n,e){n.uniform3iv(this.addr,e)}function a2(n,e){n.uniform4iv(this.addr,e)}function l2(n,e){n.uniform1uiv(this.addr,e)}function c2(n,e){n.uniform2uiv(this.addr,e)}function u2(n,e){n.uniform3uiv(this.addr,e)}function d2(n,e){n.uniform4uiv(this.addr,e)}function h2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||hM,s[o])}function f2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||pM,s[o])}function p2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||mM,s[o])}function m2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||fM,s[o])}function g2(n){switch(n){case 5126:return KP;case 35664:return JP;case 35665:return QP;case 35666:return e2;case 35674:return t2;case 35675:return n2;case 35676:return i2;case 5124:case 35670:return r2;case 35667:case 35671:return s2;case 35668:case 35672:return o2;case 35669:case 35673:return a2;case 5125:return l2;case 36294:return c2;case 36295:return u2;case 36296:return d2;case 35678:case 36198:case 36298:case 36306:case 35682:return h2;case 35679:case 36299:case 36307:return f2;case 35680:case 36300:case 36308:case 36293:return p2;case 36289:case 36303:case 36311:case 36292:return m2}}class x2{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=ZP(t.type)}}class v2{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=g2(t.type)}}class y2{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const xf=/(\w+)(\])?(\[|\.)?/g;function D0(n,e){n.seq.push(e),n.map[e.id]=e}function _2(n,e,t){const i=n.name,r=i.length;for(xf.lastIndex=0;;){const s=xf.exec(i),o=xf.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){D0(t,c===void 0?new x2(a,n,e):new v2(a,n,e));break}else{let d=t.map[a];d===void 0&&(d=new y2(a),D0(t,d)),t=d}}}class lu{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);_2(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function U0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const S2=37297;let M2=0;function w2(n,e){const t=n.split(`
3796
+ `}function bP(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===il||l===rl,u=l===Ki||l===Ir;if(c||u){let d=e.get(a);const h=d!==void 0?d.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new Dp(n)),d=c?t.fromEquirectangular(a,d):t.fromCubemap(a,d),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),d.texture;if(d!==void 0)return d.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new Dp(n)),d=c?t.fromEquirectangular(a):t.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function EP(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&bo("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function TP(n,e,t,i){const r={},s=new WeakMap;function o(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const m in h.attributes)e.remove(h.attributes[m]);for(const m in h.morphAttributes){const y=h.morphAttributes[m];for(let x=0,f=y.length;x<f;x++)e.remove(y[x])}h.removeEventListener("dispose",o),delete r[h.id];const p=s.get(h);p&&(e.remove(p),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(d,h){return r[h.id]===!0||(h.addEventListener("dispose",o),r[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const m in h)e.update(h[m],n.ARRAY_BUFFER);const p=d.morphAttributes;for(const m in p){const y=p[m];for(let x=0,f=y.length;x<f;x++)e.update(y[x],n.ARRAY_BUFFER)}}function c(d){const h=[],p=d.index,m=d.attributes.position;let y=0;if(p!==null){const v=p.array;y=p.version;for(let g=0,_=v.length;g<_;g+=3){const R=v[g+0],w=v[g+1],A=v[g+2];h.push(R,w,w,A,A,R)}}else if(m!==void 0){const v=m.array;y=m.version;for(let g=0,_=v.length/3-1;g<_;g+=3){const R=g+0,w=g+1,A=g+2;h.push(R,w,w,A,A,R)}}else return;const x=new(nM(h)?ng:tg)(h,1);x.version=y;const f=s.get(d);f&&e.remove(f),s.set(d,x)}function u(d){const h=s.get(d);if(h){const p=d.index;p!==null&&h.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:a,update:l,getWireframeAttribute:u}}function AP(n,e,t){let i;function r(h){i=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function l(h,p){n.drawElements(i,p,s,h*o),t.update(p,i,1)}function c(h,p,m){m!==0&&(n.drawElementsInstanced(i,p,s,h*o,m),t.update(p,i,m))}function u(h,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,s,h,0,m);let x=0;for(let f=0;f<m;f++)x+=p[f];t.update(x,i,1)}function d(h,p,m,y){if(m===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let f=0;f<h.length;f++)c(h[f]/o,p[f],y[f]);else{x.multiDrawElementsInstancedWEBGL(i,p,0,s,h,0,y,0,m);let f=0;for(let v=0;v<m;v++)f+=p[v];for(let v=0;v<y.length;v++)t.update(f,i,y[v])}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function CP(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function RP(n,e,t){const i=new WeakMap,r=new ct;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,d=u!==void 0?u.length:0;let h=i.get(a);if(h===void 0||h.count!==d){let E=function(){A.dispose(),i.delete(a),a.removeEventListener("dispose",E)};h!==void 0&&h.texture.dispose();const p=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,x=a.morphAttributes.position||[],f=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let g=0;p===!0&&(g=1),m===!0&&(g=2),y===!0&&(g=3);let _=a.attributes.position.count*g,R=1;_>e.maxTextureSize&&(R=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const w=new Float32Array(_*R*4*d),A=new Fd(w,_,R,d);A.type=Sn,A.needsUpdate=!0;const b=g*4;for(let M=0;M<d;M++){const L=x[M],V=f[M],F=v[M],G=_*R*4*M;for(let X=0;X<L.count;X++){const W=X*b;p===!0&&(r.fromBufferAttribute(L,X),w[G+W+0]=r.x,w[G+W+1]=r.y,w[G+W+2]=r.z,w[G+W+3]=0),m===!0&&(r.fromBufferAttribute(V,X),w[G+W+4]=r.x,w[G+W+5]=r.y,w[G+W+6]=r.z,w[G+W+7]=0),y===!0&&(r.fromBufferAttribute(F,X),w[G+W+8]=r.x,w[G+W+9]=r.y,w[G+W+10]=r.z,w[G+W+11]=F.itemSize===4?r.w:1)}}h={count:d,texture:A,size:new K(_,R)},i.set(a,h),a.addEventListener("dispose",E)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let p=0;for(let y=0;y<c.length;y++)p+=c[y];const m=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:s}}function PP(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;r.get(h)!==c&&(h.update(),r.set(h,c))}return d}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class rg extends Ct{constructor(e,t,i,r,s,o,a,l,c,u=ps){if(u!==ps&&u!==ws)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ps&&(i=Ji),i===void 0&&u===ws&&(i=Ms),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Gt,this.minFilter=l!==void 0?l:Gt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const hM=new Ct,C0=new rg(1,1),fM=new Fd,pM=new eg,mM=new Il,R0=[],P0=[],I0=new Float32Array(16),N0=new Float32Array(9),L0=new Float32Array(4);function jo(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=R0[r];if(s===void 0&&(s=new Float32Array(r),R0[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Bt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function zt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Hd(n,e){let t=P0[e];t===void 0&&(t=new Int32Array(e),P0[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function IP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function NP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2fv(this.addr,e),zt(t,e)}}function LP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Bt(t,e))return;n.uniform3fv(this.addr,e),zt(t,e)}}function DP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4fv(this.addr,e),zt(t,e)}}function UP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;L0.set(i),n.uniformMatrix2fv(this.addr,!1,L0),zt(t,i)}}function kP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;N0.set(i),n.uniformMatrix3fv(this.addr,!1,N0),zt(t,i)}}function OP(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Bt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),zt(t,e)}else{if(Bt(t,i))return;I0.set(i),n.uniformMatrix4fv(this.addr,!1,I0),zt(t,i)}}function FP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function BP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2iv(this.addr,e),zt(t,e)}}function zP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3iv(this.addr,e),zt(t,e)}}function VP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4iv(this.addr,e),zt(t,e)}}function HP(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function GP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Bt(t,e))return;n.uniform2uiv(this.addr,e),zt(t,e)}}function WP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Bt(t,e))return;n.uniform3uiv(this.addr,e),zt(t,e)}}function jP(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Bt(t,e))return;n.uniform4uiv(this.addr,e),zt(t,e)}}function XP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(C0.compareFunction=Jm,s=C0):s=hM,t.setTexture2D(e||s,r)}function YP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||pM,r)}function $P(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||mM,r)}function qP(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||fM,r)}function ZP(n){switch(n){case 5126:return IP;case 35664:return NP;case 35665:return LP;case 35666:return DP;case 35674:return UP;case 35675:return kP;case 35676:return OP;case 5124:case 35670:return FP;case 35667:case 35671:return BP;case 35668:case 35672:return zP;case 35669:case 35673:return VP;case 5125:return HP;case 36294:return GP;case 36295:return WP;case 36296:return jP;case 35678:case 36198:case 36298:case 36306:case 35682:return XP;case 35679:case 36299:case 36307:return YP;case 35680:case 36300:case 36308:case 36293:return $P;case 36289:case 36303:case 36311:case 36292:return qP}}function KP(n,e){n.uniform1fv(this.addr,e)}function JP(n,e){const t=jo(e,this.size,2);n.uniform2fv(this.addr,t)}function QP(n,e){const t=jo(e,this.size,3);n.uniform3fv(this.addr,t)}function e2(n,e){const t=jo(e,this.size,4);n.uniform4fv(this.addr,t)}function t2(n,e){const t=jo(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function n2(n,e){const t=jo(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function i2(n,e){const t=jo(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function r2(n,e){n.uniform1iv(this.addr,e)}function s2(n,e){n.uniform2iv(this.addr,e)}function o2(n,e){n.uniform3iv(this.addr,e)}function a2(n,e){n.uniform4iv(this.addr,e)}function l2(n,e){n.uniform1uiv(this.addr,e)}function c2(n,e){n.uniform2uiv(this.addr,e)}function u2(n,e){n.uniform3uiv(this.addr,e)}function d2(n,e){n.uniform4uiv(this.addr,e)}function h2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||hM,s[o])}function f2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||pM,s[o])}function p2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||mM,s[o])}function m2(n,e,t){const i=this.cache,r=e.length,s=Hd(t,r);Bt(i,s)||(n.uniform1iv(this.addr,s),zt(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||fM,s[o])}function g2(n){switch(n){case 5126:return KP;case 35664:return JP;case 35665:return QP;case 35666:return e2;case 35674:return t2;case 35675:return n2;case 35676:return i2;case 5124:case 35670:return r2;case 35667:case 35671:return s2;case 35668:case 35672:return o2;case 35669:case 35673:return a2;case 5125:return l2;case 36294:return c2;case 36295:return u2;case 36296:return d2;case 35678:case 36198:case 36298:case 36306:case 35682:return h2;case 35679:case 36299:case 36307:return f2;case 35680:case 36300:case 36308:case 36293:return p2;case 36289:case 36303:case 36311:case 36292:return m2}}class x2{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=ZP(t.type)}}class v2{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=g2(t.type)}}class y2{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const xf=/(\w+)(\])?(\[|\.)?/g;function D0(n,e){n.seq.push(e),n.map[e.id]=e}function _2(n,e,t){const i=n.name,r=i.length;for(xf.lastIndex=0;;){const s=xf.exec(i),o=xf.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){D0(t,c===void 0?new x2(a,n,e):new v2(a,n,e));break}else{let d=t.map[a];d===void 0&&(d=new y2(a),D0(t,d)),t=d}}}class lu{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);_2(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function U0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const S2=37297;let M2=0;function w2(n,e){const t=n.split(`
3797
3797
  `),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
3798
3798
  `)}function b2(n){const e=rt.getPrimaries(rt.workingColorSpace),t=rt.getPrimaries(n);let i;switch(e===t?i="":e===dl&&t===ul?i="LinearDisplayP3ToLinearSRGB":e===ul&&t===dl&&(i="LinearSRGBToLinearDisplayP3"),n){case tr:case Pl:return[i,"LinearTransferOETF"];case Hn:case Od:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function k0(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
3799
3799
 
@@ -3822,28 +3822,28 @@ void main() {
3822
3822
  `;return n.precision==="highp"?e+=`
3823
3823
  #define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3824
3824
  #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3825
- #define LOW_PRECISION`),e}function k2(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===zm?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===aS?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===gi&&(e="SHADOWMAP_TYPE_VSM"),e}function O2(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ki:case Ir:e="ENVMAP_TYPE_CUBE";break;case Vo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function F2(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Ir:e="ENVMAP_MODE_REFRACTION";break}return e}function B2(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Cl:e="ENVMAP_BLENDING_MULTIPLY";break;case LS:e="ENVMAP_BLENDING_MIX";break;case DS:e="ENVMAP_BLENDING_ADD";break}return e}function z2(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function V2(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=k2(t),c=O2(t),u=F2(t),d=B2(t),h=z2(t),p=C2(t),m=R2(s),y=r.createProgram();let g,f,v=t.glslVersion?"#version "+t.glslVersion+`
3826
- `:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(_a).join(`
3827
- `),g.length>0&&(g+=`
3825
+ #define LOW_PRECISION`),e}function k2(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===zm?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===aS?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===gi&&(e="SHADOWMAP_TYPE_VSM"),e}function O2(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ki:case Ir:e="ENVMAP_TYPE_CUBE";break;case Vo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function F2(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Ir:e="ENVMAP_MODE_REFRACTION";break}return e}function B2(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Cl:e="ENVMAP_BLENDING_MULTIPLY";break;case LS:e="ENVMAP_BLENDING_MIX";break;case DS:e="ENVMAP_BLENDING_ADD";break}return e}function z2(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function V2(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=k2(t),c=O2(t),u=F2(t),d=B2(t),h=z2(t),p=C2(t),m=R2(s),y=r.createProgram();let x,f,v=t.glslVersion?"#version "+t.glslVersion+`
3826
+ `:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(_a).join(`
3827
+ `),x.length>0&&(x+=`
3828
3828
  `),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(_a).join(`
3829
3829
  `),f.length>0&&(f+=`
3830
- `)):(g=[z0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",`
3830
+ `)):(x=[z0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",`
3831
3831
  `].filter(_a).join(`
3832
3832
  `),f=[z0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ji?"#define TONE_MAPPING":"",t.toneMapping!==ji?Ye.tonemapping_pars_fragment:"",t.toneMapping!==ji?T2("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ye.colorspace_pars_fragment,E2("linearToOutputTexel",t.outputColorSpace),A2(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3833
3833
  `].filter(_a).join(`
3834
3834
  `)),o=Up(o),o=O0(o,t),o=F0(o,t),a=Up(a),a=O0(a,t),a=F0(a,t),o=B0(o),a=B0(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
3835
- `,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3835
+ `,x=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3836
3836
  `)+`
3837
- `+g,f=["#define varying in",t.glslVersion===Lp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Lp?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3837
+ `+x,f=["#define varying in",t.glslVersion===Lp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Lp?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3838
3838
  `)+`
3839
- `+f);const x=v+g+o,_=v+f+a,R=U0(r,r.VERTEX_SHADER,x),M=U0(r,r.FRAGMENT_SHADER,_);r.attachShader(y,R),r.attachShader(y,M),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function T(L){if(n.debug.checkShaderErrors){const V=r.getProgramInfoLog(y).trim(),F=r.getShaderInfoLog(R).trim(),G=r.getShaderInfoLog(M).trim();let Y=!0,W=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(Y=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,y,R,M);else{const ne=k0(r,R,"vertex"),D=k0(r,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
3839
+ `+f);const g=v+x+o,_=v+f+a,R=U0(r,r.VERTEX_SHADER,g),w=U0(r,r.FRAGMENT_SHADER,_);r.attachShader(y,R),r.attachShader(y,w),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function A(L){if(n.debug.checkShaderErrors){const V=r.getProgramInfoLog(y).trim(),F=r.getShaderInfoLog(R).trim(),G=r.getShaderInfoLog(w).trim();let X=!0,W=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,y,R,w);else{const ne=k0(r,R,"vertex"),D=k0(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
3840
3840
 
3841
3841
  Material Name: `+L.name+`
3842
3842
  Material Type: `+L.type+`
3843
3843
 
3844
3844
  Program Info Log: `+V+`
3845
3845
  `+ne+`
3846
- `+D)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(F===""||G==="")&&(W=!1);W&&(L.diagnostics={runnable:Y,programLog:V,vertexShader:{log:F,prefix:g},fragmentShader:{log:G,prefix:f}})}r.deleteShader(R),r.deleteShader(M),A=new lu(r,y),E=P2(r,y)}let A;this.getUniforms=function(){return A===void 0&&T(this),A};let E;this.getAttributes=function(){return E===void 0&&T(this),E};let w=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=r.getProgramParameter(y,S2)),w},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=M2++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=M,this}let H2=0;class G2{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new W2(e),t.set(e,i)),i}}class W2{constructor(e){this.id=H2++,this.code=e,this.usedTimes=0}}function j2(n,e,t,i,r,s,o){const a=new Bd,l=new G2,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 y(E){return c.add(E),E===0?"uv":`uv${E}`}function g(E,w,L,V,F){const G=V.fog,Y=F.geometry,W=E.isMeshStandardMaterial?V.environment:null,ne=(E.isMeshStandardMaterial?t:e).get(E.envMap||W),D=ne&&ne.mapping===Vo?ne.image.height:null,X=m[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const Q=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,oe=Q!==void 0?Q.length:0;let Re=0;Y.morphAttributes.position!==void 0&&(Re=1),Y.morphAttributes.normal!==void 0&&(Re=2),Y.morphAttributes.color!==void 0&&(Re=3);let Ke,j,se,xe;if(X){const st=ri[X];Ke=st.vertexShader,j=st.fragmentShader}else Ke=E.vertexShader,j=E.fragmentShader,l.update(E),se=l.getVertexShaderID(E),xe=l.getFragmentShaderID(E);const de=n.getRenderTarget(),De=F.isInstancedMesh===!0,He=F.isBatchedMesh===!0,Be=!!E.map,it=!!E.matcap,P=!!ne,le=!!E.aoMap,ie=!!E.lightMap,ge=!!E.bumpMap,$=!!E.normalMap,Ue=!!E.displacementMap,me=!!E.emissiveMap,we=!!E.metalnessMap,N=!!E.roughnessMap,b=E.anisotropy>0,z=E.clearcoat>0,J=E.dispersion>0,Z=E.iridescence>0,te=E.sheen>0,Le=E.transmission>0,pe=b&&!!E.anisotropyMap,Se=z&&!!E.clearcoatMap,We=z&&!!E.clearcoatNormalMap,ae=z&&!!E.clearcoatRoughnessMap,_e=Z&&!!E.iridescenceMap,Je=Z&&!!E.iridescenceThicknessMap,Ve=te&&!!E.sheenColorMap,be=te&&!!E.sheenRoughnessMap,Ge=!!E.specularMap,qe=!!E.specularColorMap,vt=!!E.specularIntensityMap,U=Le&&!!E.transmissionMap,ce=Le&&!!E.thicknessMap,q=!!E.gradientMap,ee=!!E.alphaMap,he=E.alphaTest>0,Oe=!!E.alphaHash,Qe=!!E.extensions;let It=ji;E.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(It=n.toneMapping);const jt={shaderID:X,shaderType:E.type,shaderName:E.name,vertexShader:Ke,fragmentShader:j,defines:E.defines,customVertexShaderID:se,customFragmentShaderID:xe,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:He,batchingColor:He&&F._colorsTexture!==null,instancing:De,instancingColor:De&&F.instanceColor!==null,instancingMorph:De&&F.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:tr,alphaToCoverage:!!E.alphaToCoverage,map:Be,matcap:it,envMap:P,envMapMode:P&&ne.mapping,envMapCubeUVHeight:D,aoMap:le,lightMap:ie,bumpMap:ge,normalMap:$,displacementMap:h&&Ue,emissiveMap:me,normalMapObjectSpace:$&&E.normalMapType===$S,normalMapTangentSpace:$&&E.normalMapType===kr,metalnessMap:we,roughnessMap:N,anisotropy:b,anisotropyMap:pe,clearcoat:z,clearcoatMap:Se,clearcoatNormalMap:We,clearcoatRoughnessMap:ae,dispersion:J,iridescence:Z,iridescenceMap:_e,iridescenceThicknessMap:Je,sheen:te,sheenColorMap:Ve,sheenRoughnessMap:be,specularMap:Ge,specularColorMap:qe,specularIntensityMap:vt,transmission:Le,transmissionMap:U,thicknessMap:ce,gradientMap:q,opaque:E.transparent===!1&&E.blending===fs&&E.alphaToCoverage===!1,alphaMap:ee,alphaTest:he,alphaHash:Oe,combine:E.combine,mapUv:Be&&y(E.map.channel),aoMapUv:le&&y(E.aoMap.channel),lightMapUv:ie&&y(E.lightMap.channel),bumpMapUv:ge&&y(E.bumpMap.channel),normalMapUv:$&&y(E.normalMap.channel),displacementMapUv:Ue&&y(E.displacementMap.channel),emissiveMapUv:me&&y(E.emissiveMap.channel),metalnessMapUv:we&&y(E.metalnessMap.channel),roughnessMapUv:N&&y(E.roughnessMap.channel),anisotropyMapUv:pe&&y(E.anisotropyMap.channel),clearcoatMapUv:Se&&y(E.clearcoatMap.channel),clearcoatNormalMapUv:We&&y(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&y(E.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:Ve&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:be&&y(E.sheenRoughnessMap.channel),specularMapUv:Ge&&y(E.specularMap.channel),specularColorMapUv:qe&&y(E.specularColorMap.channel),specularIntensityMapUv:vt&&y(E.specularIntensityMap.channel),transmissionMapUv:U&&y(E.transmissionMap.channel),thicknessMapUv:ce&&y(E.thicknessMap.channel),alphaMapUv:ee&&y(E.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&($||b),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!Y.attributes.uv&&(Be||ee),fog:!!G,useFog:E.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:F.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:oe,morphTextureStride:Re,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:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:It,decodeVideoTexture:Be&&E.map.isVideoTexture===!0&&rt.getTransfer(E.map.colorSpace)===ft,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===vi,flipSided:E.side===fn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Qe&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&E.extensions.multiDraw===!0||He)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return jt.vertexUv1s=c.has(1),jt.vertexUv2s=c.has(2),jt.vertexUv3s=c.has(3),c.clear(),jt}function f(E){const w=[];if(E.shaderID?w.push(E.shaderID):(w.push(E.customVertexShaderID),w.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)w.push(L),w.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(v(w,E),x(w,E),w.push(n.outputColorSpace)),w.push(E.customProgramCacheKey),w.join()}function v(E,w){E.push(w.precision),E.push(w.outputColorSpace),E.push(w.envMapMode),E.push(w.envMapCubeUVHeight),E.push(w.mapUv),E.push(w.alphaMapUv),E.push(w.lightMapUv),E.push(w.aoMapUv),E.push(w.bumpMapUv),E.push(w.normalMapUv),E.push(w.displacementMapUv),E.push(w.emissiveMapUv),E.push(w.metalnessMapUv),E.push(w.roughnessMapUv),E.push(w.anisotropyMapUv),E.push(w.clearcoatMapUv),E.push(w.clearcoatNormalMapUv),E.push(w.clearcoatRoughnessMapUv),E.push(w.iridescenceMapUv),E.push(w.iridescenceThicknessMapUv),E.push(w.sheenColorMapUv),E.push(w.sheenRoughnessMapUv),E.push(w.specularMapUv),E.push(w.specularColorMapUv),E.push(w.specularIntensityMapUv),E.push(w.transmissionMapUv),E.push(w.thicknessMapUv),E.push(w.combine),E.push(w.fogExp2),E.push(w.sizeAttenuation),E.push(w.morphTargetsCount),E.push(w.morphAttributeCount),E.push(w.numDirLights),E.push(w.numPointLights),E.push(w.numSpotLights),E.push(w.numSpotLightMaps),E.push(w.numHemiLights),E.push(w.numRectAreaLights),E.push(w.numDirLightShadows),E.push(w.numPointLightShadows),E.push(w.numSpotLightShadows),E.push(w.numSpotLightShadowsWithMaps),E.push(w.numLightProbes),E.push(w.shadowMapType),E.push(w.toneMapping),E.push(w.numClippingPlanes),E.push(w.numClipIntersection),E.push(w.depthPacking)}function x(E,w){a.disableAll(),w.supportsVertexTextures&&a.enable(0),w.instancing&&a.enable(1),w.instancingColor&&a.enable(2),w.instancingMorph&&a.enable(3),w.matcap&&a.enable(4),w.envMap&&a.enable(5),w.normalMapObjectSpace&&a.enable(6),w.normalMapTangentSpace&&a.enable(7),w.clearcoat&&a.enable(8),w.iridescence&&a.enable(9),w.alphaTest&&a.enable(10),w.vertexColors&&a.enable(11),w.vertexAlphas&&a.enable(12),w.vertexUv1s&&a.enable(13),w.vertexUv2s&&a.enable(14),w.vertexUv3s&&a.enable(15),w.vertexTangents&&a.enable(16),w.anisotropy&&a.enable(17),w.alphaHash&&a.enable(18),w.batching&&a.enable(19),w.dispersion&&a.enable(20),w.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.skinning&&a.enable(4),w.morphTargets&&a.enable(5),w.morphNormals&&a.enable(6),w.morphColors&&a.enable(7),w.premultipliedAlpha&&a.enable(8),w.shadowMapEnabled&&a.enable(9),w.doubleSided&&a.enable(10),w.flipSided&&a.enable(11),w.useDepthPacking&&a.enable(12),w.dithering&&a.enable(13),w.transmission&&a.enable(14),w.sheen&&a.enable(15),w.opaque&&a.enable(16),w.pointsUvs&&a.enable(17),w.decodeVideoTexture&&a.enable(18),w.alphaToCoverage&&a.enable(19),E.push(a.mask)}function _(E){const w=m[E.type];let L;if(w){const V=ri[w];L=lM.clone(V.uniforms)}else L=E.uniforms;return L}function R(E,w){let L;for(let V=0,F=u.length;V<F;V++){const G=u[V];if(G.cacheKey===w){L=G,++L.usedTimes;break}}return L===void 0&&(L=new V2(n,w,E,s),u.push(L)),L}function M(E){if(--E.usedTimes===0){const w=u.indexOf(E);u[w]=u[u.length-1],u.pop(),E.destroy()}}function T(E){l.remove(E)}function A(){l.dispose()}return{getParameters:g,getProgramCacheKey:f,getUniforms:_,acquireProgram:R,releaseProgram:M,releaseShaderCache:T,programs:u,dispose:A}}function X2(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function Y2(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function V0(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function H0(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(d,h,p,m,y,g){let f=n[e];return f===void 0?(f={id:d.id,object:d,geometry:h,material:p,groupOrder:m,renderOrder:d.renderOrder,z:y,group:g},n[e]=f):(f.id=d.id,f.object=d,f.geometry=h,f.material=p,f.groupOrder=m,f.renderOrder=d.renderOrder,f.z=y,f.group=g),e++,f}function a(d,h,p,m,y,g){const f=o(d,h,p,m,y,g);p.transmission>0?i.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(d,h,p,m,y,g){const f=o(d,h,p,m,y,g);p.transmission>0?i.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(d,h){t.length>1&&t.sort(d||Y2),i.length>1&&i.sort(h||V0),r.length>1&&r.sort(h||V0)}function u(){for(let d=e,h=n.length;d<h;d++){const p=n[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function $2(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new H0,n.set(i,[o])):r>=s.length?(o=new H0,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function q2(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new ye};break;case"SpotLight":t={position:new I,direction:new I,color:new ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new ye,groundColor:new ye};break;case"RectAreaLight":t={color:new ye,position:new I,halfWidth:new I,halfHeight:new I};break}return n[e.id]=t,t}}}function Z2(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let K2=0;function J2(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Q2(n){const e=new q2,t=Z2(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new I);const r=new I,s=new ke,o=new ke;function a(c){let u=0,d=0,h=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let p=0,m=0,y=0,g=0,f=0,v=0,x=0,_=0,R=0,M=0,T=0;c.sort(J2);for(let E=0,w=c.length;E<w;E++){const L=c[E],V=L.color,F=L.intensity,G=L.distance,Y=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)u+=V.r*F,d+=V.g*F,h+=V.b*F;else if(L.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(L.sh.coefficients[W],F);T++}else if(L.isDirectionalLight){const W=e.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const ne=L.shadow,D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,i.directionalShadow[p]=D,i.directionalShadowMap[p]=Y,i.directionalShadowMatrix[p]=L.shadow.matrix,v++}i.directional[p]=W,p++}else if(L.isSpotLight){const W=e.get(L);W.position.setFromMatrixPosition(L.matrixWorld),W.color.copy(V).multiplyScalar(F),W.distance=G,W.coneCos=Math.cos(L.angle),W.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),W.decay=L.decay,i.spot[y]=W;const ne=L.shadow;if(L.map&&(i.spotLightMap[R]=L.map,R++,ne.updateMatrices(L),L.castShadow&&M++),i.spotLightMatrix[y]=ne.matrix,L.castShadow){const D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,i.spotShadow[y]=D,i.spotShadowMap[y]=Y,_++}y++}else if(L.isRectAreaLight){const W=e.get(L);W.color.copy(V).multiplyScalar(F),W.halfWidth.set(L.width*.5,0,0),W.halfHeight.set(0,L.height*.5,0),i.rectArea[g]=W,g++}else if(L.isPointLight){const W=e.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),W.distance=L.distance,W.decay=L.decay,L.castShadow){const ne=L.shadow,D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,D.shadowCameraNear=ne.camera.near,D.shadowCameraFar=ne.camera.far,i.pointShadow[m]=D,i.pointShadowMap[m]=Y,i.pointShadowMatrix[m]=L.shadow.matrix,x++}i.point[m]=W,m++}else if(L.isHemisphereLight){const W=e.get(L);W.skyColor.copy(L.color).multiplyScalar(F),W.groundColor.copy(L.groundColor).multiplyScalar(F),i.hemi[f]=W,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2):(i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=h;const A=i.hash;(A.directionalLength!==p||A.pointLength!==m||A.spotLength!==y||A.rectAreaLength!==g||A.hemiLength!==f||A.numDirectionalShadows!==v||A.numPointShadows!==x||A.numSpotShadows!==_||A.numSpotMaps!==R||A.numLightProbes!==T)&&(i.directional.length=p,i.spot.length=y,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=x,i.spotLightMatrix.length=_+R-M,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=M,i.numLightProbes=T,A.directionalLength=p,A.pointLength=m,A.spotLength=y,A.rectAreaLength=g,A.hemiLength=f,A.numDirectionalShadows=v,A.numPointShadows=x,A.numSpotShadows=_,A.numSpotMaps=R,A.numLightProbes=T,i.version=K2++)}function l(c,u){let d=0,h=0,p=0,m=0,y=0;const g=u.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){const x=c[f];if(x.isDirectionalLight){const _=i.directional[d];_.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),d++}else if(x.isSpotLight){const _=i.spot[p];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(g),_.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(g),p++}else if(x.isRectAreaLight){const _=i.rectArea[m];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(g),o.identity(),s.copy(x.matrixWorld),s.premultiply(g),o.extractRotation(s),_.halfWidth.set(x.width*.5,0,0),_.halfHeight.set(0,x.height*.5,0),_.halfWidth.applyMatrix4(o),_.halfHeight.applyMatrix4(o),m++}else if(x.isPointLight){const _=i.point[h];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(g),h++}else if(x.isHemisphereLight){const _=i.hemi[y];_.direction.setFromMatrixPosition(x.matrixWorld),_.direction.transformDirection(g),y++}}}return{setup:a,setupView:l,state:i}}function G0(n){const e=new Q2(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function o(u){i.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function eI(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new G0(n),e.set(r,[a])):s>=o.length?(a=new G0(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class sg extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XS,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class og extends on{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const tI=`void main() {
3846
+ `+D)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(F===""||G==="")&&(W=!1);W&&(L.diagnostics={runnable:X,programLog:V,vertexShader:{log:F,prefix:x},fragmentShader:{log:G,prefix:f}})}r.deleteShader(R),r.deleteShader(w),b=new lu(r,y),E=P2(r,y)}let b;this.getUniforms=function(){return b===void 0&&A(this),b};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(y,S2)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=M2++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=w,this}let H2=0;class G2{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new W2(e),t.set(e,i)),i}}class W2{constructor(e){this.id=H2++,this.code=e,this.usedTimes=0}}function j2(n,e,t,i,r,s,o){const a=new Bd,l=new G2,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 y(E){return c.add(E),E===0?"uv":`uv${E}`}function x(E,M,L,V,F){const G=V.fog,X=F.geometry,W=E.isMeshStandardMaterial?V.environment:null,ne=(E.isMeshStandardMaterial?t:e).get(E.envMap||W),D=ne&&ne.mapping===Vo?ne.image.height:null,Y=m[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const Q=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,oe=Q!==void 0?Q.length:0;let Re=0;X.morphAttributes.position!==void 0&&(Re=1),X.morphAttributes.normal!==void 0&&(Re=2),X.morphAttributes.color!==void 0&&(Re=3);let Ke,j,se,xe;if(Y){const st=ri[Y];Ke=st.vertexShader,j=st.fragmentShader}else Ke=E.vertexShader,j=E.fragmentShader,l.update(E),se=l.getVertexShaderID(E),xe=l.getFragmentShaderID(E);const de=n.getRenderTarget(),De=F.isInstancedMesh===!0,He=F.isBatchedMesh===!0,Be=!!E.map,it=!!E.matcap,P=!!ne,le=!!E.aoMap,ie=!!E.lightMap,ge=!!E.bumpMap,$=!!E.normalMap,Ue=!!E.displacementMap,me=!!E.emissiveMap,we=!!E.metalnessMap,N=!!E.roughnessMap,T=E.anisotropy>0,z=E.clearcoat>0,J=E.dispersion>0,Z=E.iridescence>0,te=E.sheen>0,Le=E.transmission>0,pe=T&&!!E.anisotropyMap,Se=z&&!!E.clearcoatMap,We=z&&!!E.clearcoatNormalMap,ae=z&&!!E.clearcoatRoughnessMap,_e=Z&&!!E.iridescenceMap,Je=Z&&!!E.iridescenceThicknessMap,Ve=te&&!!E.sheenColorMap,be=te&&!!E.sheenRoughnessMap,Ge=!!E.specularMap,qe=!!E.specularColorMap,vt=!!E.specularIntensityMap,U=Le&&!!E.transmissionMap,ce=Le&&!!E.thicknessMap,q=!!E.gradientMap,ee=!!E.alphaMap,he=E.alphaTest>0,Oe=!!E.alphaHash,Qe=!!E.extensions;let It=ji;E.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(It=n.toneMapping);const jt={shaderID:Y,shaderType:E.type,shaderName:E.name,vertexShader:Ke,fragmentShader:j,defines:E.defines,customVertexShaderID:se,customFragmentShaderID:xe,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:He,batchingColor:He&&F._colorsTexture!==null,instancing:De,instancingColor:De&&F.instanceColor!==null,instancingMorph:De&&F.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:tr,alphaToCoverage:!!E.alphaToCoverage,map:Be,matcap:it,envMap:P,envMapMode:P&&ne.mapping,envMapCubeUVHeight:D,aoMap:le,lightMap:ie,bumpMap:ge,normalMap:$,displacementMap:h&&Ue,emissiveMap:me,normalMapObjectSpace:$&&E.normalMapType===$S,normalMapTangentSpace:$&&E.normalMapType===kr,metalnessMap:we,roughnessMap:N,anisotropy:T,anisotropyMap:pe,clearcoat:z,clearcoatMap:Se,clearcoatNormalMap:We,clearcoatRoughnessMap:ae,dispersion:J,iridescence:Z,iridescenceMap:_e,iridescenceThicknessMap:Je,sheen:te,sheenColorMap:Ve,sheenRoughnessMap:be,specularMap:Ge,specularColorMap:qe,specularIntensityMap:vt,transmission:Le,transmissionMap:U,thicknessMap:ce,gradientMap:q,opaque:E.transparent===!1&&E.blending===fs&&E.alphaToCoverage===!1,alphaMap:ee,alphaTest:he,alphaHash:Oe,combine:E.combine,mapUv:Be&&y(E.map.channel),aoMapUv:le&&y(E.aoMap.channel),lightMapUv:ie&&y(E.lightMap.channel),bumpMapUv:ge&&y(E.bumpMap.channel),normalMapUv:$&&y(E.normalMap.channel),displacementMapUv:Ue&&y(E.displacementMap.channel),emissiveMapUv:me&&y(E.emissiveMap.channel),metalnessMapUv:we&&y(E.metalnessMap.channel),roughnessMapUv:N&&y(E.roughnessMap.channel),anisotropyMapUv:pe&&y(E.anisotropyMap.channel),clearcoatMapUv:Se&&y(E.clearcoatMap.channel),clearcoatNormalMapUv:We&&y(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ae&&y(E.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:Ve&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:be&&y(E.sheenRoughnessMap.channel),specularMapUv:Ge&&y(E.specularMap.channel),specularColorMapUv:qe&&y(E.specularColorMap.channel),specularIntensityMapUv:vt&&y(E.specularIntensityMap.channel),transmissionMapUv:U&&y(E.transmissionMap.channel),thicknessMapUv:ce&&y(E.thicknessMap.channel),alphaMapUv:ee&&y(E.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&($||T),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!X.attributes.uv&&(Be||ee),fog:!!G,useFog:E.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:F.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:oe,morphTextureStride:Re,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:It,decodeVideoTexture:Be&&E.map.isVideoTexture===!0&&rt.getTransfer(E.map.colorSpace)===ft,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===vi,flipSided:E.side===fn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Qe&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&E.extensions.multiDraw===!0||He)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return jt.vertexUv1s=c.has(1),jt.vertexUv2s=c.has(2),jt.vertexUv3s=c.has(3),c.clear(),jt}function f(E){const M=[];if(E.shaderID?M.push(E.shaderID):(M.push(E.customVertexShaderID),M.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)M.push(L),M.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(v(M,E),g(M,E),M.push(n.outputColorSpace)),M.push(E.customProgramCacheKey),M.join()}function v(E,M){E.push(M.precision),E.push(M.outputColorSpace),E.push(M.envMapMode),E.push(M.envMapCubeUVHeight),E.push(M.mapUv),E.push(M.alphaMapUv),E.push(M.lightMapUv),E.push(M.aoMapUv),E.push(M.bumpMapUv),E.push(M.normalMapUv),E.push(M.displacementMapUv),E.push(M.emissiveMapUv),E.push(M.metalnessMapUv),E.push(M.roughnessMapUv),E.push(M.anisotropyMapUv),E.push(M.clearcoatMapUv),E.push(M.clearcoatNormalMapUv),E.push(M.clearcoatRoughnessMapUv),E.push(M.iridescenceMapUv),E.push(M.iridescenceThicknessMapUv),E.push(M.sheenColorMapUv),E.push(M.sheenRoughnessMapUv),E.push(M.specularMapUv),E.push(M.specularColorMapUv),E.push(M.specularIntensityMapUv),E.push(M.transmissionMapUv),E.push(M.thicknessMapUv),E.push(M.combine),E.push(M.fogExp2),E.push(M.sizeAttenuation),E.push(M.morphTargetsCount),E.push(M.morphAttributeCount),E.push(M.numDirLights),E.push(M.numPointLights),E.push(M.numSpotLights),E.push(M.numSpotLightMaps),E.push(M.numHemiLights),E.push(M.numRectAreaLights),E.push(M.numDirLightShadows),E.push(M.numPointLightShadows),E.push(M.numSpotLightShadows),E.push(M.numSpotLightShadowsWithMaps),E.push(M.numLightProbes),E.push(M.shadowMapType),E.push(M.toneMapping),E.push(M.numClippingPlanes),E.push(M.numClipIntersection),E.push(M.depthPacking)}function g(E,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.doubleSided&&a.enable(10),M.flipSided&&a.enable(11),M.useDepthPacking&&a.enable(12),M.dithering&&a.enable(13),M.transmission&&a.enable(14),M.sheen&&a.enable(15),M.opaque&&a.enable(16),M.pointsUvs&&a.enable(17),M.decodeVideoTexture&&a.enable(18),M.alphaToCoverage&&a.enable(19),E.push(a.mask)}function _(E){const M=m[E.type];let L;if(M){const V=ri[M];L=lM.clone(V.uniforms)}else L=E.uniforms;return L}function R(E,M){let L;for(let V=0,F=u.length;V<F;V++){const G=u[V];if(G.cacheKey===M){L=G,++L.usedTimes;break}}return L===void 0&&(L=new V2(n,M,E,s),u.push(L)),L}function w(E){if(--E.usedTimes===0){const M=u.indexOf(E);u[M]=u[u.length-1],u.pop(),E.destroy()}}function A(E){l.remove(E)}function b(){l.dispose()}return{getParameters:x,getProgramCacheKey:f,getUniforms:_,acquireProgram:R,releaseProgram:w,releaseShaderCache:A,programs:u,dispose:b}}function X2(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function Y2(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function V0(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function H0(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(d,h,p,m,y,x){let f=n[e];return f===void 0?(f={id:d.id,object:d,geometry:h,material:p,groupOrder:m,renderOrder:d.renderOrder,z:y,group:x},n[e]=f):(f.id=d.id,f.object=d,f.geometry=h,f.material=p,f.groupOrder=m,f.renderOrder=d.renderOrder,f.z=y,f.group=x),e++,f}function a(d,h,p,m,y,x){const f=o(d,h,p,m,y,x);p.transmission>0?i.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(d,h,p,m,y,x){const f=o(d,h,p,m,y,x);p.transmission>0?i.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(d,h){t.length>1&&t.sort(d||Y2),i.length>1&&i.sort(h||V0),r.length>1&&r.sort(h||V0)}function u(){for(let d=e,h=n.length;d<h;d++){const p=n[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function $2(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new H0,n.set(i,[o])):r>=s.length?(o=new H0,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function q2(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new ye};break;case"SpotLight":t={position:new I,direction:new I,color:new ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new ye,groundColor:new ye};break;case"RectAreaLight":t={color:new ye,position:new I,halfWidth:new I,halfHeight:new I};break}return n[e.id]=t,t}}}function Z2(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let K2=0;function J2(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Q2(n){const e=new q2,t=Z2(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new I);const r=new I,s=new ke,o=new ke;function a(c){let u=0,d=0,h=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let p=0,m=0,y=0,x=0,f=0,v=0,g=0,_=0,R=0,w=0,A=0;c.sort(J2);for(let E=0,M=c.length;E<M;E++){const L=c[E],V=L.color,F=L.intensity,G=L.distance,X=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)u+=V.r*F,d+=V.g*F,h+=V.b*F;else if(L.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(L.sh.coefficients[W],F);A++}else if(L.isDirectionalLight){const W=e.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const ne=L.shadow,D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,i.directionalShadow[p]=D,i.directionalShadowMap[p]=X,i.directionalShadowMatrix[p]=L.shadow.matrix,v++}i.directional[p]=W,p++}else if(L.isSpotLight){const W=e.get(L);W.position.setFromMatrixPosition(L.matrixWorld),W.color.copy(V).multiplyScalar(F),W.distance=G,W.coneCos=Math.cos(L.angle),W.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),W.decay=L.decay,i.spot[y]=W;const ne=L.shadow;if(L.map&&(i.spotLightMap[R]=L.map,R++,ne.updateMatrices(L),L.castShadow&&w++),i.spotLightMatrix[y]=ne.matrix,L.castShadow){const D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,i.spotShadow[y]=D,i.spotShadowMap[y]=X,_++}y++}else if(L.isRectAreaLight){const W=e.get(L);W.color.copy(V).multiplyScalar(F),W.halfWidth.set(L.width*.5,0,0),W.halfHeight.set(0,L.height*.5,0),i.rectArea[x]=W,x++}else if(L.isPointLight){const W=e.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),W.distance=L.distance,W.decay=L.decay,L.castShadow){const ne=L.shadow,D=t.get(L);D.shadowIntensity=ne.intensity,D.shadowBias=ne.bias,D.shadowNormalBias=ne.normalBias,D.shadowRadius=ne.radius,D.shadowMapSize=ne.mapSize,D.shadowCameraNear=ne.camera.near,D.shadowCameraFar=ne.camera.far,i.pointShadow[m]=D,i.pointShadowMap[m]=X,i.pointShadowMatrix[m]=L.shadow.matrix,g++}i.point[m]=W,m++}else if(L.isHemisphereLight){const W=e.get(L);W.skyColor.copy(L.color).multiplyScalar(F),W.groundColor.copy(L.groundColor).multiplyScalar(F),i.hemi[f]=W,f++}}x>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2):(i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=h;const b=i.hash;(b.directionalLength!==p||b.pointLength!==m||b.spotLength!==y||b.rectAreaLength!==x||b.hemiLength!==f||b.numDirectionalShadows!==v||b.numPointShadows!==g||b.numSpotShadows!==_||b.numSpotMaps!==R||b.numLightProbes!==A)&&(i.directional.length=p,i.spot.length=y,i.rectArea.length=x,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=g,i.spotLightMatrix.length=_+R-w,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=A,b.directionalLength=p,b.pointLength=m,b.spotLength=y,b.rectAreaLength=x,b.hemiLength=f,b.numDirectionalShadows=v,b.numPointShadows=g,b.numSpotShadows=_,b.numSpotMaps=R,b.numLightProbes=A,i.version=K2++)}function l(c,u){let d=0,h=0,p=0,m=0,y=0;const x=u.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){const g=c[f];if(g.isDirectionalLight){const _=i.directional[d];_.direction.setFromMatrixPosition(g.matrixWorld),r.setFromMatrixPosition(g.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(x),d++}else if(g.isSpotLight){const _=i.spot[p];_.position.setFromMatrixPosition(g.matrixWorld),_.position.applyMatrix4(x),_.direction.setFromMatrixPosition(g.matrixWorld),r.setFromMatrixPosition(g.target.matrixWorld),_.direction.sub(r),_.direction.transformDirection(x),p++}else if(g.isRectAreaLight){const _=i.rectArea[m];_.position.setFromMatrixPosition(g.matrixWorld),_.position.applyMatrix4(x),o.identity(),s.copy(g.matrixWorld),s.premultiply(x),o.extractRotation(s),_.halfWidth.set(g.width*.5,0,0),_.halfHeight.set(0,g.height*.5,0),_.halfWidth.applyMatrix4(o),_.halfHeight.applyMatrix4(o),m++}else if(g.isPointLight){const _=i.point[h];_.position.setFromMatrixPosition(g.matrixWorld),_.position.applyMatrix4(x),h++}else if(g.isHemisphereLight){const _=i.hemi[y];_.direction.setFromMatrixPosition(g.matrixWorld),_.direction.transformDirection(x),y++}}}return{setup:a,setupView:l,state:i}}function G0(n){const e=new Q2(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function o(u){i.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function eI(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new G0(n),e.set(r,[a])):s>=o.length?(a=new G0(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class sg extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XS,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class og extends on{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const tI=`void main() {
3847
3847
  gl_Position = vec4( position, 1.0 );
3848
3848
  }`,nI=`uniform sampler2D shadow_pass;
3849
3849
  uniform vec2 resolution;
@@ -3871,7 +3871,7 @@ void main() {
3871
3871
  squared_mean = squared_mean / samples;
3872
3872
  float std_dev = sqrt( squared_mean - mean * mean );
3873
3873
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3874
- }`;function iI(n,e,t){let i=new Nl;const r=new K,s=new K,o=new ct,a=new sg({depthPacking:YS}),l=new og,c={},u=t.maxTextureSize,d={[Zi]:fn,[fn]:Zi,[vi]:vi},h=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:tI,fragmentShader:nI}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const m=new $e;m.setAttribute("position",new ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new kt(m,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zm;let f=this.type;this.render=function(M,T,A){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||M.length===0)return;const E=n.getRenderTarget(),w=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),V=n.state;V.setBlending(Wi),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const F=f!==gi&&this.type===gi,G=f===gi&&this.type!==gi;for(let Y=0,W=M.length;Y<W;Y++){const ne=M[Y],D=ne.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;r.copy(D.mapSize);const X=D.getFrameExtents();if(r.multiply(X),s.copy(D.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/X.x),r.x=s.x*X.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/X.y),r.y=s.y*X.y,D.mapSize.y=s.y)),D.map===null||F===!0||G===!0){const oe=this.type!==gi?{minFilter:Gt,magFilter:Gt}:{};D.map!==null&&D.map.dispose(),D.map=new li(r.x,r.y,oe),D.map.texture.name=ne.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const Q=D.getViewportCount();for(let oe=0;oe<Q;oe++){const Re=D.getViewport(oe);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),V.viewport(o),D.updateMatrices(ne,oe),i=D.getFrustum(),_(T,A,D.camera,ne,this.type)}D.isPointLightShadow!==!0&&this.type===gi&&v(D,A),D.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(E,w,L)};function v(M,T){const A=e.update(y);h.defines.VSM_SAMPLES!==M.blurSamples&&(h.defines.VSM_SAMPLES=M.blurSamples,p.defines.VSM_SAMPLES=M.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),M.mapPass===null&&(M.mapPass=new li(r.x,r.y)),h.uniforms.shadow_pass.value=M.map.texture,h.uniforms.resolution.value=M.mapSize,h.uniforms.radius.value=M.radius,n.setRenderTarget(M.mapPass),n.clear(),n.renderBufferDirect(T,null,A,h,y,null),p.uniforms.shadow_pass.value=M.mapPass.texture,p.uniforms.resolution.value=M.mapSize,p.uniforms.radius.value=M.radius,n.setRenderTarget(M.map),n.clear(),n.renderBufferDirect(T,null,A,p,y,null)}function x(M,T,A,E){let w=null;const L=A.isPointLight===!0?M.customDistanceMaterial:M.customDepthMaterial;if(L!==void 0)w=L;else if(w=A.isPointLight===!0?l:a,n.localClippingEnabled&&T.clipShadows===!0&&Array.isArray(T.clippingPlanes)&&T.clippingPlanes.length!==0||T.displacementMap&&T.displacementScale!==0||T.alphaMap&&T.alphaTest>0||T.map&&T.alphaTest>0){const V=w.uuid,F=T.uuid;let G=c[V];G===void 0&&(G={},c[V]=G);let Y=G[F];Y===void 0&&(Y=w.clone(),G[F]=Y,T.addEventListener("dispose",R)),w=Y}if(w.visible=T.visible,w.wireframe=T.wireframe,E===gi?w.side=T.shadowSide!==null?T.shadowSide:T.side:w.side=T.shadowSide!==null?T.shadowSide:d[T.side],w.alphaMap=T.alphaMap,w.alphaTest=T.alphaTest,w.map=T.map,w.clipShadows=T.clipShadows,w.clippingPlanes=T.clippingPlanes,w.clipIntersection=T.clipIntersection,w.displacementMap=T.displacementMap,w.displacementScale=T.displacementScale,w.displacementBias=T.displacementBias,w.wireframeLinewidth=T.wireframeLinewidth,w.linewidth=T.linewidth,A.isPointLight===!0&&w.isMeshDistanceMaterial===!0){const V=n.properties.get(w);V.light=A}return w}function _(M,T,A,E,w){if(M.visible===!1)return;if(M.layers.test(T.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&w===gi)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,M.matrixWorld);const F=e.update(M),G=M.material;if(Array.isArray(G)){const Y=F.groups;for(let W=0,ne=Y.length;W<ne;W++){const D=Y[W],X=G[D.materialIndex];if(X&&X.visible){const Q=x(M,X,E,w);M.onBeforeShadow(n,M,T,A,F,Q,D),n.renderBufferDirect(A,null,F,Q,M,D),M.onAfterShadow(n,M,T,A,F,Q,D)}}}else if(G.visible){const Y=x(M,G,E,w);M.onBeforeShadow(n,M,T,A,F,Y,null),n.renderBufferDirect(A,null,F,Y,M,null),M.onAfterShadow(n,M,T,A,F,Y,null)}}const V=M.children;for(let F=0,G=V.length;F<G;F++)_(V[F],T,A,E,w)}function R(M){M.target.removeEventListener("dispose",R);for(const A in c){const E=c[A],w=M.target.uuid;w in E&&(E[w].dispose(),delete E[w])}}}function rI(n){function e(){let U=!1;const ce=new ct;let q=null;const ee=new ct(0,0,0,0);return{setMask:function(he){q!==he&&!U&&(n.colorMask(he,he,he,he),q=he)},setLocked:function(he){U=he},setClear:function(he,Oe,Qe,It,jt){jt===!0&&(he*=It,Oe*=It,Qe*=It),ce.set(he,Oe,Qe,It),ee.equals(ce)===!1&&(n.clearColor(he,Oe,Qe,It),ee.copy(ce))},reset:function(){U=!1,q=null,ee.set(-1,0,0,0)}}}function t(){let U=!1,ce=null,q=null,ee=null;return{setTest:function(he){he?xe(n.DEPTH_TEST):de(n.DEPTH_TEST)},setMask:function(he){ce!==he&&!U&&(n.depthMask(he),ce=he)},setFunc:function(he){if(q!==he){switch(he){case TS:n.depthFunc(n.NEVER);break;case AS:n.depthFunc(n.ALWAYS);break;case CS:n.depthFunc(n.LESS);break;case nl:n.depthFunc(n.LEQUAL);break;case RS:n.depthFunc(n.EQUAL);break;case PS:n.depthFunc(n.GEQUAL);break;case IS:n.depthFunc(n.GREATER);break;case NS:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}q=he}},setLocked:function(he){U=he},setClear:function(he){ee!==he&&(n.clearDepth(he),ee=he)},reset:function(){U=!1,ce=null,q=null,ee=null}}}function i(){let U=!1,ce=null,q=null,ee=null,he=null,Oe=null,Qe=null,It=null,jt=null;return{setTest:function(st){U||(st?xe(n.STENCIL_TEST):de(n.STENCIL_TEST))},setMask:function(st){ce!==st&&!U&&(n.stencilMask(st),ce=st)},setFunc:function(st,Ci,hi){(q!==st||ee!==Ci||he!==hi)&&(n.stencilFunc(st,Ci,hi),q=st,ee=Ci,he=hi)},setOp:function(st,Ci,hi){(Oe!==st||Qe!==Ci||It!==hi)&&(n.stencilOp(st,Ci,hi),Oe=st,Qe=Ci,It=hi)},setLocked:function(st){U=st},setClear:function(st){jt!==st&&(n.clearStencil(st),jt=st)},reset:function(){U=!1,ce=null,q=null,ee=null,he=null,Oe=null,Qe=null,It=null,jt=null}}}const r=new e,s=new t,o=new i,a=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],p=null,m=!1,y=null,g=null,f=null,v=null,x=null,_=null,R=null,M=new ye(0,0,0),T=0,A=!1,E=null,w=null,L=null,V=null,F=null;const G=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,W=0;const ne=n.getParameter(n.VERSION);ne.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(ne)[1]),Y=W>=1):ne.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),Y=W>=2);let D=null,X={};const Q=n.getParameter(n.SCISSOR_BOX),oe=n.getParameter(n.VIEWPORT),Re=new ct().fromArray(Q),Ke=new ct().fromArray(oe);function j(U,ce,q,ee){const he=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(U,Oe),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Qe=0;Qe<q;Qe++)U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY?n.texImage3D(ce,0,n.RGBA,1,1,ee,0,n.RGBA,n.UNSIGNED_BYTE,he):n.texImage2D(ce+Qe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,he);return Oe}const se={};se[n.TEXTURE_2D]=j(n.TEXTURE_2D,n.TEXTURE_2D,1),se[n.TEXTURE_CUBE_MAP]=j(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),se[n.TEXTURE_2D_ARRAY]=j(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),se[n.TEXTURE_3D]=j(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),xe(n.DEPTH_TEST),s.setFunc(nl),ge(!1),$(Ap),xe(n.CULL_FACE),le(Wi);function xe(U){c[U]!==!0&&(n.enable(U),c[U]=!0)}function de(U){c[U]!==!1&&(n.disable(U),c[U]=!1)}function De(U,ce){return u[U]!==ce?(n.bindFramebuffer(U,ce),u[U]=ce,U===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ce),U===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ce),!0):!1}function He(U,ce){let q=h,ee=!1;if(U){q=d.get(ce),q===void 0&&(q=[],d.set(ce,q));const he=U.textures;if(q.length!==he.length||q[0]!==n.COLOR_ATTACHMENT0){for(let Oe=0,Qe=he.length;Oe<Qe;Oe++)q[Oe]=n.COLOR_ATTACHMENT0+Oe;q.length=he.length,ee=!0}}else q[0]!==n.BACK&&(q[0]=n.BACK,ee=!0);ee&&n.drawBuffers(q)}function Be(U){return p!==U?(n.useProgram(U),p=U,!0):!1}const it={[vr]:n.FUNC_ADD,[cS]:n.FUNC_SUBTRACT,[uS]:n.FUNC_REVERSE_SUBTRACT};it[dS]=n.MIN,it[hS]=n.MAX;const P={[fS]:n.ZERO,[pS]:n.ONE,[mS]:n.SRC_COLOR,[Lu]:n.SRC_ALPHA,[SS]:n.SRC_ALPHA_SATURATE,[yS]:n.DST_COLOR,[xS]:n.DST_ALPHA,[gS]:n.ONE_MINUS_SRC_COLOR,[Du]:n.ONE_MINUS_SRC_ALPHA,[_S]:n.ONE_MINUS_DST_COLOR,[vS]:n.ONE_MINUS_DST_ALPHA,[MS]:n.CONSTANT_COLOR,[wS]:n.ONE_MINUS_CONSTANT_COLOR,[bS]:n.CONSTANT_ALPHA,[ES]:n.ONE_MINUS_CONSTANT_ALPHA};function le(U,ce,q,ee,he,Oe,Qe,It,jt,st){if(U===Wi){m===!0&&(de(n.BLEND),m=!1);return}if(m===!1&&(xe(n.BLEND),m=!0),U!==lS){if(U!==y||st!==A){if((g!==vr||x!==vr)&&(n.blendEquation(n.FUNC_ADD),g=vr,x=vr),st)switch(U){case fs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Cp:n.blendFunc(n.ONE,n.ONE);break;case Rp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case fs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Cp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Rp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pp:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}f=null,v=null,_=null,R=null,M.set(0,0,0),T=0,y=U,A=st}return}he=he||ce,Oe=Oe||q,Qe=Qe||ee,(ce!==g||he!==x)&&(n.blendEquationSeparate(it[ce],it[he]),g=ce,x=he),(q!==f||ee!==v||Oe!==_||Qe!==R)&&(n.blendFuncSeparate(P[q],P[ee],P[Oe],P[Qe]),f=q,v=ee,_=Oe,R=Qe),(It.equals(M)===!1||jt!==T)&&(n.blendColor(It.r,It.g,It.b,jt),M.copy(It),T=jt),y=U,A=!1}function ie(U,ce){U.side===vi?de(n.CULL_FACE):xe(n.CULL_FACE);let q=U.side===fn;ce&&(q=!q),ge(q),U.blending===fs&&U.transparent===!1?le(Wi):le(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),s.setFunc(U.depthFunc),s.setTest(U.depthTest),s.setMask(U.depthWrite),r.setMask(U.colorWrite);const ee=U.stencilWrite;o.setTest(ee),ee&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),me(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?xe(n.SAMPLE_ALPHA_TO_COVERAGE):de(n.SAMPLE_ALPHA_TO_COVERAGE)}function ge(U){E!==U&&(U?n.frontFace(n.CW):n.frontFace(n.CCW),E=U)}function $(U){U!==sS?(xe(n.CULL_FACE),U!==w&&(U===Ap?n.cullFace(n.BACK):U===oS?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):de(n.CULL_FACE),w=U}function Ue(U){U!==L&&(Y&&n.lineWidth(U),L=U)}function me(U,ce,q){U?(xe(n.POLYGON_OFFSET_FILL),(V!==ce||F!==q)&&(n.polygonOffset(ce,q),V=ce,F=q)):de(n.POLYGON_OFFSET_FILL)}function we(U){U?xe(n.SCISSOR_TEST):de(n.SCISSOR_TEST)}function N(U){U===void 0&&(U=n.TEXTURE0+G-1),D!==U&&(n.activeTexture(U),D=U)}function b(U,ce,q){q===void 0&&(D===null?q=n.TEXTURE0+G-1:q=D);let ee=X[q];ee===void 0&&(ee={type:void 0,texture:void 0},X[q]=ee),(ee.type!==U||ee.texture!==ce)&&(D!==q&&(n.activeTexture(q),D=q),n.bindTexture(U,ce||se[U]),ee.type=U,ee.texture=ce)}function z(){const U=X[D];U!==void 0&&U.type!==void 0&&(n.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function J(){try{n.compressedTexImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Z(){try{n.compressedTexImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function te(){try{n.texSubImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Le(){try{n.texSubImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function pe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Se(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function We(){try{n.texStorage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ae(){try{n.texStorage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function _e(){try{n.texImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Je(){try{n.texImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ve(U){Re.equals(U)===!1&&(n.scissor(U.x,U.y,U.z,U.w),Re.copy(U))}function be(U){Ke.equals(U)===!1&&(n.viewport(U.x,U.y,U.z,U.w),Ke.copy(U))}function Ge(U,ce){let q=l.get(ce);q===void 0&&(q=new WeakMap,l.set(ce,q));let ee=q.get(U);ee===void 0&&(ee=n.getUniformBlockIndex(ce,U.name),q.set(U,ee))}function qe(U,ce){const ee=l.get(ce).get(U);a.get(ce)!==ee&&(n.uniformBlockBinding(ce,ee,U.__bindingPointIndex),a.set(ce,ee))}function vt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),c={},D=null,X={},u={},d=new WeakMap,h=[],p=null,m=!1,y=null,g=null,f=null,v=null,x=null,_=null,R=null,M=new ye(0,0,0),T=0,A=!1,E=null,w=null,L=null,V=null,F=null,Re.set(0,0,n.canvas.width,n.canvas.height),Ke.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:xe,disable:de,bindFramebuffer:De,drawBuffers:He,useProgram:Be,setBlending:le,setMaterial:ie,setFlipSided:ge,setCullFace:$,setLineWidth:Ue,setPolygonOffset:me,setScissorTest:we,activeTexture:N,bindTexture:b,unbindTexture:z,compressedTexImage2D:J,compressedTexImage3D:Z,texImage2D:_e,texImage3D:Je,updateUBOMapping:Ge,uniformBlockBinding:qe,texStorage2D:We,texStorage3D:ae,texSubImage2D:te,texSubImage3D:Le,compressedTexSubImage2D:pe,compressedTexSubImage3D:Se,scissor:Ve,viewport:be,reset:vt}}function sI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function oI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function aI(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function kp(n,e,t,i){const r=lI(i);switch(t){case jm:return n*e;case Ym:return n*e;case $m:return n*e*2;case Ld:return n*e/r.components*r.byteLength;case Rl:return n*e/r.components*r.byteLength;case qm:return n*e*2/r.components*r.byteLength;case Dd:return n*e*2/r.components*r.byteLength;case Xm:return n*e*3/r.components*r.byteLength;case dn:return n*e*4/r.components*r.byteLength;case Ud:return n*e*4/r.components*r.byteLength;case Ia:case Na:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case La:case Da:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ku:case Fu:return Math.max(n,16)*Math.max(e,8)/4;case Uu:case Ou:return Math.max(n,8)*Math.max(e,8)/2;case Bu:case zu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Vu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Hu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Gu:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Wu:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case ju:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Xu:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Yu:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case $u:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case qu:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Zu:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Ku:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ju:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Qu:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ed:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case td:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ua:case nd:case id:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Zm:case rd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case sd:case od:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function lI(n){switch(n){case Ei:case Hm:return{byteLength:1,components:1};case Do:case Gm:case Ho:return{byteLength:2,components:1};case Id:case Nd:return{byteLength:2,components:4};case Ji:case Pd:case Sn:return{byteLength:4,components:1};case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const cI={contain:sI,cover:oI,fill:aI,getByteLength:kp};function uI(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new K,u=new WeakMap;let d;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(N,b){return p?new OffscreenCanvas(N,b):pl("canvas")}function y(N,b,z){let J=1;const Z=we(N);if((Z.width>z||Z.height>z)&&(J=z/Math.max(Z.width,Z.height)),J<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const te=Math.floor(J*Z.width),Le=Math.floor(J*Z.height);d===void 0&&(d=m(te,Le));const pe=b?m(te,Le):d;return pe.width=te,pe.height=Le,pe.getContext("2d").drawImage(N,0,0,te,Le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+te+"x"+Le+")."),pe}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),N;return N}function g(N){return N.generateMipmaps&&N.minFilter!==Gt&&N.minFilter!==Ut}function f(N){n.generateMipmap(N)}function v(N,b,z,J,Z=!1){if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let te=b;if(b===n.RED&&(z===n.FLOAT&&(te=n.R32F),z===n.HALF_FLOAT&&(te=n.R16F),z===n.UNSIGNED_BYTE&&(te=n.R8)),b===n.RED_INTEGER&&(z===n.UNSIGNED_BYTE&&(te=n.R8UI),z===n.UNSIGNED_SHORT&&(te=n.R16UI),z===n.UNSIGNED_INT&&(te=n.R32UI),z===n.BYTE&&(te=n.R8I),z===n.SHORT&&(te=n.R16I),z===n.INT&&(te=n.R32I)),b===n.RG&&(z===n.FLOAT&&(te=n.RG32F),z===n.HALF_FLOAT&&(te=n.RG16F),z===n.UNSIGNED_BYTE&&(te=n.RG8)),b===n.RG_INTEGER&&(z===n.UNSIGNED_BYTE&&(te=n.RG8UI),z===n.UNSIGNED_SHORT&&(te=n.RG16UI),z===n.UNSIGNED_INT&&(te=n.RG32UI),z===n.BYTE&&(te=n.RG8I),z===n.SHORT&&(te=n.RG16I),z===n.INT&&(te=n.RG32I)),b===n.RGB&&z===n.UNSIGNED_INT_5_9_9_9_REV&&(te=n.RGB9_E5),b===n.RGBA){const Le=Z?cl:rt.getTransfer(J);z===n.FLOAT&&(te=n.RGBA32F),z===n.HALF_FLOAT&&(te=n.RGBA16F),z===n.UNSIGNED_BYTE&&(te=Le===ft?n.SRGB8_ALPHA8:n.RGBA8),z===n.UNSIGNED_SHORT_4_4_4_4&&(te=n.RGBA4),z===n.UNSIGNED_SHORT_5_5_5_1&&(te=n.RGB5_A1)}return(te===n.R16F||te===n.R32F||te===n.RG16F||te===n.RG32F||te===n.RGBA16F||te===n.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function x(N,b){let z;return N?b===null||b===Ji||b===Ms?z=n.DEPTH24_STENCIL8:b===Sn?z=n.DEPTH32F_STENCIL8:b===Do&&(z=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Ji||b===Ms?z=n.DEPTH_COMPONENT24:b===Sn?z=n.DEPTH_COMPONENT32F:b===Do&&(z=n.DEPTH_COMPONENT16),z}function _(N,b){return g(N)===!0||N.isFramebufferTexture&&N.minFilter!==Gt&&N.minFilter!==Ut?Math.log2(Math.max(b.width,b.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?b.mipmaps.length:1}function R(N){const b=N.target;b.removeEventListener("dispose",R),T(b),b.isVideoTexture&&u.delete(b)}function M(N){const b=N.target;b.removeEventListener("dispose",M),E(b)}function T(N){const b=i.get(N);if(b.__webglInit===void 0)return;const z=N.source,J=h.get(z);if(J){const Z=J[b.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&A(N),Object.keys(J).length===0&&h.delete(z)}i.remove(N)}function A(N){const b=i.get(N);n.deleteTexture(b.__webglTexture);const z=N.source,J=h.get(z);delete J[b.__cacheKey],o.memory.textures--}function E(N){const b=i.get(N);if(N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(b.__webglFramebuffer[J]))for(let Z=0;Z<b.__webglFramebuffer[J].length;Z++)n.deleteFramebuffer(b.__webglFramebuffer[J][Z]);else n.deleteFramebuffer(b.__webglFramebuffer[J]);b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer[J])}else{if(Array.isArray(b.__webglFramebuffer))for(let J=0;J<b.__webglFramebuffer.length;J++)n.deleteFramebuffer(b.__webglFramebuffer[J]);else n.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&n.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let J=0;J<b.__webglColorRenderbuffer.length;J++)b.__webglColorRenderbuffer[J]&&n.deleteRenderbuffer(b.__webglColorRenderbuffer[J]);b.__webglDepthRenderbuffer&&n.deleteRenderbuffer(b.__webglDepthRenderbuffer)}const z=N.textures;for(let J=0,Z=z.length;J<Z;J++){const te=i.get(z[J]);te.__webglTexture&&(n.deleteTexture(te.__webglTexture),o.memory.textures--),i.remove(z[J])}i.remove(N)}let w=0;function L(){w=0}function V(){const N=w;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),w+=1,N}function F(N){const b=[];return b.push(N.wrapS),b.push(N.wrapT),b.push(N.wrapR||0),b.push(N.magFilter),b.push(N.minFilter),b.push(N.anisotropy),b.push(N.internalFormat),b.push(N.format),b.push(N.type),b.push(N.generateMipmaps),b.push(N.premultiplyAlpha),b.push(N.flipY),b.push(N.unpackAlignment),b.push(N.colorSpace),b.join()}function G(N,b){const z=i.get(N);if(N.isVideoTexture&&Ue(N),N.isRenderTargetTexture===!1&&N.version>0&&z.__version!==N.version){const J=N.image;if(J===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ke(z,N,b);return}}t.bindTexture(n.TEXTURE_2D,z.__webglTexture,n.TEXTURE0+b)}function Y(N,b){const z=i.get(N);if(N.version>0&&z.__version!==N.version){Ke(z,N,b);return}t.bindTexture(n.TEXTURE_2D_ARRAY,z.__webglTexture,n.TEXTURE0+b)}function W(N,b){const z=i.get(N);if(N.version>0&&z.__version!==N.version){Ke(z,N,b);return}t.bindTexture(n.TEXTURE_3D,z.__webglTexture,n.TEXTURE0+b)}function ne(N,b){const z=i.get(N);if(N.version>0&&z.__version!==N.version){j(z,N,b);return}t.bindTexture(n.TEXTURE_CUBE_MAP,z.__webglTexture,n.TEXTURE0+b)}const D={[sl]:n.REPEAT,[Xn]:n.CLAMP_TO_EDGE,[ol]:n.MIRRORED_REPEAT},X={[Gt]:n.NEAREST,[Vm]:n.NEAREST_MIPMAP_NEAREST,[fo]:n.NEAREST_MIPMAP_LINEAR,[Ut]:n.LINEAR,[Pa]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},Q={[qS]:n.NEVER,[tM]:n.ALWAYS,[ZS]:n.LESS,[Jm]:n.LEQUAL,[KS]:n.EQUAL,[eM]:n.GEQUAL,[JS]:n.GREATER,[QS]:n.NOTEQUAL};function oe(N,b){if(b.type===Sn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===Ut||b.magFilter===Pa||b.magFilter===fo||b.magFilter===yi||b.minFilter===Ut||b.minFilter===Pa||b.minFilter===fo||b.minFilter===yi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,D[b.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,D[b.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,D[b.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,X[b.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,X[b.minFilter]),b.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,Q[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Gt||b.minFilter!==fo&&b.minFilter!==yi||b.type===Sn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||i.get(b).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,r.getMaxAnisotropy())),i.get(b).__currentAnisotropy=b.anisotropy}}}function Re(N,b){let z=!1;N.__webglInit===void 0&&(N.__webglInit=!0,b.addEventListener("dispose",R));const J=b.source;let Z=h.get(J);Z===void 0&&(Z={},h.set(J,Z));const te=F(b);if(te!==N.__cacheKey){Z[te]===void 0&&(Z[te]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,z=!0),Z[te].usedTimes++;const Le=Z[N.__cacheKey];Le!==void 0&&(Z[N.__cacheKey].usedTimes--,Le.usedTimes===0&&A(b)),N.__cacheKey=te,N.__webglTexture=Z[te].texture}return z}function Ke(N,b,z){let J=n.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(J=n.TEXTURE_2D_ARRAY),b.isData3DTexture&&(J=n.TEXTURE_3D);const Z=Re(N,b),te=b.source;t.bindTexture(J,N.__webglTexture,n.TEXTURE0+z);const Le=i.get(te);if(te.version!==Le.__version||Z===!0){t.activeTexture(n.TEXTURE0+z);const pe=rt.getPrimaries(rt.workingColorSpace),Se=b.colorSpace===Fi?null:rt.getPrimaries(b.colorSpace),We=b.colorSpace===Fi||pe===Se?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let ae=y(b.image,!1,r.maxTextureSize);ae=me(b,ae);const _e=s.convert(b.format,b.colorSpace),Je=s.convert(b.type);let Ve=v(b.internalFormat,_e,Je,b.colorSpace,b.isVideoTexture);oe(J,b);let be;const Ge=b.mipmaps,qe=b.isVideoTexture!==!0,vt=Le.__version===void 0||Z===!0,U=te.dataReady,ce=_(b,ae);if(b.isDepthTexture)Ve=x(b.format===ws,b.type),vt&&(qe?t.texStorage2D(n.TEXTURE_2D,1,Ve,ae.width,ae.height):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,_e,Je,null));else if(b.isDataTexture)if(Ge.length>0){qe&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,Je,be.data):t.texImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,_e,Je,be.data);b.generateMipmaps=!1}else qe?(vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height),U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ae.width,ae.height,_e,Je,ae.data)):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,_e,Je,ae.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){qe&&vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,Ge[0].width,Ge[0].height,ae.depth);for(let q=0,ee=Ge.length;q<ee;q++)if(be=Ge[q],b.format!==dn)if(_e!==null)if(qe){if(U)if(b.layerUpdates.size>0){const he=kp(be.width,be.height,b.format,b.type);for(const Oe of b.layerUpdates){const Qe=be.data.subarray(Oe*he/be.data.BYTES_PER_ELEMENT,(Oe+1)*he/be.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,Oe,be.width,be.height,1,_e,Qe,0,0)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,be.width,be.height,ae.depth,_e,be.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,Ve,be.width,be.height,ae.depth,0,be.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else qe?U&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,be.width,be.height,ae.depth,_e,Je,be.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,Ve,be.width,be.height,ae.depth,0,_e,Je,be.data)}else{qe&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],b.format!==dn?_e!==null?qe?U&&t.compressedTexSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,be.data):t.compressedTexImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,Je,be.data):t.texImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,_e,Je,be.data)}else if(b.isDataArrayTexture)if(qe){if(vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,ae.width,ae.height,ae.depth),U)if(b.layerUpdates.size>0){const q=kp(ae.width,ae.height,b.format,b.type);for(const ee of b.layerUpdates){const he=ae.data.subarray(ee*q/ae.data.BYTES_PER_ELEMENT,(ee+1)*q/ae.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ee,ae.width,ae.height,1,_e,Je,he)}b.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,_e,Je,ae.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ve,ae.width,ae.height,ae.depth,0,_e,Je,ae.data);else if(b.isData3DTexture)qe?(vt&&t.texStorage3D(n.TEXTURE_3D,ce,Ve,ae.width,ae.height,ae.depth),U&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,_e,Je,ae.data)):t.texImage3D(n.TEXTURE_3D,0,Ve,ae.width,ae.height,ae.depth,0,_e,Je,ae.data);else if(b.isFramebufferTexture){if(vt)if(qe)t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height);else{let q=ae.width,ee=ae.height;for(let he=0;he<ce;he++)t.texImage2D(n.TEXTURE_2D,he,Ve,q,ee,0,_e,Je,null),q>>=1,ee>>=1}}else if(Ge.length>0){if(qe&&vt){const q=we(Ge[0]);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,_e,Je,be):t.texImage2D(n.TEXTURE_2D,q,Ve,_e,Je,be);b.generateMipmaps=!1}else if(qe){if(vt){const q=we(ae);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,_e,Je,ae)}else t.texImage2D(n.TEXTURE_2D,0,Ve,_e,Je,ae);g(b)&&f(J),Le.__version=te.version,b.onUpdate&&b.onUpdate(b)}N.__version=b.version}function j(N,b,z){if(b.image.length!==6)return;const J=Re(N,b),Z=b.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+z);const te=i.get(Z);if(Z.version!==te.__version||J===!0){t.activeTexture(n.TEXTURE0+z);const Le=rt.getPrimaries(rt.workingColorSpace),pe=b.colorSpace===Fi?null:rt.getPrimaries(b.colorSpace),Se=b.colorSpace===Fi||Le===pe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const We=b.isCompressedTexture||b.image[0].isCompressedTexture,ae=b.image[0]&&b.image[0].isDataTexture,_e=[];for(let ee=0;ee<6;ee++)!We&&!ae?_e[ee]=y(b.image[ee],!0,r.maxCubemapSize):_e[ee]=ae?b.image[ee].image:b.image[ee],_e[ee]=me(b,_e[ee]);const Je=_e[0],Ve=s.convert(b.format,b.colorSpace),be=s.convert(b.type),Ge=v(b.internalFormat,Ve,be,b.colorSpace),qe=b.isVideoTexture!==!0,vt=te.__version===void 0||J===!0,U=Z.dataReady;let ce=_(b,Je);oe(n.TEXTURE_CUBE_MAP,b);let q;if(We){qe&&vt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,Je.width,Je.height);for(let ee=0;ee<6;ee++){q=_e[ee].mipmaps;for(let he=0;he<q.length;he++){const Oe=q[he];b.format!==dn?Ve!==null?qe?U&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,0,0,Oe.width,Oe.height,Ve,Oe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,Ge,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,0,0,Oe.width,Oe.height,Ve,be,Oe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,Ge,Oe.width,Oe.height,0,Ve,be,Oe.data)}}}else{if(q=b.mipmaps,qe&&vt){q.length>0&&ce++;const ee=we(_e[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(ae){qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,_e[ee].width,_e[ee].height,Ve,be,_e[ee].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Ge,_e[ee].width,_e[ee].height,0,Ve,be,_e[ee].data);for(let he=0;he<q.length;he++){const Qe=q[he].image[ee].image;qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,0,0,Qe.width,Qe.height,Ve,be,Qe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,Ge,Qe.width,Qe.height,0,Ve,be,Qe.data)}}else{qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ve,be,_e[ee]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Ge,Ve,be,_e[ee]);for(let he=0;he<q.length;he++){const Oe=q[he];qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,0,0,Ve,be,Oe.image[ee]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,Ge,Ve,be,Oe.image[ee])}}}g(b)&&f(n.TEXTURE_CUBE_MAP),te.__version=Z.version,b.onUpdate&&b.onUpdate(b)}N.__version=b.version}function se(N,b,z,J,Z,te){const Le=s.convert(z.format,z.colorSpace),pe=s.convert(z.type),Se=v(z.internalFormat,Le,pe,z.colorSpace);if(!i.get(b).__hasExternalTextures){const ae=Math.max(1,b.width>>te),_e=Math.max(1,b.height>>te);Z===n.TEXTURE_3D||Z===n.TEXTURE_2D_ARRAY?t.texImage3D(Z,te,Se,ae,_e,b.depth,0,Le,pe,null):t.texImage2D(Z,te,Se,ae,_e,0,Le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),$(b)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,J,Z,i.get(z).__webglTexture,0,ge(b)):(Z===n.TEXTURE_2D||Z>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,J,Z,i.get(z).__webglTexture,te),t.bindFramebuffer(n.FRAMEBUFFER,null)}function xe(N,b,z){if(n.bindRenderbuffer(n.RENDERBUFFER,N),b.depthBuffer){const J=b.depthTexture,Z=J&&J.isDepthTexture?J.type:null,te=x(b.stencilBuffer,Z),Le=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=ge(b);$(b)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,te,b.width,b.height):z?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,te,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,te,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Le,n.RENDERBUFFER,N)}else{const J=b.textures;for(let Z=0;Z<J.length;Z++){const te=J[Z],Le=s.convert(te.format,te.colorSpace),pe=s.convert(te.type),Se=v(te.internalFormat,Le,pe,te.colorSpace),We=ge(b);z&&$(b)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,We,Se,b.width,b.height):$(b)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We,Se,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,Se,b.width,b.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function de(N,b){if(b&&b.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(b.depthTexture).__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),G(b.depthTexture,0);const J=i.get(b.depthTexture).__webglTexture,Z=ge(b);if(b.depthTexture.format===ps)$(b)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,J,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,J,0);else if(b.depthTexture.format===ws)$(b)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,J,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,J,0);else throw new Error("Unknown depthTexture format")}function De(N){const b=i.get(N),z=N.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==N.depthTexture){const J=N.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),J){const Z=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,J.removeEventListener("dispose",Z)};J.addEventListener("dispose",Z),b.__depthDisposeCallback=Z}b.__boundDepthTexture=J}if(N.depthTexture&&!b.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");de(b.__webglFramebuffer,N)}else if(z){b.__webglDepthbuffer=[];for(let J=0;J<6;J++)if(t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[J]),b.__webglDepthbuffer[J]===void 0)b.__webglDepthbuffer[J]=n.createRenderbuffer(),xe(b.__webglDepthbuffer[J],N,!1);else{const Z=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,te=b.__webglDepthbuffer[J];n.bindRenderbuffer(n.RENDERBUFFER,te),n.framebufferRenderbuffer(n.FRAMEBUFFER,Z,n.RENDERBUFFER,te)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=n.createRenderbuffer(),xe(b.__webglDepthbuffer,N,!1);else{const J=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Z=b.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,Z),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,Z)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function He(N,b,z){const J=i.get(N);b!==void 0&&se(J.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),z!==void 0&&De(N)}function Be(N){const b=N.texture,z=i.get(N),J=i.get(b);N.addEventListener("dispose",M);const Z=N.textures,te=N.isWebGLCubeRenderTarget===!0,Le=Z.length>1;if(Le||(J.__webglTexture===void 0&&(J.__webglTexture=n.createTexture()),J.__version=b.version,o.memory.textures++),te){z.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(b.mipmaps&&b.mipmaps.length>0){z.__webglFramebuffer[pe]=[];for(let Se=0;Se<b.mipmaps.length;Se++)z.__webglFramebuffer[pe][Se]=n.createFramebuffer()}else z.__webglFramebuffer[pe]=n.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){z.__webglFramebuffer=[];for(let pe=0;pe<b.mipmaps.length;pe++)z.__webglFramebuffer[pe]=n.createFramebuffer()}else z.__webglFramebuffer=n.createFramebuffer();if(Le)for(let pe=0,Se=Z.length;pe<Se;pe++){const We=i.get(Z[pe]);We.__webglTexture===void 0&&(We.__webglTexture=n.createTexture(),o.memory.textures++)}if(N.samples>0&&$(N)===!1){z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let pe=0;pe<Z.length;pe++){const Se=Z[pe];z.__webglColorRenderbuffer[pe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,z.__webglColorRenderbuffer[pe]);const We=s.convert(Se.format,Se.colorSpace),ae=s.convert(Se.type),_e=v(Se.internalFormat,We,ae,Se.colorSpace,N.isXRRenderTarget===!0),Je=ge(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,Je,_e,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,z.__webglColorRenderbuffer[pe])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(z.__webglDepthRenderbuffer=n.createRenderbuffer(),xe(z.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(te){t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture),oe(n.TEXTURE_CUBE_MAP,b);for(let pe=0;pe<6;pe++)if(b.mipmaps&&b.mipmaps.length>0)for(let Se=0;Se<b.mipmaps.length;Se++)se(z.__webglFramebuffer[pe][Se],N,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Se);else se(z.__webglFramebuffer[pe],N,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);g(b)&&f(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Le){for(let pe=0,Se=Z.length;pe<Se;pe++){const We=Z[pe],ae=i.get(We);t.bindTexture(n.TEXTURE_2D,ae.__webglTexture),oe(n.TEXTURE_2D,We),se(z.__webglFramebuffer,N,We,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,0),g(We)&&f(n.TEXTURE_2D)}t.unbindTexture()}else{let pe=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(pe=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(pe,J.__webglTexture),oe(pe,b),b.mipmaps&&b.mipmaps.length>0)for(let Se=0;Se<b.mipmaps.length;Se++)se(z.__webglFramebuffer[Se],N,b,n.COLOR_ATTACHMENT0,pe,Se);else se(z.__webglFramebuffer,N,b,n.COLOR_ATTACHMENT0,pe,0);g(b)&&f(pe),t.unbindTexture()}N.depthBuffer&&De(N)}function it(N){const b=N.textures;for(let z=0,J=b.length;z<J;z++){const Z=b[z];if(g(Z)){const te=N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Le=i.get(Z).__webglTexture;t.bindTexture(te,Le),f(te),t.unbindTexture()}}}const P=[],le=[];function ie(N){if(N.samples>0){if($(N)===!1){const b=N.textures,z=N.width,J=N.height;let Z=n.COLOR_BUFFER_BIT;const te=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Le=i.get(N),pe=b.length>1;if(pe)for(let Se=0;Se<b.length;Se++)t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Se=0;Se<b.length;Se++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(Z|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(Z|=n.STENCIL_BUFFER_BIT)),pe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Se]);const We=i.get(b[Se]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,We,0)}n.blitFramebuffer(0,0,z,J,0,0,z,J,Z,n.NEAREST),l===!0&&(P.length=0,le.length=0,P.push(n.COLOR_ATTACHMENT0+Se),N.depthBuffer&&N.resolveDepthBuffer===!1&&(P.push(te),le.push(te),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,le)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),pe)for(let Se=0;Se<b.length;Se++){t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Se]);const We=i.get(b[Se]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,We,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const b=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[b])}}}function ge(N){return Math.min(r.maxSamples,N.samples)}function $(N){const b=i.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function Ue(N){const b=o.render.frame;u.get(N)!==b&&(u.set(N,b),N.update())}function me(N,b){const z=N.colorSpace,J=N.format,Z=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||z!==tr&&z!==Fi&&(rt.getTransfer(z)===ft?(J!==dn||Z!==Ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),b}function we(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=L,this.setTexture2D=G,this.setTexture2DArray=Y,this.setTexture3D=W,this.setTextureCube=ne,this.rebindTextures=He,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=se,this.useMultisampledRTT=$}function gM(n,e){function t(i,r=Fi){let s;const o=rt.getTransfer(r);if(i===Ei)return n.UNSIGNED_BYTE;if(i===Id)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Nd)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Wm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Hm)return n.BYTE;if(i===Gm)return n.SHORT;if(i===Do)return n.UNSIGNED_SHORT;if(i===Pd)return n.INT;if(i===Ji)return n.UNSIGNED_INT;if(i===Sn)return n.FLOAT;if(i===Ho)return n.HALF_FLOAT;if(i===jm)return n.ALPHA;if(i===Xm)return n.RGB;if(i===dn)return n.RGBA;if(i===Ym)return n.LUMINANCE;if(i===$m)return n.LUMINANCE_ALPHA;if(i===ps)return n.DEPTH_COMPONENT;if(i===ws)return n.DEPTH_STENCIL;if(i===Ld)return n.RED;if(i===Rl)return n.RED_INTEGER;if(i===qm)return n.RG;if(i===Dd)return n.RG_INTEGER;if(i===Ud)return n.RGBA_INTEGER;if(i===Ia||i===Na||i===La||i===Da)if(o===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ia)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ia)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Uu||i===ku||i===Ou||i===Fu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Uu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ku)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ou)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Fu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Bu||i===zu||i===Vu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Bu||i===zu)return o===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Vu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Hu||i===Gu||i===Wu||i===ju||i===Xu||i===Yu||i===$u||i===qu||i===Zu||i===Ku||i===Ju||i===Qu||i===ed||i===td)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Hu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Gu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Wu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Xu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Yu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===$u)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Zu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ku)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ed)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===td)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ua||i===nd||i===id)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ua)return o===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===nd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===id)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Zm||i===rd||i===sd||i===od)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Ua)return s.COMPRESSED_RED_RGTC1_EXT;if(i===rd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===sd)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===od)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ms?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class xM extends $t{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class go extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dI={type:"move"};class vf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new go,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 go,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new go,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const y of e.hand.values()){const g=t.getJointPose(y,i),f=this._getHandJoint(c,y);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&h>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(dI)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new go;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hI=`
3874
+ }`;function iI(n,e,t){let i=new Nl;const r=new K,s=new K,o=new ct,a=new sg({depthPacking:YS}),l=new og,c={},u=t.maxTextureSize,d={[Zi]:fn,[fn]:Zi,[vi]:vi},h=new ci({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:tI,fragmentShader:nI}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const m=new $e;m.setAttribute("position",new ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new kt(m,h),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zm;let f=this.type;this.render=function(w,A,b){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||w.length===0)return;const E=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),V=n.state;V.setBlending(Wi),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const F=f!==gi&&this.type===gi,G=f===gi&&this.type!==gi;for(let X=0,W=w.length;X<W;X++){const ne=w[X],D=ne.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;r.copy(D.mapSize);const Y=D.getFrameExtents();if(r.multiply(Y),s.copy(D.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Y.x),r.x=s.x*Y.x,D.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Y.y),r.y=s.y*Y.y,D.mapSize.y=s.y)),D.map===null||F===!0||G===!0){const oe=this.type!==gi?{minFilter:Gt,magFilter:Gt}:{};D.map!==null&&D.map.dispose(),D.map=new li(r.x,r.y,oe),D.map.texture.name=ne.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const Q=D.getViewportCount();for(let oe=0;oe<Q;oe++){const Re=D.getViewport(oe);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),V.viewport(o),D.updateMatrices(ne,oe),i=D.getFrustum(),_(A,b,D.camera,ne,this.type)}D.isPointLightShadow!==!0&&this.type===gi&&v(D,b),D.needsUpdate=!1}f=this.type,x.needsUpdate=!1,n.setRenderTarget(E,M,L)};function v(w,A){const b=e.update(y);h.defines.VSM_SAMPLES!==w.blurSamples&&(h.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new li(r.x,r.y)),h.uniforms.shadow_pass.value=w.map.texture,h.uniforms.resolution.value=w.mapSize,h.uniforms.radius.value=w.radius,n.setRenderTarget(w.mapPass),n.clear(),n.renderBufferDirect(A,null,b,h,y,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,n.setRenderTarget(w.map),n.clear(),n.renderBufferDirect(A,null,b,p,y,null)}function g(w,A,b,E){let M=null;const L=b.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(L!==void 0)M=L;else if(M=b.isPointLight===!0?l:a,n.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const V=M.uuid,F=A.uuid;let G=c[V];G===void 0&&(G={},c[V]=G);let X=G[F];X===void 0&&(X=M.clone(),G[F]=X,A.addEventListener("dispose",R)),M=X}if(M.visible=A.visible,M.wireframe=A.wireframe,E===gi?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:d[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,b.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const V=n.properties.get(M);V.light=b}return M}function _(w,A,b,E,M){if(w.visible===!1)return;if(w.layers.test(A.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&M===gi)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,w.matrixWorld);const F=e.update(w),G=w.material;if(Array.isArray(G)){const X=F.groups;for(let W=0,ne=X.length;W<ne;W++){const D=X[W],Y=G[D.materialIndex];if(Y&&Y.visible){const Q=g(w,Y,E,M);w.onBeforeShadow(n,w,A,b,F,Q,D),n.renderBufferDirect(b,null,F,Q,w,D),w.onAfterShadow(n,w,A,b,F,Q,D)}}}else if(G.visible){const X=g(w,G,E,M);w.onBeforeShadow(n,w,A,b,F,X,null),n.renderBufferDirect(b,null,F,X,w,null),w.onAfterShadow(n,w,A,b,F,X,null)}}const V=w.children;for(let F=0,G=V.length;F<G;F++)_(V[F],A,b,E,M)}function R(w){w.target.removeEventListener("dispose",R);for(const b in c){const E=c[b],M=w.target.uuid;M in E&&(E[M].dispose(),delete E[M])}}}function rI(n){function e(){let U=!1;const ce=new ct;let q=null;const ee=new ct(0,0,0,0);return{setMask:function(he){q!==he&&!U&&(n.colorMask(he,he,he,he),q=he)},setLocked:function(he){U=he},setClear:function(he,Oe,Qe,It,jt){jt===!0&&(he*=It,Oe*=It,Qe*=It),ce.set(he,Oe,Qe,It),ee.equals(ce)===!1&&(n.clearColor(he,Oe,Qe,It),ee.copy(ce))},reset:function(){U=!1,q=null,ee.set(-1,0,0,0)}}}function t(){let U=!1,ce=null,q=null,ee=null;return{setTest:function(he){he?xe(n.DEPTH_TEST):de(n.DEPTH_TEST)},setMask:function(he){ce!==he&&!U&&(n.depthMask(he),ce=he)},setFunc:function(he){if(q!==he){switch(he){case TS:n.depthFunc(n.NEVER);break;case AS:n.depthFunc(n.ALWAYS);break;case CS:n.depthFunc(n.LESS);break;case nl:n.depthFunc(n.LEQUAL);break;case RS:n.depthFunc(n.EQUAL);break;case PS:n.depthFunc(n.GEQUAL);break;case IS:n.depthFunc(n.GREATER);break;case NS:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}q=he}},setLocked:function(he){U=he},setClear:function(he){ee!==he&&(n.clearDepth(he),ee=he)},reset:function(){U=!1,ce=null,q=null,ee=null}}}function i(){let U=!1,ce=null,q=null,ee=null,he=null,Oe=null,Qe=null,It=null,jt=null;return{setTest:function(st){U||(st?xe(n.STENCIL_TEST):de(n.STENCIL_TEST))},setMask:function(st){ce!==st&&!U&&(n.stencilMask(st),ce=st)},setFunc:function(st,Ci,hi){(q!==st||ee!==Ci||he!==hi)&&(n.stencilFunc(st,Ci,hi),q=st,ee=Ci,he=hi)},setOp:function(st,Ci,hi){(Oe!==st||Qe!==Ci||It!==hi)&&(n.stencilOp(st,Ci,hi),Oe=st,Qe=Ci,It=hi)},setLocked:function(st){U=st},setClear:function(st){jt!==st&&(n.clearStencil(st),jt=st)},reset:function(){U=!1,ce=null,q=null,ee=null,he=null,Oe=null,Qe=null,It=null,jt=null}}}const r=new e,s=new t,o=new i,a=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],p=null,m=!1,y=null,x=null,f=null,v=null,g=null,_=null,R=null,w=new ye(0,0,0),A=0,b=!1,E=null,M=null,L=null,V=null,F=null;const G=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,W=0;const ne=n.getParameter(n.VERSION);ne.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(ne)[1]),X=W>=1):ne.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),X=W>=2);let D=null,Y={};const Q=n.getParameter(n.SCISSOR_BOX),oe=n.getParameter(n.VIEWPORT),Re=new ct().fromArray(Q),Ke=new ct().fromArray(oe);function j(U,ce,q,ee){const he=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(U,Oe),n.texParameteri(U,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(U,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Qe=0;Qe<q;Qe++)U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY?n.texImage3D(ce,0,n.RGBA,1,1,ee,0,n.RGBA,n.UNSIGNED_BYTE,he):n.texImage2D(ce+Qe,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,he);return Oe}const se={};se[n.TEXTURE_2D]=j(n.TEXTURE_2D,n.TEXTURE_2D,1),se[n.TEXTURE_CUBE_MAP]=j(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),se[n.TEXTURE_2D_ARRAY]=j(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),se[n.TEXTURE_3D]=j(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),xe(n.DEPTH_TEST),s.setFunc(nl),ge(!1),$(Ap),xe(n.CULL_FACE),le(Wi);function xe(U){c[U]!==!0&&(n.enable(U),c[U]=!0)}function de(U){c[U]!==!1&&(n.disable(U),c[U]=!1)}function De(U,ce){return u[U]!==ce?(n.bindFramebuffer(U,ce),u[U]=ce,U===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ce),U===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ce),!0):!1}function He(U,ce){let q=h,ee=!1;if(U){q=d.get(ce),q===void 0&&(q=[],d.set(ce,q));const he=U.textures;if(q.length!==he.length||q[0]!==n.COLOR_ATTACHMENT0){for(let Oe=0,Qe=he.length;Oe<Qe;Oe++)q[Oe]=n.COLOR_ATTACHMENT0+Oe;q.length=he.length,ee=!0}}else q[0]!==n.BACK&&(q[0]=n.BACK,ee=!0);ee&&n.drawBuffers(q)}function Be(U){return p!==U?(n.useProgram(U),p=U,!0):!1}const it={[vr]:n.FUNC_ADD,[cS]:n.FUNC_SUBTRACT,[uS]:n.FUNC_REVERSE_SUBTRACT};it[dS]=n.MIN,it[hS]=n.MAX;const P={[fS]:n.ZERO,[pS]:n.ONE,[mS]:n.SRC_COLOR,[Lu]:n.SRC_ALPHA,[SS]:n.SRC_ALPHA_SATURATE,[yS]:n.DST_COLOR,[xS]:n.DST_ALPHA,[gS]:n.ONE_MINUS_SRC_COLOR,[Du]:n.ONE_MINUS_SRC_ALPHA,[_S]:n.ONE_MINUS_DST_COLOR,[vS]:n.ONE_MINUS_DST_ALPHA,[MS]:n.CONSTANT_COLOR,[wS]:n.ONE_MINUS_CONSTANT_COLOR,[bS]:n.CONSTANT_ALPHA,[ES]:n.ONE_MINUS_CONSTANT_ALPHA};function le(U,ce,q,ee,he,Oe,Qe,It,jt,st){if(U===Wi){m===!0&&(de(n.BLEND),m=!1);return}if(m===!1&&(xe(n.BLEND),m=!0),U!==lS){if(U!==y||st!==b){if((x!==vr||g!==vr)&&(n.blendEquation(n.FUNC_ADD),x=vr,g=vr),st)switch(U){case fs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Cp:n.blendFunc(n.ONE,n.ONE);break;case Rp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pp:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case fs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Cp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Rp:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pp:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}f=null,v=null,_=null,R=null,w.set(0,0,0),A=0,y=U,b=st}return}he=he||ce,Oe=Oe||q,Qe=Qe||ee,(ce!==x||he!==g)&&(n.blendEquationSeparate(it[ce],it[he]),x=ce,g=he),(q!==f||ee!==v||Oe!==_||Qe!==R)&&(n.blendFuncSeparate(P[q],P[ee],P[Oe],P[Qe]),f=q,v=ee,_=Oe,R=Qe),(It.equals(w)===!1||jt!==A)&&(n.blendColor(It.r,It.g,It.b,jt),w.copy(It),A=jt),y=U,b=!1}function ie(U,ce){U.side===vi?de(n.CULL_FACE):xe(n.CULL_FACE);let q=U.side===fn;ce&&(q=!q),ge(q),U.blending===fs&&U.transparent===!1?le(Wi):le(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),s.setFunc(U.depthFunc),s.setTest(U.depthTest),s.setMask(U.depthWrite),r.setMask(U.colorWrite);const ee=U.stencilWrite;o.setTest(ee),ee&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),me(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?xe(n.SAMPLE_ALPHA_TO_COVERAGE):de(n.SAMPLE_ALPHA_TO_COVERAGE)}function ge(U){E!==U&&(U?n.frontFace(n.CW):n.frontFace(n.CCW),E=U)}function $(U){U!==sS?(xe(n.CULL_FACE),U!==M&&(U===Ap?n.cullFace(n.BACK):U===oS?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):de(n.CULL_FACE),M=U}function Ue(U){U!==L&&(X&&n.lineWidth(U),L=U)}function me(U,ce,q){U?(xe(n.POLYGON_OFFSET_FILL),(V!==ce||F!==q)&&(n.polygonOffset(ce,q),V=ce,F=q)):de(n.POLYGON_OFFSET_FILL)}function we(U){U?xe(n.SCISSOR_TEST):de(n.SCISSOR_TEST)}function N(U){U===void 0&&(U=n.TEXTURE0+G-1),D!==U&&(n.activeTexture(U),D=U)}function T(U,ce,q){q===void 0&&(D===null?q=n.TEXTURE0+G-1:q=D);let ee=Y[q];ee===void 0&&(ee={type:void 0,texture:void 0},Y[q]=ee),(ee.type!==U||ee.texture!==ce)&&(D!==q&&(n.activeTexture(q),D=q),n.bindTexture(U,ce||se[U]),ee.type=U,ee.texture=ce)}function z(){const U=Y[D];U!==void 0&&U.type!==void 0&&(n.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function J(){try{n.compressedTexImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Z(){try{n.compressedTexImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function te(){try{n.texSubImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Le(){try{n.texSubImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function pe(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Se(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function We(){try{n.texStorage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ae(){try{n.texStorage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function _e(){try{n.texImage2D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Je(){try{n.texImage3D.apply(n,arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ve(U){Re.equals(U)===!1&&(n.scissor(U.x,U.y,U.z,U.w),Re.copy(U))}function be(U){Ke.equals(U)===!1&&(n.viewport(U.x,U.y,U.z,U.w),Ke.copy(U))}function Ge(U,ce){let q=l.get(ce);q===void 0&&(q=new WeakMap,l.set(ce,q));let ee=q.get(U);ee===void 0&&(ee=n.getUniformBlockIndex(ce,U.name),q.set(U,ee))}function qe(U,ce){const ee=l.get(ce).get(U);a.get(ce)!==ee&&(n.uniformBlockBinding(ce,ee,U.__bindingPointIndex),a.set(ce,ee))}function vt(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),c={},D=null,Y={},u={},d=new WeakMap,h=[],p=null,m=!1,y=null,x=null,f=null,v=null,g=null,_=null,R=null,w=new ye(0,0,0),A=0,b=!1,E=null,M=null,L=null,V=null,F=null,Re.set(0,0,n.canvas.width,n.canvas.height),Ke.set(0,0,n.canvas.width,n.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:xe,disable:de,bindFramebuffer:De,drawBuffers:He,useProgram:Be,setBlending:le,setMaterial:ie,setFlipSided:ge,setCullFace:$,setLineWidth:Ue,setPolygonOffset:me,setScissorTest:we,activeTexture:N,bindTexture:T,unbindTexture:z,compressedTexImage2D:J,compressedTexImage3D:Z,texImage2D:_e,texImage3D:Je,updateUBOMapping:Ge,uniformBlockBinding:qe,texStorage2D:We,texStorage3D:ae,texSubImage2D:te,texSubImage3D:Le,compressedTexSubImage2D:pe,compressedTexSubImage3D:Se,scissor:Ve,viewport:be,reset:vt}}function sI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function oI(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function aI(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function kp(n,e,t,i){const r=lI(i);switch(t){case jm:return n*e;case Ym:return n*e;case $m:return n*e*2;case Ld:return n*e/r.components*r.byteLength;case Rl:return n*e/r.components*r.byteLength;case qm:return n*e*2/r.components*r.byteLength;case Dd:return n*e*2/r.components*r.byteLength;case Xm:return n*e*3/r.components*r.byteLength;case dn:return n*e*4/r.components*r.byteLength;case Ud:return n*e*4/r.components*r.byteLength;case Ia:case Na:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case La:case Da:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ku:case Fu:return Math.max(n,16)*Math.max(e,8)/4;case Uu:case Ou:return Math.max(n,8)*Math.max(e,8)/2;case Bu:case zu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Vu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Hu:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Gu:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Wu:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case ju:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Xu:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Yu:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case $u:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case qu:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Zu:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Ku:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ju:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Qu:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ed:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case td:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ua:case nd:case id:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Zm:case rd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case sd:case od:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function lI(n){switch(n){case Ei:case Hm:return{byteLength:1,components:1};case Do:case Gm:case Ho:return{byteLength:2,components:1};case Id:case Nd:return{byteLength:2,components:4};case Ji:case Pd:case Sn:return{byteLength:4,components:1};case Wm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const cI={contain:sI,cover:oI,fill:aI,getByteLength:kp};function uI(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new K,u=new WeakMap;let d;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(N,T){return p?new OffscreenCanvas(N,T):pl("canvas")}function y(N,T,z){let J=1;const Z=we(N);if((Z.width>z||Z.height>z)&&(J=z/Math.max(Z.width,Z.height)),J<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const te=Math.floor(J*Z.width),Le=Math.floor(J*Z.height);d===void 0&&(d=m(te,Le));const pe=T?m(te,Le):d;return pe.width=te,pe.height=Le,pe.getContext("2d").drawImage(N,0,0,te,Le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+te+"x"+Le+")."),pe}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),N;return N}function x(N){return N.generateMipmaps&&N.minFilter!==Gt&&N.minFilter!==Ut}function f(N){n.generateMipmap(N)}function v(N,T,z,J,Z=!1){if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let te=T;if(T===n.RED&&(z===n.FLOAT&&(te=n.R32F),z===n.HALF_FLOAT&&(te=n.R16F),z===n.UNSIGNED_BYTE&&(te=n.R8)),T===n.RED_INTEGER&&(z===n.UNSIGNED_BYTE&&(te=n.R8UI),z===n.UNSIGNED_SHORT&&(te=n.R16UI),z===n.UNSIGNED_INT&&(te=n.R32UI),z===n.BYTE&&(te=n.R8I),z===n.SHORT&&(te=n.R16I),z===n.INT&&(te=n.R32I)),T===n.RG&&(z===n.FLOAT&&(te=n.RG32F),z===n.HALF_FLOAT&&(te=n.RG16F),z===n.UNSIGNED_BYTE&&(te=n.RG8)),T===n.RG_INTEGER&&(z===n.UNSIGNED_BYTE&&(te=n.RG8UI),z===n.UNSIGNED_SHORT&&(te=n.RG16UI),z===n.UNSIGNED_INT&&(te=n.RG32UI),z===n.BYTE&&(te=n.RG8I),z===n.SHORT&&(te=n.RG16I),z===n.INT&&(te=n.RG32I)),T===n.RGB&&z===n.UNSIGNED_INT_5_9_9_9_REV&&(te=n.RGB9_E5),T===n.RGBA){const Le=Z?cl:rt.getTransfer(J);z===n.FLOAT&&(te=n.RGBA32F),z===n.HALF_FLOAT&&(te=n.RGBA16F),z===n.UNSIGNED_BYTE&&(te=Le===ft?n.SRGB8_ALPHA8:n.RGBA8),z===n.UNSIGNED_SHORT_4_4_4_4&&(te=n.RGBA4),z===n.UNSIGNED_SHORT_5_5_5_1&&(te=n.RGB5_A1)}return(te===n.R16F||te===n.R32F||te===n.RG16F||te===n.RG32F||te===n.RGBA16F||te===n.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function g(N,T){let z;return N?T===null||T===Ji||T===Ms?z=n.DEPTH24_STENCIL8:T===Sn?z=n.DEPTH32F_STENCIL8:T===Do&&(z=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===Ji||T===Ms?z=n.DEPTH_COMPONENT24:T===Sn?z=n.DEPTH_COMPONENT32F:T===Do&&(z=n.DEPTH_COMPONENT16),z}function _(N,T){return x(N)===!0||N.isFramebufferTexture&&N.minFilter!==Gt&&N.minFilter!==Ut?Math.log2(Math.max(T.width,T.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?T.mipmaps.length:1}function R(N){const T=N.target;T.removeEventListener("dispose",R),A(T),T.isVideoTexture&&u.delete(T)}function w(N){const T=N.target;T.removeEventListener("dispose",w),E(T)}function A(N){const T=i.get(N);if(T.__webglInit===void 0)return;const z=N.source,J=h.get(z);if(J){const Z=J[T.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&b(N),Object.keys(J).length===0&&h.delete(z)}i.remove(N)}function b(N){const T=i.get(N);n.deleteTexture(T.__webglTexture);const z=N.source,J=h.get(z);delete J[T.__cacheKey],o.memory.textures--}function E(N){const T=i.get(N);if(N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(T.__webglFramebuffer[J]))for(let Z=0;Z<T.__webglFramebuffer[J].length;Z++)n.deleteFramebuffer(T.__webglFramebuffer[J][Z]);else n.deleteFramebuffer(T.__webglFramebuffer[J]);T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer[J])}else{if(Array.isArray(T.__webglFramebuffer))for(let J=0;J<T.__webglFramebuffer.length;J++)n.deleteFramebuffer(T.__webglFramebuffer[J]);else n.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&n.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&n.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let J=0;J<T.__webglColorRenderbuffer.length;J++)T.__webglColorRenderbuffer[J]&&n.deleteRenderbuffer(T.__webglColorRenderbuffer[J]);T.__webglDepthRenderbuffer&&n.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const z=N.textures;for(let J=0,Z=z.length;J<Z;J++){const te=i.get(z[J]);te.__webglTexture&&(n.deleteTexture(te.__webglTexture),o.memory.textures--),i.remove(z[J])}i.remove(N)}let M=0;function L(){M=0}function V(){const N=M;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),M+=1,N}function F(N){const T=[];return T.push(N.wrapS),T.push(N.wrapT),T.push(N.wrapR||0),T.push(N.magFilter),T.push(N.minFilter),T.push(N.anisotropy),T.push(N.internalFormat),T.push(N.format),T.push(N.type),T.push(N.generateMipmaps),T.push(N.premultiplyAlpha),T.push(N.flipY),T.push(N.unpackAlignment),T.push(N.colorSpace),T.join()}function G(N,T){const z=i.get(N);if(N.isVideoTexture&&Ue(N),N.isRenderTargetTexture===!1&&N.version>0&&z.__version!==N.version){const J=N.image;if(J===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ke(z,N,T);return}}t.bindTexture(n.TEXTURE_2D,z.__webglTexture,n.TEXTURE0+T)}function X(N,T){const z=i.get(N);if(N.version>0&&z.__version!==N.version){Ke(z,N,T);return}t.bindTexture(n.TEXTURE_2D_ARRAY,z.__webglTexture,n.TEXTURE0+T)}function W(N,T){const z=i.get(N);if(N.version>0&&z.__version!==N.version){Ke(z,N,T);return}t.bindTexture(n.TEXTURE_3D,z.__webglTexture,n.TEXTURE0+T)}function ne(N,T){const z=i.get(N);if(N.version>0&&z.__version!==N.version){j(z,N,T);return}t.bindTexture(n.TEXTURE_CUBE_MAP,z.__webglTexture,n.TEXTURE0+T)}const D={[sl]:n.REPEAT,[Xn]:n.CLAMP_TO_EDGE,[ol]:n.MIRRORED_REPEAT},Y={[Gt]:n.NEAREST,[Vm]:n.NEAREST_MIPMAP_NEAREST,[fo]:n.NEAREST_MIPMAP_LINEAR,[Ut]:n.LINEAR,[Pa]:n.LINEAR_MIPMAP_NEAREST,[yi]:n.LINEAR_MIPMAP_LINEAR},Q={[qS]:n.NEVER,[tM]:n.ALWAYS,[ZS]:n.LESS,[Jm]:n.LEQUAL,[KS]:n.EQUAL,[eM]:n.GEQUAL,[JS]:n.GREATER,[QS]:n.NOTEQUAL};function oe(N,T){if(T.type===Sn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===Ut||T.magFilter===Pa||T.magFilter===fo||T.magFilter===yi||T.minFilter===Ut||T.minFilter===Pa||T.minFilter===fo||T.minFilter===yi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(N,n.TEXTURE_WRAP_S,D[T.wrapS]),n.texParameteri(N,n.TEXTURE_WRAP_T,D[T.wrapT]),(N===n.TEXTURE_3D||N===n.TEXTURE_2D_ARRAY)&&n.texParameteri(N,n.TEXTURE_WRAP_R,D[T.wrapR]),n.texParameteri(N,n.TEXTURE_MAG_FILTER,Y[T.magFilter]),n.texParameteri(N,n.TEXTURE_MIN_FILTER,Y[T.minFilter]),T.compareFunction&&(n.texParameteri(N,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(N,n.TEXTURE_COMPARE_FUNC,Q[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Gt||T.minFilter!==fo&&T.minFilter!==yi||T.type===Sn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||i.get(T).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");n.texParameterf(N,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,r.getMaxAnisotropy())),i.get(T).__currentAnisotropy=T.anisotropy}}}function Re(N,T){let z=!1;N.__webglInit===void 0&&(N.__webglInit=!0,T.addEventListener("dispose",R));const J=T.source;let Z=h.get(J);Z===void 0&&(Z={},h.set(J,Z));const te=F(T);if(te!==N.__cacheKey){Z[te]===void 0&&(Z[te]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,z=!0),Z[te].usedTimes++;const Le=Z[N.__cacheKey];Le!==void 0&&(Z[N.__cacheKey].usedTimes--,Le.usedTimes===0&&b(T)),N.__cacheKey=te,N.__webglTexture=Z[te].texture}return z}function Ke(N,T,z){let J=n.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(J=n.TEXTURE_2D_ARRAY),T.isData3DTexture&&(J=n.TEXTURE_3D);const Z=Re(N,T),te=T.source;t.bindTexture(J,N.__webglTexture,n.TEXTURE0+z);const Le=i.get(te);if(te.version!==Le.__version||Z===!0){t.activeTexture(n.TEXTURE0+z);const pe=rt.getPrimaries(rt.workingColorSpace),Se=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),We=T.colorSpace===Fi||pe===Se?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let ae=y(T.image,!1,r.maxTextureSize);ae=me(T,ae);const _e=s.convert(T.format,T.colorSpace),Je=s.convert(T.type);let Ve=v(T.internalFormat,_e,Je,T.colorSpace,T.isVideoTexture);oe(J,T);let be;const Ge=T.mipmaps,qe=T.isVideoTexture!==!0,vt=Le.__version===void 0||Z===!0,U=te.dataReady,ce=_(T,ae);if(T.isDepthTexture)Ve=g(T.format===ws,T.type),vt&&(qe?t.texStorage2D(n.TEXTURE_2D,1,Ve,ae.width,ae.height):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,_e,Je,null));else if(T.isDataTexture)if(Ge.length>0){qe&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,Je,be.data):t.texImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,_e,Je,be.data);T.generateMipmaps=!1}else qe?(vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height),U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ae.width,ae.height,_e,Je,ae.data)):t.texImage2D(n.TEXTURE_2D,0,Ve,ae.width,ae.height,0,_e,Je,ae.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){qe&&vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,Ge[0].width,Ge[0].height,ae.depth);for(let q=0,ee=Ge.length;q<ee;q++)if(be=Ge[q],T.format!==dn)if(_e!==null)if(qe){if(U)if(T.layerUpdates.size>0){const he=kp(be.width,be.height,T.format,T.type);for(const Oe of T.layerUpdates){const Qe=be.data.subarray(Oe*he/be.data.BYTES_PER_ELEMENT,(Oe+1)*he/be.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,Oe,be.width,be.height,1,_e,Qe,0,0)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,be.width,be.height,ae.depth,_e,be.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,Ve,be.width,be.height,ae.depth,0,be.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else qe?U&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,be.width,be.height,ae.depth,_e,Je,be.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,Ve,be.width,be.height,ae.depth,0,_e,Je,be.data)}else{qe&&vt&&t.texStorage2D(n.TEXTURE_2D,ce,Ve,Ge[0].width,Ge[0].height);for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],T.format!==dn?_e!==null?qe?U&&t.compressedTexSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,be.data):t.compressedTexImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,be.width,be.height,_e,Je,be.data):t.texImage2D(n.TEXTURE_2D,q,Ve,be.width,be.height,0,_e,Je,be.data)}else if(T.isDataArrayTexture)if(qe){if(vt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,ce,Ve,ae.width,ae.height,ae.depth),U)if(T.layerUpdates.size>0){const q=kp(ae.width,ae.height,T.format,T.type);for(const ee of T.layerUpdates){const he=ae.data.subarray(ee*q/ae.data.BYTES_PER_ELEMENT,(ee+1)*q/ae.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ee,ae.width,ae.height,1,_e,Je,he)}T.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,_e,Je,ae.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ve,ae.width,ae.height,ae.depth,0,_e,Je,ae.data);else if(T.isData3DTexture)qe?(vt&&t.texStorage3D(n.TEXTURE_3D,ce,Ve,ae.width,ae.height,ae.depth),U&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,_e,Je,ae.data)):t.texImage3D(n.TEXTURE_3D,0,Ve,ae.width,ae.height,ae.depth,0,_e,Je,ae.data);else if(T.isFramebufferTexture){if(vt)if(qe)t.texStorage2D(n.TEXTURE_2D,ce,Ve,ae.width,ae.height);else{let q=ae.width,ee=ae.height;for(let he=0;he<ce;he++)t.texImage2D(n.TEXTURE_2D,he,Ve,q,ee,0,_e,Je,null),q>>=1,ee>>=1}}else if(Ge.length>0){if(qe&&vt){const q=we(Ge[0]);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}for(let q=0,ee=Ge.length;q<ee;q++)be=Ge[q],qe?U&&t.texSubImage2D(n.TEXTURE_2D,q,0,0,_e,Je,be):t.texImage2D(n.TEXTURE_2D,q,Ve,_e,Je,be);T.generateMipmaps=!1}else if(qe){if(vt){const q=we(ae);t.texStorage2D(n.TEXTURE_2D,ce,Ve,q.width,q.height)}U&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,_e,Je,ae)}else t.texImage2D(n.TEXTURE_2D,0,Ve,_e,Je,ae);x(T)&&f(J),Le.__version=te.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function j(N,T,z){if(T.image.length!==6)return;const J=Re(N,T),Z=T.source;t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+z);const te=i.get(Z);if(Z.version!==te.__version||J===!0){t.activeTexture(n.TEXTURE0+z);const Le=rt.getPrimaries(rt.workingColorSpace),pe=T.colorSpace===Fi?null:rt.getPrimaries(T.colorSpace),Se=T.colorSpace===Fi||Le===pe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,T.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,T.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const We=T.isCompressedTexture||T.image[0].isCompressedTexture,ae=T.image[0]&&T.image[0].isDataTexture,_e=[];for(let ee=0;ee<6;ee++)!We&&!ae?_e[ee]=y(T.image[ee],!0,r.maxCubemapSize):_e[ee]=ae?T.image[ee].image:T.image[ee],_e[ee]=me(T,_e[ee]);const Je=_e[0],Ve=s.convert(T.format,T.colorSpace),be=s.convert(T.type),Ge=v(T.internalFormat,Ve,be,T.colorSpace),qe=T.isVideoTexture!==!0,vt=te.__version===void 0||J===!0,U=Z.dataReady;let ce=_(T,Je);oe(n.TEXTURE_CUBE_MAP,T);let q;if(We){qe&&vt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,Je.width,Je.height);for(let ee=0;ee<6;ee++){q=_e[ee].mipmaps;for(let he=0;he<q.length;he++){const Oe=q[he];T.format!==dn?Ve!==null?qe?U&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,0,0,Oe.width,Oe.height,Ve,Oe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,Ge,Oe.width,Oe.height,0,Oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,0,0,Oe.width,Oe.height,Ve,be,Oe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he,Ge,Oe.width,Oe.height,0,Ve,be,Oe.data)}}}else{if(q=T.mipmaps,qe&&vt){q.length>0&&ce++;const ee=we(_e[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ce,Ge,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(ae){qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,_e[ee].width,_e[ee].height,Ve,be,_e[ee].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Ge,_e[ee].width,_e[ee].height,0,Ve,be,_e[ee].data);for(let he=0;he<q.length;he++){const Qe=q[he].image[ee].image;qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,0,0,Qe.width,Qe.height,Ve,be,Qe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,Ge,Qe.width,Qe.height,0,Ve,be,Qe.data)}}else{qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Ve,be,_e[ee]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Ge,Ve,be,_e[ee]);for(let he=0;he<q.length;he++){const Oe=q[he];qe?U&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,0,0,Ve,be,Oe.image[ee]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ee,he+1,Ge,Ve,be,Oe.image[ee])}}}x(T)&&f(n.TEXTURE_CUBE_MAP),te.__version=Z.version,T.onUpdate&&T.onUpdate(T)}N.__version=T.version}function se(N,T,z,J,Z,te){const Le=s.convert(z.format,z.colorSpace),pe=s.convert(z.type),Se=v(z.internalFormat,Le,pe,z.colorSpace);if(!i.get(T).__hasExternalTextures){const ae=Math.max(1,T.width>>te),_e=Math.max(1,T.height>>te);Z===n.TEXTURE_3D||Z===n.TEXTURE_2D_ARRAY?t.texImage3D(Z,te,Se,ae,_e,T.depth,0,Le,pe,null):t.texImage2D(Z,te,Se,ae,_e,0,Le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,N),$(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,J,Z,i.get(z).__webglTexture,0,ge(T)):(Z===n.TEXTURE_2D||Z>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,J,Z,i.get(z).__webglTexture,te),t.bindFramebuffer(n.FRAMEBUFFER,null)}function xe(N,T,z){if(n.bindRenderbuffer(n.RENDERBUFFER,N),T.depthBuffer){const J=T.depthTexture,Z=J&&J.isDepthTexture?J.type:null,te=g(T.stencilBuffer,Z),Le=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=ge(T);$(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,te,T.width,T.height):z?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,te,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,te,T.width,T.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Le,n.RENDERBUFFER,N)}else{const J=T.textures;for(let Z=0;Z<J.length;Z++){const te=J[Z],Le=s.convert(te.format,te.colorSpace),pe=s.convert(te.type),Se=v(te.internalFormat,Le,pe,te.colorSpace),We=ge(T);z&&$(T)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,We,Se,T.width,T.height):$(T)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,We,Se,T.width,T.height):n.renderbufferStorage(n.RENDERBUFFER,Se,T.width,T.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function de(N,T){if(T&&T.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,N),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(T.depthTexture).__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),G(T.depthTexture,0);const J=i.get(T.depthTexture).__webglTexture,Z=ge(T);if(T.depthTexture.format===ps)$(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,J,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,J,0);else if(T.depthTexture.format===ws)$(T)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,J,0,Z):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,J,0);else throw new Error("Unknown depthTexture format")}function De(N){const T=i.get(N),z=N.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==N.depthTexture){const J=N.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),J){const Z=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,J.removeEventListener("dispose",Z)};J.addEventListener("dispose",Z),T.__depthDisposeCallback=Z}T.__boundDepthTexture=J}if(N.depthTexture&&!T.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");de(T.__webglFramebuffer,N)}else if(z){T.__webglDepthbuffer=[];for(let J=0;J<6;J++)if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer[J]),T.__webglDepthbuffer[J]===void 0)T.__webglDepthbuffer[J]=n.createRenderbuffer(),xe(T.__webglDepthbuffer[J],N,!1);else{const Z=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,te=T.__webglDepthbuffer[J];n.bindRenderbuffer(n.RENDERBUFFER,te),n.framebufferRenderbuffer(n.FRAMEBUFFER,Z,n.RENDERBUFFER,te)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=n.createRenderbuffer(),xe(T.__webglDepthbuffer,N,!1);else{const J=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Z=T.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,Z),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,Z)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function He(N,T,z){const J=i.get(N);T!==void 0&&se(J.__webglFramebuffer,N,N.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),z!==void 0&&De(N)}function Be(N){const T=N.texture,z=i.get(N),J=i.get(T);N.addEventListener("dispose",w);const Z=N.textures,te=N.isWebGLCubeRenderTarget===!0,Le=Z.length>1;if(Le||(J.__webglTexture===void 0&&(J.__webglTexture=n.createTexture()),J.__version=T.version,o.memory.textures++),te){z.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0){z.__webglFramebuffer[pe]=[];for(let Se=0;Se<T.mipmaps.length;Se++)z.__webglFramebuffer[pe][Se]=n.createFramebuffer()}else z.__webglFramebuffer[pe]=n.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){z.__webglFramebuffer=[];for(let pe=0;pe<T.mipmaps.length;pe++)z.__webglFramebuffer[pe]=n.createFramebuffer()}else z.__webglFramebuffer=n.createFramebuffer();if(Le)for(let pe=0,Se=Z.length;pe<Se;pe++){const We=i.get(Z[pe]);We.__webglTexture===void 0&&(We.__webglTexture=n.createTexture(),o.memory.textures++)}if(N.samples>0&&$(N)===!1){z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let pe=0;pe<Z.length;pe++){const Se=Z[pe];z.__webglColorRenderbuffer[pe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,z.__webglColorRenderbuffer[pe]);const We=s.convert(Se.format,Se.colorSpace),ae=s.convert(Se.type),_e=v(Se.internalFormat,We,ae,Se.colorSpace,N.isXRRenderTarget===!0),Je=ge(N);n.renderbufferStorageMultisample(n.RENDERBUFFER,Je,_e,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+pe,n.RENDERBUFFER,z.__webglColorRenderbuffer[pe])}n.bindRenderbuffer(n.RENDERBUFFER,null),N.depthBuffer&&(z.__webglDepthRenderbuffer=n.createRenderbuffer(),xe(z.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(te){t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture),oe(n.TEXTURE_CUBE_MAP,T);for(let pe=0;pe<6;pe++)if(T.mipmaps&&T.mipmaps.length>0)for(let Se=0;Se<T.mipmaps.length;Se++)se(z.__webglFramebuffer[pe][Se],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Se);else se(z.__webglFramebuffer[pe],N,T,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);x(T)&&f(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Le){for(let pe=0,Se=Z.length;pe<Se;pe++){const We=Z[pe],ae=i.get(We);t.bindTexture(n.TEXTURE_2D,ae.__webglTexture),oe(n.TEXTURE_2D,We),se(z.__webglFramebuffer,N,We,n.COLOR_ATTACHMENT0+pe,n.TEXTURE_2D,0),x(We)&&f(n.TEXTURE_2D)}t.unbindTexture()}else{let pe=n.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(pe=N.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(pe,J.__webglTexture),oe(pe,T),T.mipmaps&&T.mipmaps.length>0)for(let Se=0;Se<T.mipmaps.length;Se++)se(z.__webglFramebuffer[Se],N,T,n.COLOR_ATTACHMENT0,pe,Se);else se(z.__webglFramebuffer,N,T,n.COLOR_ATTACHMENT0,pe,0);x(T)&&f(pe),t.unbindTexture()}N.depthBuffer&&De(N)}function it(N){const T=N.textures;for(let z=0,J=T.length;z<J;z++){const Z=T[z];if(x(Z)){const te=N.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Le=i.get(Z).__webglTexture;t.bindTexture(te,Le),f(te),t.unbindTexture()}}}const P=[],le=[];function ie(N){if(N.samples>0){if($(N)===!1){const T=N.textures,z=N.width,J=N.height;let Z=n.COLOR_BUFFER_BIT;const te=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Le=i.get(N),pe=T.length>1;if(pe)for(let Se=0;Se<T.length;Se++)t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Se=0;Se<T.length;Se++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(Z|=n.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(Z|=n.STENCIL_BUFFER_BIT)),pe){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Se]);const We=i.get(T[Se]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,We,0)}n.blitFramebuffer(0,0,z,J,0,0,z,J,Z,n.NEAREST),l===!0&&(P.length=0,le.length=0,P.push(n.COLOR_ATTACHMENT0+Se),N.depthBuffer&&N.resolveDepthBuffer===!1&&(P.push(te),le.push(te),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,le)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),pe)for(let Se=0;Se<T.length;Se++){t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.RENDERBUFFER,Le.__webglColorRenderbuffer[Se]);const We=i.get(T[Se]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Le.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Se,n.TEXTURE_2D,We,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const T=N.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[T])}}}function ge(N){return Math.min(r.maxSamples,N.samples)}function $(N){const T=i.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function Ue(N){const T=o.render.frame;u.get(N)!==T&&(u.set(N,T),N.update())}function me(N,T){const z=N.colorSpace,J=N.format,Z=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||z!==tr&&z!==Fi&&(rt.getTransfer(z)===ft?(J!==dn||Z!==Ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),T}function we(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=L,this.setTexture2D=G,this.setTexture2DArray=X,this.setTexture3D=W,this.setTextureCube=ne,this.rebindTextures=He,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=se,this.useMultisampledRTT=$}function gM(n,e){function t(i,r=Fi){let s;const o=rt.getTransfer(r);if(i===Ei)return n.UNSIGNED_BYTE;if(i===Id)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Nd)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Wm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Hm)return n.BYTE;if(i===Gm)return n.SHORT;if(i===Do)return n.UNSIGNED_SHORT;if(i===Pd)return n.INT;if(i===Ji)return n.UNSIGNED_INT;if(i===Sn)return n.FLOAT;if(i===Ho)return n.HALF_FLOAT;if(i===jm)return n.ALPHA;if(i===Xm)return n.RGB;if(i===dn)return n.RGBA;if(i===Ym)return n.LUMINANCE;if(i===$m)return n.LUMINANCE_ALPHA;if(i===ps)return n.DEPTH_COMPONENT;if(i===ws)return n.DEPTH_STENCIL;if(i===Ld)return n.RED;if(i===Rl)return n.RED_INTEGER;if(i===qm)return n.RG;if(i===Dd)return n.RG_INTEGER;if(i===Ud)return n.RGBA_INTEGER;if(i===Ia||i===Na||i===La||i===Da)if(o===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ia)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ia)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Na)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===La)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Da)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Uu||i===ku||i===Ou||i===Fu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Uu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ku)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ou)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Fu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Bu||i===zu||i===Vu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Bu||i===zu)return o===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Vu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Hu||i===Gu||i===Wu||i===ju||i===Xu||i===Yu||i===$u||i===qu||i===Zu||i===Ku||i===Ju||i===Qu||i===ed||i===td)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Hu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Gu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Wu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Xu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Yu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===$u)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Zu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ku)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ju)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Qu)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ed)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===td)return o===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ua||i===nd||i===id)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ua)return o===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===nd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===id)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Zm||i===rd||i===sd||i===od)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Ua)return s.COMPRESSED_RED_RGTC1_EXT;if(i===rd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===sd)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===od)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ms?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class xM extends $t{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class go extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dI={type:"move"};class vf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new go,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 go,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new go,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const y of e.hand.values()){const x=t.getJointPose(y,i),f=this._getHandJoint(c,y);x!==null&&(f.matrix.fromArray(x.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=x.radius),f.visible=x!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&h>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(dI)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new go;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hI=`
3875
3875
  void main() {
3876
3876
 
3877
3877
  gl_Position = vec4( position, 1.0 );
@@ -3895,6 +3895,6 @@ void main() {
3895
3895
 
3896
3896
  }
3897
3897
 
3898
- }`;class pI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Ct,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ci({vertexShader:hI,fragmentShader:fI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Wo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class mI extends Ti{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,h=null,p=null,m=null;const y=new pI,g=t.getContextAttributes();let f=null,v=null;const x=[],_=[],R=new K;let M=null;const T=new $t;T.layers.enable(1),T.viewport=new ct;const A=new $t;A.layers.enable(2),A.viewport=new ct;const E=[T,A],w=new xM;w.layers.enable(1),w.layers.enable(2);let L=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let se=x[j];return se===void 0&&(se=new vf,x[j]=se),se.getTargetRaySpace()},this.getControllerGrip=function(j){let se=x[j];return se===void 0&&(se=new vf,x[j]=se),se.getGripSpace()},this.getHand=function(j){let se=x[j];return se===void 0&&(se=new vf,x[j]=se),se.getHandSpace()};function F(j){const se=_.indexOf(j.inputSource);if(se===-1)return;const xe=x[se];xe!==void 0&&(xe.update(j.inputSource,j.frame,c||o),xe.dispatchEvent({type:j.type,data:j.inputSource}))}function G(){r.removeEventListener("select",F),r.removeEventListener("selectstart",F),r.removeEventListener("selectend",F),r.removeEventListener("squeeze",F),r.removeEventListener("squeezestart",F),r.removeEventListener("squeezeend",F),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",Y);for(let j=0;j<x.length;j++){const se=_[j];se!==null&&(_[j]=null,x[j].disconnect(se))}L=null,V=null,y.reset(),e.setRenderTarget(f),p=null,h=null,d=null,r=null,v=null,Ke.stop(),i.isPresenting=!1,e.setPixelRatio(M),e.setSize(R.width,R.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){s=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){a=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(j){c=j},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return d},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(j){if(r=j,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",F),r.addEventListener("selectstart",F),r.addEventListener("selectend",F),r.addEventListener("squeeze",F),r.addEventListener("squeezestart",F),r.addEventListener("squeezeend",F),r.addEventListener("end",G),r.addEventListener("inputsourceschange",Y),g.xrCompatible!==!0&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const se={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),v=new li(p.framebufferWidth,p.framebufferHeight,{format:dn,type:Ei,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let se=null,xe=null,de=null;g.depth&&(de=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=g.stencil?ws:ps,xe=g.stencil?Ms:Ji);const De={colorFormat:t.RGBA8,depthFormat:de,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(De),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),v=new li(h.textureWidth,h.textureHeight,{format:dn,type:Ei,depthTexture:new rg(h.textureWidth,h.textureHeight,xe,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),Ke.setContext(r),Ke.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function Y(j){for(let se=0;se<j.removed.length;se++){const xe=j.removed[se],de=_.indexOf(xe);de>=0&&(_[de]=null,x[de].disconnect(xe))}for(let se=0;se<j.added.length;se++){const xe=j.added[se];let de=_.indexOf(xe);if(de===-1){for(let He=0;He<x.length;He++)if(He>=_.length){_.push(xe),de=He;break}else if(_[He]===null){_[He]=xe,de=He;break}if(de===-1)break}const De=x[de];De&&De.connect(xe)}}const W=new I,ne=new I;function D(j,se,xe){W.setFromMatrixPosition(se.matrixWorld),ne.setFromMatrixPosition(xe.matrixWorld);const de=W.distanceTo(ne),De=se.projectionMatrix.elements,He=xe.projectionMatrix.elements,Be=De[14]/(De[10]-1),it=De[14]/(De[10]+1),P=(De[9]+1)/De[5],le=(De[9]-1)/De[5],ie=(De[8]-1)/De[0],ge=(He[8]+1)/He[0],$=Be*ie,Ue=Be*ge,me=de/(-ie+ge),we=me*-ie;if(se.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(we),j.translateZ(me),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),De[10]===-1)j.projectionMatrix.copy(se.projectionMatrix),j.projectionMatrixInverse.copy(se.projectionMatrixInverse);else{const N=Be+me,b=it+me,z=$-we,J=Ue+(de-we),Z=P*it/b*N,te=le*it/b*N;j.projectionMatrix.makePerspective(z,J,Z,te,N,b),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function X(j,se){se===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(se.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(r===null)return;let se=j.near,xe=j.far;y.texture!==null&&(y.depthNear>0&&(se=y.depthNear),y.depthFar>0&&(xe=y.depthFar)),w.near=A.near=T.near=se,w.far=A.far=T.far=xe,(L!==w.near||V!==w.far)&&(r.updateRenderState({depthNear:w.near,depthFar:w.far}),L=w.near,V=w.far);const de=j.parent,De=w.cameras;X(w,de);for(let He=0;He<De.length;He++)X(De[He],de);De.length===2?D(w,T,A):w.projectionMatrix.copy(T.projectionMatrix),Q(j,w,de)};function Q(j,se,xe){xe===null?j.matrix.copy(se.matrixWorld):(j.matrix.copy(xe.matrixWorld),j.matrix.invert(),j.matrix.multiply(se.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(se.projectionMatrix),j.projectionMatrixInverse.copy(se.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Uo*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return w},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(j){l=j,h!==null&&(h.fixedFoveation=j),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=j)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(w)};let oe=null;function Re(j,se){if(u=se.getViewerPose(c||o),m=se,u!==null){const xe=u.views;p!==null&&(e.setRenderTargetFramebuffer(v,p.framebuffer),e.setRenderTarget(v));let de=!1;xe.length!==w.cameras.length&&(w.cameras.length=0,de=!0);for(let He=0;He<xe.length;He++){const Be=xe[He];let it=null;if(p!==null)it=p.getViewport(Be);else{const le=d.getViewSubImage(h,Be);it=le.viewport,He===0&&(e.setRenderTargetTextures(v,le.colorTexture,h.ignoreDepthValues?void 0:le.depthStencilTexture),e.setRenderTarget(v))}let P=E[He];P===void 0&&(P=new $t,P.layers.enable(He),P.viewport=new ct,E[He]=P),P.matrix.fromArray(Be.transform.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale),P.projectionMatrix.fromArray(Be.projectionMatrix),P.projectionMatrixInverse.copy(P.projectionMatrix).invert(),P.viewport.set(it.x,it.y,it.width,it.height),He===0&&(w.matrix.copy(P.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),de===!0&&w.cameras.push(P)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")){const He=d.getDepthInformation(xe[0]);He&&He.isValid&&He.texture&&y.init(e,He,r.renderState)}}for(let xe=0;xe<x.length;xe++){const de=_[xe],De=x[xe];de!==null&&De!==void 0&&De.update(de,se,c||o)}oe&&oe(j,se),se.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:se}),m=null}const Ke=new dM;Ke.setAnimationLoop(Re),this.setAnimationLoop=function(j){oe=j},this.dispose=function(){}}}const Xr=new On,gI=new ke;function xI(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,aM(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,v,x,_){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(g,f):f.isMeshToonMaterial?(s(g,f),d(g,f)):f.isMeshPhongMaterial?(s(g,f),u(g,f)):f.isMeshStandardMaterial?(s(g,f),h(g,f),f.isMeshPhysicalMaterial&&p(g,f,_)):f.isMeshMatcapMaterial?(s(g,f),m(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),y(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(o(g,f),f.isLineDashedMaterial&&a(g,f)):f.isPointsMaterial?l(g,f,v,x):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===fn&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===fn&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);const v=e.get(f),x=v.envMap,_=v.envMapRotation;x&&(g.envMap.value=x,Xr.copy(_),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Xr.y*=-1,Xr.z*=-1),g.envMapRotation.value.setFromMatrix4(gI.makeRotationFromEuler(Xr)),g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function o(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function a(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,v,x){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*v,g.scale.value=x*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function u(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function d(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function h(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,v){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===fn&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function y(g,f){const v=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function vI(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,x){const _=x.program;i.uniformBlockBinding(v,_)}function c(v,x){let _=r[v.id];_===void 0&&(m(v),_=u(v),r[v.id]=_,v.addEventListener("dispose",g));const R=x.program;i.updateUBOMapping(v,R);const M=e.render.frame;s[v.id]!==M&&(h(v),s[v.id]=M)}function u(v){const x=d();v.__bindingPointIndex=x;const _=n.createBuffer(),R=v.__size,M=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,R,M),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,_),_}function d(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(v){const x=r[v.id],_=v.uniforms,R=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,x);for(let M=0,T=_.length;M<T;M++){const A=Array.isArray(_[M])?_[M]:[_[M]];for(let E=0,w=A.length;E<w;E++){const L=A[E];if(p(L,M,E,R)===!0){const V=L.__offset,F=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let Y=0;Y<F.length;Y++){const W=F[Y],ne=y(W);typeof W=="number"||typeof W=="boolean"?(L.__data[0]=W,n.bufferSubData(n.UNIFORM_BUFFER,V+G,L.__data)):W.isMatrix3?(L.__data[0]=W.elements[0],L.__data[1]=W.elements[1],L.__data[2]=W.elements[2],L.__data[3]=0,L.__data[4]=W.elements[3],L.__data[5]=W.elements[4],L.__data[6]=W.elements[5],L.__data[7]=0,L.__data[8]=W.elements[6],L.__data[9]=W.elements[7],L.__data[10]=W.elements[8],L.__data[11]=0):(W.toArray(L.__data,G),G+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,x,_,R){const M=v.value,T=x+"_"+_;if(R[T]===void 0)return typeof M=="number"||typeof M=="boolean"?R[T]=M:R[T]=M.clone(),!0;{const A=R[T];if(typeof M=="number"||typeof M=="boolean"){if(A!==M)return R[T]=M,!0}else if(A.equals(M)===!1)return A.copy(M),!0}return!1}function m(v){const x=v.uniforms;let _=0;const R=16;for(let T=0,A=x.length;T<A;T++){const E=Array.isArray(x[T])?x[T]:[x[T]];for(let w=0,L=E.length;w<L;w++){const V=E[w],F=Array.isArray(V.value)?V.value:[V.value];for(let G=0,Y=F.length;G<Y;G++){const W=F[G],ne=y(W),D=_%R,X=D%ne.boundary,Q=D+X;_+=X,Q!==0&&R-Q<ne.storage&&(_+=R-Q),V.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=_,_+=ne.storage}}}const M=_%R;return M>0&&(_+=R-M),v.__size=_,v.__cache={},this}function y(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),x}function g(v){const x=v.target;x.removeEventListener("dispose",g);const _=o.indexOf(x.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:f}}class yI{constructor(e={}){const{canvas:t=iM(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,g=null;const f=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Hn,this.toneMapping=ji,this.toneMappingExposure=1;const x=this;let _=!1,R=0,M=0,T=null,A=-1,E=null;const w=new ct,L=new ct;let V=null;const F=new ye(0);let G=0,Y=t.width,W=t.height,ne=1,D=null,X=null;const Q=new ct(0,0,Y,W),oe=new ct(0,0,Y,W);let Re=!1;const Ke=new Nl;let j=!1,se=!1;const xe=new ke,de=new I,De=new ct,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function it(){return T===null?ne:1}let P=i;function le(C,k){return t.getContext(C,k)}try{const C={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Cd}`),t.addEventListener("webglcontextlost",q,!1),t.addEventListener("webglcontextrestored",ee,!1),t.addEventListener("webglcontextcreationerror",he,!1),P===null){const k="webgl2";if(P=le(k,C),P===null)throw le(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,ge,$,Ue,me,we,N,b,z,J,Z,te,Le,pe,Se,We,ae,_e,Je,Ve,be,Ge,qe,vt;function U(){ie=new EP(P),ie.init(),Ge=new gM(P,ie),ge=new yP(P,ie,e,Ge),$=new rI(P),Ue=new CP(P),me=new X2,we=new uI(P,ie,$,me,ge,Ge,Ue),N=new SP(x),b=new bP(x),z=new UA(P),qe=new xP(P,z),J=new TP(P,z,Ue,qe),Z=new PP(P,J,z,Ue),Je=new RP(P,ge,we),We=new _P(me),te=new j2(x,N,b,ie,ge,qe,We),Le=new xI(x,me),pe=new $2,Se=new eI(ie),_e=new gP(x,N,b,$,Z,h,l),ae=new iI(x,Z,ge),vt=new vI(P,Ue,ge,$),Ve=new vP(P,ie,Ue),be=new AP(P,ie,Ue),Ue.programs=te.programs,x.capabilities=ge,x.extensions=ie,x.properties=me,x.renderLists=pe,x.shadowMap=ae,x.state=$,x.info=Ue}U();const ce=new mI(x,P);this.xr=ce,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(C){C!==void 0&&(ne=C,this.setSize(Y,W,!1))},this.getSize=function(C){return C.set(Y,W)},this.setSize=function(C,k,B=!0){if(ce.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Y=C,W=k,t.width=Math.floor(C*ne),t.height=Math.floor(k*ne),B===!0&&(t.style.width=C+"px",t.style.height=k+"px"),this.setViewport(0,0,C,k)},this.getDrawingBufferSize=function(C){return C.set(Y*ne,W*ne).floor()},this.setDrawingBufferSize=function(C,k,B){Y=C,W=k,ne=B,t.width=Math.floor(C*B),t.height=Math.floor(k*B),this.setViewport(0,0,C,k)},this.getCurrentViewport=function(C){return C.copy(w)},this.getViewport=function(C){return C.copy(Q)},this.setViewport=function(C,k,B,H){C.isVector4?Q.set(C.x,C.y,C.z,C.w):Q.set(C,k,B,H),$.viewport(w.copy(Q).multiplyScalar(ne).round())},this.getScissor=function(C){return C.copy(oe)},this.setScissor=function(C,k,B,H){C.isVector4?oe.set(C.x,C.y,C.z,C.w):oe.set(C,k,B,H),$.scissor(L.copy(oe).multiplyScalar(ne).round())},this.getScissorTest=function(){return Re},this.setScissorTest=function(C){$.setScissorTest(Re=C)},this.setOpaqueSort=function(C){D=C},this.setTransparentSort=function(C){X=C},this.getClearColor=function(C){return C.copy(_e.getClearColor())},this.setClearColor=function(){_e.setClearColor.apply(_e,arguments)},this.getClearAlpha=function(){return _e.getClearAlpha()},this.setClearAlpha=function(){_e.setClearAlpha.apply(_e,arguments)},this.clear=function(C=!0,k=!0,B=!0){let H=0;if(C){let O=!1;if(T!==null){const ue=T.texture.format;O=ue===Ud||ue===Dd||ue===Rl}if(O){const ue=T.texture.type,ve=ue===Ei||ue===Ji||ue===Do||ue===Ms||ue===Id||ue===Nd,Te=_e.getClearColor(),Ae=_e.getClearAlpha(),Fe=Te.r,ze=Te.g,Pe=Te.b;ve?(p[0]=Fe,p[1]=ze,p[2]=Pe,p[3]=Ae,P.clearBufferuiv(P.COLOR,0,p)):(m[0]=Fe,m[1]=ze,m[2]=Pe,m[3]=Ae,P.clearBufferiv(P.COLOR,0,m))}else H|=P.COLOR_BUFFER_BIT}k&&(H|=P.DEPTH_BUFFER_BIT),B&&(H|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",q,!1),t.removeEventListener("webglcontextrestored",ee,!1),t.removeEventListener("webglcontextcreationerror",he,!1),pe.dispose(),Se.dispose(),me.dispose(),N.dispose(),b.dispose(),Z.dispose(),qe.dispose(),vt.dispose(),te.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",hi),ce.removeEventListener("sessionend",Ag),zr.stop()};function q(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function ee(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const C=Ue.autoReset,k=ae.enabled,B=ae.autoUpdate,H=ae.needsUpdate,O=ae.type;U(),Ue.autoReset=C,ae.enabled=k,ae.autoUpdate=B,ae.needsUpdate=H,ae.type=O}function he(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Oe(C){const k=C.target;k.removeEventListener("dispose",Oe),Qe(k)}function Qe(C){It(C),me.remove(C)}function It(C){const k=me.get(C).programs;k!==void 0&&(k.forEach(function(B){te.releaseProgram(B)}),C.isShaderMaterial&&te.releaseShaderCache(C))}this.renderBufferDirect=function(C,k,B,H,O,ue){k===null&&(k=He);const ve=O.isMesh&&O.matrixWorld.determinant()<0,Te=gw(C,k,B,H,O);$.setMaterial(H,ve);let Ae=B.index,Fe=1;if(H.wireframe===!0){if(Ae=J.getWireframeAttribute(B),Ae===void 0)return;Fe=2}const ze=B.drawRange,Pe=B.attributes.position;let ot=ze.start*Fe,wt=(ze.start+ze.count)*Fe;ue!==null&&(ot=Math.max(ot,ue.start*Fe),wt=Math.min(wt,(ue.start+ue.count)*Fe)),Ae!==null?(ot=Math.max(ot,0),wt=Math.min(wt,Ae.count)):Pe!=null&&(ot=Math.max(ot,0),wt=Math.min(wt,Pe.count));const bt=wt-ot;if(bt<0||bt===1/0)return;qe.setup(O,H,Te,B,Ae);let An,at=Ve;if(Ae!==null&&(An=z.get(Ae),at=be,at.setIndex(An)),O.isMesh)H.wireframe===!0?($.setLineWidth(H.wireframeLinewidth*it()),at.setMode(P.LINES)):at.setMode(P.TRIANGLES);else if(O.isLine){let Ne=H.linewidth;Ne===void 0&&(Ne=1),$.setLineWidth(Ne*it()),O.isLineSegments?at.setMode(P.LINES):O.isLineLoop?at.setMode(P.LINE_LOOP):at.setMode(P.LINE_STRIP)}else O.isPoints?at.setMode(P.POINTS):O.isSprite&&at.setMode(P.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)at.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))at.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const Ne=O._multiDrawStarts,Xt=O._multiDrawCounts,lt=O._multiDrawCount,Zn=Ae?z.get(Ae).bytesPerElement:1,Is=me.get(H).currentProgram.getUniforms();for(let Cn=0;Cn<lt;Cn++)Is.setValue(P,"_gl_DrawID",Cn),at.render(Ne[Cn]/Zn,Xt[Cn])}else if(O.isInstancedMesh)at.renderInstances(ot,bt,O.count);else if(B.isInstancedBufferGeometry){const Ne=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,Xt=Math.min(B.instanceCount,Ne);at.renderInstances(ot,bt,Xt)}else at.render(ot,bt)};function jt(C,k,B){C.transparent===!0&&C.side===vi&&C.forceSinglePass===!1?(C.side=fn,C.needsUpdate=!0,Bl(C,k,B),C.side=Zi,C.needsUpdate=!0,Bl(C,k,B),C.side=vi):Bl(C,k,B)}this.compile=function(C,k,B=null){B===null&&(B=C),g=Se.get(B),g.init(k),v.push(g),B.traverseVisible(function(O){O.isLight&&O.layers.test(k.layers)&&(g.pushLight(O),O.castShadow&&g.pushShadow(O))}),C!==B&&C.traverseVisible(function(O){O.isLight&&O.layers.test(k.layers)&&(g.pushLight(O),O.castShadow&&g.pushShadow(O))}),g.setupLights();const H=new Set;return C.traverse(function(O){const ue=O.material;if(ue)if(Array.isArray(ue))for(let ve=0;ve<ue.length;ve++){const Te=ue[ve];jt(Te,B,O),H.add(Te)}else jt(ue,B,O),H.add(ue)}),v.pop(),g=null,H},this.compileAsync=function(C,k,B=null){const H=this.compile(C,k,B);return new Promise(O=>{function ue(){if(H.forEach(function(ve){me.get(ve).currentProgram.isReady()&&H.delete(ve)}),H.size===0){O(C);return}setTimeout(ue,10)}ie.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let st=null;function Ci(C){st&&st(C)}function hi(){zr.stop()}function Ag(){zr.start()}const zr=new dM;zr.setAnimationLoop(Ci),typeof self<"u"&&zr.setContext(self),this.setAnimationLoop=function(C){st=C,ce.setAnimationLoop(C),C===null?zr.stop():zr.start()},ce.addEventListener("sessionstart",hi),ce.addEventListener("sessionend",Ag),this.render=function(C,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(k),k=ce.getCamera()),C.isScene===!0&&C.onBeforeRender(x,C,k,T),g=Se.get(C,v.length),g.init(k),v.push(g),xe.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Ke.setFromProjectionMatrix(xe),se=this.localClippingEnabled,j=We.init(this.clippingPlanes,se),y=pe.get(C,f.length),y.init(),f.push(y),ce.enabled===!0&&ce.isPresenting===!0){const ue=x.xr.getDepthSensingMesh();ue!==null&&uh(ue,k,-1/0,x.sortObjects)}uh(C,k,0,x.sortObjects),y.finish(),x.sortObjects===!0&&y.sort(D,X),Be=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Be&&_e.addToRenderList(y,C),this.info.render.frame++,j===!0&&We.beginShadows();const B=g.state.shadowsArray;ae.render(B,C,k),j===!0&&We.endShadows(),this.info.autoReset===!0&&this.info.reset();const H=y.opaque,O=y.transmissive;if(g.setupLights(),k.isArrayCamera){const ue=k.cameras;if(O.length>0)for(let ve=0,Te=ue.length;ve<Te;ve++){const Ae=ue[ve];Rg(H,O,C,Ae)}Be&&_e.render(C);for(let ve=0,Te=ue.length;ve<Te;ve++){const Ae=ue[ve];Cg(y,C,Ae,Ae.viewport)}}else O.length>0&&Rg(H,O,C,k),Be&&_e.render(C),Cg(y,C,k);T!==null&&(we.updateMultisampleRenderTarget(T),we.updateRenderTargetMipmap(T)),C.isScene===!0&&C.onAfterRender(x,C,k),qe.resetDefaultState(),A=-1,E=null,v.pop(),v.length>0?(g=v[v.length-1],j===!0&&We.setGlobalState(x.clippingPlanes,g.state.camera)):g=null,f.pop(),f.length>0?y=f[f.length-1]:y=null};function uh(C,k,B,H){if(C.visible===!1)return;if(C.layers.test(k.layers)){if(C.isGroup)B=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(k);else if(C.isLight)g.pushLight(C),C.castShadow&&g.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||Ke.intersectsSprite(C)){H&&De.setFromMatrixPosition(C.matrixWorld).applyMatrix4(xe);const ve=Z.update(C),Te=C.material;Te.visible&&y.push(C,ve,Te,B,De.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||Ke.intersectsObject(C))){const ve=Z.update(C),Te=C.material;if(H&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),De.copy(C.boundingSphere.center)):(ve.boundingSphere===null&&ve.computeBoundingSphere(),De.copy(ve.boundingSphere.center)),De.applyMatrix4(C.matrixWorld).applyMatrix4(xe)),Array.isArray(Te)){const Ae=ve.groups;for(let Fe=0,ze=Ae.length;Fe<ze;Fe++){const Pe=Ae[Fe],ot=Te[Pe.materialIndex];ot&&ot.visible&&y.push(C,ve,ot,B,De.z,Pe)}}else Te.visible&&y.push(C,ve,Te,B,De.z,null)}}const ue=C.children;for(let ve=0,Te=ue.length;ve<Te;ve++)uh(ue[ve],k,B,H)}function Cg(C,k,B,H){const O=C.opaque,ue=C.transmissive,ve=C.transparent;g.setupLightsView(B),j===!0&&We.setGlobalState(x.clippingPlanes,B),H&&$.viewport(w.copy(H)),O.length>0&&Fl(O,k,B),ue.length>0&&Fl(ue,k,B),ve.length>0&&Fl(ve,k,B),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Rg(C,k,B,H){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[H.id]===void 0&&(g.state.transmissionRenderTarget[H.id]=new li(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?Ho:Ei,minFilter:yi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace}));const ue=g.state.transmissionRenderTarget[H.id],ve=H.viewport||w;ue.setSize(ve.z,ve.w);const Te=x.getRenderTarget();x.setRenderTarget(ue),x.getClearColor(F),G=x.getClearAlpha(),G<1&&x.setClearColor(16777215,.5),x.clear(),Be&&_e.render(B);const Ae=x.toneMapping;x.toneMapping=ji;const Fe=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),g.setupLightsView(H),j===!0&&We.setGlobalState(x.clippingPlanes,H),Fl(C,B,H),we.updateMultisampleRenderTarget(ue),we.updateRenderTargetMipmap(ue),ie.has("WEBGL_multisampled_render_to_texture")===!1){let ze=!1;for(let Pe=0,ot=k.length;Pe<ot;Pe++){const wt=k[Pe],bt=wt.object,An=wt.geometry,at=wt.material,Ne=wt.group;if(at.side===vi&&bt.layers.test(H.layers)){const Xt=at.side;at.side=fn,at.needsUpdate=!0,Pg(bt,B,H,An,at,Ne),at.side=Xt,at.needsUpdate=!0,ze=!0}}ze===!0&&(we.updateMultisampleRenderTarget(ue),we.updateRenderTargetMipmap(ue))}x.setRenderTarget(Te),x.setClearColor(F,G),Fe!==void 0&&(H.viewport=Fe),x.toneMapping=Ae}function Fl(C,k,B){const H=k.isScene===!0?k.overrideMaterial:null;for(let O=0,ue=C.length;O<ue;O++){const ve=C[O],Te=ve.object,Ae=ve.geometry,Fe=H===null?ve.material:H,ze=ve.group;Te.layers.test(B.layers)&&Pg(Te,k,B,Ae,Fe,ze)}}function Pg(C,k,B,H,O,ue){C.onBeforeRender(x,k,B,H,O,ue),C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),O.onBeforeRender(x,k,B,H,C,ue),O.transparent===!0&&O.side===vi&&O.forceSinglePass===!1?(O.side=fn,O.needsUpdate=!0,x.renderBufferDirect(B,k,H,O,C,ue),O.side=Zi,O.needsUpdate=!0,x.renderBufferDirect(B,k,H,O,C,ue),O.side=vi):x.renderBufferDirect(B,k,H,O,C,ue),C.onAfterRender(x,k,B,H,O,ue)}function Bl(C,k,B){k.isScene!==!0&&(k=He);const H=me.get(C),O=g.state.lights,ue=g.state.shadowsArray,ve=O.state.version,Te=te.getParameters(C,O.state,ue,k,B),Ae=te.getProgramCacheKey(Te);let Fe=H.programs;H.environment=C.isMeshStandardMaterial?k.environment:null,H.fog=k.fog,H.envMap=(C.isMeshStandardMaterial?b:N).get(C.envMap||H.environment),H.envMapRotation=H.environment!==null&&C.envMap===null?k.environmentRotation:C.envMapRotation,Fe===void 0&&(C.addEventListener("dispose",Oe),Fe=new Map,H.programs=Fe);let ze=Fe.get(Ae);if(ze!==void 0){if(H.currentProgram===ze&&H.lightsStateVersion===ve)return Ng(C,Te),ze}else Te.uniforms=te.getUniforms(C),C.onBeforeCompile(Te,x),ze=te.acquireProgram(Te,Ae),Fe.set(Ae,ze),H.uniforms=Te.uniforms;const Pe=H.uniforms;return(!C.isShaderMaterial&&!C.isRawShaderMaterial||C.clipping===!0)&&(Pe.clippingPlanes=We.uniform),Ng(C,Te),H.needsLights=vw(C),H.lightsStateVersion=ve,H.needsLights&&(Pe.ambientLightColor.value=O.state.ambient,Pe.lightProbe.value=O.state.probe,Pe.directionalLights.value=O.state.directional,Pe.directionalLightShadows.value=O.state.directionalShadow,Pe.spotLights.value=O.state.spot,Pe.spotLightShadows.value=O.state.spotShadow,Pe.rectAreaLights.value=O.state.rectArea,Pe.ltc_1.value=O.state.rectAreaLTC1,Pe.ltc_2.value=O.state.rectAreaLTC2,Pe.pointLights.value=O.state.point,Pe.pointLightShadows.value=O.state.pointShadow,Pe.hemisphereLights.value=O.state.hemi,Pe.directionalShadowMap.value=O.state.directionalShadowMap,Pe.directionalShadowMatrix.value=O.state.directionalShadowMatrix,Pe.spotShadowMap.value=O.state.spotShadowMap,Pe.spotLightMatrix.value=O.state.spotLightMatrix,Pe.spotLightMap.value=O.state.spotLightMap,Pe.pointShadowMap.value=O.state.pointShadowMap,Pe.pointShadowMatrix.value=O.state.pointShadowMatrix),H.currentProgram=ze,H.uniformsList=null,ze}function Ig(C){if(C.uniformsList===null){const k=C.currentProgram.getUniforms();C.uniformsList=lu.seqWithValue(k.seq,C.uniforms)}return C.uniformsList}function Ng(C,k){const B=me.get(C);B.outputColorSpace=k.outputColorSpace,B.batching=k.batching,B.batchingColor=k.batchingColor,B.instancing=k.instancing,B.instancingColor=k.instancingColor,B.instancingMorph=k.instancingMorph,B.skinning=k.skinning,B.morphTargets=k.morphTargets,B.morphNormals=k.morphNormals,B.morphColors=k.morphColors,B.morphTargetsCount=k.morphTargetsCount,B.numClippingPlanes=k.numClippingPlanes,B.numIntersection=k.numClipIntersection,B.vertexAlphas=k.vertexAlphas,B.vertexTangents=k.vertexTangents,B.toneMapping=k.toneMapping}function gw(C,k,B,H,O){k.isScene!==!0&&(k=He),we.resetTextureUnits();const ue=k.fog,ve=H.isMeshStandardMaterial?k.environment:null,Te=T===null?x.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:tr,Ae=(H.isMeshStandardMaterial?b:N).get(H.envMap||ve),Fe=H.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,ze=!!B.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Pe=!!B.morphAttributes.position,ot=!!B.morphAttributes.normal,wt=!!B.morphAttributes.color;let bt=ji;H.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(bt=x.toneMapping);const An=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,at=An!==void 0?An.length:0,Ne=me.get(H),Xt=g.state.lights;if(j===!0&&(se===!0||C!==E)){const zn=C===E&&H.id===A;We.setState(H,C,zn)}let lt=!1;H.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Xt.state.version||Ne.outputColorSpace!==Te||O.isBatchedMesh&&Ne.batching===!1||!O.isBatchedMesh&&Ne.batching===!0||O.isBatchedMesh&&Ne.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&Ne.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&Ne.instancing===!1||!O.isInstancedMesh&&Ne.instancing===!0||O.isSkinnedMesh&&Ne.skinning===!1||!O.isSkinnedMesh&&Ne.skinning===!0||O.isInstancedMesh&&Ne.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&Ne.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&Ne.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&Ne.instancingMorph===!1&&O.morphTexture!==null||Ne.envMap!==Ae||H.fog===!0&&Ne.fog!==ue||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==We.numPlanes||Ne.numIntersection!==We.numIntersection)||Ne.vertexAlphas!==Fe||Ne.vertexTangents!==ze||Ne.morphTargets!==Pe||Ne.morphNormals!==ot||Ne.morphColors!==wt||Ne.toneMapping!==bt||Ne.morphTargetsCount!==at)&&(lt=!0):(lt=!0,Ne.__version=H.version);let Zn=Ne.currentProgram;lt===!0&&(Zn=Bl(H,k,O));let Is=!1,Cn=!1,dh=!1;const Nt=Zn.getUniforms(),nr=Ne.uniforms;if($.useProgram(Zn.program)&&(Is=!0,Cn=!0,dh=!0),H.id!==A&&(A=H.id,Cn=!0),Is||E!==C){Nt.setValue(P,"projectionMatrix",C.projectionMatrix),Nt.setValue(P,"viewMatrix",C.matrixWorldInverse);const zn=Nt.map.cameraPosition;zn!==void 0&&zn.setValue(P,de.setFromMatrixPosition(C.matrixWorld)),ge.logarithmicDepthBuffer&&Nt.setValue(P,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&Nt.setValue(P,"isOrthographic",C.isOrthographicCamera===!0),E!==C&&(E=C,Cn=!0,dh=!0)}if(O.isSkinnedMesh){Nt.setOptional(P,O,"bindMatrix"),Nt.setOptional(P,O,"bindMatrixInverse");const zn=O.skeleton;zn&&(zn.boneTexture===null&&zn.computeBoneTexture(),Nt.setValue(P,"boneTexture",zn.boneTexture,we))}O.isBatchedMesh&&(Nt.setOptional(P,O,"batchingTexture"),Nt.setValue(P,"batchingTexture",O._matricesTexture,we),Nt.setOptional(P,O,"batchingIdTexture"),Nt.setValue(P,"batchingIdTexture",O._indirectTexture,we),Nt.setOptional(P,O,"batchingColorTexture"),O._colorsTexture!==null&&Nt.setValue(P,"batchingColorTexture",O._colorsTexture,we));const hh=B.morphAttributes;if((hh.position!==void 0||hh.normal!==void 0||hh.color!==void 0)&&Je.update(O,B,Zn),(Cn||Ne.receiveShadow!==O.receiveShadow)&&(Ne.receiveShadow=O.receiveShadow,Nt.setValue(P,"receiveShadow",O.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(nr.envMap.value=Ae,nr.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),H.isMeshStandardMaterial&&H.envMap===null&&k.environment!==null&&(nr.envMapIntensity.value=k.environmentIntensity),Cn&&(Nt.setValue(P,"toneMappingExposure",x.toneMappingExposure),Ne.needsLights&&xw(nr,dh),ue&&H.fog===!0&&Le.refreshFogUniforms(nr,ue),Le.refreshMaterialUniforms(nr,H,ne,W,g.state.transmissionRenderTarget[C.id]),lu.upload(P,Ig(Ne),nr,we)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(lu.upload(P,Ig(Ne),nr,we),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&Nt.setValue(P,"center",O.center),Nt.setValue(P,"modelViewMatrix",O.modelViewMatrix),Nt.setValue(P,"normalMatrix",O.normalMatrix),Nt.setValue(P,"modelMatrix",O.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const zn=H.uniformsGroups;for(let fh=0,yw=zn.length;fh<yw;fh++){const Lg=zn[fh];vt.update(Lg,Zn),vt.bind(Lg,Zn)}}return Zn}function xw(C,k){C.ambientLightColor.needsUpdate=k,C.lightProbe.needsUpdate=k,C.directionalLights.needsUpdate=k,C.directionalLightShadows.needsUpdate=k,C.pointLights.needsUpdate=k,C.pointLightShadows.needsUpdate=k,C.spotLights.needsUpdate=k,C.spotLightShadows.needsUpdate=k,C.rectAreaLights.needsUpdate=k,C.hemisphereLights.needsUpdate=k}function vw(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&C.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(C,k,B){me.get(C.texture).__webglTexture=k,me.get(C.depthTexture).__webglTexture=B;const H=me.get(C);H.__hasExternalTextures=!0,H.__autoAllocateDepthBuffer=B===void 0,H.__autoAllocateDepthBuffer||ie.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),H.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(C,k){const B=me.get(C);B.__webglFramebuffer=k,B.__useDefaultFramebuffer=k===void 0},this.setRenderTarget=function(C,k=0,B=0){T=C,R=k,M=B;let H=!0,O=null,ue=!1,ve=!1;if(C){const Ae=me.get(C);if(Ae.__useDefaultFramebuffer!==void 0)$.bindFramebuffer(P.FRAMEBUFFER,null),H=!1;else if(Ae.__webglFramebuffer===void 0)we.setupRenderTarget(C);else if(Ae.__hasExternalTextures)we.rebindTextures(C,me.get(C.texture).__webglTexture,me.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Pe=C.depthTexture;if(Ae.__boundDepthTexture!==Pe){if(Pe!==null&&me.has(Pe)&&(C.width!==Pe.image.width||C.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");we.setupDepthRenderbuffer(C)}}const Fe=C.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(ve=!0);const ze=me.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(Array.isArray(ze[k])?O=ze[k][B]:O=ze[k],ue=!0):C.samples>0&&we.useMultisampledRTT(C)===!1?O=me.get(C).__webglMultisampledFramebuffer:Array.isArray(ze)?O=ze[B]:O=ze,w.copy(C.viewport),L.copy(C.scissor),V=C.scissorTest}else w.copy(Q).multiplyScalar(ne).floor(),L.copy(oe).multiplyScalar(ne).floor(),V=Re;if($.bindFramebuffer(P.FRAMEBUFFER,O)&&H&&$.drawBuffers(C,O),$.viewport(w),$.scissor(L),$.setScissorTest(V),ue){const Ae=me.get(C.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+k,Ae.__webglTexture,B)}else if(ve){const Ae=me.get(C.texture),Fe=k||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ae.__webglTexture,B||0,Fe)}A=-1},this.readRenderTargetPixels=function(C,k,B,H,O,ue,ve){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ve!==void 0&&(Te=Te[ve]),Te){$.bindFramebuffer(P.FRAMEBUFFER,Te);try{const Ae=C.texture,Fe=Ae.format,ze=Ae.type;if(!ge.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ge.textureTypeReadable(ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=C.width-H&&B>=0&&B<=C.height-O&&P.readPixels(k,B,H,O,Ge.convert(Fe),Ge.convert(ze),ue)}finally{const Ae=T!==null?me.get(T).__webglFramebuffer:null;$.bindFramebuffer(P.FRAMEBUFFER,Ae)}}},this.readRenderTargetPixelsAsync=async function(C,k,B,H,O,ue,ve){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ve!==void 0&&(Te=Te[ve]),Te){$.bindFramebuffer(P.FRAMEBUFFER,Te);try{const Ae=C.texture,Fe=Ae.format,ze=Ae.type;if(!ge.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(k>=0&&k<=C.width-H&&B>=0&&B<=C.height-O){const Pe=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Pe),P.bufferData(P.PIXEL_PACK_BUFFER,ue.byteLength,P.STREAM_READ),P.readPixels(k,B,H,O,Ge.convert(Fe),Ge.convert(ze),0),P.flush();const ot=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);await oA(P,ot,4);try{P.bindBuffer(P.PIXEL_PACK_BUFFER,Pe),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ue)}finally{P.deleteBuffer(Pe),P.deleteSync(ot)}return ue}}finally{const Ae=T!==null?me.get(T).__webglFramebuffer:null;$.bindFramebuffer(P.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(C,k=null,B=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyFramebufferToTexture function signature has changed."),k=arguments[0]||null,C=arguments[1]);const H=Math.pow(2,-B),O=Math.floor(C.image.width*H),ue=Math.floor(C.image.height*H),ve=k!==null?k.x:0,Te=k!==null?k.y:0;we.setTexture2D(C,0),P.copyTexSubImage2D(P.TEXTURE_2D,B,0,0,ve,Te,O,ue),$.unbindTexture()},this.copyTextureToTexture=function(C,k,B=null,H=null,O=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture function signature has changed."),H=arguments[0]||null,C=arguments[1],k=arguments[2],O=arguments[3]||0,B=null);let ue,ve,Te,Ae,Fe,ze;B!==null?(ue=B.max.x-B.min.x,ve=B.max.y-B.min.y,Te=B.min.x,Ae=B.min.y):(ue=C.image.width,ve=C.image.height,Te=0,Ae=0),H!==null?(Fe=H.x,ze=H.y):(Fe=0,ze=0);const Pe=Ge.convert(k.format),ot=Ge.convert(k.type);we.setTexture2D(k,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,k.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,k.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),bt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),An=P.getParameter(P.UNPACK_SKIP_PIXELS),at=P.getParameter(P.UNPACK_SKIP_ROWS),Ne=P.getParameter(P.UNPACK_SKIP_IMAGES),Xt=C.isCompressedTexture?C.mipmaps[O]:C.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Te),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ae),C.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,O,Fe,ze,ue,ve,Pe,ot,Xt.data):C.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,O,Fe,ze,Xt.width,Xt.height,Pe,Xt.data):P.texSubImage2D(P.TEXTURE_2D,O,Fe,ze,ue,ve,Pe,ot,Xt),P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,An),P.pixelStorei(P.UNPACK_SKIP_ROWS,at),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ne),O===0&&k.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(C,k,B=null,H=null,O=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture3D function signature has changed."),B=arguments[0]||null,H=arguments[1]||null,C=arguments[2],k=arguments[3],O=arguments[4]||0);let ue,ve,Te,Ae,Fe,ze,Pe,ot,wt;const bt=C.isCompressedTexture?C.mipmaps[O]:C.image;B!==null?(ue=B.max.x-B.min.x,ve=B.max.y-B.min.y,Te=B.max.z-B.min.z,Ae=B.min.x,Fe=B.min.y,ze=B.min.z):(ue=bt.width,ve=bt.height,Te=bt.depth,Ae=0,Fe=0,ze=0),H!==null?(Pe=H.x,ot=H.y,wt=H.z):(Pe=0,ot=0,wt=0);const An=Ge.convert(k.format),at=Ge.convert(k.type);let Ne;if(k.isData3DTexture)we.setTexture3D(k,0),Ne=P.TEXTURE_3D;else if(k.isDataArrayTexture||k.isCompressedArrayTexture)we.setTexture2DArray(k,0),Ne=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,k.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,k.unpackAlignment);const Xt=P.getParameter(P.UNPACK_ROW_LENGTH),lt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Zn=P.getParameter(P.UNPACK_SKIP_PIXELS),Is=P.getParameter(P.UNPACK_SKIP_ROWS),Cn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,bt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ae),P.pixelStorei(P.UNPACK_SKIP_ROWS,Fe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,ze),C.isDataTexture||C.isData3DTexture?P.texSubImage3D(Ne,O,Pe,ot,wt,ue,ve,Te,An,at,bt.data):k.isCompressedArrayTexture?P.compressedTexSubImage3D(Ne,O,Pe,ot,wt,ue,ve,Te,An,bt.data):P.texSubImage3D(Ne,O,Pe,ot,wt,ue,ve,Te,An,at,bt),P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Zn),P.pixelStorei(P.UNPACK_SKIP_ROWS,Is),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Cn),O===0&&k.generateMipmaps&&P.generateMipmap(Ne),$.unbindTexture()},this.initRenderTarget=function(C){me.get(C).__webglFramebuffer===void 0&&we.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?we.setTextureCube(C,0):C.isData3DTexture?we.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?we.setTexture2DArray(C,0):we.setTexture2D(C,0),$.unbindTexture()},this.resetState=function(){R=0,M=0,T=null,$.reset(),qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Od?"display-p3":"srgb",t.unpackColorSpace=rt.workingColorSpace===Pl?"display-p3":"srgb"}}class Gd{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ye(e),this.density=t}clone(){return new Gd(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Wd{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ye(e),this.near=t,this.far=i}clone(){return new Wd(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let vM=class extends nt{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 On,this.environmentIntensity=1,this.environmentRotation=new On,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};class jd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const an=new I;class bs{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new ht(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new bs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ag extends on{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let qs;const aa=new I,Zs=new I,Ks=new I,Js=new K,la=new K,yM=new ke,bc=new I,ca=new I,Ec=new I,W0=new K,yf=new K,j0=new K;class _M extends nt{constructor(e=new ag){if(super(),this.isSprite=!0,this.type="Sprite",qs===void 0){qs=new $e;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new jd(t,5);qs.setIndex([0,1,2,0,2,3]),qs.setAttribute("position",new bs(i,3,0,!1)),qs.setAttribute("uv",new bs(i,2,3,!1))}this.geometry=qs,this.material=e,this.center=new K(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Zs.setFromMatrixScale(this.matrixWorld),yM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ks.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Zs.multiplyScalar(-Ks.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Tc(bc.set(-.5,-.5,0),Ks,o,Zs,r,s),Tc(ca.set(.5,-.5,0),Ks,o,Zs,r,s),Tc(Ec.set(.5,.5,0),Ks,o,Zs,r,s),W0.set(0,0),yf.set(1,0),j0.set(1,1);let a=e.ray.intersectTriangle(bc,ca,Ec,!1,aa);if(a===null&&(Tc(ca.set(-.5,.5,0),Ks,o,Zs,r,s),yf.set(0,1),a=e.ray.intersectTriangle(bc,Ec,ca,!1,aa),a===null))return;const l=e.ray.origin.distanceTo(aa);l<e.near||l>e.far||t.push({distance:l,point:aa.clone(),uv:Nn.getInterpolation(aa,bc,ca,Ec,W0,yf,j0,new K),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Tc(n,e,t,i,r,s){Js.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(la.x=s*Js.x-r*Js.y,la.y=r*Js.x+s*Js.y):la.copy(Js),n.copy(e),n.x+=la.x,n.y+=la.y,n.applyMatrix4(yM)}const Ac=new I,X0=new I;class SM extends nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Ac.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Ac);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ac.setFromMatrixPosition(e.matrixWorld),X0.setFromMatrixPosition(this.matrixWorld);const i=Ac.distanceTo(X0)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Y0=new I,$0=new ct,q0=new ct,_I=new I,Z0=new ke,Cc=new I,_f=new rn,K0=new ke,Sf=new Go;class MM extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ip,this.bindMatrix=new ke,this.bindMatrixInverse=new ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new pn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingBox.expandByPoint(Cc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new rn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingSphere.expandByPoint(Cc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_f.copy(this.boundingSphere),_f.applyMatrix4(r),e.ray.intersectsSphere(_f)!==!1&&(K0.copy(r).invert(),Sf.copy(e.ray).applyMatrix4(K0),!(this.boundingBox!==null&&Sf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Sf)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ct,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ip?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===HS?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;$0.fromBufferAttribute(r.attributes.skinIndex,e),q0.fromBufferAttribute(r.attributes.skinWeight,e),Y0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=q0.getComponent(s);if(o!==0){const a=$0.getComponent(s);Z0.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(_I.copy(Y0).applyMatrix4(Z0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class lg extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class wi extends Ct{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Gt,u=Gt,d,h){super(null,o,a,l,c,u,r,s,d,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const J0=new ke,SI=new ke;class Xd{constructor(e=[],t=[]){this.uuid=Un(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ke;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:SI;J0.multiplyMatrices(a,t[s]),J0.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Xd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new wi(t,e,e,dn,Sn);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new lg),this.bones.push(o),this.boneInverses.push(new ke().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Oo extends ht{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Qs=new ke,Q0=new ke,Rc=[],ev=new pn,MI=new ke,ua=new kt,da=new rn;class wM extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Oo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,MI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new pn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),ev.copy(e.boundingBox).applyMatrix4(Qs),this.boundingBox.union(ev)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new rn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),da.copy(e.boundingSphere).applyMatrix4(Qs),this.boundingSphere.union(da)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ua.geometry=this.geometry,ua.material=this.material,ua.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),da.copy(this.boundingSphere),da.applyMatrix4(i),e.ray.intersectsSphere(da)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Qs),Q0.multiplyMatrices(i,Qs),ua.matrixWorld=Q0,ua.raycast(e,Rc);for(let o=0,a=Rc.length;o<a;o++){const l=Rc[o];l.instanceId=s,l.object=this,t.push(l)}Rc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new wi(new Float32Array(r*this.count),r,this.count,Ld,Sn));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function wI(n,e){return n.z-e.z}function bI(n,e){return e.z-n.z}class EI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=i}reset(){this.list.length=0,this.index=0}}const dr=new ke,Mf=new ke,TI=new ke,AI=new ye(1,1,1),tv=new ke,wf=new Nl,Pc=new pn,Yr=new rn,ha=new I,nv=new I,CI=new I,bf=new EI,tn=new kt,Ic=[];function RI(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class bM extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,i=t*2,r){super(new $e,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new wi(t,e,e,dn,Sn);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new wi(t,e,e,Rl,Ji);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new wi(t,e,e,dn,Sn);i.colorSpace=rt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(i*l),d=new ht(u,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new ht(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingBoxAt(s,Pc).applyMatrix4(dr),e.union(Pc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingSphereAt(s,Yr).applyMatrix4(dr),e.union(Yr)}}addInstance(e){if(this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});const t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;TI.toArray(r,t*16),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(AI.toArray(s.image.data,t*4),s.needsUpdate=!0),t}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const d=this._geometryCount;return this._geometryCount++,o.push(r),a.push({start:u?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new pn,sphereInitialized:!1,sphere:new rn}),this.setGeometryAt(d,e),d}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const p in i.attributes){const m=t.getAttribute(p),y=i.getAttribute(p);RI(m,y,l);const g=m.itemSize;for(let f=m.count,v=c;f<v;f++){const x=l+f;for(let _=0;_<g;_++)y.setComponent(x,_,0)}y.needsUpdate=!0,y.addUpdateRange(l*g,c*g)}if(r){const p=a.indexStart;for(let m=0;m<o.count;m++)s.setX(p+m,l+o.getX(m));for(let m=o.count,y=a.indexCount;m<y;m++)s.setX(p+m,l);s.needsUpdate=!0,s.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const d=this._drawRanges[e],h=t.getAttribute("position");return d.count=r?o.count:h.count,this._visibilityChanged=!0,e}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.box,s=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,u=l.start+l.count;c<u;c++){let d=c;o&&(d=o.getX(d)),r.expandByPoint(ha.fromBufferAttribute(a,d))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.sphere,s=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,Pc),Pc.getCenter(r.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let u=l.start,d=l.start+l.count;u<d;u++){let h=u;o&&(h=o.getX(h)),ha.fromBufferAttribute(a,h),c=Math.max(c,r.center.distanceToSquared(ha))}r.radius=Math.sqrt(c),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._drawInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}raycast(e,t){const i=this._drawInfo,r=this._drawRanges,s=this.matrixWorld,o=this.geometry;tn.material=this.material,tn.geometry.index=o.index,tn.geometry.attributes=o.attributes,tn.geometry.boundingBox===null&&(tn.geometry.boundingBox=new pn),tn.geometry.boundingSphere===null&&(tn.geometry.boundingSphere=new rn);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,u=r[c];tn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,tn.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,tn.geometry.boundingBox),this.getBoundingSphereAt(c,tn.geometry.boundingSphere),tn.raycast(e,Ic);for(let d=0,h=Ic.length;d<h;d++){const p=Ic[d];p.object=this,p.batchId=a,t.push(p)}Ic.length=0}tn.material=null,tn.geometry.index=null,tn.geometry.attributes={},tn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,d=this._drawRanges,h=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data;h&&(tv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),wf.setFromProjectionMatrix(tv,e.coordinateSystem));let y=0;if(this.sortObjects){Mf.copy(this.matrixWorld).invert(),ha.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Mf),nv.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Mf);for(let v=0,x=l.length;v<x;v++)if(l[v].visible&&l[v].active){const _=l[v].geometryIndex;this.getMatrixAt(v,dr),this.getBoundingSphereAt(_,Yr).applyMatrix4(dr);let R=!1;if(h&&(R=!wf.intersectsSphere(Yr)),!R){const M=CI.subVectors(Yr.center,ha).dot(nv);bf.push(d[_],M,v)}}const g=bf.list,f=this.customSort;f===null?g.sort(s.transparent?bI:wI):f.call(this,g,i);for(let v=0,x=g.length;v<x;v++){const _=g[v];c[y]=_.start*a,u[y]=_.count,m[y]=_.index,y++}bf.reset()}else for(let g=0,f=l.length;g<f;g++)if(l[g].visible&&l[g].active){const v=l[g].geometryIndex;let x=!1;if(h&&(this.getMatrixAt(g,dr),this.getBoundingSphereAt(v,Yr).applyMatrix4(dr),x=!wf.intersectsSphere(Yr)),!x){const _=d[v];c[y]=_.start*a,u[y]=_.count,m[y]=g,y++}}p.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class xn extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ye(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ld=new I,cd=new I,iv=new ke,fa=new Go,Nc=new rn,Ef=new I,rv=new I;class Nr extends nt{constructor(e=new $e,t=new xn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ld.fromBufferAttribute(t,r-1),cd.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ld.distanceTo(cd);e.setAttribute("lineDistance",new Ce(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Nc.copy(i.boundingSphere),Nc.applyMatrix4(r),Nc.radius+=s,e.ray.intersectsSphere(Nc)===!1)return;iv.copy(r).invert(),fa.copy(e.ray).applyMatrix4(iv);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){const p=Math.max(0,o.start),m=Math.min(u.count,o.start+o.count);for(let y=p,g=m-1;y<g;y+=c){const f=u.getX(y),v=u.getX(y+1),x=Lc(this,e,fa,l,f,v);x&&t.push(x)}if(this.isLineLoop){const y=u.getX(m-1),g=u.getX(p),f=Lc(this,e,fa,l,y,g);f&&t.push(f)}}else{const p=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let y=p,g=m-1;y<g;y+=c){const f=Lc(this,e,fa,l,y,y+1);f&&t.push(f)}if(this.isLineLoop){const y=Lc(this,e,fa,l,m-1,p);y&&t.push(y)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Lc(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(ld.fromBufferAttribute(o,r),cd.fromBufferAttribute(o,s),t.distanceSqToSegment(ld,cd,Ef,rv)>i)return;Ef.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(Ef);if(!(l<e.near||l>e.far))return{distance:l,point:rv.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const sv=new I,ov=new I;class Ai extends Nr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)sv.fromBufferAttribute(t,r),ov.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+sv.distanceTo(ov);e.setAttribute("lineDistance",new Ce(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class EM extends Nr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class cg extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ye(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const av=new ke,Op=new Go,Dc=new rn,Uc=new I;class TM extends nt{constructor(e=new $e,t=new cg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Dc.copy(i.boundingSphere),Dc.applyMatrix4(r),Dc.radius+=s,e.ray.intersectsSphere(Dc)===!1)return;av.copy(r).invert(),Op.copy(e.ray).applyMatrix4(av);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,d=i.attributes.position;if(c!==null){const h=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let m=h,y=p;m<y;m++){const g=c.getX(m);Uc.fromBufferAttribute(d,g),lv(Uc,g,l,r,e,t,this)}}else{const h=Math.max(0,o.start),p=Math.min(d.count,o.start+o.count);for(let m=h,y=p;m<y;m++)Uc.fromBufferAttribute(d,m),lv(Uc,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function lv(n,e,t,i,r,s,o){const a=Op.distanceSqToPoint(n);if(a<t){const l=new I;Op.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class PI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=s!==void 0?s:Ut,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class II extends Ct{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Gt,this.minFilter=Gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Yd extends Ct{constructor(e,t,i,r,s,o,a,l,c,u,d,h){super(null,o,a,l,c,u,r,s,d,h),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class NI extends Yd{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Xn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class LI extends Yd{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ki),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class DI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ui{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],h=i[r+1]-u,p=(o-u)/h;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new K:new I);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new I,r=[],s=[],o=[],a=new I,l=new ke;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new I)}s[0]=new I,o[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),h<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(r[p-1],r[p]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(At(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,m))}o[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(At(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),o[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class $d extends ui{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new K){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,p=c-this.aY;l=h*u-p*d+this.aX,c=h*d+p*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class AM extends $d{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function ug(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,d){let h=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+d)+(l-a)/d;h*=u,p*=u,r(o,a,h,p)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const kc=new I,Tf=new ug,Af=new ug,Cf=new ug;class CM extends ui{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new I){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(kc.subVectors(r[0],r[1]).add(r[0]),c=kc);const d=r[a%s],h=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(kc.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=kc),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(h),p),g=Math.pow(h.distanceToSquared(u),p);y<1e-4&&(y=1),m<1e-4&&(m=y),g<1e-4&&(g=y),Tf.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,m,y,g),Af.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,m,y,g),Cf.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,m,y,g)}else this.curveType==="catmullrom"&&(Tf.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Af.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),Cf.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return i.set(Tf.calc(l),Af.calc(l),Cf.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cv(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function UI(n,e){const t=1-n;return t*t*e}function kI(n,e){return 2*(1-n)*n*e}function OI(n,e){return n*n*e}function Oa(n,e,t,i){return UI(n,e)+kI(n,t)+OI(n,i)}function FI(n,e){const t=1-n;return t*t*t*e}function BI(n,e){const t=1-n;return 3*t*t*n*e}function zI(n,e){return 3*(1-n)*n*n*e}function VI(n,e){return n*n*n*e}function Fa(n,e,t,i,r){return FI(n,e)+BI(n,t)+zI(n,i)+VI(n,r)}class dg extends ui{constructor(e=new K,t=new K,i=new K,r=new K){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class RM extends ui{constructor(e=new I,t=new I,i=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y),Fa(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class hg extends ui{constructor(e=new K,t=new K){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new K){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new K){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class PM extends ui{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fg extends ui{constructor(e=new K,t=new K,i=new K){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class pg extends ui{constructor(e=new I,t=new I,i=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y),Oa(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class mg extends ui{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new K){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(cv(a,l.x,c.x,u.x,d.x),cv(a,l.y,c.y,u.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new K().fromArray(r))}return this}}var ud=Object.freeze({__proto__:null,ArcCurve:AM,CatmullRomCurve3:CM,CubicBezierCurve:dg,CubicBezierCurve3:RM,EllipseCurve:$d,LineCurve:hg,LineCurve3:PM,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,SplineCurve:mg});class IM extends ui{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ud[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new ud[r.type]().fromJSON(r))}return this}}class ml extends IM{constructor(e){super(),this.type="Path",this.currentPoint=new K,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new hg(this.currentPoint.clone(),new K(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new fg(this.currentPoint.clone(),new K(e,t),new K(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new dg(this.currentPoint.clone(),new K(e,t),new K(i,r),new K(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new mg(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new $d(e,t,i,r,s,o,a,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ll extends $e{constructor(e=[new K(0,-.5),new K(.5,0),new K(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=At(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,d=new I,h=new K,p=new I,m=new I,y=new I;let g=0,f=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,y.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:g=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-g,p.z=f*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),l.push(p.x,p.y,p.z),y.copy(m)}for(let v=0;v<=t;v++){const x=i+v*u*r,_=Math.sin(x),R=Math.cos(x);for(let M=0;M<=e.length-1;M++){d.x=e[M].x*_,d.y=e[M].y,d.z=e[M].x*R,o.push(d.x,d.y,d.z),h.x=v/t,h.y=M/(e.length-1),a.push(h.x,h.y);const T=l[3*M+0]*_,A=l[3*M+1],E=l[3*M+0]*R;c.push(T,A,E)}}for(let v=0;v<t;v++)for(let x=0;x<e.length-1;x++){const _=x+v*e.length,R=_,M=_+e.length,T=_+e.length+1,A=_+1;s.push(R,M,A),s.push(T,A,M)}this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("uv",new Ce(a,2)),this.setAttribute("normal",new Ce(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ll(e.points,e.segments,e.phiStart,e.phiLength)}}class qd extends Ll{constructor(e=1,t=1,i=4,r=8){const s=new ml;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new qd(e.radius,e.length,e.capSegments,e.radialSegments)}}class Zd extends $e{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new I,u=new K;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,h=3;d<=t;d++,h+=3){const p=i+d/t*r;c.x=e*Math.cos(p),c.y=e*Math.sin(p),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[h]/e+1)/2,u.y=(o[h+1]/e+1)/2,l.push(u.x,u.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("normal",new Ce(a,3)),this.setAttribute("uv",new Ce(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zd(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xo extends $e{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],d=[],h=[],p=[];let m=0;const y=[],g=i/2;let f=0;v(),o===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Ce(d,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(p,2));function v(){const _=new I,R=new I;let M=0;const T=(t-e)/i;for(let A=0;A<=s;A++){const E=[],w=A/s,L=w*(t-e)+e;for(let V=0;V<=r;V++){const F=V/r,G=F*l+a,Y=Math.sin(G),W=Math.cos(G);R.x=L*Y,R.y=-w*i+g,R.z=L*W,d.push(R.x,R.y,R.z),_.set(Y,T,W).normalize(),h.push(_.x,_.y,_.z),p.push(F,1-w),E.push(m++)}y.push(E)}for(let A=0;A<r;A++)for(let E=0;E<s;E++){const w=y[E][A],L=y[E+1][A],V=y[E+1][A+1],F=y[E][A+1];u.push(w,L,F),u.push(L,V,F),M+=6}c.addGroup(f,M,0),f+=M}function x(_){const R=m,M=new K,T=new I;let A=0;const E=_===!0?e:t,w=_===!0?1:-1;for(let V=1;V<=r;V++)d.push(0,g*w,0),h.push(0,w,0),p.push(.5,.5),m++;const L=m;for(let V=0;V<=r;V++){const G=V/r*l+a,Y=Math.cos(G),W=Math.sin(G);T.x=E*W,T.y=g*w,T.z=E*Y,d.push(T.x,T.y,T.z),h.push(0,w,0),M.x=Y*.5+.5,M.y=W*.5*w+.5,p.push(M.x,M.y),m++}for(let V=0;V<r;V++){const F=R+V,G=L+V;_===!0?u.push(G,G+1,F):u.push(G+1,G,F),A+=3}c.addGroup(f,A,_===!0?1:2),f+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Kd extends Xo{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Kd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fr extends $e{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Ce(s,3)),this.setAttribute("normal",new Ce(s.slice(),3)),this.setAttribute("uv",new Ce(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const x=new I,_=new I,R=new I;for(let M=0;M<t.length;M+=3)p(t[M+0],x),p(t[M+1],_),p(t[M+2],R),l(x,_,R,v)}function l(v,x,_,R){const M=R+1,T=[];for(let A=0;A<=M;A++){T[A]=[];const E=v.clone().lerp(_,A/M),w=x.clone().lerp(_,A/M),L=M-A;for(let V=0;V<=L;V++)V===0&&A===M?T[A][V]=E:T[A][V]=E.clone().lerp(w,V/L)}for(let A=0;A<M;A++)for(let E=0;E<2*(M-A)-1;E++){const w=Math.floor(E/2);E%2===0?(h(T[A][w+1]),h(T[A+1][w]),h(T[A][w])):(h(T[A][w+1]),h(T[A+1][w+1]),h(T[A+1][w]))}}function c(v){const x=new I;for(let _=0;_<s.length;_+=3)x.x=s[_+0],x.y=s[_+1],x.z=s[_+2],x.normalize().multiplyScalar(v),s[_+0]=x.x,s[_+1]=x.y,s[_+2]=x.z}function u(){const v=new I;for(let x=0;x<s.length;x+=3){v.x=s[x+0],v.y=s[x+1],v.z=s[x+2];const _=g(v)/2/Math.PI+.5,R=f(v)/Math.PI+.5;o.push(_,1-R)}m(),d()}function d(){for(let v=0;v<o.length;v+=6){const x=o[v+0],_=o[v+2],R=o[v+4],M=Math.max(x,_,R),T=Math.min(x,_,R);M>.9&&T<.1&&(x<.2&&(o[v+0]+=1),_<.2&&(o[v+2]+=1),R<.2&&(o[v+4]+=1))}}function h(v){s.push(v.x,v.y,v.z)}function p(v,x){const _=v*3;x.x=e[_+0],x.y=e[_+1],x.z=e[_+2]}function m(){const v=new I,x=new I,_=new I,R=new I,M=new K,T=new K,A=new K;for(let E=0,w=0;E<s.length;E+=9,w+=6){v.set(s[E+0],s[E+1],s[E+2]),x.set(s[E+3],s[E+4],s[E+5]),_.set(s[E+6],s[E+7],s[E+8]),M.set(o[w+0],o[w+1]),T.set(o[w+2],o[w+3]),A.set(o[w+4],o[w+5]),R.copy(v).add(x).add(_).divideScalar(3);const L=g(R);y(M,w+0,v,L),y(T,w+2,x,L),y(A,w+4,_,L)}}function y(v,x,_,R){R<0&&v.x===1&&(o[x]=v.x-1),_.x===0&&_.z===0&&(o[x]=R/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function f(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fr(e.vertices,e.indices,e.radius,e.details)}}class Jd extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[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(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Jd(e.radius,e.detail)}}const Oc=new I,Fc=new I,Rf=new I,Bc=new Nn;class NM extends $e{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ms*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},p=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:y,b:g,c:f}=Bc;if(y.fromBufferAttribute(a,c[0]),g.fromBufferAttribute(a,c[1]),f.fromBufferAttribute(a,c[2]),Bc.getNormal(Rf),d[0]=`${Math.round(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,d[1]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,d[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let v=0;v<3;v++){const x=(v+1)%3,_=d[v],R=d[x],M=Bc[u[v]],T=Bc[u[x]],A=`${_}_${R}`,E=`${R}_${_}`;E in h&&h[E]?(Rf.dot(h[E].normal)<=s&&(p.push(M.x,M.y,M.z),p.push(T.x,T.y,T.z)),h[E]=null):A in h||(h[A]={index0:c[v],index1:c[x],normal:Rf.clone()})}}for(const m in h)if(h[m]){const{index0:y,index1:g}=h[m];Oc.fromBufferAttribute(a,y),Fc.fromBufferAttribute(a,g),p.push(Oc.x,Oc.y,Oc.z),p.push(Fc.x,Fc.y,Fc.z)}this.setAttribute("position",new Ce(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class gs extends ml{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new ml().fromJSON(r))}return this}}const HI={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=LM(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,d,h,p;if(i&&(s=YI(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let m=t;m<r;m+=t)d=n[m],h=n[m+1],d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>u&&(u=h);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return gl(s,o,t,a,l,p,0),o}};function LM(n,e,t,i,r){let s,o;if(r===rN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=uv(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=uv(s,n[s],n[s+1],o);return o&&Qd(o,o.next)&&(vl(o),o=o.next),o}function Es(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Qd(t,t.next)||_t(t.prev,t,t.next)===0)){if(vl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function gl(n,e,t,i,r,s,o){if(!n)return;!o&&s&&JI(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?WI(n,i,r,s):GI(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),vl(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=jI(Es(n),e,t),gl(n,e,t,i,r,s,2)):o===2&&XI(n,e,t,i,r,s):gl(Es(n),e,t,i,r,s,1);break}}}function GI(n){const e=n.prev,t=n,i=n.next;if(_t(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,h=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=h&&m.y>=d&&m.y<=p&&xo(r,a,s,l,o,c,m.x,m.y)&&_t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function WI(n,e,t,i){const r=n.prev,s=n,o=n.next;if(_t(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,d=s.y,h=o.y,p=a<l?a<c?a:c:l<c?l:c,m=u<d?u<h?u:h:d<h?d:h,y=a>l?a>c?a:c:l>c?l:c,g=u>d?u>h?u:h:d>h?d:h,f=Fp(p,m,e,t,i),v=Fp(y,g,e,t,i);let x=n.prevZ,_=n.nextZ;for(;x&&x.z>=f&&_&&_.z<=v;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=g&&x!==r&&x!==o&&xo(a,u,l,d,c,h,x.x,x.y)&&_t(x.prev,x,x.next)>=0||(x=x.prevZ,_.x>=p&&_.x<=y&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,d,c,h,_.x,_.y)&&_t(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;x&&x.z>=f;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=g&&x!==r&&x!==o&&xo(a,u,l,d,c,h,x.x,x.y)&&_t(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=y&&_.y>=m&&_.y<=g&&_!==r&&_!==o&&xo(a,u,l,d,c,h,_.x,_.y)&&_t(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function jI(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Qd(r,s)&&DM(r,i,i.next,s)&&xl(r,s)&&xl(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),vl(i),vl(i.next),i=n=s),i=i.next}while(i!==n);return Es(i)}function XI(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&tN(o,a)){let l=UM(o,a);o=Es(o,o.next),l=Es(l,l.next),gl(o,e,t,i,r,s,0),gl(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function YI(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=LM(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(eN(c));for(r.sort($I),s=0;s<r.length;s++)t=qI(r[s],t);return t}function $I(n,e){return n.x-e.x}function qI(n,e){const t=ZI(n,e);if(!t)return e;const i=UM(t,n);return Es(i,i.next),Es(t,t.next)}function ZI(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const h=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=s&&h>i&&(i=h,r=t.x<t.next.x?t:t.next,h===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,d;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&xo(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(d=Math.abs(o-t.y)/(s-t.x),xl(t,n)&&(d<u||d===u&&(t.x>r.x||t.x===r.x&&KI(r,t)))&&(r=t,u=d)),t=t.next;while(t!==a);return r}function KI(n,e){return _t(n.prev,n,e.prev)<0&&_t(e.next,n,n.next)<0}function JI(n,e,t,i){let r=n;do r.z===0&&(r.z=Fp(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,QI(r)}function QI(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function Fp(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function eN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xo(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function tN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!nN(n,e)&&(xl(n,e)&&xl(e,n)&&iN(n,e)&&(_t(n.prev,n,e.prev)||_t(n,e.prev,e))||Qd(n,e)&&_t(n.prev,n,n.next)>0&&_t(e.prev,e,e.next)>0)}function _t(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Qd(n,e){return n.x===e.x&&n.y===e.y}function DM(n,e,t,i){const r=Vc(_t(n,e,t)),s=Vc(_t(n,e,i)),o=Vc(_t(t,i,n)),a=Vc(_t(t,i,e));return!!(r!==s&&o!==a||r===0&&zc(n,t,e)||s===0&&zc(n,i,e)||o===0&&zc(t,n,i)||a===0&&zc(t,e,i))}function zc(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Vc(n){return n>0?1:n<0?-1:0}function nN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&DM(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xl(n,e){return _t(n.prev,n,n.next)<0?_t(n,e,n.next)>=0&&_t(n,n.prev,e)>=0:_t(n,e,n.prev)<0||_t(n,n.next,e)<0}function iN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function UM(n,e){const t=new Bp(n.i,n.x,n.y),i=new Bp(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function uv(n,e,t,i){const r=new Bp(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vl(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Bp(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function rN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class bi{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return bi.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];dv(e),hv(i,e);let o=e.length;t.forEach(dv);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,hv(i,t[l]);const a=HI.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function dv(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function hv(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class eh extends $e{constructor(e=new gs([new K(.5,.5),new K(-.5,.5),new K(-.5,-.5),new K(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Ce(r,3)),this.setAttribute("uv",new Ce(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,y=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const f=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:sN;let x,_=!1,R,M,T,A;f&&(x=f.getSpacedPoints(u),_=!0,h=!1,R=f.computeFrenetFrames(u,!1),M=new I,T=new I,A=new I),h||(g=0,p=0,m=0,y=0);const E=a.extractPoints(c);let w=E.shape;const L=E.holes;if(!bi.isClockWise(w)){w=w.reverse();for(let P=0,le=L.length;P<le;P++){const ie=L[P];bi.isClockWise(ie)&&(L[P]=ie.reverse())}}const F=bi.triangulateShape(w,L),G=w;for(let P=0,le=L.length;P<le;P++){const ie=L[P];w=w.concat(ie)}function Y(P,le,ie){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),P.clone().addScaledVector(le,ie)}const W=w.length,ne=F.length;function D(P,le,ie){let ge,$,Ue;const me=P.x-le.x,we=P.y-le.y,N=ie.x-P.x,b=ie.y-P.y,z=me*me+we*we,J=me*b-we*N;if(Math.abs(J)>Number.EPSILON){const Z=Math.sqrt(z),te=Math.sqrt(N*N+b*b),Le=le.x-we/Z,pe=le.y+me/Z,Se=ie.x-b/te,We=ie.y+N/te,ae=((Se-Le)*b-(We-pe)*N)/(me*b-we*N);ge=Le+me*ae-P.x,$=pe+we*ae-P.y;const _e=ge*ge+$*$;if(_e<=2)return new K(ge,$);Ue=Math.sqrt(_e/2)}else{let Z=!1;me>Number.EPSILON?N>Number.EPSILON&&(Z=!0):me<-Number.EPSILON?N<-Number.EPSILON&&(Z=!0):Math.sign(we)===Math.sign(b)&&(Z=!0),Z?(ge=-we,$=me,Ue=Math.sqrt(z)):(ge=me,$=we,Ue=Math.sqrt(z/2))}return new K(ge/Ue,$/Ue)}const X=[];for(let P=0,le=G.length,ie=le-1,ge=P+1;P<le;P++,ie++,ge++)ie===le&&(ie=0),ge===le&&(ge=0),X[P]=D(G[P],G[ie],G[ge]);const Q=[];let oe,Re=X.concat();for(let P=0,le=L.length;P<le;P++){const ie=L[P];oe=[];for(let ge=0,$=ie.length,Ue=$-1,me=ge+1;ge<$;ge++,Ue++,me++)Ue===$&&(Ue=0),me===$&&(me=0),oe[ge]=D(ie[ge],ie[Ue],ie[me]);Q.push(oe),Re=Re.concat(oe)}for(let P=0;P<g;P++){const le=P/g,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+y;for(let $=0,Ue=G.length;$<Ue;$++){const me=Y(G[$],X[$],ge);de(me.x,me.y,-ie)}for(let $=0,Ue=L.length;$<Ue;$++){const me=L[$];oe=Q[$];for(let we=0,N=me.length;we<N;we++){const b=Y(me[we],oe[we],ge);de(b.x,b.y,-ie)}}}const Ke=m+y;for(let P=0;P<W;P++){const le=h?Y(w[P],Re[P],Ke):w[P];_?(T.copy(R.normals[0]).multiplyScalar(le.x),M.copy(R.binormals[0]).multiplyScalar(le.y),A.copy(x[0]).add(T).add(M),de(A.x,A.y,A.z)):de(le.x,le.y,0)}for(let P=1;P<=u;P++)for(let le=0;le<W;le++){const ie=h?Y(w[le],Re[le],Ke):w[le];_?(T.copy(R.normals[P]).multiplyScalar(ie.x),M.copy(R.binormals[P]).multiplyScalar(ie.y),A.copy(x[P]).add(T).add(M),de(A.x,A.y,A.z)):de(ie.x,ie.y,d/u*P)}for(let P=g-1;P>=0;P--){const le=P/g,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+y;for(let $=0,Ue=G.length;$<Ue;$++){const me=Y(G[$],X[$],ge);de(me.x,me.y,d+ie)}for(let $=0,Ue=L.length;$<Ue;$++){const me=L[$];oe=Q[$];for(let we=0,N=me.length;we<N;we++){const b=Y(me[we],oe[we],ge);_?de(b.x,b.y+x[u-1].y,x[u-1].x+ie):de(b.x,b.y,d+ie)}}}j(),se();function j(){const P=r.length/3;if(h){let le=0,ie=W*le;for(let ge=0;ge<ne;ge++){const $=F[ge];De($[2]+ie,$[1]+ie,$[0]+ie)}le=u+g*2,ie=W*le;for(let ge=0;ge<ne;ge++){const $=F[ge];De($[0]+ie,$[1]+ie,$[2]+ie)}}else{for(let le=0;le<ne;le++){const ie=F[le];De(ie[2],ie[1],ie[0])}for(let le=0;le<ne;le++){const ie=F[le];De(ie[0]+W*u,ie[1]+W*u,ie[2]+W*u)}}i.addGroup(P,r.length/3-P,0)}function se(){const P=r.length/3;let le=0;xe(G,le),le+=G.length;for(let ie=0,ge=L.length;ie<ge;ie++){const $=L[ie];xe($,le),le+=$.length}i.addGroup(P,r.length/3-P,1)}function xe(P,le){let ie=P.length;for(;--ie>=0;){const ge=ie;let $=ie-1;$<0&&($=P.length-1);for(let Ue=0,me=u+g*2;Ue<me;Ue++){const we=W*Ue,N=W*(Ue+1),b=le+ge+we,z=le+$+we,J=le+$+N,Z=le+ge+N;He(b,z,J,Z)}}}function de(P,le,ie){l.push(P),l.push(le),l.push(ie)}function De(P,le,ie){Be(P),Be(le),Be(ie);const ge=r.length/3,$=v.generateTopUV(i,r,ge-3,ge-2,ge-1);it($[0]),it($[1]),it($[2])}function He(P,le,ie,ge){Be(P),Be(le),Be(ge),Be(le),Be(ie),Be(ge);const $=r.length/3,Ue=v.generateSideWallUV(i,r,$-6,$-3,$-2,$-1);it(Ue[0]),it(Ue[1]),it(Ue[3]),it(Ue[1]),it(Ue[2]),it(Ue[3])}function Be(P){r.push(l[P*3+0]),r.push(l[P*3+1]),r.push(l[P*3+2])}function it(P){s.push(P.x),s.push(P.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return oN(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new ud[r.type]().fromJSON(r)),new eh(i,e.options)}}const sN={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new K(s,o),new K(a,l),new K(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],d=e[i*3+2],h=e[r*3],p=e[r*3+1],m=e[r*3+2],y=e[s*3],g=e[s*3+1],f=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new K(o,1-l),new K(c,1-d),new K(h,1-m),new K(y,1-f)]:[new K(a,1-l),new K(u,1-d),new K(p,1-m),new K(g,1-f)]}};function oN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class th extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[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(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new th(e.radius,e.detail)}}class Dl extends Fr{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Dl(e.radius,e.detail)}}class nh extends $e{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let d=e;const h=(t-e)/r,p=new I,m=new K;for(let y=0;y<=r;y++){for(let g=0;g<=i;g++){const f=s+g/i*o;p.x=d*Math.cos(f),p.y=d*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,u.push(m.x,m.y)}d+=h}for(let y=0;y<r;y++){const g=y*(i+1);for(let f=0;f<i;f++){const v=f+g,x=v,_=v+i+1,R=v+i+2,M=v+1;a.push(x,_,M),a.push(_,R,M)}}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ih extends $e{constructor(e=new gs([new K(0,.5),new K(-.5,-.5),new K(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Ce(r,3)),this.setAttribute("normal",new Ce(s,3)),this.setAttribute("uv",new Ce(o,2));function c(u){const d=r.length/3,h=u.extractPoints(t);let p=h.shape;const m=h.holes;bi.isClockWise(p)===!1&&(p=p.reverse());for(let g=0,f=m.length;g<f;g++){const v=m[g];bi.isClockWise(v)===!0&&(m[g]=v.reverse())}const y=bi.triangulateShape(p,m);for(let g=0,f=m.length;g<f;g++){const v=m[g];p=p.concat(v)}for(let g=0,f=p.length;g<f;g++){const v=p[g];r.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let g=0,f=y.length;g<f;g++){const v=y[g],x=v[0]+d,_=v[1]+d,R=v[2]+d;i.push(x,_,R),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return aN(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new ih(i,e.curveSegments)}}function aN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Ul extends $e{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],d=new I,h=new I,p=[],m=[],y=[],g=[];for(let f=0;f<=i;f++){const v=[],x=f/i;let _=0;f===0&&o===0?_=.5/t:f===i&&l===Math.PI&&(_=-.5/t);for(let R=0;R<=t;R++){const M=R/t;d.x=-e*Math.cos(r+M*s)*Math.sin(o+x*a),d.y=e*Math.cos(o+x*a),d.z=e*Math.sin(r+M*s)*Math.sin(o+x*a),m.push(d.x,d.y,d.z),h.copy(d).normalize(),y.push(h.x,h.y,h.z),g.push(M+_,1-x),v.push(c++)}u.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){const x=u[f][v+1],_=u[f][v],R=u[f+1][v],M=u[f+1][v+1];(f!==0||o>0)&&p.push(x,_,M),(f!==i-1||l<Math.PI)&&p.push(_,R,M)}this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(y,3)),this.setAttribute("uv",new Ce(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ul(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class rh extends Fr{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rh(e.radius,e.detail)}}class sh extends $e{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new I,d=new I,h=new I;for(let p=0;p<=i;p++)for(let m=0;m<=r;m++){const y=m/r*s,g=p/i*Math.PI*2;d.x=(e+t*Math.cos(g))*Math.cos(y),d.y=(e+t*Math.cos(g))*Math.sin(y),d.z=t*Math.sin(g),a.push(d.x,d.y,d.z),u.x=e*Math.cos(y),u.y=e*Math.sin(y),h.subVectors(d,u).normalize(),l.push(h.x,h.y,h.z),c.push(m/r),c.push(p/i)}for(let p=1;p<=i;p++)for(let m=1;m<=r;m++){const y=(r+1)*p+m-1,g=(r+1)*(p-1)+m-1,f=(r+1)*(p-1)+m,v=(r+1)*p+m;o.push(y,g,v),o.push(g,f,v)}this.setIndex(o),this.setAttribute("position",new Ce(a,3)),this.setAttribute("normal",new Ce(l,3)),this.setAttribute("uv",new Ce(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class oh extends $e{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],d=new I,h=new I,p=new I,m=new I,y=new I,g=new I,f=new I;for(let x=0;x<=i;++x){const _=x/i*s*Math.PI*2;v(_,s,o,e,p),v(_+.01,s,o,e,m),g.subVectors(m,p),f.addVectors(m,p),y.crossVectors(g,f),f.crossVectors(y,g),y.normalize(),f.normalize();for(let R=0;R<=r;++R){const M=R/r*Math.PI*2,T=-t*Math.cos(M),A=t*Math.sin(M);d.x=p.x+(T*f.x+A*y.x),d.y=p.y+(T*f.y+A*y.y),d.z=p.z+(T*f.z+A*y.z),l.push(d.x,d.y,d.z),h.subVectors(d,p).normalize(),c.push(h.x,h.y,h.z),u.push(x/i),u.push(R/r)}}for(let x=1;x<=i;x++)for(let _=1;_<=r;_++){const R=(r+1)*(x-1)+(_-1),M=(r+1)*x+(_-1),T=(r+1)*x+_,A=(r+1)*(x-1)+_;a.push(R,M,A),a.push(M,T,A)}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(u,2));function v(x,_,R,M,T){const A=Math.cos(x),E=Math.sin(x),w=R/_*x,L=Math.cos(w);T.x=M*(2+L)*.5*A,T.y=M*(2+L)*E*.5,T.z=M*Math.sin(w)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ah extends $e{constructor(e=new pg(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new I,l=new I,c=new K;let u=new I;const d=[],h=[],p=[],m=[];y(),this.setIndex(m),this.setAttribute("position",new Ce(d,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(p,2));function y(){for(let x=0;x<t;x++)g(x);g(s===!1?t:0),v(),f()}function g(x){u=e.getPointAt(x/t,u);const _=o.normals[x],R=o.binormals[x];for(let M=0;M<=r;M++){const T=M/r*Math.PI*2,A=Math.sin(T),E=-Math.cos(T);l.x=E*_.x+A*R.x,l.y=E*_.y+A*R.y,l.z=E*_.z+A*R.z,l.normalize(),h.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,d.push(a.x,a.y,a.z)}}function f(){for(let x=1;x<=t;x++)for(let _=1;_<=r;_++){const R=(r+1)*(x-1)+(_-1),M=(r+1)*x+(_-1),T=(r+1)*x+_,A=(r+1)*(x-1)+_;m.push(R,M,A),m.push(M,T,A)}}function v(){for(let x=0;x<=t;x++)for(let _=0;_<=r;_++)c.x=x/t,c.y=_/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ah(new ud[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class kM extends $e{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new I,s=new I;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const d=l[c],h=d.start,p=d.count;for(let m=h,y=h+p;m<y;m+=3)for(let g=0;g<3;g++){const f=a.getX(m+g),v=a.getX(m+(g+1)%3);r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,v),fv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,d=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,d),fv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ce(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function fv(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var pv=Object.freeze({__proto__:null,BoxGeometry:Cs,CapsuleGeometry:qd,CircleGeometry:Zd,ConeGeometry:Kd,CylinderGeometry:Xo,DodecahedronGeometry:Jd,EdgesGeometry:NM,ExtrudeGeometry:eh,IcosahedronGeometry:th,LatheGeometry:Ll,OctahedronGeometry:Dl,PlaneGeometry:Wo,PolyhedronGeometry:Fr,RingGeometry:nh,ShapeGeometry:ih,SphereGeometry:Ul,TetrahedronGeometry:rh,TorusGeometry:sh,TorusKnotGeometry:oh,TubeGeometry:ah,WireframeGeometry:kM});class OM extends on{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ye(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class FM extends ci{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gg extends on{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ye(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 ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(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 On,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class BM extends gg{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new K(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return At(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ye(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 ye(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ye(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class zM extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ye(16777215),this.specular=new ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class VM extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ye(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class HM extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class GM extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class WM extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jM extends xn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function us(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function XM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function YM(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function zp(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function xg(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function lN(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),d=[],h=[];for(let p=0;p<c.times.length;++p){const m=c.times[p]*r;if(!(m<t||m>=i)){d.push(c.times[p]);for(let y=0;y<u;++y)h.push(c.values[p*u+y])}}d.length!==0&&(c.times=us(d,c.times.constructor),c.values=us(h,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function cN(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(f){return f.name===a.name&&f.ValueTypeName===l});if(c===void 0)continue;let u=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let h=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);const m=a.times.length-1;let y;if(s<=a.times[0]){const f=u,v=d-u;y=a.values.slice(f,v)}else if(s>=a.times[m]){const f=m*d+u,v=f+d-u;y=a.values.slice(f,v)}else{const f=a.createInterpolant(),v=u,x=d-u;f.evaluate(s),y=f.resultBuffer.slice(v,x)}l==="quaternion"&&new En().fromArray(y).normalize().conjugate().toArray(y);const g=c.times.length;for(let f=0;f<g;++f){const v=f*p+h;if(l==="quaternion")En.multiplyQuaternionsFlat(c.values,v,y,0,c.values,v);else{const x=p-h*2;for(let _=0;_<x;++_)c.values[v+_]-=y[_]}}}return n.blendMode=Km,n}const uN={convertArray:us,isTypedArray:XM,getKeyframeOrder:YM,sortedArray:zp,flattenJSON:xg,subclip:lN,makeClipAdditive:cN};class kl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class $M extends kl{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case ls:s=e,a=2*t-i;break;case ll:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:o=e,l=2*i-t;break;case ll:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,d=this._offsetNext,h=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),y=m*m,g=y*m,f=-h*g+2*h*y-h*m,v=(1+h)*g+(-1.5-2*h)*y+(-.5+h)*m+1,x=(-1-p)*g+(1.5+p)*y+.5*m,_=p*g-p*y;for(let R=0;R!==a;++R)s[R]=f*o[u+R]+v*o[c+R]+x*o[l+R]+_*o[d+R];return s}}class vg extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),d=1-u;for(let h=0;h!==a;++h)s[h]=o[c+h]*d+o[l+h]*u;return s}}class qM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class di{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=us(t,this.TimeBufferType),this.values=us(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:us(e.times,Array),values:us(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new qM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $M(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case al:t=this.InterpolantFactoryMethodDiscrete;break;case ad:t=this.InterpolantFactoryMethodLinear;break;case au:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return al;case this.InterpolantFactoryMethodLinear:return ad;case this.InterpolantFactoryMethodSmooth:return au}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&XM(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===au,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const d=a*i,h=d-i,p=d+i;for(let m=0;m!==i;++m){const y=t[d+m];if(y!==t[h+m]||y!==t[p+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const d=a*i,h=o*i;for(let p=0;p!==i;++p)t[h+p]=t[d+p]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}di.prototype.TimeBufferType=Float32Array;di.prototype.ValueBufferType=Float32Array;di.prototype.DefaultInterpolation=ad;class Rs extends di{constructor(e,t,i){super(e,t,i)}}Rs.prototype.ValueTypeName="bool";Rs.prototype.ValueBufferType=Array;Rs.prototype.DefaultInterpolation=al;Rs.prototype.InterpolantFactoryMethodLinear=void 0;Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class yg extends di{}yg.prototype.ValueTypeName="color";class yl extends di{}yl.prototype.ValueTypeName="number";class ZM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)En.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ol extends di{InterpolantFactoryMethodLinear(e){return new ZM(this.times,this.values,this.getValueSize(),e)}}Ol.prototype.ValueTypeName="quaternion";Ol.prototype.InterpolantFactoryMethodSmooth=void 0;class Ps extends di{constructor(e,t,i){super(e,t,i)}}Ps.prototype.ValueTypeName="string";Ps.prototype.ValueBufferType=Array;Ps.prototype.DefaultInterpolation=al;Ps.prototype.InterpolantFactoryMethodLinear=void 0;Ps.prototype.InterpolantFactoryMethodSmooth=void 0;class _l extends di{}_l.prototype.ValueTypeName="vector";class Sl{constructor(e="",t=-1,i=[],r=kd){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(hN(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(di.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=YM(l);l=zp(l,1,u),c=zp(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new yl(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let h=r[d];h||(r[d]=h=[]),h.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,h,p,m,y){if(p.length!==0){const g=[],f=[];xg(p,g,f,m),g.length!==0&&y.push(new d(h,g,f))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const h=c[d].keys;if(!(!h||h.length===0))if(h[0].morphTargets){const p={};let m;for(m=0;m<h.length;m++)if(h[m].morphTargets)for(let y=0;y<h[m].morphTargets.length;y++)p[h[m].morphTargets[y]]=-1;for(const y in p){const g=[],f=[];for(let v=0;v!==h[m].morphTargets.length;++v){const x=h[m];g.push(x.time),f.push(x.morphTarget===y?1:0)}r.push(new yl(".morphTargetInfluence["+y+"]",g,f))}l=p.length*o}else{const p=".bones["+t[d].name+"]";i(_l,p+".position",h,"pos",r),i(Ol,p+".quaternion",h,"rot",r),i(_l,p+".scale",h,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function dN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return yl;case"vector":case"vector2":case"vector3":case"vector4":return _l;case"color":return yg;case"quaternion":return Ol;case"bool":case"boolean":return Rs;case"string":return Ps}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function hN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=dN(n.type);if(n.times===void 0){const t=[],i=[];xg(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Hi={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class _g{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,h=c.length;d<h;d+=2){const p=c[d],m=c[d+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}}const KM=new _g;class Tn{constructor(e){this.manager=e!==void 0?e:KM,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Tn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ui={};class fN extends Error{constructor(e,t){super(e),this.response=t}}class Qi extends Tn{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Hi.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ui[e]!==void 0){Ui[e].push({onLoad:t,onProgress:i,onError:r});return}Ui[e]=[],Ui[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Ui[e],d=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,m=p!==0;let y=0;const g=new ReadableStream({start(f){v();function v(){d.read().then(({done:x,value:_})=>{if(x)f.close();else{y+=_.byteLength;const R=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let M=0,T=u.length;M<T;M++){const A=u[M];A.onProgress&&A.onProgress(R)}f.enqueue(_),v()}},x=>{f.error(x)})}}});return new Response(g)}else throw new fN(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),h=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Hi.add(e,c);const u=Ui[e];delete Ui[e];for(let d=0,h=u.length;d<h;d++){const p=u[d];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Ui[e];if(u===void 0)throw this.manager.itemError(e),c;delete Ui[e];for(let d=0,h=u.length;d<h;d++){const p=u[d];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class pN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Sl.parse(e[i]);t.push(r)}return t}}class mN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new Yd,l=new Qi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(d){l.load(e[d],function(h){const p=s.parse(h,!0);o[d]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let d=0,h=e.length;d<h;++d)u(d);else l.load(e,function(d){const h=s.parse(d,!0);if(h.isCubemap){const p=h.mipmaps.length/h.mipmapCount;for(let m=0;m<p;m++){o[m]={mipmaps:[]};for(let y=0;y<h.mipmapCount;y++)o[m].mipmaps.push(h.mipmaps[m*h.mipmapCount+y]),o[m].format=h.format,o[m].width=h.width,o[m].height=h.height}a.image=o}else a.image.width=h.width,a.image.height=h.height,a.mipmaps=h.mipmaps;h.mipmapCount===1&&(a.minFilter=Ut),a.format=h.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Ml extends Tn{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=pl("img");function l(){u(),Hi.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(d){u(),r&&r(d),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class gN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Il;s.colorSpace=Hn;const o=new Ml(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class xN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new wi,a=new Qi(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Xn,o.wrapT=c.wrapT!==void 0?c.wrapT:Xn,o.magFilter=c.magFilter!==void 0?c.magFilter:Ut,o.minFilter=c.minFilter!==void 0?c.minFilter:Ut,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=yi),c.mipmapCount===1&&(o.minFilter=Ut),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class vN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Ct,o=new Ml(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Br extends nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class JM extends Br{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Pf=new ke,mv=new I,gv=new I;class Sg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nl,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;mv.setFromMatrixPosition(e.matrixWorld),t.position.copy(mv),gv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(gv),t.updateMatrixWorld(),Pf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pf),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Pf)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class yN extends Sg{constructor(){super(new $t(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Uo*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class QM extends Br{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new yN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const xv=new ke,pa=new I,If=new I;class _N extends Sg{constructor(){super(new $t(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new ct(2,1,1,1),new ct(0,1,1,1),new ct(3,1,1,1),new ct(1,1,1,1),new ct(3,0,1,1),new ct(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),pa.setFromMatrixPosition(e.matrixWorld),i.position.copy(pa),If.copy(i.position),If.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(If),i.updateMatrixWorld(),r.makeTranslation(-pa.x,-pa.y,-pa.z),xv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xv)}}class ew extends Br{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new _N}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class SN extends Sg{constructor(){super(new Vd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class tw extends Br{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.shadow=new SN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class nw extends Br{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class iw extends Br{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class rw{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new I)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class sw extends Br{constructor(e=new rw,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class lh extends Tn{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=lh.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new ye().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new ye().setHex(o.value);break;case"v2":r.uniforms[s].value=new K().fromArray(o.value);break;case"v3":r.uniforms[s].value=new I().fromArray(o.value);break;case"v4":r.uniforms[s].value=new ct().fromArray(o.value);break;case"m3":r.uniforms[s].value=new je().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ke().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new K().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new K().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:OM,SpriteMaterial:ag,RawShaderMaterial:FM,ShaderMaterial:ci,PointsMaterial:cg,MeshPhysicalMaterial:BM,MeshStandardMaterial:gg,MeshPhongMaterial:zM,MeshToonMaterial:VM,MeshNormalMaterial:HM,MeshLambertMaterial:GM,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshBasicMaterial:Or,MeshMatcapMaterial:WM,LineDashedMaterial:jM,LineBasicMaterial:xn,Material:on};return new t[e]}}class Vp{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class ow extends $e{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class aw extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(p,m){if(t[m]!==void 0)return t[m];const g=p.interleavedBuffers[m],f=s(p,g.buffer),v=po(g.type,f),x=new jd(v,g.stride);return x.uuid=g.uuid,t[m]=x,x}function s(p,m){if(i[m]!==void 0)return i[m];const g=p.arrayBuffers[m],f=new Uint32Array(g).buffer;return i[m]=f,f}const o=e.isInstancedBufferGeometry?new ow:new $e,a=e.data.index;if(a!==void 0){const p=po(a.type,a.array);o.setIndex(new ht(p,1))}const l=e.data.attributes;for(const p in l){const m=l[p];let y;if(m.isInterleavedBufferAttribute){const g=r(e.data,m.data);y=new bs(g,m.itemSize,m.offset,m.normalized)}else{const g=po(m.type,m.array),f=m.isInstancedBufferAttribute?Oo:ht;y=new f(g,m.itemSize,m.normalized)}m.name!==void 0&&(y.name=m.name),m.usage!==void 0&&y.setUsage(m.usage),o.setAttribute(p,y)}const c=e.data.morphAttributes;if(c)for(const p in c){const m=c[p],y=[];for(let g=0,f=m.length;g<f;g++){const v=m[g];let x;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);x=new bs(_,v.itemSize,v.offset,v.normalized)}else{const _=po(v.type,v.array);x=new ht(_,v.itemSize,v.normalized)}v.name!==void 0&&(x.name=v.name),y.push(x)}o.morphAttributes[p]=y}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let p=0,m=d.length;p!==m;++p){const y=d[p];o.addGroup(y.start,y.count,y.materialIndex)}const h=e.data.boundingSphere;if(h!==void 0){const p=new I;h.center!==void 0&&p.fromArray(h.center),o.boundingSphere=new rn(p,h.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class MN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Vp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Qi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Vp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Qi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let d=!1;for(const h in o)if(o[h].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new gs().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Xd().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new aw;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in pv?a=pv[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new lh;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Sl.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:po(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new _g(t);s=new Ml(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],h=d.url;if(Array.isArray(h)){const p=[];for(let m=0,y=h.length;m<y;m++){const g=h[m],f=a(g);f!==null&&(f instanceof HTMLImageElement?p.push(f):p.push(new wi(f.data,f.width,f.height)))}r[d.uuid]=new cs(p)}else{const p=a(d.url);r[d.uuid]=new cs(p)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:po(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Ml(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let d=0,h=c.length;d<h;d++){const p=c[d],m=await s(p);m!==null&&(m instanceof HTMLImageElement?u.push(m):u.push(new wi(m.data,m.width,m.height)))}i[l.uuid]=new cs(u)}else{const u=await s(l.url);i[l.uuid]=new cs(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Il,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new wi:u=new Ct,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,wN)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],vv),u.wrapT=i(a.wrap[1],vv)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,yv)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,yv)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(h){return t[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){const p=[];for(let m=0,y=h.length;m<y;m++){const g=h[m];i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),p.push(i[g])}return p}return i[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",h),i[h]}}function c(h){return r[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",h),r[h]}let u,d;switch(e.type){case"Scene":o=new vM,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new ye(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Wd(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Gd(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new $t(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Vd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new nw(e.color,e.intensity);break;case"DirectionalLight":o=new tw(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new ew(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new iw(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new QM(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new JM(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new sw().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),d=l(e.material),o=new MM(u,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),d=l(e.material),o=new kt(u,d);break;case"InstancedMesh":u=a(e.geometry),d=l(e.material);const h=e.count,p=e.instanceMatrix,m=e.instanceColor;o=new wM(u,d,h),o.instanceMatrix=new Oo(new Float32Array(p.array),16),m!==void 0&&(o.instanceColor=new Oo(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":u=a(e.geometry),d=l(e.material),o=new bM(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(y=>{const g=new pn;g.min.fromArray(y.boxMin),g.max.fromArray(y.boxMax);const f=new rn;return f.radius=y.sphereRadius,f.center.fromArray(y.sphereCenter),{boxInitialized:y.boxInitialized,box:g,sphereInitialized:y.sphereInitialized,sphere:f}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new SM;break;case"Line":o=new Nr(a(e.geometry),l(e.material));break;case"LineLoop":o=new EM(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ai(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new TM(a(e.geometry),l(e.material));break;case"Sprite":o=new _M(l(e.material));break;case"Group":o=new go;break;case"Bone":o=new lg;break;default:o=new nt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const h=e.children;for(let p=0;p<h.length;p++)o.add(this.parseObject(h[p],t,i,r,s))}if(e.animations!==void 0){const h=e.animations;for(let p=0;p<h.length;p++){const m=h[p];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const h=e.levels;for(let p=0;p<h.length;p++){const m=h[p],y=o.getObjectByProperty("uuid",m.object);y!==void 0&&o.addLevel(y,m.distance,m.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new nt}})}}const wN={UVMapping:Rd,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,CubeUVReflectionMapping:Vo},vv={RepeatWrapping:sl,ClampToEdgeWrapping:Xn,MirroredRepeatWrapping:ol},yv={NearestFilter:Gt,NearestMipmapNearestFilter:Vm,NearestMipmapLinearFilter:fo,LinearFilter:Ut,LinearMipmapNearestFilter:Pa,LinearMipmapLinearFilter:yi};class bN extends Tn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hi.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Hi.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hi.add(e,l),s.manager.itemStart(e)}}let Hc;class Mg{static getContext(){return Hc===void 0&&(Hc=new(window.AudioContext||window.webkitAudioContext)),Hc}static setContext(e){Hc=e}}class EN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);Mg.getContext().decodeAudioData(c,function(d){t(d)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const _v=new ke,Sv=new ke,$r=new ke;class TN{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new $t,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new $t,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,$r.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(ms*t.fov*.5)/t.zoom;let a,l;Sv.elements[12]=-r,_v.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,$r.elements[0]=2*t.near/(l-a),$r.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy($r),a=-o*t.aspect-s,l=o*t.aspect-s,$r.elements[0]=2*t.near/(l-a),$r.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy($r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Sv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_v)}}class lw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Mv(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Mv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Mv(){return(typeof performance>"u"?Date:performance).now()}const qr=new I,wv=new En,AN=new I,Zr=new I;class CN extends nt{constructor(){super(),this.type="AudioListener",this.context=Mg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new lw}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(qr,wv,AN),Zr.set(0,0,-1).applyQuaternion(wv),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(qr.x,r),t.positionY.linearRampToValueAtTime(qr.y,r),t.positionZ.linearRampToValueAtTime(qr.z,r),t.forwardX.linearRampToValueAtTime(Zr.x,r),t.forwardY.linearRampToValueAtTime(Zr.y,r),t.forwardZ.linearRampToValueAtTime(Zr.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(qr.x,qr.y,qr.z),t.setOrientation(Zr.x,Zr.y,Zr.z,i.x,i.y,i.z)}}class cw extends nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.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(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Kr=new I,bv=new En,RN=new I,Jr=new I;class PN extends cw{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Kr,bv,RN),Jr.set(0,0,1).applyQuaternion(bv);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kr.x,i),t.positionY.linearRampToValueAtTime(Kr.y,i),t.positionZ.linearRampToValueAtTime(Kr.z,i),t.orientationX.linearRampToValueAtTime(Jr.x,i),t.orientationY.linearRampToValueAtTime(Jr.y,i),t.orientationZ.linearRampToValueAtTime(Jr.z,i)}else t.setPosition(Kr.x,Kr.y,Kr.z),t.setOrientation(Jr.x,Jr.y,Jr.z)}}class IN{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class uw{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){En.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;En.multiplyQuaternionsFlat(e,o,e,t,e,i),En.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const wg="\\[\\]\\.:\\/",NN=new RegExp("["+wg+"]","g"),bg="[^"+wg+"]",LN="[^"+wg.replace("\\.","")+"]",DN=/((?:WC+[\/:])*)/.source.replace("WC",bg),UN=/(WCOD+)?/.source.replace("WCOD",LN),kN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),ON=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),FN=new RegExp("^"+DN+UN+kN+ON+"$"),BN=["material","materials","bones","map"];class zN{constructor(e,t,i){const r=i||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class et{constructor(e,t,i){this.path=t,this.parsedPath=i||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new et.Composite(e,t,i):new et(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(NN,"")}static parseTrackName(e){const t=FN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);BN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=et.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}et.Composite=zN;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class VN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,d=arguments.length;u!==d;++u){const h=arguments[u],p=h.uuid;let m=t[p];if(m===void 0){m=l++,t[p]=m,e.push(h);for(let y=0,g=o;y!==g;++y)s[y].push(new et(h,i[y],r[y]))}else if(m<c){a=e[m];const y=--c,g=e[y];t[g.uuid]=m,e[m]=g,t[p]=y,e[y]=h;for(let f=0,v=o;f!==v;++f){const x=s[f],_=x[y];let R=x[m];x[m]=_,R===void 0&&(R=new et(h,i[f],r[f])),x[y]=R}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let p=0,m=r;p!==m;++p){const y=i[p],g=y[d],f=y[u];y[u]=g,y[d]=f}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){const h=--s,p=e[h],m=--o,y=e[m];t[p.uuid]=d,e[d]=p,t[y.uuid]=h,e[h]=y,e.pop();for(let g=0,f=r;g!==f;++g){const v=i[g],x=v[h],_=v[m];v[d]=x,v[h]=_,v.pop()}}else{const h=--o,p=e[h];h>0&&(t[p.uuid]=d),e[d]=p,e.pop();for(let m=0,y=r;m!==y;++m){const g=i[m];g[d]=g[h],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(d);for(let h=u,p=l.length;h!==p;++h){const m=l[h];d[h]=new et(m,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class dw{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:as,endingEnd:as};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=WS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Km:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case kd:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===jS;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===GS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ls,r.endingEnd=ls):(e?r.endingStart=this.zeroSlopeAtStart?ls:as:r.endingStart=ll,t?r.endingEnd=this.zeroSlopeAtEnd?ls:as:r.endingEnd=ll)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const HN=new Float32Array(1);class GN extends Ti{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const h=r[d],p=h.name;let m=u[p];if(m!==void 0)++m.referenceCount,o[d]=m;else{if(m=o[d],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const y=t&&t._propertyBindings[d].binding.parsedPath;m=new uw(et.create(i,p,y),h.ValueTypeName,h.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),o[d]=m}a[d].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new vg(new Float32Array(2),new Float32Array(2),1,HN),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Sl.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=kd),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new dw(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Eg{constructor(e){this.value=e}clone(){return new Eg(this.value.clone===void 0?this.value:this.value.clone())}}let WN=0;class jN extends Ti{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:WN++}),this.name="",this.usage=hl,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class XN extends jd{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class YN{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Ev=new ke;class $N{constructor(e,t,i=0,r=1/0){this.ray=new Go(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Bd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Ev.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Ev),this}intersectObject(e,t=!0,i=[]){return Hp(e,this,i,t),i.sort(Tv),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Hp(e[r],this,i,t);return i.sort(Tv),i}}function Tv(n,e){return n.distance-e.distance}function Hp(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Hp(s[o],e,t,!0)}}class qN{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(At(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class ZN{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Tg{constructor(e,t,i,r){Tg.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const Av=new K;class KN{constructor(e=new K(1/0,1/0),t=new K(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Av.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Av).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Cv=new I,Gc=new I;class JN{constructor(e=new I,t=new I){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Cv.subVectors(e,this.start),Gc.subVectors(this.end,this.start);const i=Gc.dot(Gc);let s=Gc.dot(Cv)/i;return t&&(s=At(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Rv=new I;class QN extends nt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new $e,r=[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 o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Ce(r,3));const s=new xn({fog:!1,toneMapped:!1});this.cone=new Ai(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Rv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Rv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const hr=new I,Wc=new ke,Nf=new ke;class e3 extends Ai{constructor(e){const t=hw(e),i=new $e,r=[],s=[],o=new ye(0,0,1),a=new ye(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Ce(r,3)),i.setAttribute("color",new Ce(s,3));const l=new xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");Nf.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Wc.multiplyMatrices(Nf,a.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o,hr.x,hr.y,hr.z),Wc.multiplyMatrices(Nf,a.parent.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o+1,hr.x,hr.y,hr.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function hw(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,hw(n.children[t]));return e}class t3 extends kt{constructor(e,t,i){const r=new Ul(t,4,2),s=new Or({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const n3=new I,Pv=new ye,Iv=new ye;class i3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Dl(t);r.rotateY(Math.PI*.5),this.material=new Or({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new ht(o,3)),this.add(new kt(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Pv.copy(this.light.color),Iv.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?Pv:Iv;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(n3.setFromMatrixPosition(this.light.matrixWorld).negate())}}class r3 extends Ai{constructor(e=10,t=10,i=4473924,r=8947848){i=new ye(i),r=new ye(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let h=0,p=0,m=-a;h<=t;h++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const y=h===s?i:r;y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3}const u=new $e;u.setAttribute("position",new Ce(l,3)),u.setAttribute("color",new Ce(c,3));const d=new xn({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class s3 extends Ai{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new ye(s),o=new ye(o);const a=[],l=[];if(t>1)for(let d=0;d<t;d++){const h=d/t*(Math.PI*2),p=Math.sin(h)*e,m=Math.cos(h)*e;a.push(0,0,0),a.push(p,0,m);const y=d&1?s:o;l.push(y.r,y.g,y.b),l.push(y.r,y.g,y.b)}for(let d=0;d<i;d++){const h=d&1?s:o,p=e-e/i*d;for(let m=0;m<r;m++){let y=m/r*(Math.PI*2),g=Math.sin(y)*p,f=Math.cos(y)*p;a.push(g,0,f),l.push(h.r,h.g,h.b),y=(m+1)/r*(Math.PI*2),g=Math.sin(y)*p,f=Math.cos(y)*p,a.push(g,0,f),l.push(h.r,h.g,h.b)}}const c=new $e;c.setAttribute("position",new Ce(a,3)),c.setAttribute("color",new Ce(l,3));const u=new xn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Nv=new I,jc=new I,Lv=new I;class o3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new $e;r.setAttribute("position",new Ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new xn({fog:!1,toneMapped:!1});this.lightPlane=new Nr(r,s),this.add(this.lightPlane),r=new $e,r.setAttribute("position",new Ce([0,0,0,0,0,1],3)),this.targetLine=new Nr(r,s),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),Nv.setFromMatrixPosition(this.light.matrixWorld),jc.setFromMatrixPosition(this.light.target.matrixWorld),Lv.subVectors(jc,Nv),this.lightPlane.lookAt(jc),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(jc),this.targetLine.scale.z=Lv.length()}}const Xc=new I,Et=new zd;class a3 extends Ai{constructor(e){const t=new $e,i=new xn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(m,y){l(m),l(y)}function l(m){r.push(0,0,0),s.push(0,0,0),o[m]===void 0&&(o[m]=[]),o[m].push(r.length/3-1)}t.setAttribute("position",new Ce(r,3)),t.setAttribute("color",new Ce(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new ye(16755200),u=new ye(16711680),d=new ye(43775),h=new ye(16777215),p=new ye(3355443);this.setColors(c,u,d,h,p)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Rt("c",t,e,Et,0,0,-1),Rt("t",t,e,Et,0,0,1),Rt("n1",t,e,Et,-i,-r,-1),Rt("n2",t,e,Et,i,-r,-1),Rt("n3",t,e,Et,-i,r,-1),Rt("n4",t,e,Et,i,r,-1),Rt("f1",t,e,Et,-i,-r,1),Rt("f2",t,e,Et,i,-r,1),Rt("f3",t,e,Et,-i,r,1),Rt("f4",t,e,Et,i,r,1),Rt("u1",t,e,Et,i*.7,r*1.1,-1),Rt("u2",t,e,Et,-i*.7,r*1.1,-1),Rt("u3",t,e,Et,0,r*2,-1),Rt("cf1",t,e,Et,-i,0,1),Rt("cf2",t,e,Et,i,0,1),Rt("cf3",t,e,Et,0,-r,1),Rt("cf4",t,e,Et,0,r,1),Rt("cn1",t,e,Et,-i,0,-1),Rt("cn2",t,e,Et,i,0,-1),Rt("cn3",t,e,Et,0,-r,-1),Rt("cn4",t,e,Et,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Rt(n,e,t,i,r,s,o){Xc.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Xc.x,Xc.y,Xc.z)}}const Yc=new pn;class l3 extends Ai{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new $e;s.setIndex(new ht(i,1)),s.setAttribute("position",new ht(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Yc.setFromObject(this.object),Yc.isEmpty())return;const t=Yc.min,i=Yc.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class c3 extends Ai{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),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],s=new $e;s.setIndex(new ht(i,1)),s.setAttribute("position",new Ce(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class u3 extends Nr{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new $e;o.setAttribute("position",new Ce(s,3)),o.computeBoundingSphere(),super(o,new xn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new $e;l.setAttribute("position",new Ce(a,3)),l.computeBoundingSphere(),this.add(new kt(l,new Or({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Dv=new I;let $c,Lf;class d3 extends nt{constructor(e=new I(0,0,1),t=new I(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",$c===void 0&&($c=new $e,$c.setAttribute("position",new Ce([0,0,0,0,1,0],3)),Lf=new Xo(0,.5,1,5,1),Lf.translate(0,-.5,0)),this.position.copy(t),this.line=new Nr($c,new xn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Lf,new Or({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Dv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Dv,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class h3 extends Ai{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new $e;r.setAttribute("position",new Ce(t,3)),r.setAttribute("color",new Ce(i,3));const s=new xn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new ye,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class f3{constructor(){this.type="ShapePath",this.color=new ye,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ml,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(f){const v=[];for(let x=0,_=f.length;x<_;x++){const R=f[x],M=new gs;M.curves=R.curves,v.push(M)}return v}function i(f,v){const x=v.length;let _=!1;for(let R=x-1,M=0;M<x;R=M++){let T=v[R],A=v[M],E=A.x-T.x,w=A.y-T.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(T=v[M],E=-E,A=v[R],w=-w),f.y<T.y||f.y>A.y)continue;if(f.y===T.y){if(f.x===T.x)return!0}else{const L=w*(f.x-T.x)-E*(f.y-T.y);if(L===0)return!0;if(L<0)continue;_=!_}}else{if(f.y!==T.y)continue;if(A.x<=f.x&&f.x<=T.x||T.x<=f.x&&f.x<=A.x)return!0}}return _}const r=bi.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new gs,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const d=[],h=[];let p=[],m=0,y;h[m]=void 0,p[m]=[];for(let f=0,v=s.length;f<v;f++)a=s[f],y=a.getPoints(),o=r(y),o=e?!o:o,o?(!u&&h[m]&&m++,h[m]={s:new gs,p:y},h[m].s.curves=a.curves,u&&m++,p[m]=[]):p[m].push({h:a,p:y[0]});if(!h[0])return t(s);if(h.length>1){let f=!1,v=0;for(let x=0,_=h.length;x<_;x++)d[x]=[];for(let x=0,_=h.length;x<_;x++){const R=p[x];for(let M=0;M<R.length;M++){const T=R[M];let A=!0;for(let E=0;E<h.length;E++)i(T.p,h[E].p)&&(x!==E&&v++,A?(A=!1,d[E].push(T)):f=!0);A&&d[x].push(T)}}v>0&&f===!1&&(p=d)}let g;for(let f=0,v=h.length;f<v;f++){l=h[f].s,c.push(l),g=p[f];for(let x=0,_=g.length;x<_;x++)l.holes.push(g[x].h)}return c}}class p3 extends Ti{constructor(e,t){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class m3 extends li{constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Cd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Cd);const j3=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:FS,AddEquation:vr,AddOperation:DS,AdditiveAnimationBlendMode:Km,AdditiveBlending:Cp,AgXToneMapping:zS,AlphaFormat:jm,AlwaysCompare:tM,AlwaysDepth:AS,AlwaysStencilFunc:Np,AmbientLight:nw,AnimationAction:dw,AnimationClip:Sl,AnimationLoader:pN,AnimationMixer:GN,AnimationObjectGroup:VN,AnimationUtils:uN,ArcCurve:AM,ArrayCamera:xM,ArrowHelper:d3,AttachedBindMode:Ip,Audio:cw,AudioAnalyser:IN,AudioContext:Mg,AudioListener:CN,AudioLoader:EN,AxesHelper:h3,BackSide:fn,BasicDepthPacking:XS,BasicShadowMap:lT,BatchedMesh:bM,Bone:lg,BooleanKeyframeTrack:Rs,Box2:KN,Box3:pn,Box3Helper:c3,BoxGeometry:Cs,BoxHelper:l3,BufferAttribute:ht,BufferGeometry:$e,BufferGeometryLoader:aw,ByteType:Hm,Cache:Hi,Camera:zd,CameraHelper:a3,CanvasTexture:DI,CapsuleGeometry:qd,CatmullRomCurve3:CM,CineonToneMapping:OS,CircleGeometry:Zd,ClampToEdgeWrapping:Xn,Clock:lw,Color:ye,ColorKeyframeTrack:yg,ColorManagement:rt,CompressedArrayTexture:NI,CompressedCubeTexture:LI,CompressedTexture:Yd,CompressedTextureLoader:mN,ConeGeometry:Kd,ConstantAlphaFactor:bS,ConstantColorFactor:MS,Controls:p3,CubeCamera:cM,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,CubeTexture:Il,CubeTextureLoader:gN,CubeUVReflectionMapping:Vo,CubicBezierCurve:dg,CubicBezierCurve3:RM,CubicInterpolant:$M,CullFaceBack:Ap,CullFaceFront:oS,CullFaceFrontBack:aT,CullFaceNone:sS,Curve:ui,CurvePath:IM,CustomBlending:lS,CustomToneMapping:BS,CylinderGeometry:Xo,Cylindrical:ZN,Data3DTexture:eg,DataArrayTexture:Fd,DataTexture:wi,DataTextureLoader:xN,DataUtils:SA,DecrementStencilOp:MT,DecrementWrapStencilOp:bT,DefaultLoadingManager:KM,DepthFormat:ps,DepthStencilFormat:ws,DepthTexture:rg,DetachedBindMode:HS,DirectionalLight:tw,DirectionalLightHelper:o3,DiscreteInterpolant:qM,DisplayP3ColorSpace:Od,DodecahedronGeometry:Jd,DoubleSide:vi,DstAlphaFactor:xS,DstColorFactor:yS,DynamicCopyUsage:BT,DynamicDrawUsage:LT,DynamicReadUsage:kT,EdgesGeometry:NM,EllipseCurve:$d,EqualCompare:KS,EqualDepth:RS,EqualStencilFunc:CT,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,Euler:On,EventDispatcher:Ti,ExtrudeGeometry:eh,FileLoader:Qi,Float16BufferAttribute:AA,Float32BufferAttribute:Ce,FloatType:Sn,Fog:Wd,FogExp2:Gd,FramebufferTexture:II,FrontSide:Zi,Frustum:Nl,GLBufferAttribute:YN,GLSL1:VT,GLSL3:Lp,GreaterCompare:JS,GreaterDepth:IS,GreaterEqualCompare:eM,GreaterEqualDepth:PS,GreaterEqualStencilFunc:NT,GreaterStencilFunc:PT,GridHelper:r3,Group:go,HalfFloatType:Ho,HemisphereLight:JM,HemisphereLightHelper:i3,IcosahedronGeometry:th,ImageBitmapLoader:bN,ImageLoader:Ml,ImageUtils:rM,IncrementStencilOp:ST,IncrementWrapStencilOp:wT,InstancedBufferAttribute:Oo,InstancedBufferGeometry:ow,InstancedInterleavedBuffer:XN,InstancedMesh:wM,Int16BufferAttribute:EA,Int32BufferAttribute:TA,Int8BufferAttribute:MA,IntType:Pd,InterleavedBuffer:jd,InterleavedBufferAttribute:bs,Interpolant:kl,InterpolateDiscrete:al,InterpolateLinear:ad,InterpolateSmooth:au,InvertStencilOp:ET,KeepStencilOp:ts,KeyframeTrack:di,LOD:SM,LatheGeometry:Ll,Layers:Bd,LessCompare:ZS,LessDepth:CS,LessEqualCompare:Jm,LessEqualDepth:nl,LessEqualStencilFunc:RT,LessStencilFunc:AT,Light:Br,LightProbe:sw,Line:Nr,Line3:JN,LineBasicMaterial:xn,LineCurve:hg,LineCurve3:PM,LineDashedMaterial:jM,LineLoop:EM,LineSegments:Ai,LinearDisplayP3ColorSpace:Pl,LinearFilter:Ut,LinearInterpolant:vg,LinearMipMapLinearFilter:hT,LinearMipMapNearestFilter:dT,LinearMipmapLinearFilter:yi,LinearMipmapNearestFilter:Pa,LinearSRGBColorSpace:tr,LinearToneMapping:US,LinearTransfer:cl,Loader:Tn,LoaderUtils:Vp,LoadingManager:_g,LoopOnce:GS,LoopPingPong:jS,LoopRepeat:WS,LuminanceAlphaFormat:$m,LuminanceFormat:Ym,MOUSE:sT,Material:on,MaterialLoader:lh,MathUtils:rA,Matrix2:Tg,Matrix3:je,Matrix4:ke,MaxEquation:hS,Mesh:kt,MeshBasicMaterial:Or,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshLambertMaterial:GM,MeshMatcapMaterial:WM,MeshNormalMaterial:HM,MeshPhongMaterial:zM,MeshPhysicalMaterial:BM,MeshStandardMaterial:gg,MeshToonMaterial:VM,MinEquation:dS,MirroredRepeatWrapping:ol,MixOperation:LS,MultiplyBlending:Pp,MultiplyOperation:Cl,NearestFilter:Gt,NearestMipMapLinearFilter:uT,NearestMipMapNearestFilter:cT,NearestMipmapLinearFilter:fo,NearestMipmapNearestFilter:Vm,NeutralToneMapping:VS,NeverCompare:qS,NeverDepth:TS,NeverStencilFunc:TT,NoBlending:Wi,NoColorSpace:Fi,NoToneMapping:ji,NormalAnimationBlendMode:kd,NormalBlending:fs,NotEqualCompare:QS,NotEqualDepth:NS,NotEqualStencilFunc:IT,NumberKeyframeTrack:yl,Object3D:nt,ObjectLoader:MN,ObjectSpaceNormalMap:$S,OctahedronGeometry:Dl,OneFactor:pS,OneMinusConstantAlphaFactor:ES,OneMinusConstantColorFactor:wS,OneMinusDstAlphaFactor:vS,OneMinusDstColorFactor:_S,OneMinusSrcAlphaFactor:Du,OneMinusSrcColorFactor:gS,OrthographicCamera:Vd,P3Primaries:dl,PCFShadowMap:zm,PCFSoftShadowMap:aS,PMREMGenerator:Dp,Path:ml,PerspectiveCamera:$t,Plane:mr,PlaneGeometry:Wo,PlaneHelper:u3,PointLight:ew,PointLightHelper:t3,Points:TM,PointsMaterial:cg,PolarGridHelper:s3,PolyhedronGeometry:Fr,PositionalAudio:PN,PropertyBinding:et,PropertyMixer:uw,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,Quaternion:En,QuaternionKeyframeTrack:Ol,QuaternionLinearInterpolant:ZM,RED_GREEN_RGTC2_Format:sd,RED_RGTC1_Format:Zm,REVISION:Cd,RGBADepthPacking:YS,RGBAFormat:dn,RGBAIntegerFormat:Ud,RGBA_ASTC_10x10_Format:Qu,RGBA_ASTC_10x5_Format:Zu,RGBA_ASTC_10x6_Format:Ku,RGBA_ASTC_10x8_Format:Ju,RGBA_ASTC_12x10_Format:ed,RGBA_ASTC_12x12_Format:td,RGBA_ASTC_4x4_Format:Hu,RGBA_ASTC_5x4_Format:Gu,RGBA_ASTC_5x5_Format:Wu,RGBA_ASTC_6x5_Format:ju,RGBA_ASTC_6x6_Format:Xu,RGBA_ASTC_8x5_Format:Yu,RGBA_ASTC_8x6_Format:$u,RGBA_ASTC_8x8_Format:qu,RGBA_BPTC_Format:Ua,RGBA_ETC2_EAC_Format:Vu,RGBA_PVRTC_2BPPV1_Format:Fu,RGBA_PVRTC_4BPPV1_Format:Ou,RGBA_S3TC_DXT1_Format:Na,RGBA_S3TC_DXT3_Format:La,RGBA_S3TC_DXT5_Format:Da,RGBDepthPacking:xT,RGBFormat:Xm,RGBIntegerFormat:fT,RGB_BPTC_SIGNED_Format:nd,RGB_BPTC_UNSIGNED_Format:id,RGB_ETC1_Format:Bu,RGB_ETC2_Format:zu,RGB_PVRTC_2BPPV1_Format:ku,RGB_PVRTC_4BPPV1_Format:Uu,RGB_S3TC_DXT1_Format:Ia,RGDepthPacking:vT,RGFormat:qm,RGIntegerFormat:Dd,RawShaderMaterial:FM,Ray:Go,Raycaster:$N,Rec709Primaries:ul,RectAreaLight:iw,RedFormat:Ld,RedIntegerFormat:Rl,ReinhardToneMapping:kS,RenderTarget:sM,RepeatWrapping:sl,ReplaceStencilOp:_T,ReverseSubtractEquation:uS,RingGeometry:nh,SIGNED_RED_GREEN_RGTC2_Format:od,SIGNED_RED_RGTC1_Format:rd,SRGBColorSpace:Hn,SRGBTransfer:ft,Scene:vM,ShaderChunk:Ye,ShaderLib:ri,ShaderMaterial:ci,ShadowMaterial:OM,Shape:gs,ShapeGeometry:ih,ShapePath:f3,ShapeUtils:bi,ShortType:Gm,Skeleton:Xd,SkeletonHelper:e3,SkinnedMesh:MM,Source:cs,Sphere:rn,SphereGeometry:Ul,Spherical:qN,SphericalHarmonics3:rw,SplineCurve:mg,SpotLight:QM,SpotLightHelper:QN,Sprite:_M,SpriteMaterial:ag,SrcAlphaFactor:Lu,SrcAlphaSaturateFactor:SS,SrcColorFactor:mS,StaticCopyUsage:FT,StaticDrawUsage:hl,StaticReadUsage:UT,StereoCamera:TN,StreamCopyUsage:zT,StreamDrawUsage:DT,StreamReadUsage:OT,StringKeyframeTrack:Ps,SubtractEquation:cS,SubtractiveBlending:Rp,TOUCH:oT,TangentSpaceNormalMap:kr,TetrahedronGeometry:rh,Texture:Ct,TextureLoader:vN,TextureUtils:cI,TorusGeometry:sh,TorusKnotGeometry:oh,Triangle:Nn,TriangleFanDrawMode:gT,TriangleStripDrawMode:mT,TrianglesDrawMode:pT,TubeGeometry:ah,UVMapping:Rd,Uint16BufferAttribute:tg,Uint32BufferAttribute:ng,Uint8BufferAttribute:wA,Uint8ClampedBufferAttribute:bA,Uniform:Eg,UniformsGroup:jN,UniformsLib:fe,UniformsUtils:lM,UnsignedByteType:Ei,UnsignedInt248Type:Ms,UnsignedInt5999Type:Wm,UnsignedIntType:Ji,UnsignedShort4444Type:Id,UnsignedShort5551Type:Nd,UnsignedShortType:Do,VSMShadowMap:gi,Vector2:K,Vector3:I,Vector4:ct,VectorKeyframeTrack:_l,VideoTexture:PI,WebGL3DRenderTarget:dA,WebGLArrayRenderTarget:uA,WebGLCoordinateSystem:_i,WebGLCubeRenderTarget:uM,WebGLMultipleRenderTargets:m3,WebGLRenderTarget:li,WebGLRenderer:yI,WebGLUtils:gM,WebGPUCoordinateSystem:fl,WireframeGeometry:kM,WrapAroundEnding:ll,ZeroCurvatureEnding:as,ZeroFactor:fS,ZeroSlopeEnding:ls,ZeroStencilOp:yT,createCanvasElement:iM},Symbol.toStringTag,{value:"Module"})),ut={controls:null,camera:null,initialPosition:null,initialTarget:null};function X3(n,e){ut.controls=n,ut.camera=e,e&&!ut.initialPosition&&(ut.initialPosition=e.position.clone()),n&&!ut.initialTarget&&(ut.initialTarget=n.target.clone())}function Y3(){ut.controls=null,ut.camera=null}const fw=1.18,Uv=2.5;function pw(n=fw){if(!ut.controls||!ut.camera)return;const e=new I().subVectors(ut.controls.target,ut.camera.position).multiplyScalar(1-1/n);ut.camera.position.add(e),ut.controls.update()}function g3(n=fw){pw(1/n)}function ch(n,e){if(!ut.controls||!ut.camera)return;const t=ut.camera,i=new I().subVectors(ut.controls.target,t.position).normalize(),r=new I().crossVectors(i,t.up).normalize(),s=new I().crossVectors(r,i).normalize(),o=new I().addScaledVector(r,n*Uv).addScaledVector(s,e*Uv);t.position.add(o),ut.controls.target.add(o),ut.controls.update()}const x3=()=>ch(-1,0),v3=()=>ch(1,0),y3=()=>ch(0,1),_3=()=>ch(0,-1);function S3(){!ut.controls||!ut.camera||(ut.initialPosition&&ut.camera.position.copy(ut.initialPosition),ut.initialTarget&&ut.controls.target.copy(ut.initialTarget),ut.controls.update())}function M3(){const n=Ee(_=>_.selectedSessionId),e=Ee(_=>_.sessions),t=Ee(_=>_.missions),i=Ee(_=>_.chatBySessionId),r=Ee(_=>_.selectSession),s=Ee(_=>_.sendPromptTo),[o,a]=Ie.useState("chat"),[l,c]=Ie.useState(""),u=Ie.useRef(null),d=n?e[n]:null,h=Ie.useMemo(()=>n?i[n]??[]:[],[i,n]),p=Ie.useMemo(()=>d?Object.values(t).filter(_=>_.sessionId===d.id).sort((_,R)=>R.startedAt-_.startedAt):[],[t,d]),m=Ie.useMemo(()=>{if(d!=null&&d.currentMissionId)return t[d.currentMissionId]},[t,d]),y=d?ZE(d,m):null;if(Ie.useEffect(()=>{if(o!=="chat")return;const _=u.current;_&&(_.scrollTop=_.scrollHeight)},[o,h.length,n]),!d)return null;const g=d.origin==="internal",f=!!d.wrapperSocketPath,v=g||f,x=()=>{l.trim()&&(s(d.id,l),c(""))};return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-full sm:w-[460px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Planet"}),S.jsx("div",{className:"text-lg font-semibold truncate",children:d.name??d.id.slice(0,8)}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5 truncate",title:Bm[d.status]??void 0,children:[String(d.model)," · ",rS(d.status),d.origin==="external"?" · external":" · internal",f&&S.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide border border-solix-accent/50 text-solix-accent",title:"Wrapped by `solix run` — UI prompts go to your terminal.",children:"wrapped"})]})]}),S.jsx("button",{onClick:()=>r(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),y&&S.jsxs("div",{className:`px-4 py-2 border-b border-solix-border text-[11px] leading-snug ${y.severity==="danger"?"text-solix-danger bg-solix-danger/10":y.severity==="warn"?"text-solix-warn bg-solix-warn/10":"text-slate-300 bg-black/20"}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),y.text]}),S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[S.jsx("span",{children:"context"}),S.jsxs("span",{children:[d.contextUsagePct.toFixed(0),"%"]})]}),S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${d.contextUsagePct>=90?"bg-solix-danger":d.contextUsagePct>=80?"bg-solix-warn":"bg-solix-accent"}`,style:{width:`${Math.min(100,d.contextUsagePct)}%`}})})]}),S.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[S.jsxs(Df,{active:o==="chat",onClick:()=>a("chat"),children:["Chat ",h.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",h.length,")"]})]}),S.jsxs(Df,{active:o==="missions",onClick:()=>a("missions"),children:["Missions ",p.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",p.length,")"]})]}),S.jsx(Df,{active:o==="files",onClick:()=>a("files"),children:"Files"})]}),S.jsxs("div",{className:"flex-1 overflow-hidden",children:[o==="chat"&&S.jsx(w3,{chat:h,scrollRef:u,session:d}),o==="missions"&&S.jsx(b3,{missions:p}),o==="files"&&S.jsx(E3,{missions:p})]}),o==="chat"&&S.jsx("div",{className:"px-3 py-3 border-t border-solix-border",children:v?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx("textarea",{value:l,onChange:_=>c(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),x())},placeholder:f?"Type a prompt — it goes straight into your terminal claude (Cmd/Ctrl+Enter)":"Send a prompt to this session… (Cmd/Ctrl+Enter)",rows:2,className:"flex-1 text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),S.jsx("button",{onClick:x,disabled:!l.trim(),className:"px-3 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Send"})]}),f&&S.jsxs("div",{className:"text-[10px] text-slate-500 italic mt-1.5",children:["Wrapped by ",S.jsx("code",{children:"solix run"}),". Don't type in the terminal while sending from here, or characters will interleave."]})]}):S.jsxs("div",{className:"text-xs text-slate-500",children:["External session — keep typing in your terminal. To send prompts from here instead, restart the session with"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix run"}),"."]})})]})}function Df({active:n,onClick:e,children:t}){return S.jsx("button",{onClick:e,className:`flex-1 px-3 py-2 ${n?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:t})}function w3({chat:n,scrollRef:e,session:t}){return S.jsxs("div",{ref:e,className:"h-full overflow-y-auto p-4 space-y-3",children:[n.length===0&&S.jsxs("div",{className:"text-sm text-slate-500 italic",children:["No chat yet. Type a prompt to this session in your terminal — it will stream here as it happens.",S.jsxs("div",{className:"mt-2 text-[11px] text-slate-600",children:["Watching transcript at ",S.jsxs("code",{children:["~/.claude/projects/","<encoded>","/",t.id,".jsonl"]})]})]}),n.map(i=>S.jsx("div",{className:`flex ${i.role==="user"?"justify-end":"justify-start"}`,children:S.jsxs("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${i.role==="user"?"bg-solix-accent/15 border border-solix-accent/40 text-slate-100":"bg-black/40 border border-solix-border text-slate-200"}`,children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide opacity-60 mb-1",children:[i.role,S.jsx("span",{className:"ml-2 text-slate-500",children:new Date(i.ts).toLocaleTimeString()})]}),S.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:i.content})]})},i.messageId))]})}function b3({missions:n}){return S.jsx("div",{className:"h-full overflow-y-auto p-4 space-y-3",children:n.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No missions yet."}):n.map(e=>S.jsxs("div",{className:"rounded border border-solix-border p-3 bg-black/30",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs",children:[S.jsx("span",{className:`font-semibold ${e.status==="active"?"text-solix-warn":e.status==="completed"?"text-solix-ok":"text-slate-300"}`,children:e.shortName}),S.jsx("span",{className:"text-slate-500",children:new Date(e.startedAt).toLocaleTimeString()})]}),S.jsx("div",{className:"mt-1 text-sm text-slate-200 line-clamp-3",children:e.prompt}),S.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] text-slate-500",children:[S.jsxs("span",{children:[e.metrics.toolCallCount," tools"]}),S.jsxs("span",{children:[e.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[e.filesTouched.length," files"]}),e.metrics.durationMs!==void 0&&S.jsxs("span",{children:[(e.metrics.durationMs/1e3).toFixed(1),"s"]})]})]},e.id))})}function E3({missions:n}){const e=Array.from(new Set(n.flatMap(t=>t.filesTouched))).sort();return S.jsx("div",{className:"h-full overflow-y-auto p-4",children:e.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No files touched yet."}):S.jsx("ul",{className:"space-y-1 text-xs font-mono text-slate-300",children:e.map(t=>S.jsx("li",{className:"truncate",children:t},t))})})}function T3(){const n=Ee(m=>m.selectedAdvisorId),e=Ee(m=>n?m.advisors[n]:null),t=Ee(m=>m.selectedSessionId?m.sessions[m.selectedSessionId]:null),i=Ee(m=>m.selectAdvisor),r=Ee(m=>m.invokeAdvisor),s=Ee(m=>m.pinAdvisor),o=Ee(m=>m.unpinAdvisor),[a,l]=Ie.useState(""),[c,u]=Ie.useState(null),[d,h]=Ie.useState(!1);if(Ie.useEffect(()=>{if(!e){u(null);return}let m=!1;const y=new URLSearchParams;t&&y.set("targetSessionId",t.id),a.trim()&&y.set("prompt",a.trim());const g=y.toString();return fetch(`/api/advisors/${encodeURIComponent(e.id)}/preview${g?`?${g}`:""}`).then(f=>f.ok?f.json():null).then(f=>{m||u(f)}).catch(()=>{m||u(null)}),()=>{m=!0}},[e==null?void 0:e.id,t==null?void 0:t.id,a]),!e)return null;const p=()=>{r(e.id,a.trim()||void 0),l("")};return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-[420px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-amber-200/70",children:"Advisor"}),S.jsxs("div",{className:"text-lg font-semibold flex items-center gap-2",children:[S.jsx("span",{style:{color:e.color},children:e.glyph}),S.jsx("span",{children:e.codename}),e.pinned&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-amber-300 border border-amber-300/40 rounded px-1.5 py-0.5",children:"pinned"})]}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[e.name," · ",String(e.defaultModel)]})]}),S.jsx("button",{onClick:()=>i(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),e.requiredSkills.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"requires skills"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.requiredSkills.map(m=>S.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent",children:m},m))})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 text-sm text-slate-300",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Invoke"}),S.jsx("div",{className:"text-xs text-slate-500",children:t?S.jsxs(S.Fragment,{children:["Will dispatch to"," ",S.jsx("span",{className:"text-slate-200",children:t.name??t.id.slice(0,8)})," ",S.jsxs("span",{className:"text-slate-500",children:["(",t.cwd,")"]})]}):S.jsx(S.Fragment,{children:"No planet focused. Click a user planet first to set a target."})}),S.jsx("textarea",{value:a,onChange:m=>l(m.target.value),placeholder:`Optional: hand ${e.codename} a specific brief…`,rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),c&&S.jsxs("div",{className:"rounded border border-solix-border bg-black/30",children:[S.jsxs("button",{onClick:()=>h(m=>!m),className:"w-full text-left px-2 py-1.5 text-xs flex items-center justify-between text-slate-400 hover:text-slate-100",children:[S.jsxs("span",{children:["Context envelope · ",c.recentMissionsCount," mission(s)",c.contextUsagePct!==null&&` · target at ${c.contextUsagePct.toFixed(0)}%`]}),S.jsx("span",{children:d?"▾":"▸"})]}),d&&S.jsx("pre",{className:"text-[10.5px] text-slate-300 whitespace-pre-wrap px-3 pb-3 max-h-72 overflow-auto leading-relaxed",children:c.prompt})]})]}),S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex gap-2",children:[S.jsx("button",{onClick:p,className:"flex-1 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30",children:"Invoke"}),e.pinned?S.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 rounded bg-amber-500/15 border border-amber-400/50 text-amber-200 text-sm hover:bg-amber-500/25",children:"Unpin"}):S.jsx("button",{onClick:()=>s(e.id),className:"px-3 py-2 rounded bg-amber-500/10 border border-amber-400/30 text-amber-200/80 text-sm hover:bg-amber-500/20",title:"Spawn an always-on session for this advisor",children:"Pin"})]})]})}function A3(){const n=Ee(c=>c.selectedSkillId),e=Ee(c=>n?c.skills[n]:null),t=Ee(c=>c.selectSkill),i=Ee(c=>c.advisors),[r,s]=Ie.useState(null),[o,a]=Ie.useState(!1);if(Ie.useEffect(()=>{if(!n){s(null);return}let c=!1;return a(!0),fetch(`/api/skills/${encodeURIComponent(n)}`).then(u=>u.ok?u.json():null).then(u=>{c||s(u)}).catch(()=>{c||s(null)}).finally(()=>{c||a(!1)}),()=>{c=!0}},[n]),!e)return null;const l=Object.values(i).filter(c=>c.requiredSkills.some(u=>e.id.endsWith(`:${u}`)||e.id===u));return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"text-xs uppercase tracking-wide text-cyan-300/70",children:["Skill · ",e.source]}),S.jsx("div",{className:"text-lg font-semibold",children:e.name}),S.jsx("div",{className:"text-xs text-slate-400 mt-0.5 break-all",children:e.id})]}),S.jsx("button",{onClick:()=>t(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),l.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"required by"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>S.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-amber-300/40 text-amber-200",children:[S.jsx("span",{className:"mr-1",children:c.glyph}),c.codename]},c.id))})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-2",children:"manifest"}),o&&S.jsx("div",{className:"text-sm text-slate-500 italic",children:"Loading…"}),r&&S.jsx("pre",{className:"text-[11px] text-slate-300 whitespace-pre-wrap break-words bg-black/40 p-3 rounded border border-solix-border",children:r.manifest})]}),S.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:e.installedInProjects.length===0?"Not installed in any project yet.":`Installed in ${e.installedInProjects.length} project(s).`})]})}const C3=["default","opus","sonnet","haiku"];function R3({open:n,onClose:e}){const t=Ee(M=>M.projects),i=Ee(M=>M.advisors),r=Ee(M=>M.launchTask),s=Object.values(t).sort((M,T)=>T.lastActiveAt-M.lastActiveAt),o=Ie.useMemo(()=>Object.values(i).filter(M=>M.enabled).sort((M,T)=>M.codename.localeCompare(T.codename)),[i]),[a,l]=Ie.useState(""),[c,u]=Ie.useState("default"),[d,h]=Ie.useState(null),[p,m]=Ie.useState(""),[y,g]=Ie.useState(""),[f,v]=Ie.useState(""),[x,_]=Ie.useState(null);if(Ie.useEffect(()=>{if(!n)return;let M=!1;return fetch("/api/system/preflight").then(T=>T.ok?T.json():null).then(T=>{M||_(T)}).catch(()=>{}),()=>{M=!0}},[n]),Ie.useEffect(()=>{if(!n||a)return;const M=s[0];M&&l(M.cwd)},[n,s,a]),!n)return null;const R=()=>{const M=a.trim(),T=p.trim();if(!M||!T)return;const A=d?o.find(V=>V.id===d):void 0,E=A?`[Acting as ${A.codename} — ${A.name}. ${A.description}]
3898
+ }`;class pI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Ct,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ci({vertexShader:hI,fragmentShader:fI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Wo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class mI extends Ti{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,h=null,p=null,m=null;const y=new pI,x=t.getContextAttributes();let f=null,v=null;const g=[],_=[],R=new K;let w=null;const A=new $t;A.layers.enable(1),A.viewport=new ct;const b=new $t;b.layers.enable(2),b.viewport=new ct;const E=[A,b],M=new xM;M.layers.enable(1),M.layers.enable(2);let L=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let se=g[j];return se===void 0&&(se=new vf,g[j]=se),se.getTargetRaySpace()},this.getControllerGrip=function(j){let se=g[j];return se===void 0&&(se=new vf,g[j]=se),se.getGripSpace()},this.getHand=function(j){let se=g[j];return se===void 0&&(se=new vf,g[j]=se),se.getHandSpace()};function F(j){const se=_.indexOf(j.inputSource);if(se===-1)return;const xe=g[se];xe!==void 0&&(xe.update(j.inputSource,j.frame,c||o),xe.dispatchEvent({type:j.type,data:j.inputSource}))}function G(){r.removeEventListener("select",F),r.removeEventListener("selectstart",F),r.removeEventListener("selectend",F),r.removeEventListener("squeeze",F),r.removeEventListener("squeezestart",F),r.removeEventListener("squeezeend",F),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",X);for(let j=0;j<g.length;j++){const se=_[j];se!==null&&(_[j]=null,g[j].disconnect(se))}L=null,V=null,y.reset(),e.setRenderTarget(f),p=null,h=null,d=null,r=null,v=null,Ke.stop(),i.isPresenting=!1,e.setPixelRatio(w),e.setSize(R.width,R.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){s=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){a=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(j){c=j},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return d},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(j){if(r=j,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",F),r.addEventListener("selectstart",F),r.addEventListener("selectend",F),r.addEventListener("squeeze",F),r.addEventListener("squeezestart",F),r.addEventListener("squeezeend",F),r.addEventListener("end",G),r.addEventListener("inputsourceschange",X),x.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const se={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),v=new li(p.framebufferWidth,p.framebufferHeight,{format:dn,type:Ei,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let se=null,xe=null,de=null;x.depth&&(de=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=x.stencil?ws:ps,xe=x.stencil?Ms:Ji);const De={colorFormat:t.RGBA8,depthFormat:de,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(De),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),v=new li(h.textureWidth,h.textureHeight,{format:dn,type:Ei,depthTexture:new rg(h.textureWidth,h.textureHeight,xe,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1})}v.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),Ke.setContext(r),Ke.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function X(j){for(let se=0;se<j.removed.length;se++){const xe=j.removed[se],de=_.indexOf(xe);de>=0&&(_[de]=null,g[de].disconnect(xe))}for(let se=0;se<j.added.length;se++){const xe=j.added[se];let de=_.indexOf(xe);if(de===-1){for(let He=0;He<g.length;He++)if(He>=_.length){_.push(xe),de=He;break}else if(_[He]===null){_[He]=xe,de=He;break}if(de===-1)break}const De=g[de];De&&De.connect(xe)}}const W=new I,ne=new I;function D(j,se,xe){W.setFromMatrixPosition(se.matrixWorld),ne.setFromMatrixPosition(xe.matrixWorld);const de=W.distanceTo(ne),De=se.projectionMatrix.elements,He=xe.projectionMatrix.elements,Be=De[14]/(De[10]-1),it=De[14]/(De[10]+1),P=(De[9]+1)/De[5],le=(De[9]-1)/De[5],ie=(De[8]-1)/De[0],ge=(He[8]+1)/He[0],$=Be*ie,Ue=Be*ge,me=de/(-ie+ge),we=me*-ie;if(se.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(we),j.translateZ(me),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),De[10]===-1)j.projectionMatrix.copy(se.projectionMatrix),j.projectionMatrixInverse.copy(se.projectionMatrixInverse);else{const N=Be+me,T=it+me,z=$-we,J=Ue+(de-we),Z=P*it/T*N,te=le*it/T*N;j.projectionMatrix.makePerspective(z,J,Z,te,N,T),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function Y(j,se){se===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(se.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(r===null)return;let se=j.near,xe=j.far;y.texture!==null&&(y.depthNear>0&&(se=y.depthNear),y.depthFar>0&&(xe=y.depthFar)),M.near=b.near=A.near=se,M.far=b.far=A.far=xe,(L!==M.near||V!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,V=M.far);const de=j.parent,De=M.cameras;Y(M,de);for(let He=0;He<De.length;He++)Y(De[He],de);De.length===2?D(M,A,b):M.projectionMatrix.copy(A.projectionMatrix),Q(j,M,de)};function Q(j,se,xe){xe===null?j.matrix.copy(se.matrixWorld):(j.matrix.copy(xe.matrixWorld),j.matrix.invert(),j.matrix.multiply(se.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(se.projectionMatrix),j.projectionMatrixInverse.copy(se.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Uo*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(j){l=j,h!==null&&(h.fixedFoveation=j),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=j)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(M)};let oe=null;function Re(j,se){if(u=se.getViewerPose(c||o),m=se,u!==null){const xe=u.views;p!==null&&(e.setRenderTargetFramebuffer(v,p.framebuffer),e.setRenderTarget(v));let de=!1;xe.length!==M.cameras.length&&(M.cameras.length=0,de=!0);for(let He=0;He<xe.length;He++){const Be=xe[He];let it=null;if(p!==null)it=p.getViewport(Be);else{const le=d.getViewSubImage(h,Be);it=le.viewport,He===0&&(e.setRenderTargetTextures(v,le.colorTexture,h.ignoreDepthValues?void 0:le.depthStencilTexture),e.setRenderTarget(v))}let P=E[He];P===void 0&&(P=new $t,P.layers.enable(He),P.viewport=new ct,E[He]=P),P.matrix.fromArray(Be.transform.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale),P.projectionMatrix.fromArray(Be.projectionMatrix),P.projectionMatrixInverse.copy(P.projectionMatrix).invert(),P.viewport.set(it.x,it.y,it.width,it.height),He===0&&(M.matrix.copy(P.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),de===!0&&M.cameras.push(P)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")){const He=d.getDepthInformation(xe[0]);He&&He.isValid&&He.texture&&y.init(e,He,r.renderState)}}for(let xe=0;xe<g.length;xe++){const de=_[xe],De=g[xe];de!==null&&De!==void 0&&De.update(de,se,c||o)}oe&&oe(j,se),se.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:se}),m=null}const Ke=new dM;Ke.setAnimationLoop(Re),this.setAnimationLoop=function(j){oe=j},this.dispose=function(){}}}const Xr=new On,gI=new ke;function xI(n,e){function t(x,f){x.matrixAutoUpdate===!0&&x.updateMatrix(),f.value.copy(x.matrix)}function i(x,f){f.color.getRGB(x.fogColor.value,aM(n)),f.isFog?(x.fogNear.value=f.near,x.fogFar.value=f.far):f.isFogExp2&&(x.fogDensity.value=f.density)}function r(x,f,v,g,_){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(x,f):f.isMeshToonMaterial?(s(x,f),d(x,f)):f.isMeshPhongMaterial?(s(x,f),u(x,f)):f.isMeshStandardMaterial?(s(x,f),h(x,f),f.isMeshPhysicalMaterial&&p(x,f,_)):f.isMeshMatcapMaterial?(s(x,f),m(x,f)):f.isMeshDepthMaterial?s(x,f):f.isMeshDistanceMaterial?(s(x,f),y(x,f)):f.isMeshNormalMaterial?s(x,f):f.isLineBasicMaterial?(o(x,f),f.isLineDashedMaterial&&a(x,f)):f.isPointsMaterial?l(x,f,v,g):f.isSpriteMaterial?c(x,f):f.isShadowMaterial?(x.color.value.copy(f.color),x.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(x,f){x.opacity.value=f.opacity,f.color&&x.diffuse.value.copy(f.color),f.emissive&&x.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(x.map.value=f.map,t(f.map,x.mapTransform)),f.alphaMap&&(x.alphaMap.value=f.alphaMap,t(f.alphaMap,x.alphaMapTransform)),f.bumpMap&&(x.bumpMap.value=f.bumpMap,t(f.bumpMap,x.bumpMapTransform),x.bumpScale.value=f.bumpScale,f.side===fn&&(x.bumpScale.value*=-1)),f.normalMap&&(x.normalMap.value=f.normalMap,t(f.normalMap,x.normalMapTransform),x.normalScale.value.copy(f.normalScale),f.side===fn&&x.normalScale.value.negate()),f.displacementMap&&(x.displacementMap.value=f.displacementMap,t(f.displacementMap,x.displacementMapTransform),x.displacementScale.value=f.displacementScale,x.displacementBias.value=f.displacementBias),f.emissiveMap&&(x.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,x.emissiveMapTransform)),f.specularMap&&(x.specularMap.value=f.specularMap,t(f.specularMap,x.specularMapTransform)),f.alphaTest>0&&(x.alphaTest.value=f.alphaTest);const v=e.get(f),g=v.envMap,_=v.envMapRotation;g&&(x.envMap.value=g,Xr.copy(_),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,g.isCubeTexture&&g.isRenderTargetTexture===!1&&(Xr.y*=-1,Xr.z*=-1),x.envMapRotation.value.setFromMatrix4(gI.makeRotationFromEuler(Xr)),x.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=f.reflectivity,x.ior.value=f.ior,x.refractionRatio.value=f.refractionRatio),f.lightMap&&(x.lightMap.value=f.lightMap,x.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,x.lightMapTransform)),f.aoMap&&(x.aoMap.value=f.aoMap,x.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,x.aoMapTransform))}function o(x,f){x.diffuse.value.copy(f.color),x.opacity.value=f.opacity,f.map&&(x.map.value=f.map,t(f.map,x.mapTransform))}function a(x,f){x.dashSize.value=f.dashSize,x.totalSize.value=f.dashSize+f.gapSize,x.scale.value=f.scale}function l(x,f,v,g){x.diffuse.value.copy(f.color),x.opacity.value=f.opacity,x.size.value=f.size*v,x.scale.value=g*.5,f.map&&(x.map.value=f.map,t(f.map,x.uvTransform)),f.alphaMap&&(x.alphaMap.value=f.alphaMap,t(f.alphaMap,x.alphaMapTransform)),f.alphaTest>0&&(x.alphaTest.value=f.alphaTest)}function c(x,f){x.diffuse.value.copy(f.color),x.opacity.value=f.opacity,x.rotation.value=f.rotation,f.map&&(x.map.value=f.map,t(f.map,x.mapTransform)),f.alphaMap&&(x.alphaMap.value=f.alphaMap,t(f.alphaMap,x.alphaMapTransform)),f.alphaTest>0&&(x.alphaTest.value=f.alphaTest)}function u(x,f){x.specular.value.copy(f.specular),x.shininess.value=Math.max(f.shininess,1e-4)}function d(x,f){f.gradientMap&&(x.gradientMap.value=f.gradientMap)}function h(x,f){x.metalness.value=f.metalness,f.metalnessMap&&(x.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,x.metalnessMapTransform)),x.roughness.value=f.roughness,f.roughnessMap&&(x.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,x.roughnessMapTransform)),f.envMap&&(x.envMapIntensity.value=f.envMapIntensity)}function p(x,f,v){x.ior.value=f.ior,f.sheen>0&&(x.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),x.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(x.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,x.sheenColorMapTransform)),f.sheenRoughnessMap&&(x.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,x.sheenRoughnessMapTransform))),f.clearcoat>0&&(x.clearcoat.value=f.clearcoat,x.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(x.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,x.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(x.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===fn&&x.clearcoatNormalScale.value.negate())),f.dispersion>0&&(x.dispersion.value=f.dispersion),f.iridescence>0&&(x.iridescence.value=f.iridescence,x.iridescenceIOR.value=f.iridescenceIOR,x.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(x.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,x.iridescenceMapTransform)),f.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),f.transmission>0&&(x.transmission.value=f.transmission,x.transmissionSamplerMap.value=v.texture,x.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(x.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,x.transmissionMapTransform)),x.thickness.value=f.thickness,f.thicknessMap&&(x.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=f.attenuationDistance,x.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(x.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(x.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=f.specularIntensity,x.specularColor.value.copy(f.specularColor),f.specularColorMap&&(x.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,x.specularColorMapTransform)),f.specularIntensityMap&&(x.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,x.specularIntensityMapTransform))}function m(x,f){f.matcap&&(x.matcap.value=f.matcap)}function y(x,f){const v=e.get(f).light;x.referencePosition.value.setFromMatrixPosition(v.matrixWorld),x.nearDistance.value=v.shadow.camera.near,x.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function vI(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,g){const _=g.program;i.uniformBlockBinding(v,_)}function c(v,g){let _=r[v.id];_===void 0&&(m(v),_=u(v),r[v.id]=_,v.addEventListener("dispose",x));const R=g.program;i.updateUBOMapping(v,R);const w=e.render.frame;s[v.id]!==w&&(h(v),s[v.id]=w)}function u(v){const g=d();v.__bindingPointIndex=g;const _=n.createBuffer(),R=v.__size,w=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,R,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,g,_),_}function d(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(v){const g=r[v.id],_=v.uniforms,R=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,g);for(let w=0,A=_.length;w<A;w++){const b=Array.isArray(_[w])?_[w]:[_[w]];for(let E=0,M=b.length;E<M;E++){const L=b[E];if(p(L,w,E,R)===!0){const V=L.__offset,F=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let X=0;X<F.length;X++){const W=F[X],ne=y(W);typeof W=="number"||typeof W=="boolean"?(L.__data[0]=W,n.bufferSubData(n.UNIFORM_BUFFER,V+G,L.__data)):W.isMatrix3?(L.__data[0]=W.elements[0],L.__data[1]=W.elements[1],L.__data[2]=W.elements[2],L.__data[3]=0,L.__data[4]=W.elements[3],L.__data[5]=W.elements[4],L.__data[6]=W.elements[5],L.__data[7]=0,L.__data[8]=W.elements[6],L.__data[9]=W.elements[7],L.__data[10]=W.elements[8],L.__data[11]=0):(W.toArray(L.__data,G),G+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,V,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,g,_,R){const w=v.value,A=g+"_"+_;if(R[A]===void 0)return typeof w=="number"||typeof w=="boolean"?R[A]=w:R[A]=w.clone(),!0;{const b=R[A];if(typeof w=="number"||typeof w=="boolean"){if(b!==w)return R[A]=w,!0}else if(b.equals(w)===!1)return b.copy(w),!0}return!1}function m(v){const g=v.uniforms;let _=0;const R=16;for(let A=0,b=g.length;A<b;A++){const E=Array.isArray(g[A])?g[A]:[g[A]];for(let M=0,L=E.length;M<L;M++){const V=E[M],F=Array.isArray(V.value)?V.value:[V.value];for(let G=0,X=F.length;G<X;G++){const W=F[G],ne=y(W),D=_%R,Y=D%ne.boundary,Q=D+Y;_+=Y,Q!==0&&R-Q<ne.storage&&(_+=R-Q),V.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=_,_+=ne.storage}}}const w=_%R;return w>0&&(_+=R-w),v.__size=_,v.__cache={},this}function y(v){const g={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(g.boundary=4,g.storage=4):v.isVector2?(g.boundary=8,g.storage=8):v.isVector3||v.isColor?(g.boundary=16,g.storage=12):v.isVector4?(g.boundary=16,g.storage=16):v.isMatrix3?(g.boundary=48,g.storage=48):v.isMatrix4?(g.boundary=64,g.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),g}function x(v){const g=v.target;g.removeEventListener("dispose",x);const _=o.indexOf(g.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(r[g.id]),delete r[g.id],delete s[g.id]}function f(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:f}}class yI{constructor(e={}){const{canvas:t=iM(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,x=null;const f=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Hn,this.toneMapping=ji,this.toneMappingExposure=1;const g=this;let _=!1,R=0,w=0,A=null,b=-1,E=null;const M=new ct,L=new ct;let V=null;const F=new ye(0);let G=0,X=t.width,W=t.height,ne=1,D=null,Y=null;const Q=new ct(0,0,X,W),oe=new ct(0,0,X,W);let Re=!1;const Ke=new Nl;let j=!1,se=!1;const xe=new ke,de=new I,De=new ct,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function it(){return A===null?ne:1}let P=i;function le(C,k){return t.getContext(C,k)}try{const C={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Cd}`),t.addEventListener("webglcontextlost",q,!1),t.addEventListener("webglcontextrestored",ee,!1),t.addEventListener("webglcontextcreationerror",he,!1),P===null){const k="webgl2";if(P=le(k,C),P===null)throw le(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,ge,$,Ue,me,we,N,T,z,J,Z,te,Le,pe,Se,We,ae,_e,Je,Ve,be,Ge,qe,vt;function U(){ie=new EP(P),ie.init(),Ge=new gM(P,ie),ge=new yP(P,ie,e,Ge),$=new rI(P),Ue=new CP(P),me=new X2,we=new uI(P,ie,$,me,ge,Ge,Ue),N=new SP(g),T=new bP(g),z=new UA(P),qe=new xP(P,z),J=new TP(P,z,Ue,qe),Z=new PP(P,J,z,Ue),Je=new RP(P,ge,we),We=new _P(me),te=new j2(g,N,T,ie,ge,qe,We),Le=new xI(g,me),pe=new $2,Se=new eI(ie),_e=new gP(g,N,T,$,Z,h,l),ae=new iI(g,Z,ge),vt=new vI(P,Ue,ge,$),Ve=new vP(P,ie,Ue),be=new AP(P,ie,Ue),Ue.programs=te.programs,g.capabilities=ge,g.extensions=ie,g.properties=me,g.renderLists=pe,g.shadowMap=ae,g.state=$,g.info=Ue}U();const ce=new mI(g,P);this.xr=ce,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(C){C!==void 0&&(ne=C,this.setSize(X,W,!1))},this.getSize=function(C){return C.set(X,W)},this.setSize=function(C,k,B=!0){if(ce.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=C,W=k,t.width=Math.floor(C*ne),t.height=Math.floor(k*ne),B===!0&&(t.style.width=C+"px",t.style.height=k+"px"),this.setViewport(0,0,C,k)},this.getDrawingBufferSize=function(C){return C.set(X*ne,W*ne).floor()},this.setDrawingBufferSize=function(C,k,B){X=C,W=k,ne=B,t.width=Math.floor(C*B),t.height=Math.floor(k*B),this.setViewport(0,0,C,k)},this.getCurrentViewport=function(C){return C.copy(M)},this.getViewport=function(C){return C.copy(Q)},this.setViewport=function(C,k,B,H){C.isVector4?Q.set(C.x,C.y,C.z,C.w):Q.set(C,k,B,H),$.viewport(M.copy(Q).multiplyScalar(ne).round())},this.getScissor=function(C){return C.copy(oe)},this.setScissor=function(C,k,B,H){C.isVector4?oe.set(C.x,C.y,C.z,C.w):oe.set(C,k,B,H),$.scissor(L.copy(oe).multiplyScalar(ne).round())},this.getScissorTest=function(){return Re},this.setScissorTest=function(C){$.setScissorTest(Re=C)},this.setOpaqueSort=function(C){D=C},this.setTransparentSort=function(C){Y=C},this.getClearColor=function(C){return C.copy(_e.getClearColor())},this.setClearColor=function(){_e.setClearColor.apply(_e,arguments)},this.getClearAlpha=function(){return _e.getClearAlpha()},this.setClearAlpha=function(){_e.setClearAlpha.apply(_e,arguments)},this.clear=function(C=!0,k=!0,B=!0){let H=0;if(C){let O=!1;if(A!==null){const ue=A.texture.format;O=ue===Ud||ue===Dd||ue===Rl}if(O){const ue=A.texture.type,ve=ue===Ei||ue===Ji||ue===Do||ue===Ms||ue===Id||ue===Nd,Te=_e.getClearColor(),Ae=_e.getClearAlpha(),Fe=Te.r,ze=Te.g,Ie=Te.b;ve?(p[0]=Fe,p[1]=ze,p[2]=Ie,p[3]=Ae,P.clearBufferuiv(P.COLOR,0,p)):(m[0]=Fe,m[1]=ze,m[2]=Ie,m[3]=Ae,P.clearBufferiv(P.COLOR,0,m))}else H|=P.COLOR_BUFFER_BIT}k&&(H|=P.DEPTH_BUFFER_BIT),B&&(H|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",q,!1),t.removeEventListener("webglcontextrestored",ee,!1),t.removeEventListener("webglcontextcreationerror",he,!1),pe.dispose(),Se.dispose(),me.dispose(),N.dispose(),T.dispose(),Z.dispose(),qe.dispose(),vt.dispose(),te.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",hi),ce.removeEventListener("sessionend",Ag),zr.stop()};function q(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function ee(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const C=Ue.autoReset,k=ae.enabled,B=ae.autoUpdate,H=ae.needsUpdate,O=ae.type;U(),Ue.autoReset=C,ae.enabled=k,ae.autoUpdate=B,ae.needsUpdate=H,ae.type=O}function he(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Oe(C){const k=C.target;k.removeEventListener("dispose",Oe),Qe(k)}function Qe(C){It(C),me.remove(C)}function It(C){const k=me.get(C).programs;k!==void 0&&(k.forEach(function(B){te.releaseProgram(B)}),C.isShaderMaterial&&te.releaseShaderCache(C))}this.renderBufferDirect=function(C,k,B,H,O,ue){k===null&&(k=He);const ve=O.isMesh&&O.matrixWorld.determinant()<0,Te=gw(C,k,B,H,O);$.setMaterial(H,ve);let Ae=B.index,Fe=1;if(H.wireframe===!0){if(Ae=J.getWireframeAttribute(B),Ae===void 0)return;Fe=2}const ze=B.drawRange,Ie=B.attributes.position;let ot=ze.start*Fe,wt=(ze.start+ze.count)*Fe;ue!==null&&(ot=Math.max(ot,ue.start*Fe),wt=Math.min(wt,(ue.start+ue.count)*Fe)),Ae!==null?(ot=Math.max(ot,0),wt=Math.min(wt,Ae.count)):Ie!=null&&(ot=Math.max(ot,0),wt=Math.min(wt,Ie.count));const bt=wt-ot;if(bt<0||bt===1/0)return;qe.setup(O,H,Te,B,Ae);let An,at=Ve;if(Ae!==null&&(An=z.get(Ae),at=be,at.setIndex(An)),O.isMesh)H.wireframe===!0?($.setLineWidth(H.wireframeLinewidth*it()),at.setMode(P.LINES)):at.setMode(P.TRIANGLES);else if(O.isLine){let Ne=H.linewidth;Ne===void 0&&(Ne=1),$.setLineWidth(Ne*it()),O.isLineSegments?at.setMode(P.LINES):O.isLineLoop?at.setMode(P.LINE_LOOP):at.setMode(P.LINE_STRIP)}else O.isPoints?at.setMode(P.POINTS):O.isSprite&&at.setMode(P.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)at.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))at.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const Ne=O._multiDrawStarts,Xt=O._multiDrawCounts,lt=O._multiDrawCount,Zn=Ae?z.get(Ae).bytesPerElement:1,Is=me.get(H).currentProgram.getUniforms();for(let Cn=0;Cn<lt;Cn++)Is.setValue(P,"_gl_DrawID",Cn),at.render(Ne[Cn]/Zn,Xt[Cn])}else if(O.isInstancedMesh)at.renderInstances(ot,bt,O.count);else if(B.isInstancedBufferGeometry){const Ne=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,Xt=Math.min(B.instanceCount,Ne);at.renderInstances(ot,bt,Xt)}else at.render(ot,bt)};function jt(C,k,B){C.transparent===!0&&C.side===vi&&C.forceSinglePass===!1?(C.side=fn,C.needsUpdate=!0,Bl(C,k,B),C.side=Zi,C.needsUpdate=!0,Bl(C,k,B),C.side=vi):Bl(C,k,B)}this.compile=function(C,k,B=null){B===null&&(B=C),x=Se.get(B),x.init(k),v.push(x),B.traverseVisible(function(O){O.isLight&&O.layers.test(k.layers)&&(x.pushLight(O),O.castShadow&&x.pushShadow(O))}),C!==B&&C.traverseVisible(function(O){O.isLight&&O.layers.test(k.layers)&&(x.pushLight(O),O.castShadow&&x.pushShadow(O))}),x.setupLights();const H=new Set;return C.traverse(function(O){const ue=O.material;if(ue)if(Array.isArray(ue))for(let ve=0;ve<ue.length;ve++){const Te=ue[ve];jt(Te,B,O),H.add(Te)}else jt(ue,B,O),H.add(ue)}),v.pop(),x=null,H},this.compileAsync=function(C,k,B=null){const H=this.compile(C,k,B);return new Promise(O=>{function ue(){if(H.forEach(function(ve){me.get(ve).currentProgram.isReady()&&H.delete(ve)}),H.size===0){O(C);return}setTimeout(ue,10)}ie.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let st=null;function Ci(C){st&&st(C)}function hi(){zr.stop()}function Ag(){zr.start()}const zr=new dM;zr.setAnimationLoop(Ci),typeof self<"u"&&zr.setContext(self),this.setAnimationLoop=function(C){st=C,ce.setAnimationLoop(C),C===null?zr.stop():zr.start()},ce.addEventListener("sessionstart",hi),ce.addEventListener("sessionend",Ag),this.render=function(C,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(k),k=ce.getCamera()),C.isScene===!0&&C.onBeforeRender(g,C,k,A),x=Se.get(C,v.length),x.init(k),v.push(x),xe.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Ke.setFromProjectionMatrix(xe),se=this.localClippingEnabled,j=We.init(this.clippingPlanes,se),y=pe.get(C,f.length),y.init(),f.push(y),ce.enabled===!0&&ce.isPresenting===!0){const ue=g.xr.getDepthSensingMesh();ue!==null&&uh(ue,k,-1/0,g.sortObjects)}uh(C,k,0,g.sortObjects),y.finish(),g.sortObjects===!0&&y.sort(D,Y),Be=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,Be&&_e.addToRenderList(y,C),this.info.render.frame++,j===!0&&We.beginShadows();const B=x.state.shadowsArray;ae.render(B,C,k),j===!0&&We.endShadows(),this.info.autoReset===!0&&this.info.reset();const H=y.opaque,O=y.transmissive;if(x.setupLights(),k.isArrayCamera){const ue=k.cameras;if(O.length>0)for(let ve=0,Te=ue.length;ve<Te;ve++){const Ae=ue[ve];Rg(H,O,C,Ae)}Be&&_e.render(C);for(let ve=0,Te=ue.length;ve<Te;ve++){const Ae=ue[ve];Cg(y,C,Ae,Ae.viewport)}}else O.length>0&&Rg(H,O,C,k),Be&&_e.render(C),Cg(y,C,k);A!==null&&(we.updateMultisampleRenderTarget(A),we.updateRenderTargetMipmap(A)),C.isScene===!0&&C.onAfterRender(g,C,k),qe.resetDefaultState(),b=-1,E=null,v.pop(),v.length>0?(x=v[v.length-1],j===!0&&We.setGlobalState(g.clippingPlanes,x.state.camera)):x=null,f.pop(),f.length>0?y=f[f.length-1]:y=null};function uh(C,k,B,H){if(C.visible===!1)return;if(C.layers.test(k.layers)){if(C.isGroup)B=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(k);else if(C.isLight)x.pushLight(C),C.castShadow&&x.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||Ke.intersectsSprite(C)){H&&De.setFromMatrixPosition(C.matrixWorld).applyMatrix4(xe);const ve=Z.update(C),Te=C.material;Te.visible&&y.push(C,ve,Te,B,De.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||Ke.intersectsObject(C))){const ve=Z.update(C),Te=C.material;if(H&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),De.copy(C.boundingSphere.center)):(ve.boundingSphere===null&&ve.computeBoundingSphere(),De.copy(ve.boundingSphere.center)),De.applyMatrix4(C.matrixWorld).applyMatrix4(xe)),Array.isArray(Te)){const Ae=ve.groups;for(let Fe=0,ze=Ae.length;Fe<ze;Fe++){const Ie=Ae[Fe],ot=Te[Ie.materialIndex];ot&&ot.visible&&y.push(C,ve,ot,B,De.z,Ie)}}else Te.visible&&y.push(C,ve,Te,B,De.z,null)}}const ue=C.children;for(let ve=0,Te=ue.length;ve<Te;ve++)uh(ue[ve],k,B,H)}function Cg(C,k,B,H){const O=C.opaque,ue=C.transmissive,ve=C.transparent;x.setupLightsView(B),j===!0&&We.setGlobalState(g.clippingPlanes,B),H&&$.viewport(M.copy(H)),O.length>0&&Fl(O,k,B),ue.length>0&&Fl(ue,k,B),ve.length>0&&Fl(ve,k,B),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Rg(C,k,B,H){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;x.state.transmissionRenderTarget[H.id]===void 0&&(x.state.transmissionRenderTarget[H.id]=new li(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?Ho:Ei,minFilter:yi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace}));const ue=x.state.transmissionRenderTarget[H.id],ve=H.viewport||M;ue.setSize(ve.z,ve.w);const Te=g.getRenderTarget();g.setRenderTarget(ue),g.getClearColor(F),G=g.getClearAlpha(),G<1&&g.setClearColor(16777215,.5),g.clear(),Be&&_e.render(B);const Ae=g.toneMapping;g.toneMapping=ji;const Fe=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),x.setupLightsView(H),j===!0&&We.setGlobalState(g.clippingPlanes,H),Fl(C,B,H),we.updateMultisampleRenderTarget(ue),we.updateRenderTargetMipmap(ue),ie.has("WEBGL_multisampled_render_to_texture")===!1){let ze=!1;for(let Ie=0,ot=k.length;Ie<ot;Ie++){const wt=k[Ie],bt=wt.object,An=wt.geometry,at=wt.material,Ne=wt.group;if(at.side===vi&&bt.layers.test(H.layers)){const Xt=at.side;at.side=fn,at.needsUpdate=!0,Pg(bt,B,H,An,at,Ne),at.side=Xt,at.needsUpdate=!0,ze=!0}}ze===!0&&(we.updateMultisampleRenderTarget(ue),we.updateRenderTargetMipmap(ue))}g.setRenderTarget(Te),g.setClearColor(F,G),Fe!==void 0&&(H.viewport=Fe),g.toneMapping=Ae}function Fl(C,k,B){const H=k.isScene===!0?k.overrideMaterial:null;for(let O=0,ue=C.length;O<ue;O++){const ve=C[O],Te=ve.object,Ae=ve.geometry,Fe=H===null?ve.material:H,ze=ve.group;Te.layers.test(B.layers)&&Pg(Te,k,B,Ae,Fe,ze)}}function Pg(C,k,B,H,O,ue){C.onBeforeRender(g,k,B,H,O,ue),C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),O.onBeforeRender(g,k,B,H,C,ue),O.transparent===!0&&O.side===vi&&O.forceSinglePass===!1?(O.side=fn,O.needsUpdate=!0,g.renderBufferDirect(B,k,H,O,C,ue),O.side=Zi,O.needsUpdate=!0,g.renderBufferDirect(B,k,H,O,C,ue),O.side=vi):g.renderBufferDirect(B,k,H,O,C,ue),C.onAfterRender(g,k,B,H,O,ue)}function Bl(C,k,B){k.isScene!==!0&&(k=He);const H=me.get(C),O=x.state.lights,ue=x.state.shadowsArray,ve=O.state.version,Te=te.getParameters(C,O.state,ue,k,B),Ae=te.getProgramCacheKey(Te);let Fe=H.programs;H.environment=C.isMeshStandardMaterial?k.environment:null,H.fog=k.fog,H.envMap=(C.isMeshStandardMaterial?T:N).get(C.envMap||H.environment),H.envMapRotation=H.environment!==null&&C.envMap===null?k.environmentRotation:C.envMapRotation,Fe===void 0&&(C.addEventListener("dispose",Oe),Fe=new Map,H.programs=Fe);let ze=Fe.get(Ae);if(ze!==void 0){if(H.currentProgram===ze&&H.lightsStateVersion===ve)return Ng(C,Te),ze}else Te.uniforms=te.getUniforms(C),C.onBeforeCompile(Te,g),ze=te.acquireProgram(Te,Ae),Fe.set(Ae,ze),H.uniforms=Te.uniforms;const Ie=H.uniforms;return(!C.isShaderMaterial&&!C.isRawShaderMaterial||C.clipping===!0)&&(Ie.clippingPlanes=We.uniform),Ng(C,Te),H.needsLights=vw(C),H.lightsStateVersion=ve,H.needsLights&&(Ie.ambientLightColor.value=O.state.ambient,Ie.lightProbe.value=O.state.probe,Ie.directionalLights.value=O.state.directional,Ie.directionalLightShadows.value=O.state.directionalShadow,Ie.spotLights.value=O.state.spot,Ie.spotLightShadows.value=O.state.spotShadow,Ie.rectAreaLights.value=O.state.rectArea,Ie.ltc_1.value=O.state.rectAreaLTC1,Ie.ltc_2.value=O.state.rectAreaLTC2,Ie.pointLights.value=O.state.point,Ie.pointLightShadows.value=O.state.pointShadow,Ie.hemisphereLights.value=O.state.hemi,Ie.directionalShadowMap.value=O.state.directionalShadowMap,Ie.directionalShadowMatrix.value=O.state.directionalShadowMatrix,Ie.spotShadowMap.value=O.state.spotShadowMap,Ie.spotLightMatrix.value=O.state.spotLightMatrix,Ie.spotLightMap.value=O.state.spotLightMap,Ie.pointShadowMap.value=O.state.pointShadowMap,Ie.pointShadowMatrix.value=O.state.pointShadowMatrix),H.currentProgram=ze,H.uniformsList=null,ze}function Ig(C){if(C.uniformsList===null){const k=C.currentProgram.getUniforms();C.uniformsList=lu.seqWithValue(k.seq,C.uniforms)}return C.uniformsList}function Ng(C,k){const B=me.get(C);B.outputColorSpace=k.outputColorSpace,B.batching=k.batching,B.batchingColor=k.batchingColor,B.instancing=k.instancing,B.instancingColor=k.instancingColor,B.instancingMorph=k.instancingMorph,B.skinning=k.skinning,B.morphTargets=k.morphTargets,B.morphNormals=k.morphNormals,B.morphColors=k.morphColors,B.morphTargetsCount=k.morphTargetsCount,B.numClippingPlanes=k.numClippingPlanes,B.numIntersection=k.numClipIntersection,B.vertexAlphas=k.vertexAlphas,B.vertexTangents=k.vertexTangents,B.toneMapping=k.toneMapping}function gw(C,k,B,H,O){k.isScene!==!0&&(k=He),we.resetTextureUnits();const ue=k.fog,ve=H.isMeshStandardMaterial?k.environment:null,Te=A===null?g.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:tr,Ae=(H.isMeshStandardMaterial?T:N).get(H.envMap||ve),Fe=H.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,ze=!!B.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Ie=!!B.morphAttributes.position,ot=!!B.morphAttributes.normal,wt=!!B.morphAttributes.color;let bt=ji;H.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(bt=g.toneMapping);const An=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,at=An!==void 0?An.length:0,Ne=me.get(H),Xt=x.state.lights;if(j===!0&&(se===!0||C!==E)){const zn=C===E&&H.id===b;We.setState(H,C,zn)}let lt=!1;H.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Xt.state.version||Ne.outputColorSpace!==Te||O.isBatchedMesh&&Ne.batching===!1||!O.isBatchedMesh&&Ne.batching===!0||O.isBatchedMesh&&Ne.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&Ne.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&Ne.instancing===!1||!O.isInstancedMesh&&Ne.instancing===!0||O.isSkinnedMesh&&Ne.skinning===!1||!O.isSkinnedMesh&&Ne.skinning===!0||O.isInstancedMesh&&Ne.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&Ne.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&Ne.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&Ne.instancingMorph===!1&&O.morphTexture!==null||Ne.envMap!==Ae||H.fog===!0&&Ne.fog!==ue||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==We.numPlanes||Ne.numIntersection!==We.numIntersection)||Ne.vertexAlphas!==Fe||Ne.vertexTangents!==ze||Ne.morphTargets!==Ie||Ne.morphNormals!==ot||Ne.morphColors!==wt||Ne.toneMapping!==bt||Ne.morphTargetsCount!==at)&&(lt=!0):(lt=!0,Ne.__version=H.version);let Zn=Ne.currentProgram;lt===!0&&(Zn=Bl(H,k,O));let Is=!1,Cn=!1,dh=!1;const Nt=Zn.getUniforms(),nr=Ne.uniforms;if($.useProgram(Zn.program)&&(Is=!0,Cn=!0,dh=!0),H.id!==b&&(b=H.id,Cn=!0),Is||E!==C){Nt.setValue(P,"projectionMatrix",C.projectionMatrix),Nt.setValue(P,"viewMatrix",C.matrixWorldInverse);const zn=Nt.map.cameraPosition;zn!==void 0&&zn.setValue(P,de.setFromMatrixPosition(C.matrixWorld)),ge.logarithmicDepthBuffer&&Nt.setValue(P,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&Nt.setValue(P,"isOrthographic",C.isOrthographicCamera===!0),E!==C&&(E=C,Cn=!0,dh=!0)}if(O.isSkinnedMesh){Nt.setOptional(P,O,"bindMatrix"),Nt.setOptional(P,O,"bindMatrixInverse");const zn=O.skeleton;zn&&(zn.boneTexture===null&&zn.computeBoneTexture(),Nt.setValue(P,"boneTexture",zn.boneTexture,we))}O.isBatchedMesh&&(Nt.setOptional(P,O,"batchingTexture"),Nt.setValue(P,"batchingTexture",O._matricesTexture,we),Nt.setOptional(P,O,"batchingIdTexture"),Nt.setValue(P,"batchingIdTexture",O._indirectTexture,we),Nt.setOptional(P,O,"batchingColorTexture"),O._colorsTexture!==null&&Nt.setValue(P,"batchingColorTexture",O._colorsTexture,we));const hh=B.morphAttributes;if((hh.position!==void 0||hh.normal!==void 0||hh.color!==void 0)&&Je.update(O,B,Zn),(Cn||Ne.receiveShadow!==O.receiveShadow)&&(Ne.receiveShadow=O.receiveShadow,Nt.setValue(P,"receiveShadow",O.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(nr.envMap.value=Ae,nr.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),H.isMeshStandardMaterial&&H.envMap===null&&k.environment!==null&&(nr.envMapIntensity.value=k.environmentIntensity),Cn&&(Nt.setValue(P,"toneMappingExposure",g.toneMappingExposure),Ne.needsLights&&xw(nr,dh),ue&&H.fog===!0&&Le.refreshFogUniforms(nr,ue),Le.refreshMaterialUniforms(nr,H,ne,W,x.state.transmissionRenderTarget[C.id]),lu.upload(P,Ig(Ne),nr,we)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(lu.upload(P,Ig(Ne),nr,we),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&Nt.setValue(P,"center",O.center),Nt.setValue(P,"modelViewMatrix",O.modelViewMatrix),Nt.setValue(P,"normalMatrix",O.normalMatrix),Nt.setValue(P,"modelMatrix",O.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const zn=H.uniformsGroups;for(let fh=0,yw=zn.length;fh<yw;fh++){const Lg=zn[fh];vt.update(Lg,Zn),vt.bind(Lg,Zn)}}return Zn}function xw(C,k){C.ambientLightColor.needsUpdate=k,C.lightProbe.needsUpdate=k,C.directionalLights.needsUpdate=k,C.directionalLightShadows.needsUpdate=k,C.pointLights.needsUpdate=k,C.pointLightShadows.needsUpdate=k,C.spotLights.needsUpdate=k,C.spotLightShadows.needsUpdate=k,C.rectAreaLights.needsUpdate=k,C.hemisphereLights.needsUpdate=k}function vw(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&C.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(C,k,B){me.get(C.texture).__webglTexture=k,me.get(C.depthTexture).__webglTexture=B;const H=me.get(C);H.__hasExternalTextures=!0,H.__autoAllocateDepthBuffer=B===void 0,H.__autoAllocateDepthBuffer||ie.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),H.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(C,k){const B=me.get(C);B.__webglFramebuffer=k,B.__useDefaultFramebuffer=k===void 0},this.setRenderTarget=function(C,k=0,B=0){A=C,R=k,w=B;let H=!0,O=null,ue=!1,ve=!1;if(C){const Ae=me.get(C);if(Ae.__useDefaultFramebuffer!==void 0)$.bindFramebuffer(P.FRAMEBUFFER,null),H=!1;else if(Ae.__webglFramebuffer===void 0)we.setupRenderTarget(C);else if(Ae.__hasExternalTextures)we.rebindTextures(C,me.get(C.texture).__webglTexture,me.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Ie=C.depthTexture;if(Ae.__boundDepthTexture!==Ie){if(Ie!==null&&me.has(Ie)&&(C.width!==Ie.image.width||C.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");we.setupDepthRenderbuffer(C)}}const Fe=C.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&(ve=!0);const ze=me.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(Array.isArray(ze[k])?O=ze[k][B]:O=ze[k],ue=!0):C.samples>0&&we.useMultisampledRTT(C)===!1?O=me.get(C).__webglMultisampledFramebuffer:Array.isArray(ze)?O=ze[B]:O=ze,M.copy(C.viewport),L.copy(C.scissor),V=C.scissorTest}else M.copy(Q).multiplyScalar(ne).floor(),L.copy(oe).multiplyScalar(ne).floor(),V=Re;if($.bindFramebuffer(P.FRAMEBUFFER,O)&&H&&$.drawBuffers(C,O),$.viewport(M),$.scissor(L),$.setScissorTest(V),ue){const Ae=me.get(C.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+k,Ae.__webglTexture,B)}else if(ve){const Ae=me.get(C.texture),Fe=k||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ae.__webglTexture,B||0,Fe)}b=-1},this.readRenderTargetPixels=function(C,k,B,H,O,ue,ve){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ve!==void 0&&(Te=Te[ve]),Te){$.bindFramebuffer(P.FRAMEBUFFER,Te);try{const Ae=C.texture,Fe=Ae.format,ze=Ae.type;if(!ge.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ge.textureTypeReadable(ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=C.width-H&&B>=0&&B<=C.height-O&&P.readPixels(k,B,H,O,Ge.convert(Fe),Ge.convert(ze),ue)}finally{const Ae=A!==null?me.get(A).__webglFramebuffer:null;$.bindFramebuffer(P.FRAMEBUFFER,Ae)}}},this.readRenderTargetPixelsAsync=async function(C,k,B,H,O,ue,ve){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=me.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&ve!==void 0&&(Te=Te[ve]),Te){$.bindFramebuffer(P.FRAMEBUFFER,Te);try{const Ae=C.texture,Fe=Ae.format,ze=Ae.type;if(!ge.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(k>=0&&k<=C.width-H&&B>=0&&B<=C.height-O){const Ie=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.bufferData(P.PIXEL_PACK_BUFFER,ue.byteLength,P.STREAM_READ),P.readPixels(k,B,H,O,Ge.convert(Fe),Ge.convert(ze),0),P.flush();const ot=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);await oA(P,ot,4);try{P.bindBuffer(P.PIXEL_PACK_BUFFER,Ie),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ue)}finally{P.deleteBuffer(Ie),P.deleteSync(ot)}return ue}}finally{const Ae=A!==null?me.get(A).__webglFramebuffer:null;$.bindFramebuffer(P.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(C,k=null,B=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyFramebufferToTexture function signature has changed."),k=arguments[0]||null,C=arguments[1]);const H=Math.pow(2,-B),O=Math.floor(C.image.width*H),ue=Math.floor(C.image.height*H),ve=k!==null?k.x:0,Te=k!==null?k.y:0;we.setTexture2D(C,0),P.copyTexSubImage2D(P.TEXTURE_2D,B,0,0,ve,Te,O,ue),$.unbindTexture()},this.copyTextureToTexture=function(C,k,B=null,H=null,O=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture function signature has changed."),H=arguments[0]||null,C=arguments[1],k=arguments[2],O=arguments[3]||0,B=null);let ue,ve,Te,Ae,Fe,ze;B!==null?(ue=B.max.x-B.min.x,ve=B.max.y-B.min.y,Te=B.min.x,Ae=B.min.y):(ue=C.image.width,ve=C.image.height,Te=0,Ae=0),H!==null?(Fe=H.x,ze=H.y):(Fe=0,ze=0);const Ie=Ge.convert(k.format),ot=Ge.convert(k.type);we.setTexture2D(k,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,k.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,k.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),bt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),An=P.getParameter(P.UNPACK_SKIP_PIXELS),at=P.getParameter(P.UNPACK_SKIP_ROWS),Ne=P.getParameter(P.UNPACK_SKIP_IMAGES),Xt=C.isCompressedTexture?C.mipmaps[O]:C.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Te),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ae),C.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,O,Fe,ze,ue,ve,Ie,ot,Xt.data):C.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,O,Fe,ze,Xt.width,Xt.height,Ie,Xt.data):P.texSubImage2D(P.TEXTURE_2D,O,Fe,ze,ue,ve,Ie,ot,Xt),P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,An),P.pixelStorei(P.UNPACK_SKIP_ROWS,at),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ne),O===0&&k.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(C,k,B=null,H=null,O=0){C.isTexture!==!0&&(bo("WebGLRenderer: copyTextureToTexture3D function signature has changed."),B=arguments[0]||null,H=arguments[1]||null,C=arguments[2],k=arguments[3],O=arguments[4]||0);let ue,ve,Te,Ae,Fe,ze,Ie,ot,wt;const bt=C.isCompressedTexture?C.mipmaps[O]:C.image;B!==null?(ue=B.max.x-B.min.x,ve=B.max.y-B.min.y,Te=B.max.z-B.min.z,Ae=B.min.x,Fe=B.min.y,ze=B.min.z):(ue=bt.width,ve=bt.height,Te=bt.depth,Ae=0,Fe=0,ze=0),H!==null?(Ie=H.x,ot=H.y,wt=H.z):(Ie=0,ot=0,wt=0);const An=Ge.convert(k.format),at=Ge.convert(k.type);let Ne;if(k.isData3DTexture)we.setTexture3D(k,0),Ne=P.TEXTURE_3D;else if(k.isDataArrayTexture||k.isCompressedArrayTexture)we.setTexture2DArray(k,0),Ne=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,k.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,k.unpackAlignment);const Xt=P.getParameter(P.UNPACK_ROW_LENGTH),lt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Zn=P.getParameter(P.UNPACK_SKIP_PIXELS),Is=P.getParameter(P.UNPACK_SKIP_ROWS),Cn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,bt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,bt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ae),P.pixelStorei(P.UNPACK_SKIP_ROWS,Fe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,ze),C.isDataTexture||C.isData3DTexture?P.texSubImage3D(Ne,O,Ie,ot,wt,ue,ve,Te,An,at,bt.data):k.isCompressedArrayTexture?P.compressedTexSubImage3D(Ne,O,Ie,ot,wt,ue,ve,Te,An,bt.data):P.texSubImage3D(Ne,O,Ie,ot,wt,ue,ve,Te,An,at,bt),P.pixelStorei(P.UNPACK_ROW_LENGTH,Xt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Zn),P.pixelStorei(P.UNPACK_SKIP_ROWS,Is),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Cn),O===0&&k.generateMipmaps&&P.generateMipmap(Ne),$.unbindTexture()},this.initRenderTarget=function(C){me.get(C).__webglFramebuffer===void 0&&we.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?we.setTextureCube(C,0):C.isData3DTexture?we.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?we.setTexture2DArray(C,0):we.setTexture2D(C,0),$.unbindTexture()},this.resetState=function(){R=0,w=0,A=null,$.reset(),qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _i}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Od?"display-p3":"srgb",t.unpackColorSpace=rt.workingColorSpace===Pl?"display-p3":"srgb"}}class Gd{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ye(e),this.density=t}clone(){return new Gd(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Wd{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ye(e),this.near=t,this.far=i}clone(){return new Wd(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let vM=class extends nt{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 On,this.environmentIntensity=1,this.environmentRotation=new On,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};class jd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=hl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Un()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return bo("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Un()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const an=new I;class bs{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=un(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Xe(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Xe(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Xe(t,this.array),i=Xe(i,this.array),r=Xe(r,this.array),s=Xe(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new ht(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new bs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ag extends on{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let qs;const aa=new I,Zs=new I,Ks=new I,Js=new K,la=new K,yM=new ke,bc=new I,ca=new I,Ec=new I,W0=new K,yf=new K,j0=new K;class _M extends nt{constructor(e=new ag){if(super(),this.isSprite=!0,this.type="Sprite",qs===void 0){qs=new $e;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new jd(t,5);qs.setIndex([0,1,2,0,2,3]),qs.setAttribute("position",new bs(i,3,0,!1)),qs.setAttribute("uv",new bs(i,2,3,!1))}this.geometry=qs,this.material=e,this.center=new K(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Zs.setFromMatrixScale(this.matrixWorld),yM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ks.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Zs.multiplyScalar(-Ks.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Tc(bc.set(-.5,-.5,0),Ks,o,Zs,r,s),Tc(ca.set(.5,-.5,0),Ks,o,Zs,r,s),Tc(Ec.set(.5,.5,0),Ks,o,Zs,r,s),W0.set(0,0),yf.set(1,0),j0.set(1,1);let a=e.ray.intersectTriangle(bc,ca,Ec,!1,aa);if(a===null&&(Tc(ca.set(-.5,.5,0),Ks,o,Zs,r,s),yf.set(0,1),a=e.ray.intersectTriangle(bc,Ec,ca,!1,aa),a===null))return;const l=e.ray.origin.distanceTo(aa);l<e.near||l>e.far||t.push({distance:l,point:aa.clone(),uv:Nn.getInterpolation(aa,bc,ca,Ec,W0,yf,j0,new K),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Tc(n,e,t,i,r,s){Js.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(la.x=s*Js.x-r*Js.y,la.y=r*Js.x+s*Js.y):la.copy(Js),n.copy(e),n.x+=la.x,n.y+=la.y,n.applyMatrix4(yM)}const Ac=new I,X0=new I;class SM extends nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Ac.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Ac);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ac.setFromMatrixPosition(e.matrixWorld),X0.setFromMatrixPosition(this.matrixWorld);const i=Ac.distanceTo(X0)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Y0=new I,$0=new ct,q0=new ct,_I=new I,Z0=new ke,Cc=new I,_f=new rn,K0=new ke,Sf=new Go;class MM extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ip,this.bindMatrix=new ke,this.bindMatrixInverse=new ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new pn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingBox.expandByPoint(Cc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new rn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Cc),this.boundingSphere.expandByPoint(Cc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_f.copy(this.boundingSphere),_f.applyMatrix4(r),e.ray.intersectsSphere(_f)!==!1&&(K0.copy(r).invert(),Sf.copy(e.ray).applyMatrix4(K0),!(this.boundingBox!==null&&Sf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Sf)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ct,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ip?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===HS?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;$0.fromBufferAttribute(r.attributes.skinIndex,e),q0.fromBufferAttribute(r.attributes.skinWeight,e),Y0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=q0.getComponent(s);if(o!==0){const a=$0.getComponent(s);Z0.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(_I.copy(Y0).applyMatrix4(Z0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class lg extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class wi extends Ct{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Gt,u=Gt,d,h){super(null,o,a,l,c,u,r,s,d,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const J0=new ke,SI=new ke;class Xd{constructor(e=[],t=[]){this.uuid=Un(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ke;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:SI;J0.multiplyMatrices(a,t[s]),J0.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Xd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new wi(t,e,e,dn,Sn);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new lg),this.bones.push(o),this.boneInverses.push(new ke().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Oo extends ht{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Qs=new ke,Q0=new ke,Rc=[],ev=new pn,MI=new ke,ua=new kt,da=new rn;class wM extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Oo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,MI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new pn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),ev.copy(e.boundingBox).applyMatrix4(Qs),this.boundingBox.union(ev)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new rn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Qs),da.copy(e.boundingSphere).applyMatrix4(Qs),this.boundingSphere.union(da)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(ua.geometry=this.geometry,ua.material=this.material,ua.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),da.copy(this.boundingSphere),da.applyMatrix4(i),e.ray.intersectsSphere(da)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Qs),Q0.multiplyMatrices(i,Qs),ua.matrixWorld=Q0,ua.raycast(e,Rc);for(let o=0,a=Rc.length;o<a;o++){const l=Rc[o];l.instanceId=s,l.object=this,t.push(l)}Rc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Oo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new wi(new Float32Array(r*this.count),r,this.count,Ld,Sn));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function wI(n,e){return n.z-e.z}function bI(n,e){return e.z-n.z}class EI{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=i}reset(){this.list.length=0,this.index=0}}const dr=new ke,Mf=new ke,TI=new ke,AI=new ye(1,1,1),tv=new ke,wf=new Nl,Pc=new pn,Yr=new rn,ha=new I,nv=new I,CI=new I,bf=new EI,tn=new kt,Ic=[];function RI(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class bM extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,i=t*2,r){super(new $e,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new wi(t,e,e,dn,Sn);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new wi(t,e,e,Rl,Ji);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new wi(t,e,e,dn,Sn);i.colorSpace=rt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(i*l),d=new ht(u,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new ht(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingBoxAt(s,Pc).applyMatrix4(dr),e.union(Pc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingSphereAt(s,Yr).applyMatrix4(dr),e.union(Yr)}}addInstance(e){if(this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});const t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;TI.toArray(r,t*16),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(AI.toArray(s.image.data,t*4),s.needsUpdate=!0),t}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const d=this._geometryCount;return this._geometryCount++,o.push(r),a.push({start:u?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new pn,sphereInitialized:!1,sphere:new rn}),this.setGeometryAt(d,e),d}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const p in i.attributes){const m=t.getAttribute(p),y=i.getAttribute(p);RI(m,y,l);const x=m.itemSize;for(let f=m.count,v=c;f<v;f++){const g=l+f;for(let _=0;_<x;_++)y.setComponent(g,_,0)}y.needsUpdate=!0,y.addUpdateRange(l*x,c*x)}if(r){const p=a.indexStart;for(let m=0;m<o.count;m++)s.setX(p+m,l+o.getX(m));for(let m=o.count,y=a.indexCount;m<y;m++)s.setX(p+m,l);s.needsUpdate=!0,s.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const d=this._drawRanges[e],h=t.getAttribute("position");return d.count=r?o.count:h.count,this._visibilityChanged=!0,e}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.box,s=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,u=l.start+l.count;c<u;c++){let d=c;o&&(d=o.getX(d)),r.expandByPoint(ha.fromBufferAttribute(a,d))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this._bounds[e],r=i.sphere,s=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,Pc),Pc.getCenter(r.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let u=l.start,d=l.start+l.count;u<d;u++){let h=u;o&&(h=o.getX(h)),ha.fromBufferAttribute(a,h),c=Math.max(c,r.center.distanceToSquared(ha))}r.radius=Math.sqrt(c),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._drawInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}raycast(e,t){const i=this._drawInfo,r=this._drawRanges,s=this.matrixWorld,o=this.geometry;tn.material=this.material,tn.geometry.index=o.index,tn.geometry.attributes=o.attributes,tn.geometry.boundingBox===null&&(tn.geometry.boundingBox=new pn),tn.geometry.boundingSphere===null&&(tn.geometry.boundingSphere=new rn);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,u=r[c];tn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,tn.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,tn.geometry.boundingBox),this.getBoundingSphereAt(c,tn.geometry.boundingSphere),tn.raycast(e,Ic);for(let d=0,h=Ic.length;d<h;d++){const p=Ic[d];p.object=this,p.batchId=a,t.push(p)}Ic.length=0}tn.material=null,tn.geometry.index=null,tn.geometry.attributes={},tn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,d=this._drawRanges,h=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data;h&&(tv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),wf.setFromProjectionMatrix(tv,e.coordinateSystem));let y=0;if(this.sortObjects){Mf.copy(this.matrixWorld).invert(),ha.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Mf),nv.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Mf);for(let v=0,g=l.length;v<g;v++)if(l[v].visible&&l[v].active){const _=l[v].geometryIndex;this.getMatrixAt(v,dr),this.getBoundingSphereAt(_,Yr).applyMatrix4(dr);let R=!1;if(h&&(R=!wf.intersectsSphere(Yr)),!R){const w=CI.subVectors(Yr.center,ha).dot(nv);bf.push(d[_],w,v)}}const x=bf.list,f=this.customSort;f===null?x.sort(s.transparent?bI:wI):f.call(this,x,i);for(let v=0,g=x.length;v<g;v++){const _=x[v];c[y]=_.start*a,u[y]=_.count,m[y]=_.index,y++}bf.reset()}else for(let x=0,f=l.length;x<f;x++)if(l[x].visible&&l[x].active){const v=l[x].geometryIndex;let g=!1;if(h&&(this.getMatrixAt(x,dr),this.getBoundingSphereAt(v,Yr).applyMatrix4(dr),g=!wf.intersectsSphere(Yr)),!g){const _=d[v];c[y]=_.start*a,u[y]=_.count,m[y]=x,y++}}p.needsUpdate=!0,this._multiDrawCount=y,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class xn extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ye(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ld=new I,cd=new I,iv=new ke,fa=new Go,Nc=new rn,Ef=new I,rv=new I;class Nr extends nt{constructor(e=new $e,t=new xn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ld.fromBufferAttribute(t,r-1),cd.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ld.distanceTo(cd);e.setAttribute("lineDistance",new Ce(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Nc.copy(i.boundingSphere),Nc.applyMatrix4(r),Nc.radius+=s,e.ray.intersectsSphere(Nc)===!1)return;iv.copy(r).invert(),fa.copy(e.ray).applyMatrix4(iv);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){const p=Math.max(0,o.start),m=Math.min(u.count,o.start+o.count);for(let y=p,x=m-1;y<x;y+=c){const f=u.getX(y),v=u.getX(y+1),g=Lc(this,e,fa,l,f,v);g&&t.push(g)}if(this.isLineLoop){const y=u.getX(m-1),x=u.getX(p),f=Lc(this,e,fa,l,y,x);f&&t.push(f)}}else{const p=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let y=p,x=m-1;y<x;y+=c){const f=Lc(this,e,fa,l,y,y+1);f&&t.push(f)}if(this.isLineLoop){const y=Lc(this,e,fa,l,m-1,p);y&&t.push(y)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Lc(n,e,t,i,r,s){const o=n.geometry.attributes.position;if(ld.fromBufferAttribute(o,r),cd.fromBufferAttribute(o,s),t.distanceSqToSegment(ld,cd,Ef,rv)>i)return;Ef.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(Ef);if(!(l<e.near||l>e.far))return{distance:l,point:rv.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const sv=new I,ov=new I;class Ai extends Nr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)sv.fromBufferAttribute(t,r),ov.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+sv.distanceTo(ov);e.setAttribute("lineDistance",new Ce(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class EM extends Nr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class cg extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ye(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const av=new ke,Op=new Go,Dc=new rn,Uc=new I;class TM extends nt{constructor(e=new $e,t=new cg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Dc.copy(i.boundingSphere),Dc.applyMatrix4(r),Dc.radius+=s,e.ray.intersectsSphere(Dc)===!1)return;av.copy(r).invert(),Op.copy(e.ray).applyMatrix4(av);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,d=i.attributes.position;if(c!==null){const h=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let m=h,y=p;m<y;m++){const x=c.getX(m);Uc.fromBufferAttribute(d,x),lv(Uc,x,l,r,e,t,this)}}else{const h=Math.max(0,o.start),p=Math.min(d.count,o.start+o.count);for(let m=h,y=p;m<y;m++)Uc.fromBufferAttribute(d,m),lv(Uc,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function lv(n,e,t,i,r,s,o){const a=Op.distanceSqToPoint(n);if(a<t){const l=new I;Op.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class PI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=s!==void 0?s:Ut,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class II extends Ct{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Gt,this.minFilter=Gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Yd extends Ct{constructor(e,t,i,r,s,o,a,l,c,u,d,h){super(null,o,a,l,c,u,r,s,d,h),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class NI extends Yd{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Xn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class LI extends Yd{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ki),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class DI extends Ct{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ui{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],h=i[r+1]-u,p=(o-u)/h;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new K:new I);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new I,r=[],s=[],o=[],a=new I,l=new ke;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new I)}s[0]=new I,o[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),h<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(r[p-1],r[p]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(At(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,m))}o[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(At(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),o[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class $d extends ui{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new K){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,p=c-this.aY;l=h*u-p*d+this.aX,c=h*d+p*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class AM extends $d{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function ug(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,d){let h=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+d)+(l-a)/d;h*=u,p*=u,r(o,a,h,p)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const kc=new I,Tf=new ug,Af=new ug,Cf=new ug;class CM extends ui{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new I){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(kc.subVectors(r[0],r[1]).add(r[0]),c=kc);const d=r[a%s],h=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(kc.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=kc),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(u),p);y<1e-4&&(y=1),m<1e-4&&(m=y),x<1e-4&&(x=y),Tf.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,m,y,x),Af.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,m,y,x),Cf.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,m,y,x)}else this.curveType==="catmullrom"&&(Tf.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Af.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),Cf.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return i.set(Tf.calc(l),Af.calc(l),Cf.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cv(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function UI(n,e){const t=1-n;return t*t*e}function kI(n,e){return 2*(1-n)*n*e}function OI(n,e){return n*n*e}function Oa(n,e,t,i){return UI(n,e)+kI(n,t)+OI(n,i)}function FI(n,e){const t=1-n;return t*t*t*e}function BI(n,e){const t=1-n;return 3*t*t*n*e}function zI(n,e){return 3*(1-n)*n*n*e}function VI(n,e){return n*n*n*e}function Fa(n,e,t,i,r){return FI(n,e)+BI(n,t)+zI(n,i)+VI(n,r)}class dg extends ui{constructor(e=new K,t=new K,i=new K,r=new K){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class RM extends ui{constructor(e=new I,t=new I,i=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Fa(e,r.x,s.x,o.x,a.x),Fa(e,r.y,s.y,o.y,a.y),Fa(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class hg extends ui{constructor(e=new K,t=new K){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new K){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new K){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class PM extends ui{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fg extends ui{constructor(e=new K,t=new K,i=new K){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class pg extends ui{constructor(e=new I,t=new I,i=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new I){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Oa(e,r.x,s.x,o.x),Oa(e,r.y,s.y,o.y),Oa(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class mg extends ui{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new K){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(cv(a,l.x,c.x,u.x,d.x),cv(a,l.y,c.y,u.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new K().fromArray(r))}return this}}var ud=Object.freeze({__proto__:null,ArcCurve:AM,CatmullRomCurve3:CM,CubicBezierCurve:dg,CubicBezierCurve3:RM,EllipseCurve:$d,LineCurve:hg,LineCurve3:PM,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,SplineCurve:mg});class IM extends ui{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ud[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new ud[r.type]().fromJSON(r))}return this}}class ml extends IM{constructor(e){super(),this.type="Path",this.currentPoint=new K,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new hg(this.currentPoint.clone(),new K(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new fg(this.currentPoint.clone(),new K(e,t),new K(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new dg(this.currentPoint.clone(),new K(e,t),new K(i,r),new K(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new mg(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new $d(e,t,i,r,s,o,a,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ll extends $e{constructor(e=[new K(0,-.5),new K(.5,0),new K(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=At(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,d=new I,h=new K,p=new I,m=new I,y=new I;let x=0,f=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:x=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-x,p.z=f*0,y.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:x=e[v+1].x-e[v].x,f=e[v+1].y-e[v].y,p.x=f*1,p.y=-x,p.z=f*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),l.push(p.x,p.y,p.z),y.copy(m)}for(let v=0;v<=t;v++){const g=i+v*u*r,_=Math.sin(g),R=Math.cos(g);for(let w=0;w<=e.length-1;w++){d.x=e[w].x*_,d.y=e[w].y,d.z=e[w].x*R,o.push(d.x,d.y,d.z),h.x=v/t,h.y=w/(e.length-1),a.push(h.x,h.y);const A=l[3*w+0]*_,b=l[3*w+1],E=l[3*w+0]*R;c.push(A,b,E)}}for(let v=0;v<t;v++)for(let g=0;g<e.length-1;g++){const _=g+v*e.length,R=_,w=_+e.length,A=_+e.length+1,b=_+1;s.push(R,w,b),s.push(A,b,w)}this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("uv",new Ce(a,2)),this.setAttribute("normal",new Ce(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ll(e.points,e.segments,e.phiStart,e.phiLength)}}class qd extends Ll{constructor(e=1,t=1,i=4,r=8){const s=new ml;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new qd(e.radius,e.length,e.capSegments,e.radialSegments)}}class Zd extends $e{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new I,u=new K;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,h=3;d<=t;d++,h+=3){const p=i+d/t*r;c.x=e*Math.cos(p),c.y=e*Math.sin(p),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[h]/e+1)/2,u.y=(o[h+1]/e+1)/2,l.push(u.x,u.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Ce(o,3)),this.setAttribute("normal",new Ce(a,3)),this.setAttribute("uv",new Ce(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zd(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xo extends $e{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],d=[],h=[],p=[];let m=0;const y=[],x=i/2;let f=0;v(),o===!1&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(u),this.setAttribute("position",new Ce(d,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(p,2));function v(){const _=new I,R=new I;let w=0;const A=(t-e)/i;for(let b=0;b<=s;b++){const E=[],M=b/s,L=M*(t-e)+e;for(let V=0;V<=r;V++){const F=V/r,G=F*l+a,X=Math.sin(G),W=Math.cos(G);R.x=L*X,R.y=-M*i+x,R.z=L*W,d.push(R.x,R.y,R.z),_.set(X,A,W).normalize(),h.push(_.x,_.y,_.z),p.push(F,1-M),E.push(m++)}y.push(E)}for(let b=0;b<r;b++)for(let E=0;E<s;E++){const M=y[E][b],L=y[E+1][b],V=y[E+1][b+1],F=y[E][b+1];u.push(M,L,F),u.push(L,V,F),w+=6}c.addGroup(f,w,0),f+=w}function g(_){const R=m,w=new K,A=new I;let b=0;const E=_===!0?e:t,M=_===!0?1:-1;for(let V=1;V<=r;V++)d.push(0,x*M,0),h.push(0,M,0),p.push(.5,.5),m++;const L=m;for(let V=0;V<=r;V++){const G=V/r*l+a,X=Math.cos(G),W=Math.sin(G);A.x=E*W,A.y=x*M,A.z=E*X,d.push(A.x,A.y,A.z),h.push(0,M,0),w.x=X*.5+.5,w.y=W*.5*M+.5,p.push(w.x,w.y),m++}for(let V=0;V<r;V++){const F=R+V,G=L+V;_===!0?u.push(G,G+1,F):u.push(G+1,G,F),b+=3}c.addGroup(f,b,_===!0?1:2),f+=b}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Kd extends Xo{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Kd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fr extends $e{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Ce(s,3)),this.setAttribute("normal",new Ce(s.slice(),3)),this.setAttribute("uv",new Ce(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const g=new I,_=new I,R=new I;for(let w=0;w<t.length;w+=3)p(t[w+0],g),p(t[w+1],_),p(t[w+2],R),l(g,_,R,v)}function l(v,g,_,R){const w=R+1,A=[];for(let b=0;b<=w;b++){A[b]=[];const E=v.clone().lerp(_,b/w),M=g.clone().lerp(_,b/w),L=w-b;for(let V=0;V<=L;V++)V===0&&b===w?A[b][V]=E:A[b][V]=E.clone().lerp(M,V/L)}for(let b=0;b<w;b++)for(let E=0;E<2*(w-b)-1;E++){const M=Math.floor(E/2);E%2===0?(h(A[b][M+1]),h(A[b+1][M]),h(A[b][M])):(h(A[b][M+1]),h(A[b+1][M+1]),h(A[b+1][M]))}}function c(v){const g=new I;for(let _=0;_<s.length;_+=3)g.x=s[_+0],g.y=s[_+1],g.z=s[_+2],g.normalize().multiplyScalar(v),s[_+0]=g.x,s[_+1]=g.y,s[_+2]=g.z}function u(){const v=new I;for(let g=0;g<s.length;g+=3){v.x=s[g+0],v.y=s[g+1],v.z=s[g+2];const _=x(v)/2/Math.PI+.5,R=f(v)/Math.PI+.5;o.push(_,1-R)}m(),d()}function d(){for(let v=0;v<o.length;v+=6){const g=o[v+0],_=o[v+2],R=o[v+4],w=Math.max(g,_,R),A=Math.min(g,_,R);w>.9&&A<.1&&(g<.2&&(o[v+0]+=1),_<.2&&(o[v+2]+=1),R<.2&&(o[v+4]+=1))}}function h(v){s.push(v.x,v.y,v.z)}function p(v,g){const _=v*3;g.x=e[_+0],g.y=e[_+1],g.z=e[_+2]}function m(){const v=new I,g=new I,_=new I,R=new I,w=new K,A=new K,b=new K;for(let E=0,M=0;E<s.length;E+=9,M+=6){v.set(s[E+0],s[E+1],s[E+2]),g.set(s[E+3],s[E+4],s[E+5]),_.set(s[E+6],s[E+7],s[E+8]),w.set(o[M+0],o[M+1]),A.set(o[M+2],o[M+3]),b.set(o[M+4],o[M+5]),R.copy(v).add(g).add(_).divideScalar(3);const L=x(R);y(w,M+0,v,L),y(A,M+2,g,L),y(b,M+4,_,L)}}function y(v,g,_,R){R<0&&v.x===1&&(o[g]=v.x-1),_.x===0&&_.z===0&&(o[g]=R/2/Math.PI+.5)}function x(v){return Math.atan2(v.z,-v.x)}function f(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fr(e.vertices,e.indices,e.radius,e.details)}}class Jd extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,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,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[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(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Jd(e.radius,e.detail)}}const Oc=new I,Fc=new I,Rf=new I,Bc=new Nn;class NM extends $e{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ms*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},p=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:y,b:x,c:f}=Bc;if(y.fromBufferAttribute(a,c[0]),x.fromBufferAttribute(a,c[1]),f.fromBufferAttribute(a,c[2]),Bc.getNormal(Rf),d[0]=`${Math.round(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,d[1]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,d[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let v=0;v<3;v++){const g=(v+1)%3,_=d[v],R=d[g],w=Bc[u[v]],A=Bc[u[g]],b=`${_}_${R}`,E=`${R}_${_}`;E in h&&h[E]?(Rf.dot(h[E].normal)<=s&&(p.push(w.x,w.y,w.z),p.push(A.x,A.y,A.z)),h[E]=null):b in h||(h[b]={index0:c[v],index1:c[g],normal:Rf.clone()})}}for(const m in h)if(h[m]){const{index0:y,index1:x}=h[m];Oc.fromBufferAttribute(a,y),Fc.fromBufferAttribute(a,x),p.push(Oc.x,Oc.y,Oc.z),p.push(Fc.x,Fc.y,Fc.z)}this.setAttribute("position",new Ce(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class gs extends ml{constructor(e){super(e),this.uuid=Un(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new ml().fromJSON(r))}return this}}const HI={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=LM(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,d,h,p;if(i&&(s=YI(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let m=t;m<r;m+=t)d=n[m],h=n[m+1],d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>u&&(u=h);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return gl(s,o,t,a,l,p,0),o}};function LM(n,e,t,i,r){let s,o;if(r===rN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=uv(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=uv(s,n[s],n[s+1],o);return o&&Qd(o,o.next)&&(vl(o),o=o.next),o}function Es(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Qd(t,t.next)||_t(t.prev,t,t.next)===0)){if(vl(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function gl(n,e,t,i,r,s,o){if(!n)return;!o&&s&&JI(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?WI(n,i,r,s):GI(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),vl(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=jI(Es(n),e,t),gl(n,e,t,i,r,s,2)):o===2&&XI(n,e,t,i,r,s):gl(Es(n),e,t,i,r,s,1);break}}}function GI(n){const e=n.prev,t=n,i=n.next;if(_t(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,h=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=h&&m.y>=d&&m.y<=p&&xo(r,a,s,l,o,c,m.x,m.y)&&_t(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function WI(n,e,t,i){const r=n.prev,s=n,o=n.next;if(_t(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,d=s.y,h=o.y,p=a<l?a<c?a:c:l<c?l:c,m=u<d?u<h?u:h:d<h?d:h,y=a>l?a>c?a:c:l>c?l:c,x=u>d?u>h?u:h:d>h?d:h,f=Fp(p,m,e,t,i),v=Fp(y,x,e,t,i);let g=n.prevZ,_=n.nextZ;for(;g&&g.z>=f&&_&&_.z<=v;){if(g.x>=p&&g.x<=y&&g.y>=m&&g.y<=x&&g!==r&&g!==o&&xo(a,u,l,d,c,h,g.x,g.y)&&_t(g.prev,g,g.next)>=0||(g=g.prevZ,_.x>=p&&_.x<=y&&_.y>=m&&_.y<=x&&_!==r&&_!==o&&xo(a,u,l,d,c,h,_.x,_.y)&&_t(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;g&&g.z>=f;){if(g.x>=p&&g.x<=y&&g.y>=m&&g.y<=x&&g!==r&&g!==o&&xo(a,u,l,d,c,h,g.x,g.y)&&_t(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=y&&_.y>=m&&_.y<=x&&_!==r&&_!==o&&xo(a,u,l,d,c,h,_.x,_.y)&&_t(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function jI(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Qd(r,s)&&DM(r,i,i.next,s)&&xl(r,s)&&xl(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),vl(i),vl(i.next),i=n=s),i=i.next}while(i!==n);return Es(i)}function XI(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&tN(o,a)){let l=UM(o,a);o=Es(o,o.next),l=Es(l,l.next),gl(o,e,t,i,r,s,0),gl(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function YI(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=LM(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(eN(c));for(r.sort($I),s=0;s<r.length;s++)t=qI(r[s],t);return t}function $I(n,e){return n.x-e.x}function qI(n,e){const t=ZI(n,e);if(!t)return e;const i=UM(t,n);return Es(i,i.next),Es(t,t.next)}function ZI(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const h=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=s&&h>i&&(i=h,r=t.x<t.next.x?t:t.next,h===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,d;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&xo(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(d=Math.abs(o-t.y)/(s-t.x),xl(t,n)&&(d<u||d===u&&(t.x>r.x||t.x===r.x&&KI(r,t)))&&(r=t,u=d)),t=t.next;while(t!==a);return r}function KI(n,e){return _t(n.prev,n,e.prev)<0&&_t(e.next,n,n.next)<0}function JI(n,e,t,i){let r=n;do r.z===0&&(r.z=Fp(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,QI(r)}function QI(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function Fp(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function eN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xo(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function tN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!nN(n,e)&&(xl(n,e)&&xl(e,n)&&iN(n,e)&&(_t(n.prev,n,e.prev)||_t(n,e.prev,e))||Qd(n,e)&&_t(n.prev,n,n.next)>0&&_t(e.prev,e,e.next)>0)}function _t(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Qd(n,e){return n.x===e.x&&n.y===e.y}function DM(n,e,t,i){const r=Vc(_t(n,e,t)),s=Vc(_t(n,e,i)),o=Vc(_t(t,i,n)),a=Vc(_t(t,i,e));return!!(r!==s&&o!==a||r===0&&zc(n,t,e)||s===0&&zc(n,i,e)||o===0&&zc(t,n,i)||a===0&&zc(t,e,i))}function zc(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Vc(n){return n>0?1:n<0?-1:0}function nN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&DM(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xl(n,e){return _t(n.prev,n,n.next)<0?_t(n,e,n.next)>=0&&_t(n,n.prev,e)>=0:_t(n,e,n.prev)<0||_t(n,n.next,e)<0}function iN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function UM(n,e){const t=new Bp(n.i,n.x,n.y),i=new Bp(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function uv(n,e,t,i){const r=new Bp(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vl(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Bp(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function rN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class bi{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return bi.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];dv(e),hv(i,e);let o=e.length;t.forEach(dv);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,hv(i,t[l]);const a=HI.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function dv(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function hv(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class eh extends $e{constructor(e=new gs([new K(.5,.5),new K(-.5,.5),new K(-.5,-.5),new K(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Ce(r,3)),this.setAttribute("uv",new Ce(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:p-.1,y=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3;const f=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:sN;let g,_=!1,R,w,A,b;f&&(g=f.getSpacedPoints(u),_=!0,h=!1,R=f.computeFrenetFrames(u,!1),w=new I,A=new I,b=new I),h||(x=0,p=0,m=0,y=0);const E=a.extractPoints(c);let M=E.shape;const L=E.holes;if(!bi.isClockWise(M)){M=M.reverse();for(let P=0,le=L.length;P<le;P++){const ie=L[P];bi.isClockWise(ie)&&(L[P]=ie.reverse())}}const F=bi.triangulateShape(M,L),G=M;for(let P=0,le=L.length;P<le;P++){const ie=L[P];M=M.concat(ie)}function X(P,le,ie){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),P.clone().addScaledVector(le,ie)}const W=M.length,ne=F.length;function D(P,le,ie){let ge,$,Ue;const me=P.x-le.x,we=P.y-le.y,N=ie.x-P.x,T=ie.y-P.y,z=me*me+we*we,J=me*T-we*N;if(Math.abs(J)>Number.EPSILON){const Z=Math.sqrt(z),te=Math.sqrt(N*N+T*T),Le=le.x-we/Z,pe=le.y+me/Z,Se=ie.x-T/te,We=ie.y+N/te,ae=((Se-Le)*T-(We-pe)*N)/(me*T-we*N);ge=Le+me*ae-P.x,$=pe+we*ae-P.y;const _e=ge*ge+$*$;if(_e<=2)return new K(ge,$);Ue=Math.sqrt(_e/2)}else{let Z=!1;me>Number.EPSILON?N>Number.EPSILON&&(Z=!0):me<-Number.EPSILON?N<-Number.EPSILON&&(Z=!0):Math.sign(we)===Math.sign(T)&&(Z=!0),Z?(ge=-we,$=me,Ue=Math.sqrt(z)):(ge=me,$=we,Ue=Math.sqrt(z/2))}return new K(ge/Ue,$/Ue)}const Y=[];for(let P=0,le=G.length,ie=le-1,ge=P+1;P<le;P++,ie++,ge++)ie===le&&(ie=0),ge===le&&(ge=0),Y[P]=D(G[P],G[ie],G[ge]);const Q=[];let oe,Re=Y.concat();for(let P=0,le=L.length;P<le;P++){const ie=L[P];oe=[];for(let ge=0,$=ie.length,Ue=$-1,me=ge+1;ge<$;ge++,Ue++,me++)Ue===$&&(Ue=0),me===$&&(me=0),oe[ge]=D(ie[ge],ie[Ue],ie[me]);Q.push(oe),Re=Re.concat(oe)}for(let P=0;P<x;P++){const le=P/x,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+y;for(let $=0,Ue=G.length;$<Ue;$++){const me=X(G[$],Y[$],ge);de(me.x,me.y,-ie)}for(let $=0,Ue=L.length;$<Ue;$++){const me=L[$];oe=Q[$];for(let we=0,N=me.length;we<N;we++){const T=X(me[we],oe[we],ge);de(T.x,T.y,-ie)}}}const Ke=m+y;for(let P=0;P<W;P++){const le=h?X(M[P],Re[P],Ke):M[P];_?(A.copy(R.normals[0]).multiplyScalar(le.x),w.copy(R.binormals[0]).multiplyScalar(le.y),b.copy(g[0]).add(A).add(w),de(b.x,b.y,b.z)):de(le.x,le.y,0)}for(let P=1;P<=u;P++)for(let le=0;le<W;le++){const ie=h?X(M[le],Re[le],Ke):M[le];_?(A.copy(R.normals[P]).multiplyScalar(ie.x),w.copy(R.binormals[P]).multiplyScalar(ie.y),b.copy(g[P]).add(A).add(w),de(b.x,b.y,b.z)):de(ie.x,ie.y,d/u*P)}for(let P=x-1;P>=0;P--){const le=P/x,ie=p*Math.cos(le*Math.PI/2),ge=m*Math.sin(le*Math.PI/2)+y;for(let $=0,Ue=G.length;$<Ue;$++){const me=X(G[$],Y[$],ge);de(me.x,me.y,d+ie)}for(let $=0,Ue=L.length;$<Ue;$++){const me=L[$];oe=Q[$];for(let we=0,N=me.length;we<N;we++){const T=X(me[we],oe[we],ge);_?de(T.x,T.y+g[u-1].y,g[u-1].x+ie):de(T.x,T.y,d+ie)}}}j(),se();function j(){const P=r.length/3;if(h){let le=0,ie=W*le;for(let ge=0;ge<ne;ge++){const $=F[ge];De($[2]+ie,$[1]+ie,$[0]+ie)}le=u+x*2,ie=W*le;for(let ge=0;ge<ne;ge++){const $=F[ge];De($[0]+ie,$[1]+ie,$[2]+ie)}}else{for(let le=0;le<ne;le++){const ie=F[le];De(ie[2],ie[1],ie[0])}for(let le=0;le<ne;le++){const ie=F[le];De(ie[0]+W*u,ie[1]+W*u,ie[2]+W*u)}}i.addGroup(P,r.length/3-P,0)}function se(){const P=r.length/3;let le=0;xe(G,le),le+=G.length;for(let ie=0,ge=L.length;ie<ge;ie++){const $=L[ie];xe($,le),le+=$.length}i.addGroup(P,r.length/3-P,1)}function xe(P,le){let ie=P.length;for(;--ie>=0;){const ge=ie;let $=ie-1;$<0&&($=P.length-1);for(let Ue=0,me=u+x*2;Ue<me;Ue++){const we=W*Ue,N=W*(Ue+1),T=le+ge+we,z=le+$+we,J=le+$+N,Z=le+ge+N;He(T,z,J,Z)}}}function de(P,le,ie){l.push(P),l.push(le),l.push(ie)}function De(P,le,ie){Be(P),Be(le),Be(ie);const ge=r.length/3,$=v.generateTopUV(i,r,ge-3,ge-2,ge-1);it($[0]),it($[1]),it($[2])}function He(P,le,ie,ge){Be(P),Be(le),Be(ge),Be(le),Be(ie),Be(ge);const $=r.length/3,Ue=v.generateSideWallUV(i,r,$-6,$-3,$-2,$-1);it(Ue[0]),it(Ue[1]),it(Ue[3]),it(Ue[1]),it(Ue[2]),it(Ue[3])}function Be(P){r.push(l[P*3+0]),r.push(l[P*3+1]),r.push(l[P*3+2])}function it(P){s.push(P.x),s.push(P.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return oN(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new ud[r.type]().fromJSON(r)),new eh(i,e.options)}}const sN={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new K(s,o),new K(a,l),new K(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],d=e[i*3+2],h=e[r*3],p=e[r*3+1],m=e[r*3+2],y=e[s*3],x=e[s*3+1],f=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new K(o,1-l),new K(c,1-d),new K(h,1-m),new K(y,1-f)]:[new K(a,1-l),new K(u,1-d),new K(p,1-m),new K(x,1-f)]}};function oN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class th extends Fr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[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(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new th(e.radius,e.detail)}}class Dl extends Fr{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Dl(e.radius,e.detail)}}class nh extends $e{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let d=e;const h=(t-e)/r,p=new I,m=new K;for(let y=0;y<=r;y++){for(let x=0;x<=i;x++){const f=s+x/i*o;p.x=d*Math.cos(f),p.y=d*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,u.push(m.x,m.y)}d+=h}for(let y=0;y<r;y++){const x=y*(i+1);for(let f=0;f<i;f++){const v=f+x,g=v,_=v+i+1,R=v+i+2,w=v+1;a.push(g,_,w),a.push(_,R,w)}}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ih extends $e{constructor(e=new gs([new K(0,.5),new K(-.5,-.5),new K(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Ce(r,3)),this.setAttribute("normal",new Ce(s,3)),this.setAttribute("uv",new Ce(o,2));function c(u){const d=r.length/3,h=u.extractPoints(t);let p=h.shape;const m=h.holes;bi.isClockWise(p)===!1&&(p=p.reverse());for(let x=0,f=m.length;x<f;x++){const v=m[x];bi.isClockWise(v)===!0&&(m[x]=v.reverse())}const y=bi.triangulateShape(p,m);for(let x=0,f=m.length;x<f;x++){const v=m[x];p=p.concat(v)}for(let x=0,f=p.length;x<f;x++){const v=p[x];r.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let x=0,f=y.length;x<f;x++){const v=y[x],g=v[0]+d,_=v[1]+d,R=v[2]+d;i.push(g,_,R),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return aN(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new ih(i,e.curveSegments)}}function aN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Ul extends $e{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],d=new I,h=new I,p=[],m=[],y=[],x=[];for(let f=0;f<=i;f++){const v=[],g=f/i;let _=0;f===0&&o===0?_=.5/t:f===i&&l===Math.PI&&(_=-.5/t);for(let R=0;R<=t;R++){const w=R/t;d.x=-e*Math.cos(r+w*s)*Math.sin(o+g*a),d.y=e*Math.cos(o+g*a),d.z=e*Math.sin(r+w*s)*Math.sin(o+g*a),m.push(d.x,d.y,d.z),h.copy(d).normalize(),y.push(h.x,h.y,h.z),x.push(w+_,1-g),v.push(c++)}u.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){const g=u[f][v+1],_=u[f][v],R=u[f+1][v],w=u[f+1][v+1];(f!==0||o>0)&&p.push(g,_,w),(f!==i-1||l<Math.PI)&&p.push(_,R,w)}this.setIndex(p),this.setAttribute("position",new Ce(m,3)),this.setAttribute("normal",new Ce(y,3)),this.setAttribute("uv",new Ce(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ul(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class rh extends Fr{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rh(e.radius,e.detail)}}class sh extends $e{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new I,d=new I,h=new I;for(let p=0;p<=i;p++)for(let m=0;m<=r;m++){const y=m/r*s,x=p/i*Math.PI*2;d.x=(e+t*Math.cos(x))*Math.cos(y),d.y=(e+t*Math.cos(x))*Math.sin(y),d.z=t*Math.sin(x),a.push(d.x,d.y,d.z),u.x=e*Math.cos(y),u.y=e*Math.sin(y),h.subVectors(d,u).normalize(),l.push(h.x,h.y,h.z),c.push(m/r),c.push(p/i)}for(let p=1;p<=i;p++)for(let m=1;m<=r;m++){const y=(r+1)*p+m-1,x=(r+1)*(p-1)+m-1,f=(r+1)*(p-1)+m,v=(r+1)*p+m;o.push(y,x,v),o.push(x,f,v)}this.setIndex(o),this.setAttribute("position",new Ce(a,3)),this.setAttribute("normal",new Ce(l,3)),this.setAttribute("uv",new Ce(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class oh extends $e{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],d=new I,h=new I,p=new I,m=new I,y=new I,x=new I,f=new I;for(let g=0;g<=i;++g){const _=g/i*s*Math.PI*2;v(_,s,o,e,p),v(_+.01,s,o,e,m),x.subVectors(m,p),f.addVectors(m,p),y.crossVectors(x,f),f.crossVectors(y,x),y.normalize(),f.normalize();for(let R=0;R<=r;++R){const w=R/r*Math.PI*2,A=-t*Math.cos(w),b=t*Math.sin(w);d.x=p.x+(A*f.x+b*y.x),d.y=p.y+(A*f.y+b*y.y),d.z=p.z+(A*f.z+b*y.z),l.push(d.x,d.y,d.z),h.subVectors(d,p).normalize(),c.push(h.x,h.y,h.z),u.push(g/i),u.push(R/r)}}for(let g=1;g<=i;g++)for(let _=1;_<=r;_++){const R=(r+1)*(g-1)+(_-1),w=(r+1)*g+(_-1),A=(r+1)*g+_,b=(r+1)*(g-1)+_;a.push(R,w,b),a.push(w,A,b)}this.setIndex(a),this.setAttribute("position",new Ce(l,3)),this.setAttribute("normal",new Ce(c,3)),this.setAttribute("uv",new Ce(u,2));function v(g,_,R,w,A){const b=Math.cos(g),E=Math.sin(g),M=R/_*g,L=Math.cos(M);A.x=w*(2+L)*.5*b,A.y=w*(2+L)*E*.5,A.z=w*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ah extends $e{constructor(e=new pg(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new I,l=new I,c=new K;let u=new I;const d=[],h=[],p=[],m=[];y(),this.setIndex(m),this.setAttribute("position",new Ce(d,3)),this.setAttribute("normal",new Ce(h,3)),this.setAttribute("uv",new Ce(p,2));function y(){for(let g=0;g<t;g++)x(g);x(s===!1?t:0),v(),f()}function x(g){u=e.getPointAt(g/t,u);const _=o.normals[g],R=o.binormals[g];for(let w=0;w<=r;w++){const A=w/r*Math.PI*2,b=Math.sin(A),E=-Math.cos(A);l.x=E*_.x+b*R.x,l.y=E*_.y+b*R.y,l.z=E*_.z+b*R.z,l.normalize(),h.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,d.push(a.x,a.y,a.z)}}function f(){for(let g=1;g<=t;g++)for(let _=1;_<=r;_++){const R=(r+1)*(g-1)+(_-1),w=(r+1)*g+(_-1),A=(r+1)*g+_,b=(r+1)*(g-1)+_;m.push(R,w,b),m.push(w,A,b)}}function v(){for(let g=0;g<=t;g++)for(let _=0;_<=r;_++)c.x=g/t,c.y=_/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ah(new ud[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class kM extends $e{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new I,s=new I;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const d=l[c],h=d.start,p=d.count;for(let m=h,y=h+p;m<y;m+=3)for(let x=0;x<3;x++){const f=a.getX(m+x),v=a.getX(m+(x+1)%3);r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,v),fv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,d=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,d),fv(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ce(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function fv(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var pv=Object.freeze({__proto__:null,BoxGeometry:Cs,CapsuleGeometry:qd,CircleGeometry:Zd,ConeGeometry:Kd,CylinderGeometry:Xo,DodecahedronGeometry:Jd,EdgesGeometry:NM,ExtrudeGeometry:eh,IcosahedronGeometry:th,LatheGeometry:Ll,OctahedronGeometry:Dl,PlaneGeometry:Wo,PolyhedronGeometry:Fr,RingGeometry:nh,ShapeGeometry:ih,SphereGeometry:Ul,TetrahedronGeometry:rh,TorusGeometry:sh,TorusKnotGeometry:oh,TubeGeometry:ah,WireframeGeometry:kM});class OM extends on{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ye(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class FM extends ci{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gg extends on{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ye(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 ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(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 On,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class BM extends gg{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new K(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return At(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ye(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 ye(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ye(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class zM extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ye(16777215),this.specular=new ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class VM extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ye(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class HM extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class GM extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=Cl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class WM extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kr,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jM extends xn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function us(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function XM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function YM(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function zp(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function xg(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function lN(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),d=[],h=[];for(let p=0;p<c.times.length;++p){const m=c.times[p]*r;if(!(m<t||m>=i)){d.push(c.times[p]);for(let y=0;y<u;++y)h.push(c.values[p*u+y])}}d.length!==0&&(c.times=us(d,c.times.constructor),c.values=us(h,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function cN(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(f){return f.name===a.name&&f.ValueTypeName===l});if(c===void 0)continue;let u=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let h=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);const m=a.times.length-1;let y;if(s<=a.times[0]){const f=u,v=d-u;y=a.values.slice(f,v)}else if(s>=a.times[m]){const f=m*d+u,v=f+d-u;y=a.values.slice(f,v)}else{const f=a.createInterpolant(),v=u,g=d-u;f.evaluate(s),y=f.resultBuffer.slice(v,g)}l==="quaternion"&&new En().fromArray(y).normalize().conjugate().toArray(y);const x=c.times.length;for(let f=0;f<x;++f){const v=f*p+h;if(l==="quaternion")En.multiplyQuaternionsFlat(c.values,v,y,0,c.values,v);else{const g=p-h*2;for(let _=0;_<g;++_)c.values[v+_]-=y[_]}}}return n.blendMode=Km,n}const uN={convertArray:us,isTypedArray:XM,getKeyframeOrder:YM,sortedArray:zp,flattenJSON:xg,subclip:lN,makeClipAdditive:cN};class kl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class $M extends kl{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case ls:s=e,a=2*t-i;break;case ll:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:o=e,l=2*i-t;break;case ll:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,d=this._offsetNext,h=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),y=m*m,x=y*m,f=-h*x+2*h*y-h*m,v=(1+h)*x+(-1.5-2*h)*y+(-.5+h)*m+1,g=(-1-p)*x+(1.5+p)*y+.5*m,_=p*x-p*y;for(let R=0;R!==a;++R)s[R]=f*o[u+R]+v*o[c+R]+g*o[l+R]+_*o[d+R];return s}}class vg extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),d=1-u;for(let h=0;h!==a;++h)s[h]=o[c+h]*d+o[l+h]*u;return s}}class qM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class di{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=us(t,this.TimeBufferType),this.values=us(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:us(e.times,Array),values:us(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new qM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $M(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case al:t=this.InterpolantFactoryMethodDiscrete;break;case ad:t=this.InterpolantFactoryMethodLinear;break;case au:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return al;case this.InterpolantFactoryMethodLinear:return ad;case this.InterpolantFactoryMethodSmooth:return au}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&XM(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===au,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const d=a*i,h=d-i,p=d+i;for(let m=0;m!==i;++m){const y=t[d+m];if(y!==t[h+m]||y!==t[p+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const d=a*i,h=o*i;for(let p=0;p!==i;++p)t[h+p]=t[d+p]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}di.prototype.TimeBufferType=Float32Array;di.prototype.ValueBufferType=Float32Array;di.prototype.DefaultInterpolation=ad;class Rs extends di{constructor(e,t,i){super(e,t,i)}}Rs.prototype.ValueTypeName="bool";Rs.prototype.ValueBufferType=Array;Rs.prototype.DefaultInterpolation=al;Rs.prototype.InterpolantFactoryMethodLinear=void 0;Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class yg extends di{}yg.prototype.ValueTypeName="color";class yl extends di{}yl.prototype.ValueTypeName="number";class ZM extends kl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)En.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ol extends di{InterpolantFactoryMethodLinear(e){return new ZM(this.times,this.values,this.getValueSize(),e)}}Ol.prototype.ValueTypeName="quaternion";Ol.prototype.InterpolantFactoryMethodSmooth=void 0;class Ps extends di{constructor(e,t,i){super(e,t,i)}}Ps.prototype.ValueTypeName="string";Ps.prototype.ValueBufferType=Array;Ps.prototype.DefaultInterpolation=al;Ps.prototype.InterpolantFactoryMethodLinear=void 0;Ps.prototype.InterpolantFactoryMethodSmooth=void 0;class _l extends di{}_l.prototype.ValueTypeName="vector";class Sl{constructor(e="",t=-1,i=[],r=kd){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Un(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(hN(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(di.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=YM(l);l=zp(l,1,u),c=zp(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new yl(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let h=r[d];h||(r[d]=h=[]),h.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(d,h,p,m,y){if(p.length!==0){const x=[],f=[];xg(p,x,f,m),x.length!==0&&y.push(new d(h,x,f))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const h=c[d].keys;if(!(!h||h.length===0))if(h[0].morphTargets){const p={};let m;for(m=0;m<h.length;m++)if(h[m].morphTargets)for(let y=0;y<h[m].morphTargets.length;y++)p[h[m].morphTargets[y]]=-1;for(const y in p){const x=[],f=[];for(let v=0;v!==h[m].morphTargets.length;++v){const g=h[m];x.push(g.time),f.push(g.morphTarget===y?1:0)}r.push(new yl(".morphTargetInfluence["+y+"]",x,f))}l=p.length*o}else{const p=".bones["+t[d].name+"]";i(_l,p+".position",h,"pos",r),i(Ol,p+".quaternion",h,"rot",r),i(_l,p+".scale",h,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function dN(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return yl;case"vector":case"vector2":case"vector3":case"vector4":return _l;case"color":return yg;case"quaternion":return Ol;case"bool":case"boolean":return Rs;case"string":return Ps}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function hN(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=dN(n.type);if(n.times===void 0){const t=[],i=[];xg(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Hi={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class _g{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,h=c.length;d<h;d+=2){const p=c[d],m=c[d+1];if(p.global&&(p.lastIndex=0),p.test(u))return m}return null}}}const KM=new _g;class Tn{constructor(e){this.manager=e!==void 0?e:KM,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Tn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ui={};class fN extends Error{constructor(e,t){super(e),this.response=t}}class Qi extends Tn{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Hi.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ui[e]!==void 0){Ui[e].push({onLoad:t,onProgress:i,onError:r});return}Ui[e]=[],Ui[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Ui[e],d=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,m=p!==0;let y=0;const x=new ReadableStream({start(f){v();function v(){d.read().then(({done:g,value:_})=>{if(g)f.close();else{y+=_.byteLength;const R=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let w=0,A=u.length;w<A;w++){const b=u[w];b.onProgress&&b.onProgress(R)}f.enqueue(_),v()}},g=>{f.error(g)})}}});return new Response(x)}else throw new fN(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),h=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Hi.add(e,c);const u=Ui[e];delete Ui[e];for(let d=0,h=u.length;d<h;d++){const p=u[d];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Ui[e];if(u===void 0)throw this.manager.itemError(e),c;delete Ui[e];for(let d=0,h=u.length;d<h;d++){const p=u[d];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class pN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=Sl.parse(e[i]);t.push(r)}return t}}class mN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new Yd,l=new Qi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(d){l.load(e[d],function(h){const p=s.parse(h,!0);o[d]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let d=0,h=e.length;d<h;++d)u(d);else l.load(e,function(d){const h=s.parse(d,!0);if(h.isCubemap){const p=h.mipmaps.length/h.mipmapCount;for(let m=0;m<p;m++){o[m]={mipmaps:[]};for(let y=0;y<h.mipmapCount;y++)o[m].mipmaps.push(h.mipmaps[m*h.mipmapCount+y]),o[m].format=h.format,o[m].width=h.width,o[m].height=h.height}a.image=o}else a.image.width=h.width,a.image.height=h.height,a.mipmaps=h.mipmaps;h.mipmapCount===1&&(a.minFilter=Ut),a.format=h.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class Ml extends Tn{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=pl("img");function l(){u(),Hi.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(d){u(),r&&r(d),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class gN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Il;s.colorSpace=Hn;const o=new Ml(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class xN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new wi,a=new Qi(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Xn,o.wrapT=c.wrapT!==void 0?c.wrapT:Xn,o.magFilter=c.magFilter!==void 0?c.magFilter:Ut,o.minFilter=c.minFilter!==void 0?c.minFilter:Ut,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=yi),c.mipmapCount===1&&(o.minFilter=Ut),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class vN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=new Ct,o=new Ml(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Br extends nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class JM extends Br{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Pf=new ke,mv=new I,gv=new I;class Sg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nl,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;mv.setFromMatrixPosition(e.matrixWorld),t.position.copy(mv),gv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(gv),t.updateMatrixWorld(),Pf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pf),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Pf)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class yN extends Sg{constructor(){super(new $t(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Uo*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class QM extends Br{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new yN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const xv=new ke,pa=new I,If=new I;class _N extends Sg{constructor(){super(new $t(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new ct(2,1,1,1),new ct(0,1,1,1),new ct(3,1,1,1),new ct(1,1,1,1),new ct(3,0,1,1),new ct(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),pa.setFromMatrixPosition(e.matrixWorld),i.position.copy(pa),If.copy(i.position),If.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(If),i.updateMatrixWorld(),r.makeTranslation(-pa.x,-pa.y,-pa.z),xv.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xv)}}class ew extends Br{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new _N}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class SN extends Sg{constructor(){super(new Vd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class tw extends Br{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nt.DEFAULT_UP),this.updateMatrix(),this.target=new nt,this.shadow=new SN}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class nw extends Br{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class iw extends Br{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class rw{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new I)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class sw extends Br{constructor(e=new rw,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class lh extends Tn{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=lh.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new ye().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new ye().setHex(o.value);break;case"v2":r.uniforms[s].value=new K().fromArray(o.value);break;case"v3":r.uniforms[s].value=new I().fromArray(o.value);break;case"v4":r.uniforms[s].value=new ct().fromArray(o.value);break;case"m3":r.uniforms[s].value=new je().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ke().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new K().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new K().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:OM,SpriteMaterial:ag,RawShaderMaterial:FM,ShaderMaterial:ci,PointsMaterial:cg,MeshPhysicalMaterial:BM,MeshStandardMaterial:gg,MeshPhongMaterial:zM,MeshToonMaterial:VM,MeshNormalMaterial:HM,MeshLambertMaterial:GM,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshBasicMaterial:Or,MeshMatcapMaterial:WM,LineDashedMaterial:jM,LineBasicMaterial:xn,Material:on};return new t[e]}}class Vp{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class ow extends $e{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class aw extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(p,m){if(t[m]!==void 0)return t[m];const x=p.interleavedBuffers[m],f=s(p,x.buffer),v=po(x.type,f),g=new jd(v,x.stride);return g.uuid=x.uuid,t[m]=g,g}function s(p,m){if(i[m]!==void 0)return i[m];const x=p.arrayBuffers[m],f=new Uint32Array(x).buffer;return i[m]=f,f}const o=e.isInstancedBufferGeometry?new ow:new $e,a=e.data.index;if(a!==void 0){const p=po(a.type,a.array);o.setIndex(new ht(p,1))}const l=e.data.attributes;for(const p in l){const m=l[p];let y;if(m.isInterleavedBufferAttribute){const x=r(e.data,m.data);y=new bs(x,m.itemSize,m.offset,m.normalized)}else{const x=po(m.type,m.array),f=m.isInstancedBufferAttribute?Oo:ht;y=new f(x,m.itemSize,m.normalized)}m.name!==void 0&&(y.name=m.name),m.usage!==void 0&&y.setUsage(m.usage),o.setAttribute(p,y)}const c=e.data.morphAttributes;if(c)for(const p in c){const m=c[p],y=[];for(let x=0,f=m.length;x<f;x++){const v=m[x];let g;if(v.isInterleavedBufferAttribute){const _=r(e.data,v.data);g=new bs(_,v.itemSize,v.offset,v.normalized)}else{const _=po(v.type,v.array);g=new ht(_,v.itemSize,v.normalized)}v.name!==void 0&&(g.name=v.name),y.push(g)}o.morphAttributes[p]=y}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let p=0,m=d.length;p!==m;++p){const y=d[p];o.addGroup(y.start,y.count,y.materialIndex)}const h=e.data.boundingSphere;if(h!==void 0){const p=new I;h.center!==void 0&&p.fromArray(h.center),o.boundingSphere=new rn(p,h.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class MN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Vp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Qi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){r!==void 0&&r(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Vp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Qi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let d=!1;for(const h in o)if(o[h].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new gs().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Xd().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new aw;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in pv?a=pv[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new lh;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=Sl.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:po(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new _g(t);s=new Ml(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],h=d.url;if(Array.isArray(h)){const p=[];for(let m=0,y=h.length;m<y;m++){const x=h[m],f=a(x);f!==null&&(f instanceof HTMLImageElement?p.push(f):p.push(new wi(f.data,f.width,f.height)))}r[d.uuid]=new cs(p)}else{const p=a(d.url);r[d.uuid]=new cs(p)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:po(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Ml(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let d=0,h=c.length;d<h;d++){const p=c[d],m=await s(p);m!==null&&(m instanceof HTMLImageElement?u.push(m):u.push(new wi(m.data,m.width,m.height)))}i[l.uuid]=new cs(u)}else{const u=await s(l.url);i[l.uuid]=new cs(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Il,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new wi:u=new Ct,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,wN)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],vv),u.wrapT=i(a.wrap[1],vv)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,yv)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,yv)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(h){return t[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){const p=[];for(let m=0,y=h.length;m<y;m++){const x=h[m];i[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),p.push(i[x])}return p}return i[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",h),i[h]}}function c(h){return r[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",h),r[h]}let u,d;switch(e.type){case"Scene":o=new vM,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new ye(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Wd(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Gd(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new $t(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Vd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new nw(e.color,e.intensity);break;case"DirectionalLight":o=new tw(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new ew(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new iw(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new QM(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new JM(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new sw().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),d=l(e.material),o=new MM(u,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),d=l(e.material),o=new kt(u,d);break;case"InstancedMesh":u=a(e.geometry),d=l(e.material);const h=e.count,p=e.instanceMatrix,m=e.instanceColor;o=new wM(u,d,h),o.instanceMatrix=new Oo(new Float32Array(p.array),16),m!==void 0&&(o.instanceColor=new Oo(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":u=a(e.geometry),d=l(e.material),o=new bM(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(y=>{const x=new pn;x.min.fromArray(y.boxMin),x.max.fromArray(y.boxMax);const f=new rn;return f.radius=y.sphereRadius,f.center.fromArray(y.sphereCenter),{boxInitialized:y.boxInitialized,box:x,sphereInitialized:y.sphereInitialized,sphere:f}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new SM;break;case"Line":o=new Nr(a(e.geometry),l(e.material));break;case"LineLoop":o=new EM(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ai(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new TM(a(e.geometry),l(e.material));break;case"Sprite":o=new _M(l(e.material));break;case"Group":o=new go;break;case"Bone":o=new lg;break;default:o=new nt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const h=e.children;for(let p=0;p<h.length;p++)o.add(this.parseObject(h[p],t,i,r,s))}if(e.animations!==void 0){const h=e.animations;for(let p=0;p<h.length;p++){const m=h[p];o.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const h=e.levels;for(let p=0;p<h.length;p++){const m=h[p],y=o.getObjectByProperty("uuid",m.object);y!==void 0&&o.addLevel(y,m.distance,m.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new nt}})}}const wN={UVMapping:Rd,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,CubeUVReflectionMapping:Vo},vv={RepeatWrapping:sl,ClampToEdgeWrapping:Xn,MirroredRepeatWrapping:ol},yv={NearestFilter:Gt,NearestMipmapNearestFilter:Vm,NearestMipmapLinearFilter:fo,LinearFilter:Ut,LinearMipmapNearestFilter:Pa,LinearMipmapLinearFilter:yi};class bN extends Tn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hi.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hi.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Hi.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hi.add(e,l),s.manager.itemStart(e)}}let Hc;class Mg{static getContext(){return Hc===void 0&&(Hc=new(window.AudioContext||window.webkitAudioContext)),Hc}static setContext(e){Hc=e}}class EN extends Tn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Qi(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);Mg.getContext().decodeAudioData(c,function(d){t(d)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const _v=new ke,Sv=new ke,$r=new ke;class TN{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new $t,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new $t,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,$r.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(ms*t.fov*.5)/t.zoom;let a,l;Sv.elements[12]=-r,_v.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,$r.elements[0]=2*t.near/(l-a),$r.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy($r),a=-o*t.aspect-s,l=o*t.aspect-s,$r.elements[0]=2*t.near/(l-a),$r.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy($r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Sv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_v)}}class lw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Mv(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Mv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Mv(){return(typeof performance>"u"?Date:performance).now()}const qr=new I,wv=new En,AN=new I,Zr=new I;class CN extends nt{constructor(){super(),this.type="AudioListener",this.context=Mg.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new lw}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(qr,wv,AN),Zr.set(0,0,-1).applyQuaternion(wv),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(qr.x,r),t.positionY.linearRampToValueAtTime(qr.y,r),t.positionZ.linearRampToValueAtTime(qr.z,r),t.forwardX.linearRampToValueAtTime(Zr.x,r),t.forwardY.linearRampToValueAtTime(Zr.y,r),t.forwardZ.linearRampToValueAtTime(Zr.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(qr.x,qr.y,qr.z),t.setOrientation(Zr.x,Zr.y,Zr.z,i.x,i.y,i.z)}}class cw extends nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.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(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Kr=new I,bv=new En,RN=new I,Jr=new I;class PN extends cw{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Kr,bv,RN),Jr.set(0,0,1).applyQuaternion(bv);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kr.x,i),t.positionY.linearRampToValueAtTime(Kr.y,i),t.positionZ.linearRampToValueAtTime(Kr.z,i),t.orientationX.linearRampToValueAtTime(Jr.x,i),t.orientationY.linearRampToValueAtTime(Jr.y,i),t.orientationZ.linearRampToValueAtTime(Jr.z,i)}else t.setPosition(Kr.x,Kr.y,Kr.z),t.setOrientation(Jr.x,Jr.y,Jr.z)}}class IN{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class uw{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){En.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;En.multiplyQuaternionsFlat(e,o,e,t,e,i),En.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const wg="\\[\\]\\.:\\/",NN=new RegExp("["+wg+"]","g"),bg="[^"+wg+"]",LN="[^"+wg.replace("\\.","")+"]",DN=/((?:WC+[\/:])*)/.source.replace("WC",bg),UN=/(WCOD+)?/.source.replace("WCOD",LN),kN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bg),ON=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bg),FN=new RegExp("^"+DN+UN+kN+ON+"$"),BN=["material","materials","bones","map"];class zN{constructor(e,t,i){const r=i||et.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class et{constructor(e,t,i){this.path=t,this.parsedPath=i||et.parseTrackName(t),this.node=et.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new et.Composite(e,t,i):new et(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(NN,"")}static parseTrackName(e){const t=FN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);BN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=et.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}et.Composite=zN;et.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};et.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};et.prototype.GetterByBindingType=[et.prototype._getValue_direct,et.prototype._getValue_array,et.prototype._getValue_arrayElement,et.prototype._getValue_toArray];et.prototype.SetterByBindingTypeAndVersioning=[[et.prototype._setValue_direct,et.prototype._setValue_direct_setNeedsUpdate,et.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[et.prototype._setValue_array,et.prototype._setValue_array_setNeedsUpdate,et.prototype._setValue_array_setMatrixWorldNeedsUpdate],[et.prototype._setValue_arrayElement,et.prototype._setValue_arrayElement_setNeedsUpdate,et.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[et.prototype._setValue_fromArray,et.prototype._setValue_fromArray_setNeedsUpdate,et.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class VN{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Un(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,d=arguments.length;u!==d;++u){const h=arguments[u],p=h.uuid;let m=t[p];if(m===void 0){m=l++,t[p]=m,e.push(h);for(let y=0,x=o;y!==x;++y)s[y].push(new et(h,i[y],r[y]))}else if(m<c){a=e[m];const y=--c,x=e[y];t[x.uuid]=m,e[m]=x,t[p]=y,e[y]=h;for(let f=0,v=o;f!==v;++f){const g=s[f],_=g[y];let R=g[m];g[m]=_,R===void 0&&(R=new et(h,i[f],r[f])),g[y]=R}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let p=0,m=r;p!==m;++p){const y=i[p],x=y[d],f=y[u];y[u]=x,y[d]=f}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){const h=--s,p=e[h],m=--o,y=e[m];t[p.uuid]=d,e[d]=p,t[y.uuid]=h,e[h]=y,e.pop();for(let x=0,f=r;x!==f;++x){const v=i[x],g=v[h],_=v[m];v[d]=g,v[h]=_,v.pop()}}else{const h=--o,p=e[h];h>0&&(t[p.uuid]=d),e[d]=p,e.pop();for(let m=0,y=r;m!==y;++m){const x=i[m];x[d]=x[h],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(d);for(let h=u,p=l.length;h!==p;++h){const m=l[h];d[h]=new et(m,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class dw{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:as,endingEnd:as};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=WS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Km:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case kd:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===jS;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===GS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=ls,r.endingEnd=ls):(e?r.endingStart=this.zeroSlopeAtStart?ls:as:r.endingStart=ll,t?r.endingEnd=this.zeroSlopeAtEnd?ls:as:r.endingEnd=ll)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const HN=new Float32Array(1);class GN extends Ti{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const h=r[d],p=h.name;let m=u[p];if(m!==void 0)++m.referenceCount,o[d]=m;else{if(m=o[d],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const y=t&&t._propertyBindings[d].binding.parsedPath;m=new uw(et.create(i,p,y),h.ValueTypeName,h.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),o[d]=m}a[d].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new vg(new Float32Array(2),new Float32Array(2),1,HN),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?Sl.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=kd),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new dw(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Eg{constructor(e){this.value=e}clone(){return new Eg(this.value.clone===void 0?this.value:this.value.clone())}}let WN=0;class jN extends Ti{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:WN++}),this.name="",this.usage=hl,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class XN extends jd{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class YN{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Ev=new ke;class $N{constructor(e,t,i=0,r=1/0){this.ray=new Go(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Bd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Ev.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Ev),this}intersectObject(e,t=!0,i=[]){return Hp(e,this,i,t),i.sort(Tv),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Hp(e[r],this,i,t);return i.sort(Tv),i}}function Tv(n,e){return n.distance-e.distance}function Hp(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Hp(s[o],e,t,!0)}}class qN{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(At(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class ZN{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Tg{constructor(e,t,i,r){Tg.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const Av=new K;class KN{constructor(e=new K(1/0,1/0),t=new K(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Av.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Av).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Cv=new I,Gc=new I;class JN{constructor(e=new I,t=new I){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Cv.subVectors(e,this.start),Gc.subVectors(this.end,this.start);const i=Gc.dot(Gc);let s=Gc.dot(Cv)/i;return t&&(s=At(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Rv=new I;class QN extends nt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new $e,r=[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 o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Ce(r,3));const s=new xn({fog:!1,toneMapped:!1});this.cone=new Ai(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Rv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Rv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const hr=new I,Wc=new ke,Nf=new ke;class e3 extends Ai{constructor(e){const t=hw(e),i=new $e,r=[],s=[],o=new ye(0,0,1),a=new ye(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Ce(r,3)),i.setAttribute("color",new Ce(s,3));const l=new xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");Nf.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(Wc.multiplyMatrices(Nf,a.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o,hr.x,hr.y,hr.z),Wc.multiplyMatrices(Nf,a.parent.matrixWorld),hr.setFromMatrixPosition(Wc),r.setXYZ(o+1,hr.x,hr.y,hr.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function hw(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,hw(n.children[t]));return e}class t3 extends kt{constructor(e,t,i){const r=new Ul(t,4,2),s=new Or({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const n3=new I,Pv=new ye,Iv=new ye;class i3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Dl(t);r.rotateY(Math.PI*.5),this.material=new Or({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new ht(o,3)),this.add(new kt(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Pv.copy(this.light.color),Iv.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?Pv:Iv;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(n3.setFromMatrixPosition(this.light.matrixWorld).negate())}}class r3 extends Ai{constructor(e=10,t=10,i=4473924,r=8947848){i=new ye(i),r=new ye(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let h=0,p=0,m=-a;h<=t;h++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const y=h===s?i:r;y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3,y.toArray(c,p),p+=3}const u=new $e;u.setAttribute("position",new Ce(l,3)),u.setAttribute("color",new Ce(c,3));const d=new xn({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class s3 extends Ai{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new ye(s),o=new ye(o);const a=[],l=[];if(t>1)for(let d=0;d<t;d++){const h=d/t*(Math.PI*2),p=Math.sin(h)*e,m=Math.cos(h)*e;a.push(0,0,0),a.push(p,0,m);const y=d&1?s:o;l.push(y.r,y.g,y.b),l.push(y.r,y.g,y.b)}for(let d=0;d<i;d++){const h=d&1?s:o,p=e-e/i*d;for(let m=0;m<r;m++){let y=m/r*(Math.PI*2),x=Math.sin(y)*p,f=Math.cos(y)*p;a.push(x,0,f),l.push(h.r,h.g,h.b),y=(m+1)/r*(Math.PI*2),x=Math.sin(y)*p,f=Math.cos(y)*p,a.push(x,0,f),l.push(h.r,h.g,h.b)}}const c=new $e;c.setAttribute("position",new Ce(a,3)),c.setAttribute("color",new Ce(l,3));const u=new xn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Nv=new I,jc=new I,Lv=new I;class o3 extends nt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new $e;r.setAttribute("position",new Ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new xn({fog:!1,toneMapped:!1});this.lightPlane=new Nr(r,s),this.add(this.lightPlane),r=new $e,r.setAttribute("position",new Ce([0,0,0,0,0,1],3)),this.targetLine=new Nr(r,s),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),Nv.setFromMatrixPosition(this.light.matrixWorld),jc.setFromMatrixPosition(this.light.target.matrixWorld),Lv.subVectors(jc,Nv),this.lightPlane.lookAt(jc),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(jc),this.targetLine.scale.z=Lv.length()}}const Xc=new I,Et=new zd;class a3 extends Ai{constructor(e){const t=new $e,i=new xn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(m,y){l(m),l(y)}function l(m){r.push(0,0,0),s.push(0,0,0),o[m]===void 0&&(o[m]=[]),o[m].push(r.length/3-1)}t.setAttribute("position",new Ce(r,3)),t.setAttribute("color",new Ce(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new ye(16755200),u=new ye(16711680),d=new ye(43775),h=new ye(16777215),p=new ye(3355443);this.setColors(c,u,d,h,p)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Et.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Rt("c",t,e,Et,0,0,-1),Rt("t",t,e,Et,0,0,1),Rt("n1",t,e,Et,-i,-r,-1),Rt("n2",t,e,Et,i,-r,-1),Rt("n3",t,e,Et,-i,r,-1),Rt("n4",t,e,Et,i,r,-1),Rt("f1",t,e,Et,-i,-r,1),Rt("f2",t,e,Et,i,-r,1),Rt("f3",t,e,Et,-i,r,1),Rt("f4",t,e,Et,i,r,1),Rt("u1",t,e,Et,i*.7,r*1.1,-1),Rt("u2",t,e,Et,-i*.7,r*1.1,-1),Rt("u3",t,e,Et,0,r*2,-1),Rt("cf1",t,e,Et,-i,0,1),Rt("cf2",t,e,Et,i,0,1),Rt("cf3",t,e,Et,0,-r,1),Rt("cf4",t,e,Et,0,r,1),Rt("cn1",t,e,Et,-i,0,-1),Rt("cn2",t,e,Et,i,0,-1),Rt("cn3",t,e,Et,0,-r,-1),Rt("cn4",t,e,Et,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Rt(n,e,t,i,r,s,o){Xc.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Xc.x,Xc.y,Xc.z)}}const Yc=new pn;class l3 extends Ai{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new $e;s.setIndex(new ht(i,1)),s.setAttribute("position",new ht(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Yc.setFromObject(this.object),Yc.isEmpty())return;const t=Yc.min,i=Yc.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class c3 extends Ai{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),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],s=new $e;s.setIndex(new ht(i,1)),s.setAttribute("position",new Ce(r,3)),super(s,new xn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class u3 extends Nr{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new $e;o.setAttribute("position",new Ce(s,3)),o.computeBoundingSphere(),super(o,new xn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new $e;l.setAttribute("position",new Ce(a,3)),l.computeBoundingSphere(),this.add(new kt(l,new Or({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Dv=new I;let $c,Lf;class d3 extends nt{constructor(e=new I(0,0,1),t=new I(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",$c===void 0&&($c=new $e,$c.setAttribute("position",new Ce([0,0,0,0,1,0],3)),Lf=new Xo(0,.5,1,5,1),Lf.translate(0,-.5,0)),this.position.copy(t),this.line=new Nr($c,new xn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Lf,new Or({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Dv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Dv,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class h3 extends Ai{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new $e;r.setAttribute("position",new Ce(t,3)),r.setAttribute("color",new Ce(i,3));const s=new xn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new ye,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class f3{constructor(){this.type="ShapePath",this.color=new ye,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ml,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(f){const v=[];for(let g=0,_=f.length;g<_;g++){const R=f[g],w=new gs;w.curves=R.curves,v.push(w)}return v}function i(f,v){const g=v.length;let _=!1;for(let R=g-1,w=0;w<g;R=w++){let A=v[R],b=v[w],E=b.x-A.x,M=b.y-A.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(A=v[w],E=-E,b=v[R],M=-M),f.y<A.y||f.y>b.y)continue;if(f.y===A.y){if(f.x===A.x)return!0}else{const L=M*(f.x-A.x)-E*(f.y-A.y);if(L===0)return!0;if(L<0)continue;_=!_}}else{if(f.y!==A.y)continue;if(b.x<=f.x&&f.x<=A.x||A.x<=f.x&&f.x<=b.x)return!0}}return _}const r=bi.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new gs,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const d=[],h=[];let p=[],m=0,y;h[m]=void 0,p[m]=[];for(let f=0,v=s.length;f<v;f++)a=s[f],y=a.getPoints(),o=r(y),o=e?!o:o,o?(!u&&h[m]&&m++,h[m]={s:new gs,p:y},h[m].s.curves=a.curves,u&&m++,p[m]=[]):p[m].push({h:a,p:y[0]});if(!h[0])return t(s);if(h.length>1){let f=!1,v=0;for(let g=0,_=h.length;g<_;g++)d[g]=[];for(let g=0,_=h.length;g<_;g++){const R=p[g];for(let w=0;w<R.length;w++){const A=R[w];let b=!0;for(let E=0;E<h.length;E++)i(A.p,h[E].p)&&(g!==E&&v++,b?(b=!1,d[E].push(A)):f=!0);b&&d[g].push(A)}}v>0&&f===!1&&(p=d)}let x;for(let f=0,v=h.length;f<v;f++){l=h[f].s,c.push(l),x=p[f];for(let g=0,_=x.length;g<_;g++)l.holes.push(x[g].h)}return c}}class p3 extends Ti{constructor(e,t){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class m3 extends li{constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Cd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Cd);const j3=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:FS,AddEquation:vr,AddOperation:DS,AdditiveAnimationBlendMode:Km,AdditiveBlending:Cp,AgXToneMapping:zS,AlphaFormat:jm,AlwaysCompare:tM,AlwaysDepth:AS,AlwaysStencilFunc:Np,AmbientLight:nw,AnimationAction:dw,AnimationClip:Sl,AnimationLoader:pN,AnimationMixer:GN,AnimationObjectGroup:VN,AnimationUtils:uN,ArcCurve:AM,ArrayCamera:xM,ArrowHelper:d3,AttachedBindMode:Ip,Audio:cw,AudioAnalyser:IN,AudioContext:Mg,AudioListener:CN,AudioLoader:EN,AxesHelper:h3,BackSide:fn,BasicDepthPacking:XS,BasicShadowMap:lT,BatchedMesh:bM,Bone:lg,BooleanKeyframeTrack:Rs,Box2:KN,Box3:pn,Box3Helper:c3,BoxGeometry:Cs,BoxHelper:l3,BufferAttribute:ht,BufferGeometry:$e,BufferGeometryLoader:aw,ByteType:Hm,Cache:Hi,Camera:zd,CameraHelper:a3,CanvasTexture:DI,CapsuleGeometry:qd,CatmullRomCurve3:CM,CineonToneMapping:OS,CircleGeometry:Zd,ClampToEdgeWrapping:Xn,Clock:lw,Color:ye,ColorKeyframeTrack:yg,ColorManagement:rt,CompressedArrayTexture:NI,CompressedCubeTexture:LI,CompressedTexture:Yd,CompressedTextureLoader:mN,ConeGeometry:Kd,ConstantAlphaFactor:bS,ConstantColorFactor:MS,Controls:p3,CubeCamera:cM,CubeReflectionMapping:Ki,CubeRefractionMapping:Ir,CubeTexture:Il,CubeTextureLoader:gN,CubeUVReflectionMapping:Vo,CubicBezierCurve:dg,CubicBezierCurve3:RM,CubicInterpolant:$M,CullFaceBack:Ap,CullFaceFront:oS,CullFaceFrontBack:aT,CullFaceNone:sS,Curve:ui,CurvePath:IM,CustomBlending:lS,CustomToneMapping:BS,CylinderGeometry:Xo,Cylindrical:ZN,Data3DTexture:eg,DataArrayTexture:Fd,DataTexture:wi,DataTextureLoader:xN,DataUtils:SA,DecrementStencilOp:MT,DecrementWrapStencilOp:bT,DefaultLoadingManager:KM,DepthFormat:ps,DepthStencilFormat:ws,DepthTexture:rg,DetachedBindMode:HS,DirectionalLight:tw,DirectionalLightHelper:o3,DiscreteInterpolant:qM,DisplayP3ColorSpace:Od,DodecahedronGeometry:Jd,DoubleSide:vi,DstAlphaFactor:xS,DstColorFactor:yS,DynamicCopyUsage:BT,DynamicDrawUsage:LT,DynamicReadUsage:kT,EdgesGeometry:NM,EllipseCurve:$d,EqualCompare:KS,EqualDepth:RS,EqualStencilFunc:CT,EquirectangularReflectionMapping:il,EquirectangularRefractionMapping:rl,Euler:On,EventDispatcher:Ti,ExtrudeGeometry:eh,FileLoader:Qi,Float16BufferAttribute:AA,Float32BufferAttribute:Ce,FloatType:Sn,Fog:Wd,FogExp2:Gd,FramebufferTexture:II,FrontSide:Zi,Frustum:Nl,GLBufferAttribute:YN,GLSL1:VT,GLSL3:Lp,GreaterCompare:JS,GreaterDepth:IS,GreaterEqualCompare:eM,GreaterEqualDepth:PS,GreaterEqualStencilFunc:NT,GreaterStencilFunc:PT,GridHelper:r3,Group:go,HalfFloatType:Ho,HemisphereLight:JM,HemisphereLightHelper:i3,IcosahedronGeometry:th,ImageBitmapLoader:bN,ImageLoader:Ml,ImageUtils:rM,IncrementStencilOp:ST,IncrementWrapStencilOp:wT,InstancedBufferAttribute:Oo,InstancedBufferGeometry:ow,InstancedInterleavedBuffer:XN,InstancedMesh:wM,Int16BufferAttribute:EA,Int32BufferAttribute:TA,Int8BufferAttribute:MA,IntType:Pd,InterleavedBuffer:jd,InterleavedBufferAttribute:bs,Interpolant:kl,InterpolateDiscrete:al,InterpolateLinear:ad,InterpolateSmooth:au,InvertStencilOp:ET,KeepStencilOp:ts,KeyframeTrack:di,LOD:SM,LatheGeometry:Ll,Layers:Bd,LessCompare:ZS,LessDepth:CS,LessEqualCompare:Jm,LessEqualDepth:nl,LessEqualStencilFunc:RT,LessStencilFunc:AT,Light:Br,LightProbe:sw,Line:Nr,Line3:JN,LineBasicMaterial:xn,LineCurve:hg,LineCurve3:PM,LineDashedMaterial:jM,LineLoop:EM,LineSegments:Ai,LinearDisplayP3ColorSpace:Pl,LinearFilter:Ut,LinearInterpolant:vg,LinearMipMapLinearFilter:hT,LinearMipMapNearestFilter:dT,LinearMipmapLinearFilter:yi,LinearMipmapNearestFilter:Pa,LinearSRGBColorSpace:tr,LinearToneMapping:US,LinearTransfer:cl,Loader:Tn,LoaderUtils:Vp,LoadingManager:_g,LoopOnce:GS,LoopPingPong:jS,LoopRepeat:WS,LuminanceAlphaFormat:$m,LuminanceFormat:Ym,MOUSE:sT,Material:on,MaterialLoader:lh,MathUtils:rA,Matrix2:Tg,Matrix3:je,Matrix4:ke,MaxEquation:hS,Mesh:kt,MeshBasicMaterial:Or,MeshDepthMaterial:sg,MeshDistanceMaterial:og,MeshLambertMaterial:GM,MeshMatcapMaterial:WM,MeshNormalMaterial:HM,MeshPhongMaterial:zM,MeshPhysicalMaterial:BM,MeshStandardMaterial:gg,MeshToonMaterial:VM,MinEquation:dS,MirroredRepeatWrapping:ol,MixOperation:LS,MultiplyBlending:Pp,MultiplyOperation:Cl,NearestFilter:Gt,NearestMipMapLinearFilter:uT,NearestMipMapNearestFilter:cT,NearestMipmapLinearFilter:fo,NearestMipmapNearestFilter:Vm,NeutralToneMapping:VS,NeverCompare:qS,NeverDepth:TS,NeverStencilFunc:TT,NoBlending:Wi,NoColorSpace:Fi,NoToneMapping:ji,NormalAnimationBlendMode:kd,NormalBlending:fs,NotEqualCompare:QS,NotEqualDepth:NS,NotEqualStencilFunc:IT,NumberKeyframeTrack:yl,Object3D:nt,ObjectLoader:MN,ObjectSpaceNormalMap:$S,OctahedronGeometry:Dl,OneFactor:pS,OneMinusConstantAlphaFactor:ES,OneMinusConstantColorFactor:wS,OneMinusDstAlphaFactor:vS,OneMinusDstColorFactor:_S,OneMinusSrcAlphaFactor:Du,OneMinusSrcColorFactor:gS,OrthographicCamera:Vd,P3Primaries:dl,PCFShadowMap:zm,PCFSoftShadowMap:aS,PMREMGenerator:Dp,Path:ml,PerspectiveCamera:$t,Plane:mr,PlaneGeometry:Wo,PlaneHelper:u3,PointLight:ew,PointLightHelper:t3,Points:TM,PointsMaterial:cg,PolarGridHelper:s3,PolyhedronGeometry:Fr,PositionalAudio:PN,PropertyBinding:et,PropertyMixer:uw,QuadraticBezierCurve:fg,QuadraticBezierCurve3:pg,Quaternion:En,QuaternionKeyframeTrack:Ol,QuaternionLinearInterpolant:ZM,RED_GREEN_RGTC2_Format:sd,RED_RGTC1_Format:Zm,REVISION:Cd,RGBADepthPacking:YS,RGBAFormat:dn,RGBAIntegerFormat:Ud,RGBA_ASTC_10x10_Format:Qu,RGBA_ASTC_10x5_Format:Zu,RGBA_ASTC_10x6_Format:Ku,RGBA_ASTC_10x8_Format:Ju,RGBA_ASTC_12x10_Format:ed,RGBA_ASTC_12x12_Format:td,RGBA_ASTC_4x4_Format:Hu,RGBA_ASTC_5x4_Format:Gu,RGBA_ASTC_5x5_Format:Wu,RGBA_ASTC_6x5_Format:ju,RGBA_ASTC_6x6_Format:Xu,RGBA_ASTC_8x5_Format:Yu,RGBA_ASTC_8x6_Format:$u,RGBA_ASTC_8x8_Format:qu,RGBA_BPTC_Format:Ua,RGBA_ETC2_EAC_Format:Vu,RGBA_PVRTC_2BPPV1_Format:Fu,RGBA_PVRTC_4BPPV1_Format:Ou,RGBA_S3TC_DXT1_Format:Na,RGBA_S3TC_DXT3_Format:La,RGBA_S3TC_DXT5_Format:Da,RGBDepthPacking:xT,RGBFormat:Xm,RGBIntegerFormat:fT,RGB_BPTC_SIGNED_Format:nd,RGB_BPTC_UNSIGNED_Format:id,RGB_ETC1_Format:Bu,RGB_ETC2_Format:zu,RGB_PVRTC_2BPPV1_Format:ku,RGB_PVRTC_4BPPV1_Format:Uu,RGB_S3TC_DXT1_Format:Ia,RGDepthPacking:vT,RGFormat:qm,RGIntegerFormat:Dd,RawShaderMaterial:FM,Ray:Go,Raycaster:$N,Rec709Primaries:ul,RectAreaLight:iw,RedFormat:Ld,RedIntegerFormat:Rl,ReinhardToneMapping:kS,RenderTarget:sM,RepeatWrapping:sl,ReplaceStencilOp:_T,ReverseSubtractEquation:uS,RingGeometry:nh,SIGNED_RED_GREEN_RGTC2_Format:od,SIGNED_RED_RGTC1_Format:rd,SRGBColorSpace:Hn,SRGBTransfer:ft,Scene:vM,ShaderChunk:Ye,ShaderLib:ri,ShaderMaterial:ci,ShadowMaterial:OM,Shape:gs,ShapeGeometry:ih,ShapePath:f3,ShapeUtils:bi,ShortType:Gm,Skeleton:Xd,SkeletonHelper:e3,SkinnedMesh:MM,Source:cs,Sphere:rn,SphereGeometry:Ul,Spherical:qN,SphericalHarmonics3:rw,SplineCurve:mg,SpotLight:QM,SpotLightHelper:QN,Sprite:_M,SpriteMaterial:ag,SrcAlphaFactor:Lu,SrcAlphaSaturateFactor:SS,SrcColorFactor:mS,StaticCopyUsage:FT,StaticDrawUsage:hl,StaticReadUsage:UT,StereoCamera:TN,StreamCopyUsage:zT,StreamDrawUsage:DT,StreamReadUsage:OT,StringKeyframeTrack:Ps,SubtractEquation:cS,SubtractiveBlending:Rp,TOUCH:oT,TangentSpaceNormalMap:kr,TetrahedronGeometry:rh,Texture:Ct,TextureLoader:vN,TextureUtils:cI,TorusGeometry:sh,TorusKnotGeometry:oh,Triangle:Nn,TriangleFanDrawMode:gT,TriangleStripDrawMode:mT,TrianglesDrawMode:pT,TubeGeometry:ah,UVMapping:Rd,Uint16BufferAttribute:tg,Uint32BufferAttribute:ng,Uint8BufferAttribute:wA,Uint8ClampedBufferAttribute:bA,Uniform:Eg,UniformsGroup:jN,UniformsLib:fe,UniformsUtils:lM,UnsignedByteType:Ei,UnsignedInt248Type:Ms,UnsignedInt5999Type:Wm,UnsignedIntType:Ji,UnsignedShort4444Type:Id,UnsignedShort5551Type:Nd,UnsignedShortType:Do,VSMShadowMap:gi,Vector2:K,Vector3:I,Vector4:ct,VectorKeyframeTrack:_l,VideoTexture:PI,WebGL3DRenderTarget:dA,WebGLArrayRenderTarget:uA,WebGLCoordinateSystem:_i,WebGLCubeRenderTarget:uM,WebGLMultipleRenderTargets:m3,WebGLRenderTarget:li,WebGLRenderer:yI,WebGLUtils:gM,WebGPUCoordinateSystem:fl,WireframeGeometry:kM,WrapAroundEnding:ll,ZeroCurvatureEnding:as,ZeroFactor:fS,ZeroSlopeEnding:ls,ZeroStencilOp:yT,createCanvasElement:iM},Symbol.toStringTag,{value:"Module"})),ut={controls:null,camera:null,initialPosition:null,initialTarget:null};function X3(n,e){ut.controls=n,ut.camera=e,e&&!ut.initialPosition&&(ut.initialPosition=e.position.clone()),n&&!ut.initialTarget&&(ut.initialTarget=n.target.clone())}function Y3(){ut.controls=null,ut.camera=null}const fw=1.18,Uv=2.5;function pw(n=fw){if(!ut.controls||!ut.camera)return;const e=new I().subVectors(ut.controls.target,ut.camera.position).multiplyScalar(1-1/n);ut.camera.position.add(e),ut.controls.update()}function g3(n=fw){pw(1/n)}function ch(n,e){if(!ut.controls||!ut.camera)return;const t=ut.camera,i=new I().subVectors(ut.controls.target,t.position).normalize(),r=new I().crossVectors(i,t.up).normalize(),s=new I().crossVectors(r,i).normalize(),o=new I().addScaledVector(r,n*Uv).addScaledVector(s,e*Uv);t.position.add(o),ut.controls.target.add(o),ut.controls.update()}const x3=()=>ch(-1,0),v3=()=>ch(1,0),y3=()=>ch(0,1),_3=()=>ch(0,-1);function S3(){!ut.controls||!ut.camera||(ut.initialPosition&&ut.camera.position.copy(ut.initialPosition),ut.initialTarget&&ut.controls.target.copy(ut.initialTarget),ut.controls.update())}function M3(){const n=Ee(_=>_.selectedSessionId),e=Ee(_=>_.sessions),t=Ee(_=>_.missions),i=Ee(_=>_.chatBySessionId),r=Ee(_=>_.selectSession),s=Ee(_=>_.sendPromptTo),[o,a]=Pe.useState("chat"),[l,c]=Pe.useState(""),u=Pe.useRef(null),d=n?e[n]:null,h=Pe.useMemo(()=>n?i[n]??[]:[],[i,n]),p=Pe.useMemo(()=>d?Object.values(t).filter(_=>_.sessionId===d.id).sort((_,R)=>R.startedAt-_.startedAt):[],[t,d]),m=Pe.useMemo(()=>{if(d!=null&&d.currentMissionId)return t[d.currentMissionId]},[t,d]),y=d?ZE(d,m):null;if(Pe.useEffect(()=>{if(o!=="chat")return;const _=u.current;_&&(_.scrollTop=_.scrollHeight)},[o,h.length,n]),!d)return null;const x=d.origin==="internal",f=!!d.wrapperSocketPath,v=x||f,g=()=>{l.trim()&&(s(d.id,l),c(""))};return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-full sm:w-[460px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Planet"}),S.jsx("div",{className:"text-lg font-semibold truncate",children:d.name??d.id.slice(0,8)}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5 truncate",title:Bm[d.status]??void 0,children:[String(d.model)," · ",rS(d.status),d.origin==="external"?" · external":d.origin==="agentview"?" · agent view":" · internal",f&&S.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide border border-solix-accent/50 text-solix-accent",title:"Wrapped by `solix run` — UI prompts go to your terminal.",children:"wrapped"}),d.agentViewId&&S.jsx("span",{className:"ml-1.5 font-mono text-[9px] text-cyan-300/80",title:`Agent View id: ${d.agentViewId}`,children:d.agentViewId.slice(0,8)})]}),d.prUrl&&S.jsxs("a",{href:d.prUrl,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-[11px] text-slate-300 hover:text-white border border-solix-border rounded px-2 py-0.5",title:`Open ${d.prUrl}`,children:[S.jsx("span",{children:"PR"}),S.jsx("span",{className:"text-slate-500 truncate max-w-[200px]",children:d.prUrl.replace(/^https?:\/\//,"")}),d.prCheckStatus&&S.jsx("span",{className:d.prCheckStatus==="success"?"text-solix-ok":d.prCheckStatus==="failure"?"text-solix-danger":"text-amber-300",children:d.prCheckStatus==="success"?"✓":d.prCheckStatus==="failure"?"✗":"⏳"})]}),d.agentViewSummary&&S.jsx("div",{className:"mt-1 text-[11px] text-slate-400 italic line-clamp-2",title:d.agentViewSummary,children:d.agentViewSummary})]}),S.jsx("button",{onClick:()=>r(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),y&&S.jsxs("div",{className:`px-4 py-2 border-b border-solix-border text-[11px] leading-snug ${y.severity==="danger"?"text-solix-danger bg-solix-danger/10":y.severity==="warn"?"text-solix-warn bg-solix-warn/10":"text-slate-300 bg-black/20"}`,children:[S.jsx("span",{className:"font-semibold mr-1",children:"Suggested:"}),y.text]}),S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[S.jsx("span",{children:"context"}),S.jsxs("span",{children:[d.contextUsagePct.toFixed(0),"%"]})]}),S.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:S.jsx("div",{className:`h-full ${d.contextUsagePct>=90?"bg-solix-danger":d.contextUsagePct>=80?"bg-solix-warn":"bg-solix-accent"}`,style:{width:`${Math.min(100,d.contextUsagePct)}%`}})})]}),S.jsxs("div",{className:"flex border-b border-solix-border text-xs",children:[S.jsxs(Df,{active:o==="chat",onClick:()=>a("chat"),children:["Chat ",h.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",h.length,")"]})]}),S.jsxs(Df,{active:o==="missions",onClick:()=>a("missions"),children:["Missions ",p.length>0&&S.jsxs("span",{className:"opacity-60",children:["(",p.length,")"]})]}),S.jsx(Df,{active:o==="files",onClick:()=>a("files"),children:"Files"})]}),S.jsxs("div",{className:"flex-1 overflow-hidden",children:[o==="chat"&&S.jsx(w3,{chat:h,scrollRef:u,session:d}),o==="missions"&&S.jsx(b3,{missions:p}),o==="files"&&S.jsx(E3,{missions:p})]}),o==="chat"&&S.jsx("div",{className:"px-3 py-3 border-t border-solix-border",children:v?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx("textarea",{value:l,onChange:_=>c(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),g())},placeholder:f?"Type a prompt — it goes straight into your terminal claude (Cmd/Ctrl+Enter)":"Send a prompt to this session… (Cmd/Ctrl+Enter)",rows:2,className:"flex-1 text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),S.jsx("button",{onClick:g,disabled:!l.trim(),className:"px-3 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Send"})]}),f&&S.jsxs("div",{className:"text-[10px] text-slate-500 italic mt-1.5",children:["Wrapped by ",S.jsx("code",{children:"solix run"}),". Don't type in the terminal while sending from here, or characters will interleave."]})]}):S.jsxs("div",{className:"text-xs text-slate-500",children:["External session — keep typing in your terminal. To send prompts from here instead, restart the session with"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"solix run"}),"."]})})]})}function Df({active:n,onClick:e,children:t}){return S.jsx("button",{onClick:e,className:`flex-1 px-3 py-2 ${n?"text-solix-accent border-b-2 border-solix-accent":"text-slate-400 hover:text-slate-200 border-b-2 border-transparent"}`,children:t})}function w3({chat:n,scrollRef:e,session:t}){return S.jsxs("div",{ref:e,className:"h-full overflow-y-auto p-4 space-y-3",children:[n.length===0&&S.jsxs("div",{className:"text-sm text-slate-500 italic",children:["No chat yet. Type a prompt to this session in your terminal — it will stream here as it happens.",S.jsxs("div",{className:"mt-2 text-[11px] text-slate-600",children:["Watching transcript at ",S.jsxs("code",{children:["~/.claude/projects/","<encoded>","/",t.id,".jsonl"]})]})]}),n.map(i=>S.jsx("div",{className:`flex ${i.role==="user"?"justify-end":"justify-start"}`,children:S.jsxs("div",{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${i.role==="user"?"bg-solix-accent/15 border border-solix-accent/40 text-slate-100":"bg-black/40 border border-solix-border text-slate-200"}`,children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide opacity-60 mb-1",children:[i.role,S.jsx("span",{className:"ml-2 text-slate-500",children:new Date(i.ts).toLocaleTimeString()})]}),S.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:i.content})]})},i.messageId))]})}function b3({missions:n}){return S.jsx("div",{className:"h-full overflow-y-auto p-4 space-y-3",children:n.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No missions yet."}):n.map(e=>S.jsxs("div",{className:"rounded border border-solix-border p-3 bg-black/30",children:[S.jsxs("div",{className:"flex items-center justify-between text-xs",children:[S.jsx("span",{className:`font-semibold ${e.status==="active"?"text-solix-warn":e.status==="completed"?"text-solix-ok":"text-slate-300"}`,children:e.shortName}),S.jsx("span",{className:"text-slate-500",children:new Date(e.startedAt).toLocaleTimeString()})]}),S.jsx("div",{className:"mt-1 text-sm text-slate-200 line-clamp-3",children:e.prompt}),S.jsxs("div",{className:"mt-2 flex gap-3 text-[10px] text-slate-500",children:[S.jsxs("span",{children:[e.metrics.toolCallCount," tools"]}),S.jsxs("span",{children:[e.metrics.subagentCount," subagents"]}),S.jsxs("span",{children:[e.filesTouched.length," files"]}),e.metrics.durationMs!==void 0&&S.jsxs("span",{children:[(e.metrics.durationMs/1e3).toFixed(1),"s"]})]})]},e.id))})}function E3({missions:n}){const e=Array.from(new Set(n.flatMap(t=>t.filesTouched))).sort();return S.jsx("div",{className:"h-full overflow-y-auto p-4",children:e.length===0?S.jsx("div",{className:"text-sm text-slate-500 italic",children:"No files touched yet."}):S.jsx("ul",{className:"space-y-1 text-xs font-mono text-slate-300",children:e.map(t=>S.jsx("li",{className:"truncate",children:t},t))})})}function T3(){const n=Ee(m=>m.selectedAdvisorId),e=Ee(m=>n?m.advisors[n]:null),t=Ee(m=>m.selectedSessionId?m.sessions[m.selectedSessionId]:null),i=Ee(m=>m.selectAdvisor),r=Ee(m=>m.invokeAdvisor),s=Ee(m=>m.pinAdvisor),o=Ee(m=>m.unpinAdvisor),[a,l]=Pe.useState(""),[c,u]=Pe.useState(null),[d,h]=Pe.useState(!1);if(Pe.useEffect(()=>{if(!e){u(null);return}let m=!1;const y=new URLSearchParams;t&&y.set("targetSessionId",t.id),a.trim()&&y.set("prompt",a.trim());const x=y.toString();return fetch(`/api/advisors/${encodeURIComponent(e.id)}/preview${x?`?${x}`:""}`).then(f=>f.ok?f.json():null).then(f=>{m||u(f)}).catch(()=>{m||u(null)}),()=>{m=!0}},[e==null?void 0:e.id,t==null?void 0:t.id,a]),!e)return null;const p=()=>{r(e.id,a.trim()||void 0),l("")};return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-[420px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-amber-200/70",children:"Advisor"}),S.jsxs("div",{className:"text-lg font-semibold flex items-center gap-2",children:[S.jsx("span",{style:{color:e.color},children:e.glyph}),S.jsx("span",{children:e.codename}),e.pinned&&S.jsx("span",{className:"text-[10px] uppercase tracking-wider text-amber-300 border border-amber-300/40 rounded px-1.5 py-0.5",children:"pinned"})]}),S.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:[e.name," · ",String(e.defaultModel)]})]}),S.jsx("button",{onClick:()=>i(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),e.requiredSkills.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"requires skills"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.requiredSkills.map(m=>S.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-solix-accent/15 border border-solix-accent/40 text-solix-accent",children:m},m))})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 text-sm text-slate-300",children:[S.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Invoke"}),S.jsx("div",{className:"text-xs text-slate-500",children:t?S.jsxs(S.Fragment,{children:["Will dispatch to"," ",S.jsx("span",{className:"text-slate-200",children:t.name??t.id.slice(0,8)})," ",S.jsxs("span",{className:"text-slate-500",children:["(",t.cwd,")"]})]}):S.jsx(S.Fragment,{children:"No planet focused. Click a user planet first to set a target."})}),S.jsx("textarea",{value:a,onChange:m=>l(m.target.value),placeholder:`Optional: hand ${e.codename} a specific brief…`,rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"}),c&&S.jsxs("div",{className:"rounded border border-solix-border bg-black/30",children:[S.jsxs("button",{onClick:()=>h(m=>!m),className:"w-full text-left px-2 py-1.5 text-xs flex items-center justify-between text-slate-400 hover:text-slate-100",children:[S.jsxs("span",{children:["Context envelope · ",c.recentMissionsCount," mission(s)",c.contextUsagePct!==null&&` · target at ${c.contextUsagePct.toFixed(0)}%`]}),S.jsx("span",{children:d?"▾":"▸"})]}),d&&S.jsx("pre",{className:"text-[10.5px] text-slate-300 whitespace-pre-wrap px-3 pb-3 max-h-72 overflow-auto leading-relaxed",children:c.prompt})]})]}),S.jsxs("div",{className:"px-4 py-3 border-t border-solix-border flex gap-2",children:[S.jsx("button",{onClick:p,className:"flex-1 py-2 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30",children:"Invoke"}),e.pinned?S.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 rounded bg-amber-500/15 border border-amber-400/50 text-amber-200 text-sm hover:bg-amber-500/25",children:"Unpin"}):S.jsx("button",{onClick:()=>s(e.id),className:"px-3 py-2 rounded bg-amber-500/10 border border-amber-400/30 text-amber-200/80 text-sm hover:bg-amber-500/20",title:"Spawn an always-on session for this advisor",children:"Pin"})]})]})}function A3(){const n=Ee(c=>c.selectedSkillId),e=Ee(c=>n?c.skills[n]:null),t=Ee(c=>c.selectSkill),i=Ee(c=>c.advisors),[r,s]=Pe.useState(null),[o,a]=Pe.useState(!1);if(Pe.useEffect(()=>{if(!n){s(null);return}let c=!1;return a(!0),fetch(`/api/skills/${encodeURIComponent(n)}`).then(u=>u.ok?u.json():null).then(u=>{c||s(u)}).catch(()=>{c||s(null)}).finally(()=>{c||a(!1)}),()=>{c=!0}},[n]),!e)return null;const l=Object.values(i).filter(c=>c.requiredSkills.some(u=>e.id.endsWith(`:${u}`)||e.id===u));return S.jsxs("div",{className:"absolute top-0 right-0 h-full w-[480px] bg-solix-panel border-l border-solix-border backdrop-blur-md flex flex-col z-20",children:[S.jsxs("div",{className:"px-4 py-3 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"text-xs uppercase tracking-wide text-cyan-300/70",children:["Skill · ",e.source]}),S.jsx("div",{className:"text-lg font-semibold",children:e.name}),S.jsx("div",{className:"text-xs text-slate-400 mt-0.5 break-all",children:e.id})]}),S.jsx("button",{onClick:()=>t(null),className:"text-slate-400 hover:text-slate-100","aria-label":"Close",children:"✕"})]}),l.length>0&&S.jsxs("div",{className:"px-4 py-2 border-b border-solix-border",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-1",children:"required by"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map(c=>S.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-amber-300/40 text-amber-200",children:[S.jsx("span",{className:"mr-1",children:c.glyph}),c.codename]},c.id))})]}),S.jsx("div",{className:"px-4 py-3 border-b border-solix-border text-sm text-slate-300 leading-relaxed",children:e.description}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-500 mb-2",children:"manifest"}),o&&S.jsx("div",{className:"text-sm text-slate-500 italic",children:"Loading…"}),r&&S.jsx("pre",{className:"text-[11px] text-slate-300 whitespace-pre-wrap break-words bg-black/40 p-3 rounded border border-solix-border",children:r.manifest})]}),S.jsx("div",{className:"px-4 py-3 border-t border-solix-border text-xs text-slate-500",children:e.installedInProjects.length===0?"Not installed in any project yet.":`Installed in ${e.installedInProjects.length} project(s).`})]})}const C3=["default","opus","sonnet","haiku"];function R3({open:n,onClose:e}){const t=Ee(b=>b.projects),i=Ee(b=>b.advisors),r=Ee(b=>b.launchTask),s=Object.values(t).sort((b,E)=>E.lastActiveAt-b.lastActiveAt),o=Pe.useMemo(()=>Object.values(i).filter(b=>b.enabled).sort((b,E)=>b.codename.localeCompare(E.codename)),[i]),[a,l]=Pe.useState(""),[c,u]=Pe.useState("default"),[d,h]=Pe.useState(null),[p,m]=Pe.useState(""),[y,x]=Pe.useState(""),[f,v]=Pe.useState(""),[g,_]=Pe.useState(null),[R,w]=Pe.useState(!0);if(Pe.useEffect(()=>{if(!n)return;let b=!1;return fetch("/api/system/preflight").then(E=>E.ok?E.json():null).then(E=>{b||_(E)}).catch(()=>{}),()=>{b=!0}},[n]),Pe.useEffect(()=>{if(!n||a)return;const b=s[0];b&&l(b.cwd)},[n,s,a]),!n)return null;const A=()=>{const b=a.trim(),E=p.trim();if(!b||!E)return;const M=d?o.find(X=>X.id===d):void 0,L=M?`[Acting as ${M.codename} — ${M.name}. ${M.description}]
3899
3899
 
3900
- ${T}`:T,w=A&&c==="default"?A.defaultModel:c,L=y.trim();r(M,w,E,{worktreeBranch:L||void 0,worktreeBaseRef:L&&f.trim()||void 0}),m(""),h(null),g(""),v(""),e()};return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:S.jsxs("div",{className:"w-[520px] max-w-[92vw] rounded-xl border border-solix-accent/40 bg-solix-panel/95 shadow-2xl",children:[S.jsxs("div",{className:"px-5 py-4 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"new task"}),S.jsx("div",{className:"text-lg font-semibold mt-0.5",children:"Launch a Claude Code session"}),S.jsxs("div",{className:"text-xs text-slate-400 mt-1",children:["Solix will spawn ",S.jsx("code",{children:"claude --print"})," in this folder. A new planet appears the moment it starts."]}),x&&!x.claudeAvailable&&S.jsxs("div",{className:"mt-2 text-[11px] text-solix-danger border border-solix-danger/40 bg-solix-danger/10 rounded px-2 py-1",children:[S.jsx("span",{className:"font-semibold",children:"claude"})," not found on the server's PATH. Install Claude Code, then restart the Solix server."]}),(x==null?void 0:x.claudeAvailable)&&x.version&&S.jsxs("div",{className:"mt-1 text-[10px] text-slate-500 font-mono",children:["claude detected · ",x.version]})]}),S.jsx("button",{onClick:e,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),S.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Working directory"}),s.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:s.slice(0,6).map(M=>S.jsx("button",{onClick:()=>l(M.cwd),className:`text-[10px] px-2 py-1 rounded border ${a===M.cwd?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:M.name},M.id))}),S.jsx("input",{value:a,onChange:M=>l(M.target.value),placeholder:"/Users/you/path/to/project",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Model"}),S.jsx("div",{className:"flex gap-1.5",children:C3.map(M=>S.jsx("button",{onClick:()=>u(M),className:`text-xs px-3 py-1.5 rounded border ${c===M?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:M},M))})]}),o.length>0&&S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Advisor ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>h(null),className:`text-xs px-3 py-1.5 rounded border ${d===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),o.map(M=>S.jsxs("button",{onClick:()=>h(M.id),title:M.description,className:`text-xs px-3 py-1.5 rounded border flex items-center gap-1.5 ${d===M.id?"border-amber-300 text-amber-100 bg-amber-500/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{style:{color:M.color},children:M.glyph}),M.codename]},M.id))]}),d&&S.jsx("div",{className:"mt-1.5 text-[10px] text-slate-500 italic",children:"The advisor's role will be prepended to your prompt."})]}),S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Worktree branch"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsx("input",{value:y,onChange:M=>g(M.target.value),placeholder:"leave empty to run in the chosen directory",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),y.trim()&&S.jsxs("div",{className:"mt-2 space-y-1",children:[S.jsxs("div",{className:"text-[10px] text-slate-500 italic",children:["Solix will create (or reuse) a fresh git worktree at ~/.solix/worktrees/<repo>-",y.trim()||"<branch>","and spawn Claude there. Existing branches are reused."]}),S.jsx("input",{value:f,onChange:M=>v(M.target.value),placeholder:"based on (default: HEAD)",className:"w-full text-xs font-mono bg-black/40 border border-solix-border rounded p-1.5 text-slate-200 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Prompt"}),S.jsx("textarea",{value:p,onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),R())},placeholder:"What should this Claude Code session do?",rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"})]})]}),S.jsxs("div",{className:"px-5 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:e,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Cancel"}),S.jsx("div",{className:"flex-1"}),S.jsx("span",{className:"text-[10px] text-slate-500 mr-2",children:"Cmd/Ctrl+Enter"}),S.jsx("button",{onClick:R,disabled:!a.trim()||!p.trim()||(x==null?void 0:x.claudeAvailable)===!1,className:"px-4 py-1.5 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Launch"})]})]})})}const P3=1500;function I3(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`}function N3(){let n=null,e=!1;const t=r=>{n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r))};Ee.getState().attachSocket(t);const i=()=>{if(e)return;n=new WebSocket(I3()),n.onopen=()=>{Ee.getState().setConnected(!0)},n.onmessage=s=>{try{const o=JSON.parse(s.data);Ee.getState().applyMessage(o)}catch(o){console.warn("[ws] bad message",o)}};const r=()=>{Ee.getState().setConnected(!1),e||setTimeout(i,P3)};n.onclose=r,n.onerror=()=>n==null?void 0:n.close()};i(),window.addEventListener("beforeunload",()=>{e=!0,n==null||n.close()})}const L3=Ie.lazy(()=>Om(()=>import("./Scene-DGvQzQki.js"),[]).then(n=>({default:n.Scene}))),D3=Ie.lazy(()=>Om(()=>import("./TimelineDrawer-CcNI10xd.js"),[]).then(n=>({default:n.TimelineDrawer}))),U3=Ie.lazy(()=>Om(()=>import("./GalaxyPanel-D3Z8JKOp.js"),[]).then(n=>({default:n.GalaxyPanel})));function k3(){const[n,e]=Ie.useState(!1),[t,i]=Ie.useState(!1),[r,s]=Ie.useState(!1),[o,a]=Ie.useState(!1);return Ie.useEffect(()=>{N3()},[]),Ie.useEffect(()=>{const l=c=>{const u=Ee.getState(),d=c.target,h=(d==null?void 0:d.tagName)==="INPUT"||(d==null?void 0:d.tagName)==="TEXTAREA"||(d==null?void 0:d.isContentEditable)===!0,m=Object.values(u.pendingPermissions)[0];c.key==="Escape"?(u.selectSession(null),u.selectAdvisor(null),u.selectSkill(null),e(!1),i(!1),a(!1),u.playback.active&&(u.exitPlayback(),s(!1))):!h&&c.key==="?"?a(y=>!y):!h&&(c.key==="g"||c.key==="G")?e(y=>!y):!h&&(c.key==="l"||c.key==="L")?i(!0):!h&&(c.key==="+"||c.key==="=")?pw():!h&&c.key==="-"?g3():!h&&c.key==="0"?S3():!h&&c.key==="ArrowLeft"?x3():!h&&c.key==="ArrowRight"?v3():!h&&c.key==="ArrowUp"?y3():!h&&c.key==="ArrowDown"?_3():!h&&c.key===" "?(c.preventDefault(),u.toggleMotion()):!h&&(c.key==="v"||c.key==="V")?u.toggleViewMode():!h&&(c.key==="m"||c.key==="M")?u.setViewMode("missions"):!h&&(c.key==="t"||c.key==="T")?s(y=>!y):!h&&m&&(c.key==="y"||c.key==="Y")?u.resolvePermission(m.requestId,!0):!h&&m&&(c.key==="n"||c.key==="N")&&u.resolvePermission(m.requestId,!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[]),S.jsxs("div",{className:"relative h-full w-full",children:[S.jsx(O3,{}),S.jsx(jE,{onOpenGalaxy:()=>e(!0),onNewTask:()=>i(!0),onOpenTimeline:()=>s(!0),onOpenHelp:()=>a(!0)}),S.jsx(KE,{}),S.jsx(M3,{}),S.jsx(T3,{}),S.jsx(A3,{}),n&&S.jsx(Ie.Suspense,{fallback:null,children:S.jsx(U3,{open:n,onClose:()=>e(!1)})}),S.jsx(R3,{open:t,onClose:()=>i(!1)}),r&&S.jsx(Ie.Suspense,{fallback:null,children:S.jsx(D3,{open:r,onClose:()=>s(!1)})}),S.jsx(rT,{}),S.jsx($E,{onOpenGalaxy:()=>e(!0),forceOpen:o,onClose:()=>a(!1)}),S.jsx(YE,{}),S.jsx(B3,{})]})}function O3(){const n=Ee(e=>e.viewMode);return n==="list"?S.jsx(DE,{}):n==="missions"?S.jsx(VE,{}):S.jsx(Ie.Suspense,{fallback:S.jsx(F3,{}),children:S.jsx(L3,{})})}function F3(){return S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-solix-bg z-0",children:S.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-widest solix-pulse",children:"loading galaxy…"})})}function B3(){const n=Ee(t=>Object.keys(t.sessions).length),e=Ee(t=>t.connected);return n>0?null:S.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center z-10",children:S.jsxs("div",{className:"rounded-lg border border-solix-border bg-solix-panel p-6 max-w-md text-center backdrop-blur",children:[S.jsx("div",{className:"text-sm uppercase tracking-widest text-solix-accent",children:"empty system"}),S.jsx("div",{className:"mt-2 text-slate-200",children:e?"Run `claude` in any terminal — the planet will appear here.":"Waiting for the Solix server…"}),S.jsx("div",{className:"mt-3 text-xs text-slate-500",children:"The sun is mission control. Each agent orbits it as a planet."})]})})}const mw=document.getElementById("root");if(!mw)throw new Error("#root not found");q_(mw).render(S.jsx(Ie.StrictMode,{children:S.jsx(k3,{})}));export{Eg as $,FS as A,lT as B,zd as C,vi as D,HM as E,Sn as F,Gt as G,XS as H,Ti as I,tr as J,Fi as K,Bd as L,sT as M,ji as N,Vd as O,$t as P,En as Q,$N as R,vM as S,j3 as T,Ei as U,gi as V,yI as W,kt as X,fn as Y,Zi as Z,Wi as _,aS as a,on as a0,AS as a1,$e as a2,ht as a3,ct as a4,Uw as a5,Ho as a6,sl as a7,DI as a8,Ee as a9,IE as aa,G3 as ab,rA as ac,z3 as ad,NE as ae,Bm as af,rS as ag,LE as ah,V3 as ai,H3 as aj,nt as ak,iS as al,PE as am,X3 as an,Y3 as ao,zm as b,I as c,K as d,lw as e,dn as f,kv as g,q_ as h,oT as i,S as j,qN as k,Go as l,mr as m,Ct as n,vN as o,Cd as p,ye as q,Ie as r,Cp as s,ci as t,Hn as u,rg as v,ws as w,Ms as x,li as y,Ut as z};
3900
+ ${E}`:E,V=M&&c==="default"?M.defaultModel:c,F=y.trim(),G=R&&(g==null?void 0:g.agentViewAvailable)===!0;r(b,V,L,{worktreeBranch:G?void 0:F||void 0,worktreeBaseRef:G?void 0:F&&f.trim()||void 0,useAgentView:G,agentName:M==null?void 0:M.codename.toLowerCase()}),m(""),h(null),x(""),v(""),e()};return S.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:S.jsxs("div",{className:"w-[520px] max-w-[92vw] rounded-xl border border-solix-accent/40 bg-solix-panel/95 shadow-2xl",children:[S.jsxs("div",{className:"px-5 py-4 border-b border-solix-border flex items-start justify-between",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"new task"}),S.jsx("div",{className:"text-lg font-semibold mt-0.5",children:"Launch a Claude Code session"}),S.jsx("div",{className:"text-xs text-slate-400 mt-1",children:g!=null&&g.agentViewAvailable&&R?S.jsxs(S.Fragment,{children:["Dispatches via"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --bg"})," ","— the session shows up in both Solix and"," ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude agents"}),"."]}):S.jsxs(S.Fragment,{children:["Solix will spawn ",S.jsx("code",{className:"bg-black/40 px-1 rounded",children:"claude --print"})," ","in this folder. A new planet appears the moment it starts."]})}),g&&!g.claudeAvailable&&S.jsxs("div",{className:"mt-2 text-[11px] text-solix-danger border border-solix-danger/40 bg-solix-danger/10 rounded px-2 py-1",children:[S.jsx("span",{className:"font-semibold",children:"claude"})," not found on the server's PATH. Install Claude Code, then restart the Solix server."]}),(g==null?void 0:g.claudeAvailable)&&g.version&&S.jsxs("div",{className:"mt-1 text-[10px] text-slate-500 font-mono",children:["claude detected · ",g.version,g.agentViewAvailable&&S.jsxs(S.Fragment,{children:[" ","·"," ",S.jsx("button",{onClick:()=>w(b=>!b),className:`underline decoration-dotted ${R?"text-solix-accent":"text-slate-500 hover:text-slate-300"}`,title:"Toggle dispatch through Anthropic's Agent View",children:R?"agent view: on":"agent view: off"})]})]})]}),S.jsx("button",{onClick:e,className:"text-slate-400 hover:text-slate-100",children:"✕"})]}),S.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Working directory"}),s.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:s.slice(0,6).map(b=>S.jsx("button",{onClick:()=>l(b.cwd),className:`text-[10px] px-2 py-1 rounded border ${a===b.cwd?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:b.name},b.id))}),S.jsx("input",{value:a,onChange:b=>l(b.target.value),placeholder:"/Users/you/path/to/project",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Model"}),S.jsx("div",{className:"flex gap-1.5",children:C3.map(b=>S.jsx("button",{onClick:()=>u(b),className:`text-xs px-3 py-1.5 rounded border ${c===b?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:b},b))})]}),o.length>0&&S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Advisor ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[S.jsx("button",{onClick:()=>h(null),className:`text-xs px-3 py-1.5 rounded border ${d===null?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:"none"}),o.map(b=>S.jsxs("button",{onClick:()=>h(b.id),title:b.description,className:`text-xs px-3 py-1.5 rounded border flex items-center gap-1.5 ${d===b.id?"border-amber-300 text-amber-100 bg-amber-500/15":"border-solix-border text-slate-300 hover:bg-solix-border/30"}`,children:[S.jsx("span",{style:{color:b.color},children:b.glyph}),b.codename]},b.id))]}),d&&S.jsx("div",{className:"mt-1.5 text-[10px] text-slate-500 italic",children:"The advisor's role will be prepended to your prompt."})]}),S.jsxs("label",{className:"block",children:[S.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:["Worktree branch"," ",S.jsx("span",{className:"text-slate-600 normal-case",children:"(optional)"})]}),S.jsx("input",{value:y,onChange:b=>x(b.target.value),placeholder:"leave empty to run in the chosen directory",className:"w-full text-sm font-mono bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent"}),y.trim()&&S.jsxs("div",{className:"mt-2 space-y-1",children:[S.jsxs("div",{className:"text-[10px] text-slate-500 italic",children:["Solix will create (or reuse) a fresh git worktree at ~/.solix/worktrees/<repo>-",y.trim()||"<branch>","and spawn Claude there. Existing branches are reused."]}),S.jsx("input",{value:f,onChange:b=>v(b.target.value),placeholder:"based on (default: HEAD)",className:"w-full text-xs font-mono bg-black/40 border border-solix-border rounded p-1.5 text-slate-200 placeholder-slate-600 focus:outline-none focus:border-solix-accent"})]})]}),S.jsxs("label",{className:"block",children:[S.jsx("div",{className:"text-[10px] uppercase tracking-wide text-slate-400 mb-1",children:"Prompt"}),S.jsx("textarea",{value:p,onChange:b=>m(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),A())},placeholder:"What should this Claude Code session do?",rows:4,className:"w-full text-sm bg-black/40 border border-solix-border rounded p-2 text-slate-100 placeholder-slate-600 focus:outline-none focus:border-solix-accent resize-none"})]})]}),S.jsxs("div",{className:"px-5 py-3 border-t border-solix-border flex items-center gap-2",children:[S.jsx("button",{onClick:e,className:"px-3 py-1.5 rounded border border-solix-border text-xs text-slate-300 hover:text-white",children:"Cancel"}),S.jsx("div",{className:"flex-1"}),S.jsx("span",{className:"text-[10px] text-slate-500 mr-2",children:"Cmd/Ctrl+Enter"}),S.jsx("button",{onClick:A,disabled:!a.trim()||!p.trim()||(g==null?void 0:g.claudeAvailable)===!1,className:"px-4 py-1.5 rounded bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40",children:"Launch"})]})]})})}const P3=1500;function I3(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`}function N3(){let n=null,e=!1;const t=r=>{n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r))};Ee.getState().attachSocket(t);const i=()=>{if(e)return;n=new WebSocket(I3()),n.onopen=()=>{Ee.getState().setConnected(!0)},n.onmessage=s=>{try{const o=JSON.parse(s.data);Ee.getState().applyMessage(o)}catch(o){console.warn("[ws] bad message",o)}};const r=()=>{Ee.getState().setConnected(!1),e||setTimeout(i,P3)};n.onclose=r,n.onerror=()=>n==null?void 0:n.close()};i(),window.addEventListener("beforeunload",()=>{e=!0,n==null||n.close()})}const L3=Pe.lazy(()=>Om(()=>import("./Scene-DrvagUWn.js"),[]).then(n=>({default:n.Scene}))),D3=Pe.lazy(()=>Om(()=>import("./TimelineDrawer-DsGkgssp.js"),[]).then(n=>({default:n.TimelineDrawer}))),U3=Pe.lazy(()=>Om(()=>import("./GalaxyPanel-CsENB_VZ.js"),[]).then(n=>({default:n.GalaxyPanel})));function k3(){const[n,e]=Pe.useState(!1),[t,i]=Pe.useState(!1),[r,s]=Pe.useState(!1),[o,a]=Pe.useState(!1);return Pe.useEffect(()=>{N3()},[]),Pe.useEffect(()=>{const l=c=>{const u=Ee.getState(),d=c.target,h=(d==null?void 0:d.tagName)==="INPUT"||(d==null?void 0:d.tagName)==="TEXTAREA"||(d==null?void 0:d.isContentEditable)===!0,m=Object.values(u.pendingPermissions)[0];c.key==="Escape"?(u.selectSession(null),u.selectAdvisor(null),u.selectSkill(null),e(!1),i(!1),a(!1),u.playback.active&&(u.exitPlayback(),s(!1))):!h&&c.key==="?"?a(y=>!y):!h&&(c.key==="g"||c.key==="G")?e(y=>!y):!h&&(c.key==="l"||c.key==="L")?i(!0):!h&&(c.key==="+"||c.key==="=")?pw():!h&&c.key==="-"?g3():!h&&c.key==="0"?S3():!h&&c.key==="ArrowLeft"?x3():!h&&c.key==="ArrowRight"?v3():!h&&c.key==="ArrowUp"?y3():!h&&c.key==="ArrowDown"?_3():!h&&c.key===" "?(c.preventDefault(),u.toggleMotion()):!h&&(c.key==="v"||c.key==="V")?u.toggleViewMode():!h&&(c.key==="m"||c.key==="M")?u.setViewMode("missions"):!h&&(c.key==="t"||c.key==="T")?s(y=>!y):!h&&m&&(c.key==="y"||c.key==="Y")?u.resolvePermission(m.requestId,!0):!h&&m&&(c.key==="n"||c.key==="N")&&u.resolvePermission(m.requestId,!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[]),S.jsxs("div",{className:"relative h-full w-full",children:[S.jsx(O3,{}),S.jsx(jE,{onOpenGalaxy:()=>e(!0),onNewTask:()=>i(!0),onOpenTimeline:()=>s(!0),onOpenHelp:()=>a(!0)}),S.jsx(KE,{}),S.jsx(M3,{}),S.jsx(T3,{}),S.jsx(A3,{}),n&&S.jsx(Pe.Suspense,{fallback:null,children:S.jsx(U3,{open:n,onClose:()=>e(!1)})}),S.jsx(R3,{open:t,onClose:()=>i(!1)}),r&&S.jsx(Pe.Suspense,{fallback:null,children:S.jsx(D3,{open:r,onClose:()=>s(!1)})}),S.jsx(rT,{}),S.jsx($E,{onOpenGalaxy:()=>e(!0),forceOpen:o,onClose:()=>a(!1)}),S.jsx(YE,{}),S.jsx(B3,{})]})}function O3(){const n=Ee(e=>e.viewMode);return n==="list"?S.jsx(DE,{}):n==="missions"?S.jsx(VE,{}):S.jsx(Pe.Suspense,{fallback:S.jsx(F3,{}),children:S.jsx(L3,{})})}function F3(){return S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-solix-bg z-0",children:S.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-widest solix-pulse",children:"loading galaxy…"})})}function B3(){const n=Ee(t=>Object.keys(t.sessions).length),e=Ee(t=>t.connected);return n>0?null:S.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center z-10",children:S.jsxs("div",{className:"rounded-lg border border-solix-border bg-solix-panel p-6 max-w-md text-center backdrop-blur",children:[S.jsx("div",{className:"text-sm uppercase tracking-widest text-solix-accent",children:"empty system"}),S.jsx("div",{className:"mt-2 text-slate-200",children:e?"Run `claude` in any terminal — the planet will appear here.":"Waiting for the Solix server…"}),S.jsx("div",{className:"mt-3 text-xs text-slate-500",children:"The sun is mission control. Each agent orbits it as a planet."})]})})}const mw=document.getElementById("root");if(!mw)throw new Error("#root not found");q_(mw).render(S.jsx(Pe.StrictMode,{children:S.jsx(k3,{})}));export{Eg as $,FS as A,lT as B,zd as C,vi as D,HM as E,Sn as F,Gt as G,XS as H,Ti as I,tr as J,Fi as K,Bd as L,sT as M,ji as N,Vd as O,$t as P,En as Q,$N as R,vM as S,j3 as T,Ei as U,gi as V,yI as W,kt as X,fn as Y,Zi as Z,Wi as _,aS as a,on as a0,AS as a1,$e as a2,ht as a3,ct as a4,Uw as a5,Ho as a6,sl as a7,DI as a8,Ee as a9,IE as aa,G3 as ab,rA as ac,z3 as ad,NE as ae,Bm as af,rS as ag,LE as ah,V3 as ai,H3 as aj,nt as ak,iS as al,PE as am,X3 as an,Y3 as ao,zm as b,I as c,K as d,lw as e,dn as f,kv as g,q_ as h,oT as i,S as j,qN as k,Go as l,mr as m,Ct as n,vN as o,Cd as p,ye as q,Pe as r,Cp as s,ci as t,Hn as u,rg as v,ws as w,Ms as x,li as y,Ut as z};