import{g as nS,r as pt,a as fI,R as Fw}from"./vendor-react-C0ZmnAiH.js";import{s as hI,j as fa}from"./vendor-ui-BUsIib4b.js";var Hw={exports:{}},Wg={},Vw={exports:{}},kw={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(n){function e(V,ne){var q=V.length;V.push(ne);e:for(;0<q;){var oe=q-1>>>1,me=V[oe];if(0<a(me,ne))V[oe]=ne,V[q]=me,q=oe;else break e}}function t(V){return V.length===0?null:V[0]}function i(V){if(V.length===0)return null;var ne=V[0],q=V.pop();if(q!==ne){V[0]=q;e:for(var oe=0,me=V.length,ye=me>>>1;oe<ye;){var Ie=2*(oe+1)-1,tt=V[Ie],ee=Ie+1,ve=V[ee];if(0>a(tt,q))ee<me&&0>a(ve,tt)?(V[oe]=ve,V[ee]=q,oe=ee):(V[oe]=tt,V[Ie]=q,oe=Ie);else if(ee<me&&0>a(ve,q))V[oe]=ve,V[ee]=q,oe=ee;else break e}}return ne}function a(V,ne){var q=V.sortIndex-ne.sortIndex;return q!==0?q:V.id-ne.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var l=Date,u=l.now();n.unstable_now=function(){return l.now()-u}}var c=[],h=[],p=1,g=null,m=3,v=!1,_=!1,T=!1,b=!1,y=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(V){for(var ne=t(h);ne!==null;){if(ne.callback===null)i(h);else if(ne.startTime<=V)i(h),ne.sortIndex=ne.expirationTime,e(c,ne);else break;ne=t(h)}}function I(V){if(T=!1,A(V),!_)if(t(c)!==null)_=!0,R||(R=!0,Q());else{var ne=t(h);ne!==null&&ae(I,ne.startTime-V)}}var R=!1,L=-1,z=5,C=-1;function w(){return b?!0:!(n.unstable_now()-C<z)}function B(){if(b=!1,R){var V=n.unstable_now();C=V;var ne=!0;try{e:{_=!1,T&&(T=!1,S(L),L=-1),v=!0;var q=m;try{t:{for(A(V),g=t(c);g!==null&&!(g.expirationTime>V&&w());){var oe=g.callback;if(typeof oe=="function"){g.callback=null,m=g.priorityLevel;var me=oe(g.expirationTime<=V);if(V=n.unstable_now(),typeof me=="function"){g.callback=me,A(V),ne=!0;break t}g===t(c)&&i(c),A(V)}else i(c);g=t(c)}if(g!==null)ne=!0;else{var ye=t(h);ye!==null&&ae(I,ye.startTime-V),ne=!1}}break e}finally{g=null,m=q,v=!1}ne=void 0}}finally{ne?Q():R=!1}}}var Q;if(typeof E=="function")Q=function(){E(B)};else if(typeof MessageChannel<"u"){var k=new MessageChannel,j=k.port2;k.port1.onmessage=B,Q=function(){j.postMessage(null)}}else Q=function(){y(B,0)};function ae(V,ne){L=y(function(){V(n.unstable_now())},ne)}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(V){V.callback=null},n.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<V?Math.floor(1e3/V):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_next=function(V){switch(m){case 1:case 2:case 3:var ne=3;break;default:ne=m}var q=m;m=ne;try{return V()}finally{m=q}},n.unstable_requestPaint=function(){b=!0},n.unstable_runWithPriority=function(V,ne){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var q=m;m=V;try{return ne()}finally{m=q}},n.unstable_scheduleCallback=function(V,ne,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,V){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=q+me,V={id:p++,callback:ne,priorityLevel:V,startTime:q,expirationTime:me,sortIndex:-1},q>oe?(V.sortIndex=q,e(h,V),t(c)===null&&V===t(h)&&(T?(S(L),L=-1):T=!0,ae(I,q-oe))):(V.sortIndex=me,e(c,V),_||v||(_=!0,R||(R=!0,Q()))),V},n.unstable_shouldYield=w,n.unstable_wrapCallback=function(V){var ne=m;return function(){var q=m;m=ne;try{return V.apply(this,arguments)}finally{m=q}}}})(kw);Vw.exports=kw;var Am=Vw.exports;const dI=nS(Am);/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Xn=Am,Gw=pt,pI=fI;function ue(n){var e="https://react.dev/errors/"+n;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;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."}function Xw(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Wh(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 Ww(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 qw(n){if(n.tag===31){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function xE(n){if(Wh(n)!==n)throw Error(ue(188))}function mI(n){var e=n.alternate;if(!e){if(e=Wh(n),e===null)throw Error(ue(188));return e!==n?null:n}for(var t=n,i=e;;){var a=t.return;if(a===null)break;var s=a.alternate;if(s===null){if(i=a.return,i!==null){t=i;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===t)return xE(a),n;if(s===i)return xE(a),e;s=s.sibling}throw Error(ue(188))}if(t.return!==i.return)t=a,i=s;else{for(var l=!1,u=a.child;u;){if(u===t){l=!0,t=a,i=s;break}if(u===i){l=!0,i=a,t=s;break}u=u.sibling}if(!l){for(u=s.child;u;){if(u===t){l=!0,t=s,i=a;break}if(u===i){l=!0,i=s,t=a;break}u=u.sibling}if(!l)throw Error(ue(189))}}if(t.alternate!==i)throw Error(ue(190))}if(t.tag!==3)throw Error(ue(188));return t.stateNode.current===t?n:e}function Yw(n){var e=n.tag;if(e===5||e===26||e===27||e===6)return n;for(n=n.child;n!==null;){if(e=Yw(n),e!==null)return e;n=n.sibling}return null}var cn=Object.assign,gI=Symbol.for("react.element"),ep=Symbol.for("react.transitional.element"),zf=Symbol.for("react.portal"),Gu=Symbol.for("react.fragment"),Zw=Symbol.for("react.strict_mode"),F_=Symbol.for("react.profiler"),jw=Symbol.for("react.consumer"),ir=Symbol.for("react.context"),iS=Symbol.for("react.forward_ref"),H_=Symbol.for("react.suspense"),V_=Symbol.for("react.suspense_list"),aS=Symbol.for("react.memo"),Xr=Symbol.for("react.lazy"),k_=Symbol.for("react.activity"),vI=Symbol.for("react.memo_cache_sentinel"),SE=Symbol.iterator;function gf(n){return n===null||typeof n!="object"?null:(n=SE&&n[SE]||n["@@iterator"],typeof n=="function"?n:null)}var yI=Symbol.for("react.client.reference");function G_(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===yI?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Gu:return"Fragment";case F_:return"Profiler";case Zw:return"StrictMode";case H_:return"Suspense";case V_:return"SuspenseList";case k_:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case zf:return"Portal";case ir:return n.displayName||"Context";case jw:return(n._context.displayName||"Context")+".Consumer";case iS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case aS:return e=n.displayName||null,e!==null?e:G_(n.type)||"Memo";case Xr:e=n._payload,n=n._init;try{return G_(n(e))}catch{}}return null}var Of=Array.isArray,ot=Gw.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qt=pI.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,gl={pending:!1,data:null,method:null,action:null},X_=[],Xu=-1;function As(n){return{current:n}}function ni(n){0>Xu||(n.current=X_[Xu],X_[Xu]=null,Xu--)}function sn(n,e){Xu++,X_[Xu]=n.current,n.current=e}var bs=As(null),dh=As(null),ao=As(null),wm=As(null);function Cm(n,e){switch(sn(ao,e),sn(dh,n),sn(bs,null),e.nodeType){case 9:case 11:n=(n=e.documentElement)&&(n=n.namespaceURI)?wT(n):0;break;default:if(n=e.tagName,e=e.namespaceURI)e=wT(e),n=m3(e,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ni(bs),sn(bs,n)}function pc(){ni(bs),ni(dh),ni(ao)}function W_(n){n.memoizedState!==null&&sn(wm,n);var e=bs.current,t=m3(e,n.type);e!==t&&(sn(dh,n),sn(bs,t))}function Rm(n){dh.current===n&&(ni(bs),ni(dh)),wm.current===n&&(ni(wm),Eh._currentValue=gl)}var ly,bE;function sl(n){if(ly===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);ly=e&&e[1]||"",bE=-1<t.stack.indexOf(`
    at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ly+n+bE}var uy=!1;function cy(n,e){if(!n||uy)return"";uy=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(e){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(v){var m=v}Reflect.construct(n,[],g)}else{try{g.call()}catch(v){m=v}n.call(g.prototype)}}else{try{throw Error()}catch(v){m=v}(g=n())&&typeof g.catch=="function"&&g.catch(function(){})}}catch(v){if(v&&m&&typeof v.stack=="string")return[v.stack,m.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=i.DetermineComponentFrameRoot(),l=s[0],u=s[1];if(l&&u){var c=l.split(`
`),h=u.split(`
`);for(a=i=0;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;for(;a<h.length&&!h[a].includes("DetermineComponentFrameRoot");)a++;if(i===c.length||a===h.length)for(i=c.length-1,a=h.length-1;1<=i&&0<=a&&c[i]!==h[a];)a--;for(;1<=i&&0<=a;i--,a--)if(c[i]!==h[a]){if(i!==1||a!==1)do if(i--,a--,0>a||c[i]!==h[a]){var p=`
`+c[i].replace(" at new "," at ");return n.displayName&&p.includes("<anonymous>")&&(p=p.replace("<anonymous>",n.displayName)),p}while(1<=i&&0<=a);break}}}finally{uy=!1,Error.prepareStackTrace=t}return(t=n?n.displayName||n.name:"")?sl(t):""}function _I(n,e){switch(n.tag){case 26:case 27:case 5:return sl(n.type);case 16:return sl("Lazy");case 13:return n.child!==e&&e!==null?sl("Suspense Fallback"):sl("Suspense");case 19:return sl("SuspenseList");case 0:case 15:return cy(n.type,!1);case 11:return cy(n.type.render,!1);case 1:return cy(n.type,!0);case 31:return sl("Activity");default:return""}}function ME(n){try{var e="",t=null;do e+=_I(n,t),t=n,n=n.return;while(n);return e}catch(i){return`
Error generating stack: `+i.message+`
`+i.stack}}var q_=Object.prototype.hasOwnProperty,sS=Xn.unstable_scheduleCallback,fy=Xn.unstable_cancelCallback,xI=Xn.unstable_shouldYield,SI=Xn.unstable_requestPaint,ma=Xn.unstable_now,bI=Xn.unstable_getCurrentPriorityLevel,Qw=Xn.unstable_ImmediatePriority,Kw=Xn.unstable_UserBlockingPriority,Dm=Xn.unstable_NormalPriority,MI=Xn.unstable_LowPriority,Jw=Xn.unstable_IdlePriority,EI=Xn.log,TI=Xn.unstable_setDisableYieldValue,qh=null,ga=null;function $r(n){if(typeof EI=="function"&&TI(n),ga&&typeof ga.setStrictMode=="function")try{ga.setStrictMode(qh,n)}catch{}}var va=Math.clz32?Math.clz32:CI,AI=Math.log,wI=Math.LN2;function CI(n){return n>>>=0,n===0?32:31-(AI(n)/wI|0)|0}var tp=256,np=262144,ip=4194304;function rl(n){var e=n&42;if(e!==0)return e;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function qg(n,e,t){var i=n.pendingLanes;if(i===0)return 0;var a=0,s=n.suspendedLanes,l=n.pingedLanes;n=n.warmLanes;var u=i&134217727;return u!==0?(i=u&~s,i!==0?a=rl(i):(l&=u,l!==0?a=rl(l):t||(t=u&~n,t!==0&&(a=rl(t))))):(u=i&~s,u!==0?a=rl(u):l!==0?a=rl(l):t||(t=i&~n,t!==0&&(a=rl(t)))),a===0?0:e!==0&&e!==a&&!(e&s)&&(s=a&-a,t=e&-e,s>=t||s===32&&(t&4194048)!==0)?e:a}function Yh(n,e){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&e)===0}function RI(n,e){switch(n){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $w(){var n=ip;return ip<<=1,!(ip&62914560)&&(ip=4194304),n}function hy(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Zh(n,e){n.pendingLanes|=e,e!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function DI(n,e,t,i,a,s){var l=n.pendingLanes;n.pendingLanes=t,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=t,n.entangledLanes&=t,n.errorRecoveryDisabledLanes&=t,n.shellSuspendCounter=0;var u=n.entanglements,c=n.expirationTimes,h=n.hiddenUpdates;for(t=l&~t;0<t;){var p=31-va(t),g=1<<p;u[p]=0,c[p]=-1;var m=h[p];if(m!==null)for(h[p]=null,p=0;p<m.length;p++){var v=m[p];v!==null&&(v.lane&=-536870913)}t&=~g}i!==0&&eC(n,i,0),s!==0&&a===0&&n.tag!==0&&(n.suspendedLanes|=s&~(l&~e))}function eC(n,e,t){n.pendingLanes|=e,n.suspendedLanes&=~e;var i=31-va(e);n.entangledLanes|=e,n.entanglements[i]=n.entanglements[i]|1073741824|t&261930}function tC(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-va(t),a=1<<i;a&e|n[i]&e&&(n[i]|=e),t&=~a}}function nC(n,e){var t=e&-e;return t=t&42?1:rS(t),t&(n.suspendedLanes|e)?0:t}function rS(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function oS(n){return n&=-n,2<n?8<n?n&134217727?32:268435456:8:2}function iC(){var n=qt.p;return n!==0?n:(n=window.event,n===void 0?32:A3(n.type))}function EE(n,e){var t=qt.p;try{return qt.p=n,e()}finally{qt.p=t}}var xo=Math.random().toString(36).slice(2),ui="__reactFiber$"+xo,Ki="__reactProps$"+xo,Uc="__reactContainer$"+xo,Y_="__reactEvents$"+xo,UI="__reactListeners$"+xo,LI="__reactHandles$"+xo,TE="__reactResources$"+xo,jh="__reactMarker$"+xo;function lS(n){delete n[ui],delete n[Ki],delete n[Y_],delete n[UI],delete n[LI]}function Wu(n){var e=n[ui];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Uc]||t[ui]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=LT(n);n!==null;){if(t=n[ui])return t;n=LT(n)}return e}n=t,t=n.parentNode}return null}function Lc(n){if(n=n[ui]||n[Uc]){var e=n.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return n}return null}function Pf(n){var e=n.tag;if(e===5||e===26||e===27||e===6)return n.stateNode;throw Error(ue(33))}function rc(n){var e=n[TE];return e||(e=n[TE]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function ei(n){n[jh]=!0}var aC=new Set,sC={};function Ol(n,e){mc(n,e),mc(n+"Capture",e)}function mc(n,e){for(sC[n]=e,n=0;n<e.length;n++)aC.add(e[n])}var NI=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),AE={},wE={};function II(n){return q_.call(wE,n)?!0:q_.call(AE,n)?!1:NI.test(n)?wE[n]=!0:(AE[n]=!0,!1)}function lm(n,e,t){if(II(e))if(t===null)n.removeAttribute(e);else{switch(typeof t){case"undefined":case"function":case"symbol":n.removeAttribute(e);return;case"boolean":var i=e.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){n.removeAttribute(e);return}}n.setAttribute(e,""+t)}}function ap(n,e,t){if(t===null)n.removeAttribute(e);else{switch(typeof t){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(e);return}n.setAttribute(e,""+t)}}function ks(n,e,t,i){if(i===null)n.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(t);return}n.setAttributeNS(e,t,""+i)}}function La(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function rC(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function zI(n,e,t){var i=Object.getOwnPropertyDescriptor(n.constructor.prototype,e);if(!n.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var a=i.get,s=i.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return a.call(this)},set:function(l){t=""+l,s.call(this,l)}}),Object.defineProperty(n,e,{enumerable:i.enumerable}),{getValue:function(){return t},setValue:function(l){t=""+l},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Z_(n){if(!n._valueTracker){var e=rC(n)?"checked":"value";n._valueTracker=zI(n,e,""+n[e])}}function oC(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=rC(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Um(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var OI=/[\n"\\]/g;function za(n){return n.replace(OI,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function j_(n,e,t,i,a,s,l,u){n.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?n.type=l:n.removeAttribute("type"),e!=null?l==="number"?(e===0&&n.value===""||n.value!=e)&&(n.value=""+La(e)):n.value!==""+La(e)&&(n.value=""+La(e)):l!=="submit"&&l!=="reset"||n.removeAttribute("value"),e!=null?Q_(n,l,La(e)):t!=null?Q_(n,l,La(t)):i!=null&&n.removeAttribute("value"),a==null&&s!=null&&(n.defaultChecked=!!s),a!=null&&(n.checked=a&&typeof a!="function"&&typeof a!="symbol"),u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"?n.name=""+La(u):n.removeAttribute("name")}function lC(n,e,t,i,a,s,l,u){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(n.type=s),e!=null||t!=null){if(!(s!=="submit"&&s!=="reset"||e!=null)){Z_(n);return}t=t!=null?""+La(t):"",e=e!=null?""+La(e):t,u||e===n.value||(n.value=e),n.defaultValue=e}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,n.checked=u?n.checked:!!i,n.defaultChecked=!!i,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(n.name=l),Z_(n)}function Q_(n,e,t){e==="number"&&Um(n.ownerDocument)===n||n.defaultValue===""+t||(n.defaultValue=""+t)}function oc(n,e,t,i){if(n=n.options,e){e={};for(var a=0;a<t.length;a++)e["$"+t[a]]=!0;for(t=0;t<n.length;t++)a=e.hasOwnProperty("$"+n[t].value),n[t].selected!==a&&(n[t].selected=a),a&&i&&(n[t].defaultSelected=!0)}else{for(t=""+La(t),e=null,a=0;a<n.length;a++){if(n[a].value===t){n[a].selected=!0,i&&(n[a].defaultSelected=!0);return}e!==null||n[a].disabled||(e=n[a])}e!==null&&(e.selected=!0)}}function uC(n,e,t){if(e!=null&&(e=""+La(e),e!==n.value&&(n.value=e),t==null)){n.defaultValue!==e&&(n.defaultValue=e);return}n.defaultValue=t!=null?""+La(t):""}function cC(n,e,t,i){if(e==null){if(i!=null){if(t!=null)throw Error(ue(92));if(Of(i)){if(1<i.length)throw Error(ue(93));i=i[0]}t=i}t==null&&(t=""),e=t}t=La(e),n.defaultValue=t,i=n.textContent,i===t&&i!==""&&i!==null&&(n.value=i),Z_(n)}function gc(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var PI=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function CE(n,e,t){var i=e.indexOf("--")===0;t==null||typeof t=="boolean"||t===""?i?n.setProperty(e,""):e==="float"?n.cssFloat="":n[e]="":i?n.setProperty(e,t):typeof t!="number"||t===0||PI.has(e)?e==="float"?n.cssFloat=t:n[e]=(""+t).trim():n[e]=t+"px"}function fC(n,e,t){if(e!=null&&typeof e!="object")throw Error(ue(62));if(n=n.style,t!=null){for(var i in t)!t.hasOwnProperty(i)||e!=null&&e.hasOwnProperty(i)||(i.indexOf("--")===0?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="");for(var a in e)i=e[a],e.hasOwnProperty(a)&&t[a]!==i&&CE(n,a,i)}else for(var s in e)e.hasOwnProperty(s)&&CE(n,s,e[s])}function uS(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var BI=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),FI=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function um(n){return FI.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function ar(){}var K_=null;function cS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qu=null,lc=null;function RE(n){var e=Lc(n);if(e&&(n=e.stateNode)){var t=n[Ki]||null;e:switch(n=e.stateNode,e.type){case"input":if(j_(n,t.value,t.defaultValue,t.defaultValue,t.checked,t.defaultChecked,t.type,t.name),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll('input[name="'+za(""+e)+'"][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var a=i[Ki]||null;if(!a)throw Error(ue(90));j_(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<t.length;e++)i=t[e],i.form===n.form&&oC(i)}break e;case"textarea":uC(n,t.value,t.defaultValue);break e;case"select":e=t.value,e!=null&&oc(n,!!t.multiple,e,!1)}}}var dy=!1;function hC(n,e,t){if(dy)return n(e,t);dy=!0;try{var i=n(e);return i}finally{if(dy=!1,(qu!==null||lc!==null)&&(a0(),qu&&(e=qu,n=lc,lc=qu=null,RE(e),n)))for(e=0;e<n.length;e++)RE(n[e])}}function ph(n,e){var t=n.stateNode;if(t===null)return null;var i=t[Ki]||null;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(ue(231,e,typeof t));return t}var hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),J_=!1;if(hr)try{var vf={};Object.defineProperty(vf,"passive",{get:function(){J_=!0}}),window.addEventListener("test",vf,vf),window.removeEventListener("test",vf,vf)}catch{J_=!1}var eo=null,fS=null,cm=null;function dC(){if(cm)return cm;var n,e=fS,t=e.length,i,a="value"in eo?eo.value:eo.textContent,s=a.length;for(n=0;n<t&&e[n]===a[n];n++);var l=t-n;for(i=1;i<=l&&e[t-i]===a[s-i];i++);return cm=a.slice(n,1<i?1-i:void 0)}function fm(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 sp(){return!0}function DE(){return!1}function Ji(n){function e(t,i,a,s,l){this._reactName=t,this._targetInst=a,this.type=i,this.nativeEvent=s,this.target=l,this.currentTarget=null;for(var u in n)n.hasOwnProperty(u)&&(t=n[u],this[u]=t?t(s):s[u]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?sp:DE,this.isPropagationStopped=DE,this}return cn(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=sp)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=sp)},persist:function(){},isPersistent:sp}),e}var Pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yg=Ji(Pl),Qh=cn({},Pl,{view:0,detail:0}),HI=Ji(Qh),py,my,yf,Zg=cn({},Qh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hS,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!==yf&&(yf&&n.type==="mousemove"?(py=n.screenX-yf.screenX,my=n.screenY-yf.screenY):my=py=0,yf=n),py)},movementY:function(n){return"movementY"in n?n.movementY:my}}),UE=Ji(Zg),VI=cn({},Zg,{dataTransfer:0}),kI=Ji(VI),GI=cn({},Qh,{relatedTarget:0}),gy=Ji(GI),XI=cn({},Pl,{animationName:0,elapsedTime:0,pseudoElement:0}),WI=Ji(XI),qI=cn({},Pl,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),YI=Ji(qI),ZI=cn({},Pl,{data:0}),LE=Ji(ZI),jI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QI={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"},KI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JI(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=KI[n])?!!e[n]:!1}function hS(){return JI}var $I=cn({},Qh,{key:function(n){if(n.key){var e=jI[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=fm(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?QI[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hS,charCode:function(n){return n.type==="keypress"?fm(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?fm(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),ez=Ji($I),tz=cn({},Zg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),NE=Ji(tz),nz=cn({},Qh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hS}),iz=Ji(nz),az=cn({},Pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),sz=Ji(az),rz=cn({},Zg,{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}),oz=Ji(rz),lz=cn({},Pl,{newState:0,oldState:0}),uz=Ji(lz),cz=[9,13,27,32],dS=hr&&"CompositionEvent"in window,Gf=null;hr&&"documentMode"in document&&(Gf=document.documentMode);var fz=hr&&"TextEvent"in window&&!Gf,pC=hr&&(!dS||Gf&&8<Gf&&11>=Gf),IE=" ",zE=!1;function mC(n,e){switch(n){case"keyup":return cz.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gC(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Yu=!1;function hz(n,e){switch(n){case"compositionend":return gC(e);case"keypress":return e.which!==32?null:(zE=!0,IE);case"textInput":return n=e.data,n===IE&&zE?null:n;default:return null}}function dz(n,e){if(Yu)return n==="compositionend"||!dS&&mC(n,e)?(n=dC(),cm=fS=eo=null,Yu=!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 pC&&e.locale!=="ko"?null:e.data;default:return null}}var pz={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 OE(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!pz[n.type]:e==="textarea"}function vC(n,e,t,i){qu?lc?lc.push(i):lc=[i]:qu=i,e=jm(e,"onChange"),0<e.length&&(t=new Yg("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var Xf=null,mh=null;function mz(n){h3(n,0)}function jg(n){var e=Pf(n);if(oC(e))return n}function PE(n,e){if(n==="change")return e}var yC=!1;if(hr){var vy;if(hr){var yy="oninput"in document;if(!yy){var BE=document.createElement("div");BE.setAttribute("oninput","return;"),yy=typeof BE.oninput=="function"}vy=yy}else vy=!1;yC=vy&&(!document.documentMode||9<document.documentMode)}function FE(){Xf&&(Xf.detachEvent("onpropertychange",_C),mh=Xf=null)}function _C(n){if(n.propertyName==="value"&&jg(mh)){var e=[];vC(e,mh,n,cS(n)),hC(mz,e)}}function gz(n,e,t){n==="focusin"?(FE(),Xf=e,mh=t,Xf.attachEvent("onpropertychange",_C)):n==="focusout"&&FE()}function vz(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return jg(mh)}function yz(n,e){if(n==="click")return jg(e)}function _z(n,e){if(n==="input"||n==="change")return jg(e)}function xz(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var xa=typeof Object.is=="function"?Object.is:xz;function gh(n,e){if(xa(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 a=t[i];if(!q_.call(e,a)||!xa(n[a],e[a]))return!1}return!0}function HE(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function VE(n,e){var t=HE(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=HE(t)}}function xC(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?xC(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function SC(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var e=Um(n.document);e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Um(n.document)}return e}function pS(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")}var Sz=hr&&"documentMode"in document&&11>=document.documentMode,Zu=null,$_=null,Wf=null,ex=!1;function kE(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;ex||Zu==null||Zu!==Um(i)||(i=Zu,"selectionStart"in i&&pS(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}),Wf&&gh(Wf,i)||(Wf=i,i=jm($_,"onSelect"),0<i.length&&(e=new Yg("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=Zu)))}function Wo(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var ju={animationend:Wo("Animation","AnimationEnd"),animationiteration:Wo("Animation","AnimationIteration"),animationstart:Wo("Animation","AnimationStart"),transitionrun:Wo("Transition","TransitionRun"),transitionstart:Wo("Transition","TransitionStart"),transitioncancel:Wo("Transition","TransitionCancel"),transitionend:Wo("Transition","TransitionEnd")},_y={},bC={};hr&&(bC=document.createElement("div").style,"AnimationEvent"in window||(delete ju.animationend.animation,delete ju.animationiteration.animation,delete ju.animationstart.animation),"TransitionEvent"in window||delete ju.transitionend.transition);function Bl(n){if(_y[n])return _y[n];if(!ju[n])return n;var e=ju[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in bC)return _y[n]=e[t];return n}var MC=Bl("animationend"),EC=Bl("animationiteration"),TC=Bl("animationstart"),bz=Bl("transitionrun"),Mz=Bl("transitionstart"),Ez=Bl("transitioncancel"),AC=Bl("transitionend"),wC=new Map,tx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");tx.push("scrollEnd");function ss(n,e){wC.set(n,e),Ol(e,[n])}var Lm=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ua=[],Qu=0,mS=0;function Qg(){for(var n=Qu,e=mS=Qu=0;e<n;){var t=Ua[e];Ua[e++]=null;var i=Ua[e];Ua[e++]=null;var a=Ua[e];Ua[e++]=null;var s=Ua[e];if(Ua[e++]=null,i!==null&&a!==null){var l=i.pending;l===null?a.next=a:(a.next=l.next,l.next=a),i.pending=a}s!==0&&CC(t,a,s)}}function Kg(n,e,t,i){Ua[Qu++]=n,Ua[Qu++]=e,Ua[Qu++]=t,Ua[Qu++]=i,mS|=i,n.lanes|=i,n=n.alternate,n!==null&&(n.lanes|=i)}function gS(n,e,t,i){return Kg(n,e,t,i),Nm(n)}function Fl(n,e){return Kg(n,null,null,e),Nm(n)}function CC(n,e,t){n.lanes|=t;var i=n.alternate;i!==null&&(i.lanes|=t);for(var a=!1,s=n.return;s!==null;)s.childLanes|=t,i=s.alternate,i!==null&&(i.childLanes|=t),s.tag===22&&(n=s.stateNode,n===null||n._visibility&1||(a=!0)),n=s,s=s.return;return n.tag===3?(s=n.stateNode,a&&e!==null&&(a=31-va(t),n=s.hiddenUpdates,i=n[a],i===null?n[a]=[e]:i.push(e),e.lane=t|536870912),s):null}function Nm(n){if(50<eh)throw eh=0,bx=null,Error(ue(185));for(var e=n.return;e!==null;)n=e,e=n.return;return n.tag===3?n.stateNode:null}var Ku={};function Tz(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.refCleanup=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 da(n,e,t,i){return new Tz(n,e,t,i)}function vS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function or(n,e){var t=n.alternate;return t===null?(t=da(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&65011712,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.refCleanup=n.refCleanup,t}function RC(n,e){n.flags&=65011714;var t=n.alternate;return t===null?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,n.type=t.type,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n}function hm(n,e,t,i,a,s){var l=0;if(i=n,typeof n=="function")vS(n)&&(l=1);else if(typeof n=="string")l=DO(n,t,bs.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case k_:return n=da(31,t,e,a),n.elementType=k_,n.lanes=s,n;case Gu:return vl(t.children,a,s,e);case Zw:l=8,a|=24;break;case F_:return n=da(12,t,e,a|2),n.elementType=F_,n.lanes=s,n;case H_:return n=da(13,t,e,a),n.elementType=H_,n.lanes=s,n;case V_:return n=da(19,t,e,a),n.elementType=V_,n.lanes=s,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ir:l=10;break e;case jw:l=9;break e;case iS:l=11;break e;case aS:l=14;break e;case Xr:l=16,i=null;break e}l=29,t=Error(ue(130,n===null?"null":typeof n,"")),i=null}return e=da(l,t,e,a),e.elementType=n,e.type=i,e.lanes=s,e}function vl(n,e,t,i){return n=da(7,n,i,e),n.lanes=t,n}function xy(n,e,t){return n=da(6,n,null,e),n.lanes=t,n}function DC(n){var e=da(18,null,null,0);return e.stateNode=n,e}function Sy(n,e,t){return e=da(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}var GE=new WeakMap;function Oa(n,e){if(typeof n=="object"&&n!==null){var t=GE.get(n);return t!==void 0?t:(e={value:n,source:e,stack:ME(e)},GE.set(n,e),e)}return{value:n,source:e,stack:ME(e)}}var Ju=[],$u=0,Im=null,vh=0,Na=[],Ia=0,po=null,vs=1,ys="";function $s(n,e){Ju[$u++]=vh,Ju[$u++]=Im,Im=n,vh=e}function UC(n,e,t){Na[Ia++]=vs,Na[Ia++]=ys,Na[Ia++]=po,po=n;var i=vs;n=ys;var a=32-va(i)-1;i&=~(1<<a),t+=1;var s=32-va(e)+a;if(30<s){var l=a-a%5;s=(i&(1<<l)-1).toString(32),i>>=l,a-=l,vs=1<<32-va(e)+a|t<<a|i,ys=s+n}else vs=1<<s|t<<a|i,ys=n}function yS(n){n.return!==null&&($s(n,1),UC(n,1,0))}function _S(n){for(;n===Im;)Im=Ju[--$u],Ju[$u]=null,vh=Ju[--$u],Ju[$u]=null;for(;n===po;)po=Na[--Ia],Na[Ia]=null,ys=Na[--Ia],Na[Ia]=null,vs=Na[--Ia],Na[Ia]=null}function LC(n,e){Na[Ia++]=vs,Na[Ia++]=ys,Na[Ia++]=po,vs=e.id,ys=e.overflow,po=n}var ci=null,un=null,It=!1,so=null,Pa=!1,nx=Error(ue(519));function mo(n){var e=Error(ue(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yh(Oa(e,n)),nx}function XE(n){var e=n.stateNode,t=n.type,i=n.memoizedProps;switch(e[ui]=n,e[Ki]=i,t){case"dialog":At("cancel",e),At("close",e);break;case"iframe":case"object":case"embed":At("load",e);break;case"video":case"audio":for(t=0;t<bh.length;t++)At(bh[t],e);break;case"source":At("error",e);break;case"img":case"image":case"link":At("error",e),At("load",e);break;case"details":At("toggle",e);break;case"input":At("invalid",e),lC(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":At("invalid",e);break;case"textarea":At("invalid",e),cC(e,i.value,i.defaultValue,i.children)}t=i.children,typeof t!="string"&&typeof t!="number"&&typeof t!="bigint"||e.textContent===""+t||i.suppressHydrationWarning===!0||p3(e.textContent,t)?(i.popover!=null&&(At("beforetoggle",e),At("toggle",e)),i.onScroll!=null&&At("scroll",e),i.onScrollEnd!=null&&At("scrollend",e),i.onClick!=null&&(e.onclick=ar),e=!0):e=!1,e||mo(n,!0)}function WE(n){for(ci=n.return;ci;)switch(ci.tag){case 5:case 31:case 13:Pa=!1;return;case 27:case 3:Pa=!0;return;default:ci=ci.return}}function yu(n){if(n!==ci)return!1;if(!It)return WE(n),It=!0,!1;var e=n.tag,t;if((t=e!==3&&e!==27)&&((t=e===5)&&(t=n.type,t=!(t!=="form"&&t!=="button")||wx(n.type,n.memoizedProps)),t=!t),t&&un&&mo(n),WE(n),e===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ue(317));un=UT(n)}else if(e===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ue(317));un=UT(n)}else e===27?(e=un,So(n.type)?(n=Ux,Ux=null,un=n):un=e):un=ci?Ha(n.stateNode.nextSibling):null;return!0}function Tl(){un=ci=null,It=!1}function by(){var n=so;return n!==null&&(Wi===null?Wi=n:Wi.push.apply(Wi,n),so=null),n}function yh(n){so===null?so=[n]:so.push(n)}var ix=As(null),Hl=null,sr=null;function Yr(n,e,t){sn(ix,e._currentValue),e._currentValue=t}function lr(n){n._currentValue=ix.current,ni(ix)}function ax(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 sx(n,e,t,i){var a=n.child;for(a!==null&&(a.return=n);a!==null;){var s=a.dependencies;if(s!==null){var l=a.child;s=s.firstContext;e:for(;s!==null;){var u=s;s=a;for(var c=0;c<e.length;c++)if(u.context===e[c]){s.lanes|=t,u=s.alternate,u!==null&&(u.lanes|=t),ax(s.return,t,n),i||(l=null);break e}s=u.next}}else if(a.tag===18){if(l=a.return,l===null)throw Error(ue(341));l.lanes|=t,s=l.alternate,s!==null&&(s.lanes|=t),ax(l,t,n),l=null}else l=a.child;if(l!==null)l.return=a;else for(l=a;l!==null;){if(l===n){l=null;break}if(a=l.sibling,a!==null){a.return=l.return,l=a;break}l=l.return}a=l}}function Nc(n,e,t,i){n=null;for(var a=e,s=!1;a!==null;){if(!s){if(a.flags&524288)s=!0;else if(a.flags&262144)break}if(a.tag===10){var l=a.alternate;if(l===null)throw Error(ue(387));if(l=l.memoizedProps,l!==null){var u=a.type;xa(a.pendingProps.value,l.value)||(n!==null?n.push(u):n=[u])}}else if(a===wm.current){if(l=a.alternate,l===null)throw Error(ue(387));l.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(n!==null?n.push(Eh):n=[Eh])}a=a.return}n!==null&&sx(e,n,t,i),e.flags|=262144}function zm(n){for(n=n.firstContext;n!==null;){if(!xa(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Al(n){Hl=n,sr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function fi(n){return NC(Hl,n)}function rp(n,e){return Hl===null&&Al(n),NC(n,e)}function NC(n,e){var t=e._currentValue;if(e={context:e,memoizedValue:t,next:null},sr===null){if(n===null)throw Error(ue(308));sr=e,n.dependencies={lanes:0,firstContext:e},n.flags|=524288}else sr=sr.next=e;return t}var Az=typeof AbortController<"u"?AbortController:function(){var n=[],e=this.signal={aborted:!1,addEventListener:function(t,i){n.push(i)}};this.abort=function(){e.aborted=!0,n.forEach(function(t){return t()})}},wz=Xn.unstable_scheduleCallback,Cz=Xn.unstable_NormalPriority,Pn={$$typeof:ir,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xS(){return{controller:new Az,data:new Map,refCount:0}}function Kh(n){n.refCount--,n.refCount===0&&wz(Cz,function(){n.controller.abort()})}var qf=null,rx=0,vc=0,uc=null;function Rz(n,e){if(qf===null){var t=qf=[];rx=0,vc=WS(),uc={status:"pending",value:void 0,then:function(i){t.push(i)}}}return rx++,e.then(qE,qE),e}function qE(){if(--rx===0&&qf!==null){uc!==null&&(uc.status="fulfilled");var n=qf;qf=null,vc=0,uc=null;for(var e=0;e<n.length;e++)(0,n[e])()}}function Dz(n,e){var t=[],i={status:"pending",value:null,reason:null,then:function(a){t.push(a)}};return n.then(function(){i.status="fulfilled",i.value=e;for(var a=0;a<t.length;a++)(0,t[a])(e)},function(a){for(i.status="rejected",i.reason=a,a=0;a<t.length;a++)(0,t[a])(void 0)}),i}var YE=ot.S;ot.S=function(n,e){YR=ma(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&Rz(n,e),YE!==null&&YE(n,e)};var yl=As(null);function SS(){var n=yl.current;return n!==null?n:an.pooledCache}function dm(n,e){e===null?sn(yl,yl.current):sn(yl,e.pool)}function IC(){var n=SS();return n===null?null:{parent:Pn._currentValue,pool:n}}var Ic=Error(ue(460)),bS=Error(ue(474)),Jg=Error(ue(542)),Om={then:function(){}};function ZE(n){return n=n.status,n==="fulfilled"||n==="rejected"}function zC(n,e,t){switch(t=n[t],t===void 0?n.push(e):t!==e&&(e.then(ar,ar),e=t),e.status){case"fulfilled":return e.value;case"rejected":throw n=e.reason,QE(n),n;default:if(typeof e.status=="string")e.then(ar,ar);else{if(n=an,n!==null&&100<n.shellSuspendCounter)throw Error(ue(482));n=e,n.status="pending",n.then(function(i){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=i}},function(i){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=i}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw n=e.reason,QE(n),n}throw _l=e,Ic}}function ol(n){try{var e=n._init;return e(n._payload)}catch(t){throw t!==null&&typeof t=="object"&&typeof t.then=="function"?(_l=t,Ic):t}}var _l=null;function jE(){if(_l===null)throw Error(ue(459));var n=_l;return _l=null,n}function QE(n){if(n===Ic||n===Jg)throw Error(ue(483))}var cc=null,_h=0;function op(n){var e=_h;return _h+=1,cc===null&&(cc=[]),zC(cc,n,e)}function _f(n,e){e=e.props.ref,n.ref=e!==void 0?e:null}function lp(n,e){throw e.$$typeof===gI?Error(ue(525)):(n=Object.prototype.toString.call(e),Error(ue(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)))}function OC(n){function e(y,S){if(n){var E=y.deletions;E===null?(y.deletions=[S],y.flags|=16):E.push(S)}}function t(y,S){if(!n)return null;for(;S!==null;)e(y,S),S=S.sibling;return null}function i(y){for(var S=new Map;y!==null;)y.key!==null?S.set(y.key,y):S.set(y.index,y),y=y.sibling;return S}function a(y,S){return y=or(y,S),y.index=0,y.sibling=null,y}function s(y,S,E){return y.index=E,n?(E=y.alternate,E!==null?(E=E.index,E<S?(y.flags|=67108866,S):E):(y.flags|=67108866,S)):(y.flags|=1048576,S)}function l(y){return n&&y.alternate===null&&(y.flags|=67108866),y}function u(y,S,E,A){return S===null||S.tag!==6?(S=xy(E,y.mode,A),S.return=y,S):(S=a(S,E),S.return=y,S)}function c(y,S,E,A){var I=E.type;return I===Gu?p(y,S,E.props.children,A,E.key):S!==null&&(S.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Xr&&ol(I)===S.type)?(S=a(S,E.props),_f(S,E),S.return=y,S):(S=hm(E.type,E.key,E.props,null,y.mode,A),_f(S,E),S.return=y,S)}function h(y,S,E,A){return S===null||S.tag!==4||S.stateNode.containerInfo!==E.containerInfo||S.stateNode.implementation!==E.implementation?(S=Sy(E,y.mode,A),S.return=y,S):(S=a(S,E.children||[]),S.return=y,S)}function p(y,S,E,A,I){return S===null||S.tag!==7?(S=vl(E,y.mode,A,I),S.return=y,S):(S=a(S,E),S.return=y,S)}function g(y,S,E){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return S=xy(""+S,y.mode,E),S.return=y,S;if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ep:return E=hm(S.type,S.key,S.props,null,y.mode,E),_f(E,S),E.return=y,E;case zf:return S=Sy(S,y.mode,E),S.return=y,S;case Xr:return S=ol(S),g(y,S,E)}if(Of(S)||gf(S))return S=vl(S,y.mode,E,null),S.return=y,S;if(typeof S.then=="function")return g(y,op(S),E);if(S.$$typeof===ir)return g(y,rp(y,S),E);lp(y,S)}return null}function m(y,S,E,A){var I=S!==null?S.key:null;if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return I!==null?null:u(y,S,""+E,A);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case ep:return E.key===I?c(y,S,E,A):null;case zf:return E.key===I?h(y,S,E,A):null;case Xr:return E=ol(E),m(y,S,E,A)}if(Of(E)||gf(E))return I!==null?null:p(y,S,E,A,null);if(typeof E.then=="function")return m(y,S,op(E),A);if(E.$$typeof===ir)return m(y,S,rp(y,E),A);lp(y,E)}return null}function v(y,S,E,A,I){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return y=y.get(E)||null,u(S,y,""+A,I);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case ep:return y=y.get(A.key===null?E:A.key)||null,c(S,y,A,I);case zf:return y=y.get(A.key===null?E:A.key)||null,h(S,y,A,I);case Xr:return A=ol(A),v(y,S,E,A,I)}if(Of(A)||gf(A))return y=y.get(E)||null,p(S,y,A,I,null);if(typeof A.then=="function")return v(y,S,E,op(A),I);if(A.$$typeof===ir)return v(y,S,E,rp(S,A),I);lp(S,A)}return null}function _(y,S,E,A){for(var I=null,R=null,L=S,z=S=0,C=null;L!==null&&z<E.length;z++){L.index>z?(C=L,L=null):C=L.sibling;var w=m(y,L,E[z],A);if(w===null){L===null&&(L=C);break}n&&L&&w.alternate===null&&e(y,L),S=s(w,S,z),R===null?I=w:R.sibling=w,R=w,L=C}if(z===E.length)return t(y,L),It&&$s(y,z),I;if(L===null){for(;z<E.length;z++)L=g(y,E[z],A),L!==null&&(S=s(L,S,z),R===null?I=L:R.sibling=L,R=L);return It&&$s(y,z),I}for(L=i(L);z<E.length;z++)C=v(L,y,z,E[z],A),C!==null&&(n&&C.alternate!==null&&L.delete(C.key===null?z:C.key),S=s(C,S,z),R===null?I=C:R.sibling=C,R=C);return n&&L.forEach(function(B){return e(y,B)}),It&&$s(y,z),I}function T(y,S,E,A){if(E==null)throw Error(ue(151));for(var I=null,R=null,L=S,z=S=0,C=null,w=E.next();L!==null&&!w.done;z++,w=E.next()){L.index>z?(C=L,L=null):C=L.sibling;var B=m(y,L,w.value,A);if(B===null){L===null&&(L=C);break}n&&L&&B.alternate===null&&e(y,L),S=s(B,S,z),R===null?I=B:R.sibling=B,R=B,L=C}if(w.done)return t(y,L),It&&$s(y,z),I;if(L===null){for(;!w.done;z++,w=E.next())w=g(y,w.value,A),w!==null&&(S=s(w,S,z),R===null?I=w:R.sibling=w,R=w);return It&&$s(y,z),I}for(L=i(L);!w.done;z++,w=E.next())w=v(L,y,z,w.value,A),w!==null&&(n&&w.alternate!==null&&L.delete(w.key===null?z:w.key),S=s(w,S,z),R===null?I=w:R.sibling=w,R=w);return n&&L.forEach(function(Q){return e(y,Q)}),It&&$s(y,z),I}function b(y,S,E,A){if(typeof E=="object"&&E!==null&&E.type===Gu&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case ep:e:{for(var I=E.key;S!==null;){if(S.key===I){if(I=E.type,I===Gu){if(S.tag===7){t(y,S.sibling),A=a(S,E.props.children),A.return=y,y=A;break e}}else if(S.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Xr&&ol(I)===S.type){t(y,S.sibling),A=a(S,E.props),_f(A,E),A.return=y,y=A;break e}t(y,S);break}else e(y,S);S=S.sibling}E.type===Gu?(A=vl(E.props.children,y.mode,A,E.key),A.return=y,y=A):(A=hm(E.type,E.key,E.props,null,y.mode,A),_f(A,E),A.return=y,y=A)}return l(y);case zf:e:{for(I=E.key;S!==null;){if(S.key===I)if(S.tag===4&&S.stateNode.containerInfo===E.containerInfo&&S.stateNode.implementation===E.implementation){t(y,S.sibling),A=a(S,E.children||[]),A.return=y,y=A;break e}else{t(y,S);break}else e(y,S);S=S.sibling}A=Sy(E,y.mode,A),A.return=y,y=A}return l(y);case Xr:return E=ol(E),b(y,S,E,A)}if(Of(E))return _(y,S,E,A);if(gf(E)){if(I=gf(E),typeof I!="function")throw Error(ue(150));return E=I.call(E),T(y,S,E,A)}if(typeof E.then=="function")return b(y,S,op(E),A);if(E.$$typeof===ir)return b(y,S,rp(y,E),A);lp(y,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,S!==null&&S.tag===6?(t(y,S.sibling),A=a(S,E),A.return=y,y=A):(t(y,S),A=xy(E,y.mode,A),A.return=y,y=A),l(y)):t(y,S)}return function(y,S,E,A){try{_h=0;var I=b(y,S,E,A);return cc=null,I}catch(L){if(L===Ic||L===Jg)throw L;var R=da(29,L,null,y.mode);return R.lanes=A,R.return=y,R}finally{}}}var wl=OC(!0),PC=OC(!1),Wr=!1;function MS(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ox(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ro(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function oo(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Wt&2){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=Nm(n),CC(n,null,t),e}return Kg(n,i,e,t),Nm(n)}function Yf(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194048)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tC(n,t)}}function My(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var a=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var l={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};s===null?a=s=l:s=s.next=l,t=t.next}while(t!==null);s===null?a=s=e:s=s.next=e}else a=s=e;t={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}var lx=!1;function Zf(){if(lx){var n=uc;if(n!==null)throw n}}function jf(n,e,t,i){lx=!1;var a=n.updateQueue;Wr=!1;var s=a.firstBaseUpdate,l=a.lastBaseUpdate,u=a.shared.pending;if(u!==null){a.shared.pending=null;var c=u,h=c.next;c.next=null,l===null?s=h:l.next=h,l=c;var p=n.alternate;p!==null&&(p=p.updateQueue,u=p.lastBaseUpdate,u!==l&&(u===null?p.firstBaseUpdate=h:u.next=h,p.lastBaseUpdate=c))}if(s!==null){var g=a.baseState;l=0,p=h=c=null,u=s;do{var m=u.lane&-536870913,v=m!==u.lane;if(v?(Lt&m)===m:(i&m)===m){m!==0&&m===vc&&(lx=!0),p!==null&&(p=p.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});e:{var _=n,T=u;m=e;var b=t;switch(T.tag){case 1:if(_=T.payload,typeof _=="function"){g=_.call(b,g,m);break e}g=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=T.payload,m=typeof _=="function"?_.call(b,g,m):_,m==null)break e;g=cn({},g,m);break e;case 2:Wr=!0}}m=u.callback,m!==null&&(n.flags|=64,v&&(n.flags|=8192),v=a.callbacks,v===null?a.callbacks=[m]:v.push(m))}else v={lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(h=p=v,c=g):p=p.next=v,l|=m;if(u=u.next,u===null){if(u=a.shared.pending,u===null)break;v=u,u=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);p===null&&(c=g),a.baseState=c,a.firstBaseUpdate=h,a.lastBaseUpdate=p,s===null&&(a.shared.lanes=0),vo|=l,n.lanes=l,n.memoizedState=g}}function BC(n,e){if(typeof n!="function")throw Error(ue(191,n));n.call(e)}function FC(n,e){var t=n.callbacks;if(t!==null)for(n.callbacks=null,n=0;n<t.length;n++)BC(t[n],e)}var yc=As(null),Pm=As(0);function KE(n,e){n=gr,sn(Pm,n),sn(yc,e),gr=n|e.baseLanes}function ux(){sn(Pm,gr),sn(yc,yc.current)}function ES(){gr=Pm.current,ni(yc),ni(Pm)}var Sa=As(null),Fa=null;function Zr(n){var e=n.alternate;sn(wn,wn.current&1),sn(Sa,n),Fa===null&&(e===null||yc.current!==null||e.memoizedState!==null)&&(Fa=n)}function cx(n){sn(wn,wn.current),sn(Sa,n),Fa===null&&(Fa=n)}function HC(n){n.tag===22?(sn(wn,wn.current),sn(Sa,n),Fa===null&&(Fa=n)):jr()}function jr(){sn(wn,wn.current),sn(Sa,Sa.current)}function ha(n){ni(Sa),Fa===n&&(Fa=null),ni(wn)}var wn=As(0);function Bm(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||Rx(t)||Dx(t)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){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 dr=0,xt=null,en=null,zn=null,Fm=!1,fc=!1,Cl=!1,Hm=0,xh=0,hc=null,Uz=0;function xn(){throw Error(ue(321))}function TS(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!xa(n[t],e[t]))return!1;return!0}function AS(n,e,t,i,a,s){return dr=s,xt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ot.H=n===null||n.memoizedState===null?vR:PS,Cl=!1,s=t(i,a),Cl=!1,fc&&(s=kC(e,t,i,a)),VC(n),s}function VC(n){ot.H=Sh;var e=en!==null&&en.next!==null;if(dr=0,zn=en=xt=null,Fm=!1,xh=0,hc=null,e)throw Error(ue(300));n===null||Bn||(n=n.dependencies,n!==null&&zm(n)&&(Bn=!0))}function kC(n,e,t,i){xt=n;var a=0;do{if(fc&&(hc=null),xh=0,fc=!1,25<=a)throw Error(ue(301));if(a+=1,zn=en=null,n.updateQueue!=null){var s=n.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}ot.H=yR,s=e(t,i)}while(fc);return s}function Lz(){var n=ot.H,e=n.useState()[0];return e=typeof e.then=="function"?Jh(e):e,n=n.useState()[0],(en!==null?en.memoizedState:null)!==n&&(xt.flags|=1024),e}function wS(){var n=Hm!==0;return Hm=0,n}function CS(n,e,t){e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~t}function RS(n){if(Fm){for(n=n.memoizedState;n!==null;){var e=n.queue;e!==null&&(e.pending=null),n=n.next}Fm=!1}dr=0,zn=en=xt=null,fc=!1,xh=Hm=0,hc=null}function Ri(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?xt.memoizedState=zn=n:zn=zn.next=n,zn}function Cn(){if(en===null){var n=xt.alternate;n=n!==null?n.memoizedState:null}else n=en.next;var e=zn===null?xt.memoizedState:zn.next;if(e!==null)zn=e,en=n;else{if(n===null)throw xt.alternate===null?Error(ue(467)):Error(ue(310));en=n,n={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},zn===null?xt.memoizedState=zn=n:zn=zn.next=n}return zn}function $g(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jh(n){var e=xh;return xh+=1,hc===null&&(hc=[]),n=zC(hc,n,e),e=xt,(zn===null?e.memoizedState:zn.next)===null&&(e=e.alternate,ot.H=e===null||e.memoizedState===null?vR:PS),n}function e0(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Jh(n);if(n.$$typeof===ir)return fi(n)}throw Error(ue(438,String(n)))}function DS(n){var e=null,t=xt.updateQueue;if(t!==null&&(e=t.memoCache),e==null){var i=xt.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(e={data:i.data.map(function(a){return a.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),t===null&&(t=$g(),xt.updateQueue=t),t.memoCache=e,t=e.data[e.index],t===void 0)for(t=e.data[e.index]=Array(n),i=0;i<n;i++)t[i]=vI;return e.index++,t}function pr(n,e){return typeof e=="function"?e(n):e}function pm(n){var e=Cn();return US(e,en,n)}function US(n,e,t){var i=n.queue;if(i===null)throw Error(ue(311));i.lastRenderedReducer=t;var a=n.baseQueue,s=i.pending;if(s!==null){if(a!==null){var l=a.next;a.next=s.next,s.next=l}e.baseQueue=a=s,i.pending=null}if(s=n.baseState,a===null)n.memoizedState=s;else{e=a.next;var u=l=null,c=null,h=e,p=!1;do{var g=h.lane&-536870913;if(g!==h.lane?(Lt&g)===g:(dr&g)===g){var m=h.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),g===vc&&(p=!0);else if((dr&m)===m){h=h.next,m===vc&&(p=!0);continue}else g={lane:0,revertLane:h.revertLane,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},c===null?(u=c=g,l=s):c=c.next=g,xt.lanes|=m,vo|=m;g=h.action,Cl&&t(s,g),s=h.hasEagerState?h.eagerState:t(s,g)}else m={lane:g,revertLane:h.revertLane,gesture:h.gesture,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},c===null?(u=c=m,l=s):c=c.next=m,xt.lanes|=g,vo|=g;h=h.next}while(h!==null&&h!==e);if(c===null?l=s:c.next=u,!xa(s,n.memoizedState)&&(Bn=!0,p&&(t=uc,t!==null)))throw t;n.memoizedState=s,n.baseState=l,n.baseQueue=c,i.lastRenderedState=s}return a===null&&(i.lanes=0),[n.memoizedState,i.dispatch]}function Ey(n){var e=Cn(),t=e.queue;if(t===null)throw Error(ue(311));t.lastRenderedReducer=n;var i=t.dispatch,a=t.pending,s=e.memoizedState;if(a!==null){t.pending=null;var l=a=a.next;do s=n(s,l.action),l=l.next;while(l!==a);xa(s,e.memoizedState)||(Bn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function GC(n,e,t){var i=xt,a=Cn(),s=It;if(s){if(t===void 0)throw Error(ue(407));t=t()}else t=e();var l=!xa((en||a).memoizedState,t);if(l&&(a.memoizedState=t,Bn=!0),a=a.queue,LS(qC.bind(null,i,a,n),[n]),a.getSnapshot!==e||l||zn!==null&&zn.memoizedState.tag&1){if(i.flags|=2048,_c(9,{destroy:void 0},WC.bind(null,i,a,t,e),null),an===null)throw Error(ue(349));s||dr&127||XC(i,e,t)}return t}function XC(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=xt.updateQueue,e===null?(e=$g(),xt.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function WC(n,e,t,i){e.value=t,e.getSnapshot=i,YC(e)&&ZC(n)}function qC(n,e,t){return t(function(){YC(e)&&ZC(n)})}function YC(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!xa(n,t)}catch{return!0}}function ZC(n){var e=Fl(n,2);e!==null&&ji(e,n,2)}function fx(n){var e=Ri();if(typeof n=="function"){var t=n;if(n=t(),Cl){$r(!0);try{t()}finally{$r(!1)}}}return e.memoizedState=e.baseState=n,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:n},e}function jC(n,e,t,i){return n.baseState=t,US(n,en,typeof i=="function"?i:pr)}function Nz(n,e,t,i,a){if(n0(n))throw Error(ue(485));if(n=e.action,n!==null){var s={payload:a,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(l){s.listeners.push(l)}};ot.T!==null?t(!0):s.isTransition=!1,i(s),t=e.pending,t===null?(s.next=e.pending=s,QC(e,s)):(s.next=t.next,e.pending=t.next=s)}}function QC(n,e){var t=e.action,i=e.payload,a=n.state;if(e.isTransition){var s=ot.T,l={};ot.T=l;try{var u=t(a,i),c=ot.S;c!==null&&c(l,u),JE(n,e,u)}catch(h){hx(n,e,h)}finally{s!==null&&l.types!==null&&(s.types=l.types),ot.T=s}}else try{s=t(a,i),JE(n,e,s)}catch(h){hx(n,e,h)}}function JE(n,e,t){t!==null&&typeof t=="object"&&typeof t.then=="function"?t.then(function(i){$E(n,e,i)},function(i){return hx(n,e,i)}):$E(n,e,t)}function $E(n,e,t){e.status="fulfilled",e.value=t,KC(e),n.state=t,e=n.pending,e!==null&&(t=e.next,t===e?n.pending=null:(t=t.next,e.next=t,QC(n,t)))}function hx(n,e,t){var i=n.pending;if(n.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=t,KC(e),e=e.next;while(e!==i)}n.action=null}function KC(n){n=n.listeners;for(var e=0;e<n.length;e++)(0,n[e])()}function JC(n,e){return e}function eT(n,e){if(It){var t=an.formState;if(t!==null){e:{var i=xt;if(It){if(un){t:{for(var a=un,s=Pa;a.nodeType!==8;){if(!s){a=null;break t}if(a=Ha(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){un=Ha(a.nextSibling),i=a.data==="F!";break e}}mo(i)}i=!1}i&&(e=t[0])}}return t=Ri(),t.memoizedState=t.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:e},t.queue=i,t=pR.bind(null,xt,i),i.dispatch=t,i=fx(!1),s=OS.bind(null,xt,!1,i.queue),i=Ri(),a={state:e,dispatch:null,action:n,pending:null},i.queue=a,t=Nz.bind(null,xt,a,s,t),a.dispatch=t,i.memoizedState=n,[e,t,!1]}function tT(n){var e=Cn();return $C(e,en,n)}function $C(n,e,t){if(e=US(n,e,JC)[0],n=pm(pr)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=Jh(e)}catch(l){throw l===Ic?Jg:l}else i=e;e=Cn();var a=e.queue,s=a.dispatch;return t!==e.memoizedState&&(xt.flags|=2048,_c(9,{destroy:void 0},Iz.bind(null,a,t),null)),[i,s,n]}function Iz(n,e){n.action=e}function nT(n){var e=Cn(),t=en;if(t!==null)return $C(e,t,n);Cn(),e=e.memoizedState,t=Cn();var i=t.queue.dispatch;return t.memoizedState=n,[e,i,!1]}function _c(n,e,t,i){return n={tag:n,create:t,deps:i,inst:e,next:null},e=xt.updateQueue,e===null&&(e=$g(),xt.updateQueue=e),t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n),n}function eR(){return Cn().memoizedState}function mm(n,e,t,i){var a=Ri();xt.flags|=n,a.memoizedState=_c(1|e,{destroy:void 0},t,i===void 0?null:i)}function t0(n,e,t,i){var a=Cn();i=i===void 0?null:i;var s=a.memoizedState.inst;en!==null&&i!==null&&TS(i,en.memoizedState.deps)?a.memoizedState=_c(e,s,t,i):(xt.flags|=n,a.memoizedState=_c(1|e,s,t,i))}function iT(n,e){mm(8390656,8,n,e)}function LS(n,e){t0(2048,8,n,e)}function zz(n){xt.flags|=4;var e=xt.updateQueue;if(e===null)e=$g(),xt.updateQueue=e,e.events=[n];else{var t=e.events;t===null?e.events=[n]:t.push(n)}}function tR(n){var e=Cn().memoizedState;return zz({ref:e,nextImpl:n}),function(){if(Wt&2)throw Error(ue(440));return e.impl.apply(void 0,arguments)}}function nR(n,e){return t0(4,2,n,e)}function iR(n,e){return t0(4,4,n,e)}function aR(n,e){if(typeof e=="function"){n=n();var t=e(n);return function(){typeof t=="function"?t():e(null)}}if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function sR(n,e,t){t=t!=null?t.concat([n]):null,t0(4,4,aR.bind(null,e,n),t)}function NS(){}function rR(n,e){var t=Cn();e=e===void 0?null:e;var i=t.memoizedState;return e!==null&&TS(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function oR(n,e){var t=Cn();e=e===void 0?null:e;var i=t.memoizedState;if(e!==null&&TS(e,i[1]))return i[0];if(i=n(),Cl){$r(!0);try{n()}finally{$r(!1)}}return t.memoizedState=[i,e],i}function IS(n,e,t){return t===void 0||dr&1073741824&&!(Lt&261930)?n.memoizedState=e:(n.memoizedState=t,n=jR(),xt.lanes|=n,vo|=n,t)}function lR(n,e,t,i){return xa(t,e)?t:yc.current!==null?(n=IS(n,t,i),xa(n,e)||(Bn=!0),n):!(dr&42)||dr&1073741824&&!(Lt&261930)?(Bn=!0,n.memoizedState=t):(n=jR(),xt.lanes|=n,vo|=n,e)}function uR(n,e,t,i,a){var s=qt.p;qt.p=s!==0&&8>s?s:8;var l=ot.T,u={};ot.T=u,OS(n,!1,e,t);try{var c=a(),h=ot.S;if(h!==null&&h(u,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var p=Dz(c,i);Qf(n,e,p,ya(n))}else Qf(n,e,i,ya(n))}catch(g){Qf(n,e,{then:function(){},status:"rejected",reason:g},ya())}finally{qt.p=s,l!==null&&u.types!==null&&(l.types=u.types),ot.T=l}}function Oz(){}function dx(n,e,t,i){if(n.tag!==5)throw Error(ue(476));var a=cR(n).queue;uR(n,a,e,gl,t===null?Oz:function(){return fR(n),t(i)})}function cR(n){var e=n.memoizedState;if(e!==null)return e;e={memoizedState:gl,baseState:gl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:gl},next:null};var t={};return e.next={memoizedState:t,baseState:t,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:t},next:null},n.memoizedState=e,n=n.alternate,n!==null&&(n.memoizedState=e),e}function fR(n){var e=cR(n);e.next===null&&(e=n.alternate.memoizedState),Qf(n,e.next.queue,{},ya())}function zS(){return fi(Eh)}function hR(){return Cn().memoizedState}function dR(){return Cn().memoizedState}function Pz(n){for(var e=n.return;e!==null;){switch(e.tag){case 24:case 3:var t=ya();n=ro(t);var i=oo(e,n,t);i!==null&&(ji(i,e,t),Yf(i,e,t)),e={cache:xS()},n.payload=e;return}e=e.return}}function Bz(n,e,t){var i=ya();t={lane:i,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null},n0(n)?mR(e,t):(t=gS(n,e,t,i),t!==null&&(ji(t,n,i),gR(t,e,i)))}function pR(n,e,t){var i=ya();Qf(n,e,t,i)}function Qf(n,e,t,i){var a={lane:i,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null};if(n0(n))mR(e,a);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var l=e.lastRenderedState,u=s(l,t);if(a.hasEagerState=!0,a.eagerState=u,xa(u,l))return Kg(n,e,a,0),an===null&&Qg(),!1}catch{}finally{}if(t=gS(n,e,a,i),t!==null)return ji(t,n,i),gR(t,e,i),!0}return!1}function OS(n,e,t,i){if(i={lane:2,revertLane:WS(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},n0(n)){if(e)throw Error(ue(479))}else e=gS(n,t,i,2),e!==null&&ji(e,n,2)}function n0(n){var e=n.alternate;return n===xt||e!==null&&e===xt}function mR(n,e){fc=Fm=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function gR(n,e,t){if(t&4194048){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,tC(n,t)}}var Sh={readContext:fi,use:e0,useCallback:xn,useContext:xn,useEffect:xn,useImperativeHandle:xn,useLayoutEffect:xn,useInsertionEffect:xn,useMemo:xn,useReducer:xn,useRef:xn,useState:xn,useDebugValue:xn,useDeferredValue:xn,useTransition:xn,useSyncExternalStore:xn,useId:xn,useHostTransitionStatus:xn,useFormState:xn,useActionState:xn,useOptimistic:xn,useMemoCache:xn,useCacheRefresh:xn};Sh.useEffectEvent=xn;var vR={readContext:fi,use:e0,useCallback:function(n,e){return Ri().memoizedState=[n,e===void 0?null:e],n},useContext:fi,useEffect:iT,useImperativeHandle:function(n,e,t){t=t!=null?t.concat([n]):null,mm(4194308,4,aR.bind(null,e,n),t)},useLayoutEffect:function(n,e){return mm(4194308,4,n,e)},useInsertionEffect:function(n,e){mm(4,2,n,e)},useMemo:function(n,e){var t=Ri();e=e===void 0?null:e;var i=n();if(Cl){$r(!0);try{n()}finally{$r(!1)}}return t.memoizedState=[i,e],i},useReducer:function(n,e,t){var i=Ri();if(t!==void 0){var a=t(e);if(Cl){$r(!0);try{t(e)}finally{$r(!1)}}}else a=e;return i.memoizedState=i.baseState=a,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:a},i.queue=n,n=n.dispatch=Bz.bind(null,xt,n),[i.memoizedState,n]},useRef:function(n){var e=Ri();return n={current:n},e.memoizedState=n},useState:function(n){n=fx(n);var e=n.queue,t=pR.bind(null,xt,e);return e.dispatch=t,[n.memoizedState,t]},useDebugValue:NS,useDeferredValue:function(n,e){var t=Ri();return IS(t,n,e)},useTransition:function(){var n=fx(!1);return n=uR.bind(null,xt,n.queue,!0,!1),Ri().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,e,t){var i=xt,a=Ri();if(It){if(t===void 0)throw Error(ue(407));t=t()}else{if(t=e(),an===null)throw Error(ue(349));Lt&127||XC(i,e,t)}a.memoizedState=t;var s={value:t,getSnapshot:e};return a.queue=s,iT(qC.bind(null,i,s,n),[n]),i.flags|=2048,_c(9,{destroy:void 0},WC.bind(null,i,s,t,e),null),t},useId:function(){var n=Ri(),e=an.identifierPrefix;if(It){var t=ys,i=vs;t=(i&~(1<<32-va(i)-1)).toString(32)+t,e="_"+e+"R_"+t,t=Hm++,0<t&&(e+="H"+t.toString(32)),e+="_"}else t=Uz++,e="_"+e+"r_"+t.toString(32)+"_";return n.memoizedState=e},useHostTransitionStatus:zS,useFormState:eT,useActionState:eT,useOptimistic:function(n){var e=Ri();e.memoizedState=e.baseState=n;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=t,e=OS.bind(null,xt,!0,t),t.dispatch=e,[n,e]},useMemoCache:DS,useCacheRefresh:function(){return Ri().memoizedState=Pz.bind(null,xt)},useEffectEvent:function(n){var e=Ri(),t={impl:n};return e.memoizedState=t,function(){if(Wt&2)throw Error(ue(440));return t.impl.apply(void 0,arguments)}}},PS={readContext:fi,use:e0,useCallback:rR,useContext:fi,useEffect:LS,useImperativeHandle:sR,useInsertionEffect:nR,useLayoutEffect:iR,useMemo:oR,useReducer:pm,useRef:eR,useState:function(){return pm(pr)},useDebugValue:NS,useDeferredValue:function(n,e){var t=Cn();return lR(t,en.memoizedState,n,e)},useTransition:function(){var n=pm(pr)[0],e=Cn().memoizedState;return[typeof n=="boolean"?n:Jh(n),e]},useSyncExternalStore:GC,useId:hR,useHostTransitionStatus:zS,useFormState:tT,useActionState:tT,useOptimistic:function(n,e){var t=Cn();return jC(t,en,n,e)},useMemoCache:DS,useCacheRefresh:dR};PS.useEffectEvent=tR;var yR={readContext:fi,use:e0,useCallback:rR,useContext:fi,useEffect:LS,useImperativeHandle:sR,useInsertionEffect:nR,useLayoutEffect:iR,useMemo:oR,useReducer:Ey,useRef:eR,useState:function(){return Ey(pr)},useDebugValue:NS,useDeferredValue:function(n,e){var t=Cn();return en===null?IS(t,n,e):lR(t,en.memoizedState,n,e)},useTransition:function(){var n=Ey(pr)[0],e=Cn().memoizedState;return[typeof n=="boolean"?n:Jh(n),e]},useSyncExternalStore:GC,useId:hR,useHostTransitionStatus:zS,useFormState:nT,useActionState:nT,useOptimistic:function(n,e){var t=Cn();return en!==null?jC(t,en,n,e):(t.baseState=n,[n,t.queue.dispatch])},useMemoCache:DS,useCacheRefresh:dR};yR.useEffectEvent=tR;function Ty(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:cn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var px={enqueueSetState:function(n,e,t){n=n._reactInternals;var i=ya(),a=ro(i);a.payload=e,t!=null&&(a.callback=t),e=oo(n,a,i),e!==null&&(ji(e,n,i),Yf(e,n,i))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=ya(),a=ro(i);a.tag=1,a.payload=e,t!=null&&(a.callback=t),e=oo(n,a,i),e!==null&&(ji(e,n,i),Yf(e,n,i))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=ya(),i=ro(t);i.tag=2,e!=null&&(i.callback=e),e=oo(n,i,t),e!==null&&(ji(e,n,t),Yf(e,n,t))}};function aT(n,e,t,i,a,s,l){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,l):e.prototype&&e.prototype.isPureReactComponent?!gh(t,i)||!gh(a,s):!0}function sT(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&&px.enqueueReplaceState(e,e.state,null)}function Rl(n,e){var t=e;if("ref"in e){t={};for(var i in e)i!=="ref"&&(t[i]=e[i])}if(n=n.defaultProps){t===e&&(t=cn({},t));for(var a in n)t[a]===void 0&&(t[a]=n[a])}return t}function _R(n){Lm(n)}function xR(n){console.error(n)}function SR(n){Lm(n)}function Vm(n,e){try{var t=n.onUncaughtError;t(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function rT(n,e,t){try{var i=n.onCaughtError;i(t.value,{componentStack:t.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function mx(n,e,t){return t=ro(t),t.tag=3,t.payload={element:null},t.callback=function(){Vm(n,e)},t}function bR(n){return n=ro(n),n.tag=3,n}function MR(n,e,t,i){var a=t.type.getDerivedStateFromError;if(typeof a=="function"){var s=i.value;n.payload=function(){return a(s)},n.callback=function(){rT(e,t,i)}}var l=t.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){rT(e,t,i),typeof a!="function"&&(lo===null?lo=new Set([this]):lo.add(this));var u=i.stack;this.componentDidCatch(i.value,{componentStack:u!==null?u:""})})}function Fz(n,e,t,i,a){if(t.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=t.alternate,e!==null&&Nc(e,t,a,!0),t=Sa.current,t!==null){switch(t.tag){case 31:case 13:return Fa===null?qm():t.alternate===null&&Sn===0&&(Sn=3),t.flags&=-257,t.flags|=65536,t.lanes=a,i===Om?t.flags|=16384:(e=t.updateQueue,e===null?t.updateQueue=new Set([i]):e.add(i),Oy(n,i,a)),!1;case 22:return t.flags|=65536,i===Om?t.flags|=16384:(e=t.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([i])},t.updateQueue=e):(t=e.retryQueue,t===null?e.retryQueue=new Set([i]):t.add(i)),Oy(n,i,a)),!1}throw Error(ue(435,t.tag))}return Oy(n,i,a),qm(),!1}if(It)return e=Sa.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==nx&&(n=Error(ue(422),{cause:i}),yh(Oa(n,t)))):(i!==nx&&(e=Error(ue(423),{cause:i}),yh(Oa(e,t))),n=n.current.alternate,n.flags|=65536,a&=-a,n.lanes|=a,i=Oa(i,t),a=mx(n.stateNode,i,a),My(n,a),Sn!==4&&(Sn=2)),!1;var s=Error(ue(520),{cause:i});if(s=Oa(s,t),$f===null?$f=[s]:$f.push(s),Sn!==4&&(Sn=2),e===null)return!0;i=Oa(i,t),t=e;do{switch(t.tag){case 3:return t.flags|=65536,n=a&-a,t.lanes|=n,n=mx(t.stateNode,i,n),My(t,n),!1;case 1:if(e=t.type,s=t.stateNode,(t.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(lo===null||!lo.has(s))))return t.flags|=65536,a&=-a,t.lanes|=a,a=bR(a),MR(a,n,t,i),My(t,a),!1}t=t.return}while(t!==null);return!1}var BS=Error(ue(461)),Bn=!1;function li(n,e,t,i){e.child=n===null?PC(e,null,t,i):wl(e,n.child,t,i)}function oT(n,e,t,i,a){t=t.render;var s=e.ref;if("ref"in i){var l={};for(var u in i)u!=="ref"&&(l[u]=i[u])}else l=i;return Al(e),i=AS(n,e,t,l,s,a),u=wS(),n!==null&&!Bn?(CS(n,e,a),mr(n,e,a)):(It&&u&&yS(e),e.flags|=1,li(n,e,i,a),e.child)}function lT(n,e,t,i,a){if(n===null){var s=t.type;return typeof s=="function"&&!vS(s)&&s.defaultProps===void 0&&t.compare===null?(e.tag=15,e.type=s,ER(n,e,s,i,a)):(n=hm(t.type,null,i,e,e.mode,a),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!FS(n,a)){var l=s.memoizedProps;if(t=t.compare,t=t!==null?t:gh,t(l,i)&&n.ref===e.ref)return mr(n,e,a)}return e.flags|=1,n=or(s,i),n.ref=e.ref,n.return=e,e.child=n}function ER(n,e,t,i,a){if(n!==null){var s=n.memoizedProps;if(gh(s,i)&&n.ref===e.ref)if(Bn=!1,e.pendingProps=i=s,FS(n,a))n.flags&131072&&(Bn=!0);else return e.lanes=n.lanes,mr(n,e,a)}return gx(n,e,t,i,a)}function TR(n,e,t,i){var a=i.children,s=n!==null?n.memoizedState:null;if(n===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if(e.flags&128){if(s=s!==null?s.baseLanes|t:t,n!==null){for(i=e.child=n.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~s}else i=0,e.child=null;return uT(n,e,s,t,i)}if(t&536870912)e.memoizedState={baseLanes:0,cachePool:null},n!==null&&dm(e,s!==null?s.cachePool:null),s!==null?KE(e,s):ux(),HC(e);else return i=e.lanes=536870912,uT(n,e,s!==null?s.baseLanes|t:t,t,i)}else s!==null?(dm(e,s.cachePool),KE(e,s),jr(),e.memoizedState=null):(n!==null&&dm(e,null),ux(),jr());return li(n,e,a,t),e.child}function Bf(n,e){return n!==null&&n.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function uT(n,e,t,i,a){var s=SS();return s=s===null?null:{parent:Pn._currentValue,pool:s},e.memoizedState={baseLanes:t,cachePool:s},n!==null&&dm(e,null),ux(),HC(e),n!==null&&Nc(n,e,i,!0),e.childLanes=a,null}function gm(n,e){return e=km({mode:e.mode,children:e.children},n.mode),e.ref=n.ref,n.child=e,e.return=n,e}function cT(n,e,t){return wl(e,n.child,null,t),n=gm(e,e.pendingProps),n.flags|=2,ha(e),e.memoizedState=null,n}function Hz(n,e,t){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,n===null){if(It){if(i.mode==="hidden")return n=gm(e,i),e.lanes=536870912,Bf(null,n);if(cx(e),(n=un)?(n=v3(n,Pa),n=n!==null&&n.data==="&"?n:null,n!==null&&(e.memoizedState={dehydrated:n,treeContext:po!==null?{id:vs,overflow:ys}:null,retryLane:536870912,hydrationErrors:null},t=DC(n),t.return=e,e.child=t,ci=e,un=null)):n=null,n===null)throw mo(e);return e.lanes=536870912,null}return gm(e,i)}var s=n.memoizedState;if(s!==null){var l=s.dehydrated;if(cx(e),a)if(e.flags&256)e.flags&=-257,e=cT(n,e,t);else if(e.memoizedState!==null)e.child=n.child,e.flags|=128,e=null;else throw Error(ue(558));else if(Bn||Nc(n,e,t,!1),a=(t&n.childLanes)!==0,Bn||a){if(i=an,i!==null&&(l=nC(i,t),l!==0&&l!==s.retryLane))throw s.retryLane=l,Fl(n,l),ji(i,n,l),BS;qm(),e=cT(n,e,t)}else n=s.treeContext,un=Ha(l.nextSibling),ci=e,It=!0,so=null,Pa=!1,n!==null&&LC(e,n),e=gm(e,i),e.flags|=4096;return e}return n=or(n.child,{mode:i.mode,children:i.children}),n.ref=e.ref,e.child=n,n.return=e,n}function vm(n,e){var t=e.ref;if(t===null)n!==null&&n.ref!==null&&(e.flags|=4194816);else{if(typeof t!="function"&&typeof t!="object")throw Error(ue(284));(n===null||n.ref!==t)&&(e.flags|=4194816)}}function gx(n,e,t,i,a){return Al(e),t=AS(n,e,t,i,void 0,a),i=wS(),n!==null&&!Bn?(CS(n,e,a),mr(n,e,a)):(It&&i&&yS(e),e.flags|=1,li(n,e,t,a),e.child)}function fT(n,e,t,i,a,s){return Al(e),e.updateQueue=null,t=kC(e,i,t,a),VC(n),i=wS(),n!==null&&!Bn?(CS(n,e,s),mr(n,e,s)):(It&&i&&yS(e),e.flags|=1,li(n,e,t,s),e.child)}function hT(n,e,t,i,a){if(Al(e),e.stateNode===null){var s=Ku,l=t.contextType;typeof l=="object"&&l!==null&&(s=fi(l)),s=new t(i,s),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=px,e.stateNode=s,s._reactInternals=e,s=e.stateNode,s.props=i,s.state=e.memoizedState,s.refs={},MS(e),l=t.contextType,s.context=typeof l=="object"&&l!==null?fi(l):Ku,s.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(Ty(e,t,l,i),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(l=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),l!==s.state&&px.enqueueReplaceState(s,s.state,null),jf(e,i,s,a),Zf(),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308),i=!0}else if(n===null){s=e.stateNode;var u=e.memoizedProps,c=Rl(t,u);s.props=c;var h=s.context,p=t.contextType;l=Ku,typeof p=="object"&&p!==null&&(l=fi(p));var g=t.getDerivedStateFromProps;p=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function",u=e.pendingProps!==u,p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u||h!==l)&&sT(e,s,i,l),Wr=!1;var m=e.memoizedState;s.state=m,jf(e,i,s,a),Zf(),h=e.memoizedState,u||m!==h||Wr?(typeof g=="function"&&(Ty(e,t,g,i),h=e.memoizedState),(c=Wr||aT(e,t,c,i,m,h,l))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=h),s.props=i,s.state=h,s.context=l,i=c):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{s=e.stateNode,ox(n,e),l=e.memoizedProps,p=Rl(t,l),s.props=p,g=e.pendingProps,m=s.context,h=t.contextType,c=Ku,typeof h=="object"&&h!==null&&(c=fi(h)),u=t.getDerivedStateFromProps,(h=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==g||m!==c)&&sT(e,s,i,c),Wr=!1,m=e.memoizedState,s.state=m,jf(e,i,s,a),Zf();var v=e.memoizedState;l!==g||m!==v||Wr||n!==null&&n.dependencies!==null&&zm(n.dependencies)?(typeof u=="function"&&(Ty(e,t,u,i),v=e.memoizedState),(p=Wr||aT(e,t,p,i,m,v,c)||n!==null&&n.dependencies!==null&&zm(n.dependencies))?(h||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(i,v,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(i,v,c)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=v),s.props=i,s.state=v,s.context=c,i=p):(typeof s.componentDidUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),i=!1)}return s=i,vm(n,e),i=(e.flags&128)!==0,s||i?(s=e.stateNode,t=i&&typeof t.getDerivedStateFromError!="function"?null:s.render(),e.flags|=1,n!==null&&i?(e.child=wl(e,n.child,null,a),e.child=wl(e,null,t,a)):li(n,e,t,a),e.memoizedState=s.state,n=e.child):n=mr(n,e,a),n}function dT(n,e,t,i){return Tl(),e.flags|=256,li(n,e,t,i),e.child}var Ay={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wy(n){return{baseLanes:n,cachePool:IC()}}function Cy(n,e,t){return n=n!==null?n.childLanes&~t:0,e&&(n|=pa),n}function AR(n,e,t){var i=e.pendingProps,a=!1,s=(e.flags&128)!==0,l;if((l=s)||(l=n!==null&&n.memoizedState===null?!1:(wn.current&2)!==0),l&&(a=!0,e.flags&=-129),l=(e.flags&32)!==0,e.flags&=-33,n===null){if(It){if(a?Zr(e):jr(),(n=un)?(n=v3(n,Pa),n=n!==null&&n.data!=="&"?n:null,n!==null&&(e.memoizedState={dehydrated:n,treeContext:po!==null?{id:vs,overflow:ys}:null,retryLane:536870912,hydrationErrors:null},t=DC(n),t.return=e,e.child=t,ci=e,un=null)):n=null,n===null)throw mo(e);return Dx(n)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(jr(),a=e.mode,u=km({mode:"hidden",children:u},a),i=vl(i,a,t,null),u.return=e,i.return=e,u.sibling=i,e.child=u,i=e.child,i.memoizedState=wy(t),i.childLanes=Cy(n,l,t),e.memoizedState=Ay,Bf(null,i)):(Zr(e),vx(e,u))}var c=n.memoizedState;if(c!==null&&(u=c.dehydrated,u!==null)){if(s)e.flags&256?(Zr(e),e.flags&=-257,e=Ry(n,e,t)):e.memoizedState!==null?(jr(),e.child=n.child,e.flags|=128,e=null):(jr(),u=i.fallback,a=e.mode,i=km({mode:"visible",children:i.children},a),u=vl(u,a,t,null),u.flags|=2,i.return=e,u.return=e,i.sibling=u,e.child=i,wl(e,n.child,null,t),i=e.child,i.memoizedState=wy(t),i.childLanes=Cy(n,l,t),e.memoizedState=Ay,e=Bf(null,i));else if(Zr(e),Dx(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var h=l.dgst;l=h,i=Error(ue(419)),i.stack="",i.digest=l,yh({value:i,source:null,stack:null}),e=Ry(n,e,t)}else if(Bn||Nc(n,e,t,!1),l=(t&n.childLanes)!==0,Bn||l){if(l=an,l!==null&&(i=nC(l,t),i!==0&&i!==c.retryLane))throw c.retryLane=i,Fl(n,i),ji(l,n,i),BS;Rx(u)||qm(),e=Ry(n,e,t)}else Rx(u)?(e.flags|=192,e.child=n.child,e=null):(n=c.treeContext,un=Ha(u.nextSibling),ci=e,It=!0,so=null,Pa=!1,n!==null&&LC(e,n),e=vx(e,i.children),e.flags|=4096);return e}return a?(jr(),u=i.fallback,a=e.mode,c=n.child,h=c.sibling,i=or(c,{mode:"hidden",children:i.children}),i.subtreeFlags=c.subtreeFlags&65011712,h!==null?u=or(h,u):(u=vl(u,a,t,null),u.flags|=2),u.return=e,i.return=e,i.sibling=u,e.child=i,Bf(null,i),i=e.child,u=n.child.memoizedState,u===null?u=wy(t):(a=u.cachePool,a!==null?(c=Pn._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=IC(),u={baseLanes:u.baseLanes|t,cachePool:a}),i.memoizedState=u,i.childLanes=Cy(n,l,t),e.memoizedState=Ay,Bf(n.child,i)):(Zr(e),t=n.child,n=t.sibling,t=or(t,{mode:"visible",children:i.children}),t.return=e,t.sibling=null,n!==null&&(l=e.deletions,l===null?(e.deletions=[n],e.flags|=16):l.push(n)),e.child=t,e.memoizedState=null,t)}function vx(n,e){return e=km({mode:"visible",children:e},n.mode),e.return=n,n.child=e}function km(n,e){return n=da(22,n,null,e),n.lanes=0,n}function Ry(n,e,t){return wl(e,n.child,null,t),n=vx(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function pT(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),ax(n.return,e,t)}function Dy(n,e,t,i,a,s){var l=n.memoizedState;l===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:a,treeForkCount:s}:(l.isBackwards=e,l.rendering=null,l.renderingStartTime=0,l.last=i,l.tail=t,l.tailMode=a,l.treeForkCount=s)}function wR(n,e,t){var i=e.pendingProps,a=i.revealOrder,s=i.tail;i=i.children;var l=wn.current,u=(l&2)!==0;if(u?(l=l&1|2,e.flags|=128):l&=1,sn(wn,l),li(n,e,i,t),i=It?vh:0,!u&&n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&pT(n,t,e);else if(n.tag===19)pT(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}switch(a){case"forwards":for(t=e.child,a=null;t!==null;)n=t.alternate,n!==null&&Bm(n)===null&&(a=t),t=t.sibling;t=a,t===null?(a=e.child,e.child=null):(a=t.sibling,t.sibling=null),Dy(e,!1,a,t,s,i);break;case"backwards":case"unstable_legacy-backwards":for(t=null,a=e.child,e.child=null;a!==null;){if(n=a.alternate,n!==null&&Bm(n)===null){e.child=a;break}n=a.sibling,a.sibling=t,t=a,a=n}Dy(e,!0,t,null,s,i);break;case"together":Dy(e,!1,null,null,void 0,i);break;default:e.memoizedState=null}return e.child}function mr(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),vo|=e.lanes,!(t&e.childLanes))if(n!==null){if(Nc(n,e,t,!1),(t&e.childLanes)===0)return null}else return null;if(n!==null&&e.child!==n.child)throw Error(ue(153));if(e.child!==null){for(n=e.child,t=or(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=or(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function FS(n,e){return n.lanes&e?!0:(n=n.dependencies,!!(n!==null&&zm(n)))}function Vz(n,e,t){switch(e.tag){case 3:Cm(e,e.stateNode.containerInfo),Yr(e,Pn,n.memoizedState.cache),Tl();break;case 27:case 5:W_(e);break;case 4:Cm(e,e.stateNode.containerInfo);break;case 10:Yr(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,cx(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(Zr(e),e.flags|=128,null):t&e.child.childLanes?AR(n,e,t):(Zr(e),n=mr(n,e,t),n!==null?n.sibling:null);Zr(e);break;case 19:var a=(n.flags&128)!==0;if(i=(t&e.childLanes)!==0,i||(Nc(n,e,t,!1),i=(t&e.childLanes)!==0),a){if(i)return wR(n,e,t);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),sn(wn,wn.current),i)break;return null;case 22:return e.lanes=0,TR(n,e,t,e.pendingProps);case 24:Yr(e,Pn,n.memoizedState.cache)}return mr(n,e,t)}function CR(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps)Bn=!0;else{if(!FS(n,t)&&!(e.flags&128))return Bn=!1,Vz(n,e,t);Bn=!!(n.flags&131072)}else Bn=!1,It&&e.flags&1048576&&UC(e,vh,e.index);switch(e.lanes=0,e.tag){case 16:e:{var i=e.pendingProps;if(n=ol(e.elementType),e.type=n,typeof n=="function")vS(n)?(i=Rl(n,i),e.tag=1,e=hT(null,e,n,i,t)):(e.tag=0,e=gx(null,e,n,i,t));else{if(n!=null){var a=n.$$typeof;if(a===iS){e.tag=11,e=oT(null,e,n,i,t);break e}else if(a===aS){e.tag=14,e=lT(null,e,n,i,t);break e}}throw e=G_(n)||n,Error(ue(306,e,""))}}return e;case 0:return gx(n,e,e.type,e.pendingProps,t);case 1:return i=e.type,a=Rl(i,e.pendingProps),hT(n,e,i,a,t);case 3:e:{if(Cm(e,e.stateNode.containerInfo),n===null)throw Error(ue(387));i=e.pendingProps;var s=e.memoizedState;a=s.element,ox(n,e),jf(e,i,null,t);var l=e.memoizedState;if(i=l.cache,Yr(e,Pn,i),i!==s.cache&&sx(e,[Pn],t,!0),Zf(),i=l.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:l.cache},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){e=dT(n,e,i,t);break e}else if(i!==a){a=Oa(Error(ue(424)),e),yh(a),e=dT(n,e,i,t);break e}else{switch(n=e.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(un=Ha(n.firstChild),ci=e,It=!0,so=null,Pa=!0,t=PC(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling}else{if(Tl(),i===a){e=mr(n,e,t);break e}li(n,e,i,t)}e=e.child}return e;case 26:return vm(n,e),n===null?(t=IT(e.type,null,e.pendingProps,null))?e.memoizedState=t:It||(t=e.type,n=e.pendingProps,i=Qm(ao.current).createElement(t),i[ui]=e,i[Ki]=n,hi(i,t,n),ei(i),e.stateNode=i):e.memoizedState=IT(e.type,n.memoizedProps,e.pendingProps,n.memoizedState),null;case 27:return W_(e),n===null&&It&&(i=e.stateNode=y3(e.type,e.pendingProps,ao.current),ci=e,Pa=!0,a=un,So(e.type)?(Ux=a,un=Ha(i.firstChild)):un=a),li(n,e,e.pendingProps.children,t),vm(n,e),n===null&&(e.flags|=4194304),e.child;case 5:return n===null&&It&&((a=i=un)&&(i=vO(i,e.type,e.pendingProps,Pa),i!==null?(e.stateNode=i,ci=e,un=Ha(i.firstChild),Pa=!1,a=!0):a=!1),a||mo(e)),W_(e),a=e.type,s=e.pendingProps,l=n!==null?n.memoizedProps:null,i=s.children,wx(a,s)?i=null:l!==null&&wx(a,l)&&(e.flags|=32),e.memoizedState!==null&&(a=AS(n,e,Lz,null,null,t),Eh._currentValue=a),vm(n,e),li(n,e,i,t),e.child;case 6:return n===null&&It&&((n=t=un)&&(t=yO(t,e.pendingProps,Pa),t!==null?(e.stateNode=t,ci=e,un=null,n=!0):n=!1),n||mo(e)),null;case 13:return AR(n,e,t);case 4:return Cm(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=wl(e,null,i,t):li(n,e,i,t),e.child;case 11:return oT(n,e,e.type,e.pendingProps,t);case 7:return li(n,e,e.pendingProps,t),e.child;case 8:return li(n,e,e.pendingProps.children,t),e.child;case 12:return li(n,e,e.pendingProps.children,t),e.child;case 10:return i=e.pendingProps,Yr(e,e.type,i.value),li(n,e,i.children,t),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,Al(e),a=fi(a),i=i(a),e.flags|=1,li(n,e,i,t),e.child;case 14:return lT(n,e,e.type,e.pendingProps,t);case 15:return ER(n,e,e.type,e.pendingProps,t);case 19:return wR(n,e,t);case 31:return Hz(n,e,t);case 22:return TR(n,e,t,e.pendingProps);case 24:return Al(e),i=fi(Pn),n===null?(a=SS(),a===null&&(a=an,s=xS(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=t),a=s),e.memoizedState={parent:i,cache:a},MS(e),Yr(e,Pn,a)):(n.lanes&t&&(ox(n,e),jf(e,null,null,t),Zf()),a=n.memoizedState,s=e.memoizedState,a.parent!==i?(a={parent:i,cache:i},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),Yr(e,Pn,i)):(i=s.cache,Yr(e,Pn,i),i!==a.cache&&sx(e,[Pn],t,!0))),li(n,e,e.pendingProps.children,t),e.child;case 29:throw e.pendingProps}throw Error(ue(156,e.tag))}function Gs(n){n.flags|=4}function Uy(n,e,t,i,a){if((e=(n.mode&32)!==0)&&(e=!1),e){if(n.flags|=16777216,(a&335544128)===a)if(n.stateNode.complete)n.flags|=8192;else if(JR())n.flags|=8192;else throw _l=Om,bS}else n.flags&=-16777217}function mT(n,e){if(e.type!=="stylesheet"||e.state.loading&4)n.flags&=-16777217;else if(n.flags|=16777216,!S3(e))if(JR())n.flags|=8192;else throw _l=Om,bS}function up(n,e){e!==null&&(n.flags|=4),n.flags&16384&&(e=n.tag!==22?$w():536870912,n.lanes|=e,xc|=e)}function xf(n,e){if(!It)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 ln(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var a=n.child;a!==null;)t|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=n,a=a.sibling;else for(a=n.child;a!==null;)t|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=n,a=a.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function kz(n,e,t){var i=e.pendingProps;switch(_S(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ln(e),null;case 1:return ln(e),null;case 3:return t=e.stateNode,i=null,n!==null&&(i=n.memoizedState.cache),e.memoizedState.cache!==i&&(e.flags|=2048),lr(Pn),pc(),t.pendingContext&&(t.context=t.pendingContext,t.pendingContext=null),(n===null||n.child===null)&&(yu(e)?Gs(e):n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,by())),ln(e),null;case 26:var a=e.type,s=e.memoizedState;return n===null?(Gs(e),s!==null?(ln(e),mT(e,s)):(ln(e),Uy(e,a,null,i,t))):s?s!==n.memoizedState?(Gs(e),ln(e),mT(e,s)):(ln(e),e.flags&=-16777217):(n=n.memoizedProps,n!==i&&Gs(e),ln(e),Uy(e,a,n,i,t)),null;case 27:if(Rm(e),t=ao.current,a=e.type,n!==null&&e.stateNode!=null)n.memoizedProps!==i&&Gs(e);else{if(!i){if(e.stateNode===null)throw Error(ue(166));return ln(e),null}n=bs.current,yu(e)?XE(e):(n=y3(a,i,t),e.stateNode=n,Gs(e))}return ln(e),null;case 5:if(Rm(e),a=e.type,n!==null&&e.stateNode!=null)n.memoizedProps!==i&&Gs(e);else{if(!i){if(e.stateNode===null)throw Error(ue(166));return ln(e),null}if(s=bs.current,yu(e))XE(e);else{var l=Qm(ao.current);switch(s){case 1:s=l.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=l.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=l.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=l.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":s=l.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof i.is=="string"?l.createElement("select",{is:i.is}):l.createElement("select"),i.multiple?s.multiple=!0:i.size&&(s.size=i.size);break;default:s=typeof i.is=="string"?l.createElement(a,{is:i.is}):l.createElement(a)}}s[ui]=e,s[Ki]=i;e:for(l=e.child;l!==null;){if(l.tag===5||l.tag===6)s.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===e)break e;for(;l.sibling===null;){if(l.return===null||l.return===e)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}e.stateNode=s;e:switch(hi(s,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Gs(e)}}return ln(e),Uy(e,e.type,n===null?null:n.memoizedProps,e.pendingProps,t),null;case 6:if(n&&e.stateNode!=null)n.memoizedProps!==i&&Gs(e);else{if(typeof i!="string"&&e.stateNode===null)throw Error(ue(166));if(n=ao.current,yu(e)){if(n=e.stateNode,t=e.memoizedProps,i=null,a=ci,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}n[ui]=e,n=!!(n.nodeValue===t||i!==null&&i.suppressHydrationWarning===!0||p3(n.nodeValue,t)),n||mo(e,!0)}else n=Qm(n).createTextNode(i),n[ui]=e,e.stateNode=n}return ln(e),null;case 31:if(t=e.memoizedState,n===null||n.memoizedState!==null){if(i=yu(e),t!==null){if(n===null){if(!i)throw Error(ue(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ue(557));n[ui]=e}else Tl(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ln(e),n=!1}else t=by(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=t),n=!0;if(!n)return e.flags&256?(ha(e),e):(ha(e),null);if(e.flags&128)throw Error(ue(558))}return ln(e),null;case 13:if(i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(a=yu(e),i!==null&&i.dehydrated!==null){if(n===null){if(!a)throw Error(ue(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(ue(317));a[ui]=e}else Tl(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ln(e),a=!1}else a=by(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(ha(e),e):(ha(e),null)}return ha(e),e.flags&128?(e.lanes=t,e):(t=i!==null,n=n!==null&&n.memoizedState!==null,t&&(i=e.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==a&&(i.flags|=2048)),t!==n&&t&&(e.child.flags|=8192),up(e,e.updateQueue),ln(e),null);case 4:return pc(),n===null&&qS(e.stateNode.containerInfo),ln(e),null;case 10:return lr(e.type),ln(e),null;case 19:if(ni(wn),i=e.memoizedState,i===null)return ln(e),null;if(a=(e.flags&128)!==0,s=i.rendering,s===null)if(a)xf(i,!1);else{if(Sn!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(s=Bm(n),s!==null){for(e.flags|=128,xf(i,!1),n=s.updateQueue,e.updateQueue=n,up(e,n),e.subtreeFlags=0,n=t,t=e.child;t!==null;)RC(t,n),t=t.sibling;return sn(wn,wn.current&1|2),It&&$s(e,i.treeForkCount),e.child}n=n.sibling}i.tail!==null&&ma()>Xm&&(e.flags|=128,a=!0,xf(i,!1),e.lanes=4194304)}else{if(!a)if(n=Bm(s),n!==null){if(e.flags|=128,a=!0,n=n.updateQueue,e.updateQueue=n,up(e,n),xf(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!It)return ln(e),null}else 2*ma()-i.renderingStartTime>Xm&&t!==536870912&&(e.flags|=128,a=!0,xf(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(n=i.tail,i.rendering=n,i.tail=n.sibling,i.renderingStartTime=ma(),n.sibling=null,t=wn.current,sn(wn,a?t&1|2:t&1),It&&$s(e,i.treeForkCount),n):(ln(e),null);case 22:case 23:return ha(e),ES(),i=e.memoizedState!==null,n!==null?n.memoizedState!==null!==i&&(e.flags|=8192):i&&(e.flags|=8192),i?t&536870912&&!(e.flags&128)&&(ln(e),e.subtreeFlags&6&&(e.flags|=8192)):ln(e),t=e.updateQueue,t!==null&&up(e,t.retryQueue),t=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),i=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),i!==t&&(e.flags|=2048),n!==null&&ni(yl),null;case 24:return t=null,n!==null&&(t=n.memoizedState.cache),e.memoizedState.cache!==t&&(e.flags|=2048),lr(Pn),ln(e),null;case 25:return null;case 30:return null}throw Error(ue(156,e.tag))}function Gz(n,e){switch(_S(e),e.tag){case 1:return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return lr(Pn),pc(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 26:case 27:case 5:return Rm(e),null;case 31:if(e.memoizedState!==null){if(ha(e),e.alternate===null)throw Error(ue(340));Tl()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 13:if(ha(e),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(ue(340));Tl()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ni(wn),null;case 4:return pc(),null;case 10:return lr(e.type),null;case 22:case 23:return ha(e),ES(),n!==null&&ni(yl),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 24:return lr(Pn),null;case 25:return null;default:return null}}function RR(n,e){switch(_S(e),e.tag){case 3:lr(Pn),pc();break;case 26:case 27:case 5:Rm(e);break;case 4:pc();break;case 31:e.memoizedState!==null&&ha(e);break;case 13:ha(e);break;case 19:ni(wn);break;case 10:lr(e.type);break;case 22:case 23:ha(e),ES(),n!==null&&ni(yl);break;case 24:lr(Pn)}}function $h(n,e){try{var t=e.updateQueue,i=t!==null?t.lastEffect:null;if(i!==null){var a=i.next;t=a;do{if((t.tag&n)===n){i=void 0;var s=t.create,l=t.inst;i=s(),l.destroy=i}t=t.next}while(t!==a)}}catch(u){Qt(e,e.return,u)}}function go(n,e,t){try{var i=e.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var s=a.next;i=s;do{if((i.tag&n)===n){var l=i.inst,u=l.destroy;if(u!==void 0){l.destroy=void 0,a=e;var c=t,h=u;try{h()}catch(p){Qt(a,c,p)}}}i=i.next}while(i!==s)}}catch(p){Qt(e,e.return,p)}}function DR(n){var e=n.updateQueue;if(e!==null){var t=n.stateNode;try{FC(e,t)}catch(i){Qt(n,n.return,i)}}}function UR(n,e,t){t.props=Rl(n.type,n.memoizedProps),t.state=n.memoizedState;try{t.componentWillUnmount()}catch(i){Qt(n,e,i)}}function Kf(n,e){try{var t=n.ref;if(t!==null){switch(n.tag){case 26:case 27:case 5:var i=n.stateNode;break;case 30:i=n.stateNode;break;default:i=n.stateNode}typeof t=="function"?n.refCleanup=t(i):t.current=i}}catch(a){Qt(n,e,a)}}function _s(n,e){var t=n.ref,i=n.refCleanup;if(t!==null)if(typeof i=="function")try{i()}catch(a){Qt(n,e,a)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof t=="function")try{t(null)}catch(a){Qt(n,e,a)}else t.current=null}function LR(n){var e=n.type,t=n.memoizedProps,i=n.stateNode;try{e:switch(e){case"button":case"input":case"select":case"textarea":t.autoFocus&&i.focus();break e;case"img":t.src?i.src=t.src:t.srcSet&&(i.srcset=t.srcSet)}}catch(a){Qt(n,n.return,a)}}function Ly(n,e,t){try{var i=n.stateNode;fO(i,n.type,t,e),i[Ki]=e}catch(a){Qt(n,n.return,a)}}function NR(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&So(n.type)||n.tag===4}function Ny(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||NR(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&So(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function yx(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t).insertBefore(n,e):(e=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,e.appendChild(n),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=ar));else if(i!==4&&(i===27&&So(n.type)&&(t=n.stateNode,e=null),n=n.child,n!==null))for(yx(n,e,t),n=n.sibling;n!==null;)yx(n,e,t),n=n.sibling}function Gm(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&&(i===27&&So(n.type)&&(t=n.stateNode),n=n.child,n!==null))for(Gm(n,e,t),n=n.sibling;n!==null;)Gm(n,e,t),n=n.sibling}function IR(n){var e=n.stateNode,t=n.memoizedProps;try{for(var i=n.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);hi(e,i,t),e[ui]=n,e[Ki]=t}catch(s){Qt(n,n.return,s)}}var er=!1,On=!1,Iy=!1,gT=typeof WeakSet=="function"?WeakSet:Set,$n=null;function Xz(n,e){if(n=n.containerInfo,Tx=eg,n=SC(n),pS(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 a=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var l=0,u=-1,c=-1,h=0,p=0,g=n,m=null;t:for(;;){for(var v;g!==t||a!==0&&g.nodeType!==3||(u=l+a),g!==s||i!==0&&g.nodeType!==3||(c=l+i),g.nodeType===3&&(l+=g.nodeValue.length),(v=g.firstChild)!==null;)m=g,g=v;for(;;){if(g===n)break t;if(m===t&&++h===a&&(u=l),m===s&&++p===i&&(c=l),(v=g.nextSibling)!==null)break;g=m,m=g.parentNode}g=v}t=u===-1||c===-1?null:{start:u,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(Ax={focusedElem:n,selectionRange:t},eg=!1,$n=e;$n!==null;)if(e=$n,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,$n=n;else for(;$n!==null;){switch(e=$n,s=e.alternate,n=e.flags,e.tag){case 0:if(n&4&&(n=e.updateQueue,n=n!==null?n.events:null,n!==null))for(t=0;t<n.length;t++)a=n[t],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(n&1024&&s!==null){n=void 0,t=e,a=s.memoizedProps,s=s.memoizedState,i=t.stateNode;try{var _=Rl(t.type,a);n=i.getSnapshotBeforeUpdate(_,s),i.__reactInternalSnapshotBeforeUpdate=n}catch(T){Qt(t,t.return,T)}}break;case 3:if(n&1024){if(n=e.stateNode.containerInfo,t=n.nodeType,t===9)Cx(n);else if(t===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Cx(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(n&1024)throw Error(ue(163))}if(n=e.sibling,n!==null){n.return=e.return,$n=n;break}$n=e.return}}function zR(n,e,t){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ws(n,t),i&4&&$h(5,t);break;case 1:if(Ws(n,t),i&4)if(n=t.stateNode,e===null)try{n.componentDidMount()}catch(l){Qt(t,t.return,l)}else{var a=Rl(t.type,e.memoizedProps);e=e.memoizedState;try{n.componentDidUpdate(a,e,n.__reactInternalSnapshotBeforeUpdate)}catch(l){Qt(t,t.return,l)}}i&64&&DR(t),i&512&&Kf(t,t.return);break;case 3:if(Ws(n,t),i&64&&(n=t.updateQueue,n!==null)){if(e=null,t.child!==null)switch(t.child.tag){case 27:case 5:e=t.child.stateNode;break;case 1:e=t.child.stateNode}try{FC(n,e)}catch(l){Qt(t,t.return,l)}}break;case 27:e===null&&i&4&&IR(t);case 26:case 5:Ws(n,t),e===null&&i&4&&LR(t),i&512&&Kf(t,t.return);break;case 12:Ws(n,t);break;case 31:Ws(n,t),i&4&&BR(n,t);break;case 13:Ws(n,t),i&4&&FR(n,t),i&64&&(n=t.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(t=$z.bind(null,t),_O(n,t))));break;case 22:if(i=t.memoizedState!==null||er,!i){e=e!==null&&e.memoizedState!==null||On,a=er;var s=On;er=i,(On=e)&&!s?Js(n,t,(t.subtreeFlags&8772)!==0):Ws(n,t),er=a,On=s}break;case 30:break;default:Ws(n,t)}}function OR(n){var e=n.alternate;e!==null&&(n.alternate=null,OR(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&lS(e)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var hn=null,Xi=!1;function Xs(n,e,t){for(t=t.child;t!==null;)PR(n,e,t),t=t.sibling}function PR(n,e,t){if(ga&&typeof ga.onCommitFiberUnmount=="function")try{ga.onCommitFiberUnmount(qh,t)}catch{}switch(t.tag){case 26:On||_s(t,e),Xs(n,e,t),t.memoizedState?t.memoizedState.count--:t.stateNode&&(t=t.stateNode,t.parentNode.removeChild(t));break;case 27:On||_s(t,e);var i=hn,a=Xi;So(t.type)&&(hn=t.stateNode,Xi=!1),Xs(n,e,t),th(t.stateNode),hn=i,Xi=a;break;case 5:On||_s(t,e);case 6:if(i=hn,a=Xi,hn=null,Xs(n,e,t),hn=i,Xi=a,hn!==null)if(Xi)try{(hn.nodeType===9?hn.body:hn.nodeName==="HTML"?hn.ownerDocument.body:hn).removeChild(t.stateNode)}catch(s){Qt(t,e,s)}else try{hn.removeChild(t.stateNode)}catch(s){Qt(t,e,s)}break;case 18:hn!==null&&(Xi?(n=hn,RT(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.stateNode),Ec(n)):RT(hn,t.stateNode));break;case 4:i=hn,a=Xi,hn=t.stateNode.containerInfo,Xi=!0,Xs(n,e,t),hn=i,Xi=a;break;case 0:case 11:case 14:case 15:go(2,t,e),On||go(4,t,e),Xs(n,e,t);break;case 1:On||(_s(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"&&UR(t,e,i)),Xs(n,e,t);break;case 21:Xs(n,e,t);break;case 22:On=(i=On)||t.memoizedState!==null,Xs(n,e,t),On=i;break;default:Xs(n,e,t)}}function BR(n,e){if(e.memoizedState===null&&(n=e.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ec(n)}catch(t){Qt(e,e.return,t)}}}function FR(n,e){if(e.memoizedState===null&&(n=e.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ec(n)}catch(t){Qt(e,e.return,t)}}function Wz(n){switch(n.tag){case 31:case 13:case 19:var e=n.stateNode;return e===null&&(e=n.stateNode=new gT),e;case 22:return n=n.stateNode,e=n._retryCache,e===null&&(e=n._retryCache=new gT),e;default:throw Error(ue(435,n.tag))}}function cp(n,e){var t=Wz(n);e.forEach(function(i){if(!t.has(i)){t.add(i);var a=eO.bind(null,n,i);i.then(a,a)}})}function Hi(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var a=t[i],s=n,l=e,u=l;e:for(;u!==null;){switch(u.tag){case 27:if(So(u.type)){hn=u.stateNode,Xi=!1;break e}break;case 5:hn=u.stateNode,Xi=!1;break e;case 3:case 4:hn=u.stateNode.containerInfo,Xi=!0;break e}u=u.return}if(hn===null)throw Error(ue(160));PR(s,l,a),hn=null,Xi=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)HR(e,n),e=e.sibling}var es=null;function HR(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Hi(e,n),Vi(n),i&4&&(go(3,n,n.return),$h(3,n),go(5,n,n.return));break;case 1:Hi(e,n),Vi(n),i&512&&(On||t===null||_s(t,t.return)),i&64&&er&&(n=n.updateQueue,n!==null&&(i=n.callbacks,i!==null&&(t=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=t===null?i:t.concat(i))));break;case 26:var a=es;if(Hi(e,n),Vi(n),i&512&&(On||t===null||_s(t,t.return)),i&4){var s=t!==null?t.memoizedState:null;if(i=n.memoizedState,t===null)if(i===null)if(n.stateNode===null){e:{i=n.type,t=n.memoizedProps,a=a.ownerDocument||a;t:switch(i){case"title":s=a.getElementsByTagName("title")[0],(!s||s[jh]||s[ui]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(i),a.head.insertBefore(s,a.querySelector("head > title"))),hi(s,i,t),s[ui]=n,ei(s),i=s;break e;case"link":var l=OT("link","href",a).get(i+(t.href||""));if(l){for(var u=0;u<l.length;u++)if(s=l[u],s.getAttribute("href")===(t.href==null||t.href===""?null:t.href)&&s.getAttribute("rel")===(t.rel==null?null:t.rel)&&s.getAttribute("title")===(t.title==null?null:t.title)&&s.getAttribute("crossorigin")===(t.crossOrigin==null?null:t.crossOrigin)){l.splice(u,1);break t}}s=a.createElement(i),hi(s,i,t),a.head.appendChild(s);break;case"meta":if(l=OT("meta","content",a).get(i+(t.content||""))){for(u=0;u<l.length;u++)if(s=l[u],s.getAttribute("content")===(t.content==null?null:""+t.content)&&s.getAttribute("name")===(t.name==null?null:t.name)&&s.getAttribute("property")===(t.property==null?null:t.property)&&s.getAttribute("http-equiv")===(t.httpEquiv==null?null:t.httpEquiv)&&s.getAttribute("charset")===(t.charSet==null?null:t.charSet)){l.splice(u,1);break t}}s=a.createElement(i),hi(s,i,t),a.head.appendChild(s);break;default:throw Error(ue(468,i))}s[ui]=n,ei(s),i=s}n.stateNode=i}else PT(a,n.type,n.stateNode);else n.stateNode=zT(a,i,n.memoizedProps);else s!==i?(s===null?t.stateNode!==null&&(t=t.stateNode,t.parentNode.removeChild(t)):s.count--,i===null?PT(a,n.type,n.stateNode):zT(a,i,n.memoizedProps)):i===null&&n.stateNode!==null&&Ly(n,n.memoizedProps,t.memoizedProps)}break;case 27:Hi(e,n),Vi(n),i&512&&(On||t===null||_s(t,t.return)),t!==null&&i&4&&Ly(n,n.memoizedProps,t.memoizedProps);break;case 5:if(Hi(e,n),Vi(n),i&512&&(On||t===null||_s(t,t.return)),n.flags&32){a=n.stateNode;try{gc(a,"")}catch(_){Qt(n,n.return,_)}}i&4&&n.stateNode!=null&&(a=n.memoizedProps,Ly(n,a,t!==null?t.memoizedProps:a)),i&1024&&(Iy=!0);break;case 6:if(Hi(e,n),Vi(n),i&4){if(n.stateNode===null)throw Error(ue(162));i=n.memoizedProps,t=n.stateNode;try{t.nodeValue=i}catch(_){Qt(n,n.return,_)}}break;case 3:if(xm=null,a=es,es=Km(e.containerInfo),Hi(e,n),es=a,Vi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Ec(e.containerInfo)}catch(_){Qt(n,n.return,_)}Iy&&(Iy=!1,VR(n));break;case 4:i=es,es=Km(n.stateNode.containerInfo),Hi(e,n),Vi(n),es=i;break;case 12:Hi(e,n),Vi(n);break;case 31:Hi(e,n),Vi(n),i&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,cp(n,i)));break;case 13:Hi(e,n),Vi(n),n.child.flags&8192&&n.memoizedState!==null!=(t!==null&&t.memoizedState!==null)&&(i0=ma()),i&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,cp(n,i)));break;case 22:a=n.memoizedState!==null;var c=t!==null&&t.memoizedState!==null,h=er,p=On;if(er=h||a,On=p||c,Hi(e,n),On=p,er=h,Vi(n),i&8192)e:for(e=n.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(t===null||c||er||On||ll(n)),t=null,e=n;;){if(e.tag===5||e.tag===26){if(t===null){c=t=e;try{if(s=c.stateNode,a)l=s.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none";else{u=c.stateNode;var g=c.memoizedProps.style,m=g!=null&&g.hasOwnProperty("display")?g.display:null;u.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(_){Qt(c,c.return,_)}}}else if(e.tag===6){if(t===null){c=e;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(_){Qt(c,c.return,_)}}}else if(e.tag===18){if(t===null){c=e;try{var v=c.stateNode;a?DT(v,!0):DT(c.stateNode,!1)}catch(_){Qt(c,c.return,_)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===n)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;t===e&&(t=null),e=e.return}t===e&&(t=null),e.sibling.return=e.return,e=e.sibling}i&4&&(i=n.updateQueue,i!==null&&(t=i.retryQueue,t!==null&&(i.retryQueue=null,cp(n,t))));break;case 19:Hi(e,n),Vi(n),i&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,cp(n,i)));break;case 30:break;case 21:break;default:Hi(e,n),Vi(n)}}function Vi(n){var e=n.flags;if(e&2){try{for(var t,i=n.return;i!==null;){if(NR(i)){t=i;break}i=i.return}if(t==null)throw Error(ue(160));switch(t.tag){case 27:var a=t.stateNode,s=Ny(n);Gm(n,s,a);break;case 5:var l=t.stateNode;t.flags&32&&(gc(l,""),t.flags&=-33);var u=Ny(n);Gm(n,u,l);break;case 3:case 4:var c=t.stateNode.containerInfo,h=Ny(n);yx(n,h,c);break;default:throw Error(ue(161))}}catch(p){Qt(n,n.return,p)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function VR(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var e=n;VR(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),n=n.sibling}}function Ws(n,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)zR(n,e.alternate,e),e=e.sibling}function ll(n){for(n=n.child;n!==null;){var e=n;switch(e.tag){case 0:case 11:case 14:case 15:go(4,e,e.return),ll(e);break;case 1:_s(e,e.return);var t=e.stateNode;typeof t.componentWillUnmount=="function"&&UR(e,e.return,t),ll(e);break;case 27:th(e.stateNode);case 26:case 5:_s(e,e.return),ll(e);break;case 22:e.memoizedState===null&&ll(e);break;case 30:ll(e);break;default:ll(e)}n=n.sibling}}function Js(n,e,t){for(t=t&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var i=e.alternate,a=n,s=e,l=s.flags;switch(s.tag){case 0:case 11:case 15:Js(a,s,t),$h(4,s);break;case 1:if(Js(a,s,t),i=s,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(h){Qt(i,i.return,h)}if(i=s,a=i.updateQueue,a!==null){var u=i.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)BC(c[a],u)}catch(h){Qt(i,i.return,h)}}t&&l&64&&DR(s),Kf(s,s.return);break;case 27:IR(s);case 26:case 5:Js(a,s,t),t&&i===null&&l&4&&LR(s),Kf(s,s.return);break;case 12:Js(a,s,t);break;case 31:Js(a,s,t),t&&l&4&&BR(a,s);break;case 13:Js(a,s,t),t&&l&4&&FR(a,s);break;case 22:s.memoizedState===null&&Js(a,s,t),Kf(s,s.return);break;case 30:break;default:Js(a,s,t)}e=e.sibling}}function HS(n,e){var t=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),n=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),n!==t&&(n!=null&&n.refCount++,t!=null&&Kh(t))}function VS(n,e){n=null,e.alternate!==null&&(n=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==n&&(e.refCount++,n!=null&&Kh(n))}function ja(n,e,t,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kR(n,e,t,i),e=e.sibling}function kR(n,e,t,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:ja(n,e,t,i),a&2048&&$h(9,e);break;case 1:ja(n,e,t,i);break;case 3:ja(n,e,t,i),a&2048&&(n=null,e.alternate!==null&&(n=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==n&&(e.refCount++,n!=null&&Kh(n)));break;case 12:if(a&2048){ja(n,e,t,i),n=e.stateNode;try{var s=e.memoizedProps,l=s.id,u=s.onPostCommit;typeof u=="function"&&u(l,e.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(c){Qt(e,e.return,c)}}else ja(n,e,t,i);break;case 31:ja(n,e,t,i);break;case 13:ja(n,e,t,i);break;case 23:break;case 22:s=e.stateNode,l=e.alternate,e.memoizedState!==null?s._visibility&2?ja(n,e,t,i):Jf(n,e):s._visibility&2?ja(n,e,t,i):(s._visibility|=2,Vu(n,e,t,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&HS(l,e);break;case 24:ja(n,e,t,i),a&2048&&VS(e.alternate,e);break;default:ja(n,e,t,i)}}function Vu(n,e,t,i,a){for(a=a&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var s=n,l=e,u=t,c=i,h=l.flags;switch(l.tag){case 0:case 11:case 15:Vu(s,l,u,c,a),$h(8,l);break;case 23:break;case 22:var p=l.stateNode;l.memoizedState!==null?p._visibility&2?Vu(s,l,u,c,a):Jf(s,l):(p._visibility|=2,Vu(s,l,u,c,a)),a&&h&2048&&HS(l.alternate,l);break;case 24:Vu(s,l,u,c,a),a&&h&2048&&VS(l.alternate,l);break;default:Vu(s,l,u,c,a)}e=e.sibling}}function Jf(n,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var t=n,i=e,a=i.flags;switch(i.tag){case 22:Jf(t,i),a&2048&&HS(i.alternate,i);break;case 24:Jf(t,i),a&2048&&VS(i.alternate,i);break;default:Jf(t,i)}e=e.sibling}}var Ff=8192;function _u(n,e,t){if(n.subtreeFlags&Ff)for(n=n.child;n!==null;)GR(n,e,t),n=n.sibling}function GR(n,e,t){switch(n.tag){case 26:_u(n,e,t),n.flags&Ff&&n.memoizedState!==null&&UO(t,es,n.memoizedState,n.memoizedProps);break;case 5:_u(n,e,t);break;case 3:case 4:var i=es;es=Km(n.stateNode.containerInfo),_u(n,e,t),es=i;break;case 22:n.memoizedState===null&&(i=n.alternate,i!==null&&i.memoizedState!==null?(i=Ff,Ff=16777216,_u(n,e,t),Ff=i):_u(n,e,t));break;default:_u(n,e,t)}}function XR(n){var e=n.alternate;if(e!==null&&(n=e.child,n!==null)){e.child=null;do e=n.sibling,n.sibling=null,n=e;while(n!==null)}}function Sf(n){var e=n.deletions;if(n.flags&16){if(e!==null)for(var t=0;t<e.length;t++){var i=e[t];$n=i,qR(i,n)}XR(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)WR(n),n=n.sibling}function WR(n){switch(n.tag){case 0:case 11:case 15:Sf(n),n.flags&2048&&go(9,n,n.return);break;case 3:Sf(n);break;case 12:Sf(n);break;case 22:var e=n.stateNode;n.memoizedState!==null&&e._visibility&2&&(n.return===null||n.return.tag!==13)?(e._visibility&=-3,ym(n)):Sf(n);break;default:Sf(n)}}function ym(n){var e=n.deletions;if(n.flags&16){if(e!==null)for(var t=0;t<e.length;t++){var i=e[t];$n=i,qR(i,n)}XR(n)}for(n=n.child;n!==null;){switch(e=n,e.tag){case 0:case 11:case 15:go(8,e,e.return),ym(e);break;case 22:t=e.stateNode,t._visibility&2&&(t._visibility&=-3,ym(e));break;default:ym(e)}n=n.sibling}}function qR(n,e){for(;$n!==null;){var t=$n;switch(t.tag){case 0:case 11:case 15:go(8,t,e);break;case 23:case 22:if(t.memoizedState!==null&&t.memoizedState.cachePool!==null){var i=t.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Kh(t.memoizedState.cache)}if(i=t.child,i!==null)i.return=t,$n=i;else e:for(t=n;$n!==null;){i=$n;var a=i.sibling,s=i.return;if(OR(i),i===t){$n=null;break e}if(a!==null){a.return=s,$n=a;break e}$n=s}}}var qz={getCacheForType:function(n){var e=fi(Pn),t=e.data.get(n);return t===void 0&&(t=n(),e.data.set(n,t)),t},cacheSignal:function(){return fi(Pn).controller.signal}},Yz=typeof WeakMap=="function"?WeakMap:Map,Wt=0,an=null,wt=null,Lt=0,jt=0,ca=null,to=!1,zc=!1,kS=!1,gr=0,Sn=0,vo=0,xl=0,GS=0,pa=0,xc=0,$f=null,Wi=null,_x=!1,i0=0,YR=0,Xm=1/0,Wm=null,lo=null,kn=0,uo=null,Sc=null,ur=0,xx=0,Sx=null,ZR=null,eh=0,bx=null;function ya(){return Wt&2&&Lt!==0?Lt&-Lt:ot.T!==null?WS():iC()}function jR(){if(pa===0)if(!(Lt&536870912)||It){var n=np;np<<=1,!(np&3932160)&&(np=262144),pa=n}else pa=536870912;return n=Sa.current,n!==null&&(n.flags|=32),pa}function ji(n,e,t){(n===an&&(jt===2||jt===9)||n.cancelPendingCommit!==null)&&(bc(n,0),no(n,Lt,pa,!1)),Zh(n,t),(!(Wt&2)||n!==an)&&(n===an&&(!(Wt&2)&&(xl|=t),Sn===4&&no(n,Lt,pa,!1)),ws(n))}function QR(n,e,t){if(Wt&6)throw Error(ue(327));var i=!t&&(e&127)===0&&(e&n.expiredLanes)===0||Yh(n,e),a=i?Qz(n,e):zy(n,e,!0),s=i;do{if(a===0){zc&&!i&&no(n,e,0,!1);break}else{if(t=n.current.alternate,s&&!Zz(t)){a=zy(n,e,!1),s=!1;continue}if(a===2){if(s=e,n.errorRecoveryDisabledLanes&s)var l=0;else l=n.pendingLanes&-536870913,l=l!==0?l:l&536870912?536870912:0;if(l!==0){e=l;e:{var u=n;a=$f;var c=u.current.memoizedState.isDehydrated;if(c&&(bc(u,l).flags|=256),l=zy(u,l,!1),l!==2){if(kS&&!c){u.errorRecoveryDisabledLanes|=s,xl|=s,a=4;break e}s=Wi,Wi=a,s!==null&&(Wi===null?Wi=s:Wi.push.apply(Wi,s))}a=l}if(s=!1,a!==2)continue}}if(a===1){bc(n,0),no(n,e,0,!0);break}e:{switch(i=n,s=a,s){case 0:case 1:throw Error(ue(345));case 4:if((e&4194048)!==e)break;case 6:no(i,e,pa,!to);break e;case 2:Wi=null;break;case 3:case 5:break;default:throw Error(ue(329))}if((e&62914560)===e&&(a=i0+300-ma(),10<a)){if(no(i,e,pa,!to),qg(i,0,!0)!==0)break e;ur=e,i.timeoutHandle=g3(vT.bind(null,i,t,Wi,Wm,_x,e,pa,xl,xc,to,s,"Throttled",-0,0),a);break e}vT(i,t,Wi,Wm,_x,e,pa,xl,xc,to,s,null,-0,0)}}break}while(!0);ws(n)}function vT(n,e,t,i,a,s,l,u,c,h,p,g,m,v){if(n.timeoutHandle=-1,g=e.subtreeFlags,g&8192||(g&16785408)===16785408){g={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ar},GR(e,s,g);var _=(s&62914560)===s?i0-ma():(s&4194048)===s?YR-ma():0;if(_=LO(g,_),_!==null){ur=s,n.cancelPendingCommit=_(_T.bind(null,n,e,s,t,i,a,l,u,c,p,g,null,m,v)),no(n,s,l,!h);return}}_T(n,e,s,t,i,a,l,u,c)}function Zz(n){for(var e=n;;){var t=e.tag;if((t===0||t===11||t===15)&&e.flags&16384&&(t=e.updateQueue,t!==null&&(t=t.stores,t!==null)))for(var i=0;i<t.length;i++){var a=t[i],s=a.getSnapshot;a=a.value;try{if(!xa(s(),a))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 no(n,e,t,i){e&=~GS,e&=~xl,n.suspendedLanes|=e,n.pingedLanes&=~e,i&&(n.warmLanes|=e),i=n.expirationTimes;for(var a=e;0<a;){var s=31-va(a),l=1<<s;i[s]=-1,a&=~l}t!==0&&eC(n,t,e)}function a0(){return Wt&6?!0:(ed(0),!1)}function XS(){if(wt!==null){if(jt===0)var n=wt.return;else n=wt,sr=Hl=null,RS(n),cc=null,_h=0,n=wt;for(;n!==null;)RR(n.alternate,n),n=n.return;wt=null}}function bc(n,e){var t=n.timeoutHandle;t!==-1&&(n.timeoutHandle=-1,pO(t)),t=n.cancelPendingCommit,t!==null&&(n.cancelPendingCommit=null,t()),ur=0,XS(),an=n,wt=t=or(n.current,null),Lt=e,jt=0,ca=null,to=!1,zc=Yh(n,e),kS=!1,xc=pa=GS=xl=vo=Sn=0,Wi=$f=null,_x=!1,e&8&&(e|=e&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=e;0<i;){var a=31-va(i),s=1<<a;e|=n[a],i&=~s}return gr=e,Qg(),t}function KR(n,e){xt=null,ot.H=Sh,e===Ic||e===Jg?(e=jE(),jt=3):e===bS?(e=jE(),jt=4):jt=e===BS?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,ca=e,wt===null&&(Sn=1,Vm(n,Oa(e,n.current)))}function JR(){var n=Sa.current;return n===null?!0:(Lt&4194048)===Lt?Fa===null:(Lt&62914560)===Lt||Lt&536870912?n===Fa:!1}function $R(){var n=ot.H;return ot.H=Sh,n===null?Sh:n}function e3(){var n=ot.A;return ot.A=qz,n}function qm(){Sn=4,to||(Lt&4194048)!==Lt&&Sa.current!==null||(zc=!0),!(vo&134217727)&&!(xl&134217727)||an===null||no(an,Lt,pa,!1)}function zy(n,e,t){var i=Wt;Wt|=2;var a=$R(),s=e3();(an!==n||Lt!==e)&&(Wm=null,bc(n,e)),e=!1;var l=Sn;e:do try{if(jt!==0&&wt!==null){var u=wt,c=ca;switch(jt){case 8:XS(),l=6;break e;case 3:case 2:case 9:case 6:Sa.current===null&&(e=!0);var h=jt;if(jt=0,ca=null,ec(n,u,c,h),t&&zc){l=0;break e}break;default:h=jt,jt=0,ca=null,ec(n,u,c,h)}}jz(),l=Sn;break}catch(p){KR(n,p)}while(!0);return e&&n.shellSuspendCounter++,sr=Hl=null,Wt=i,ot.H=a,ot.A=s,wt===null&&(an=null,Lt=0,Qg()),l}function jz(){for(;wt!==null;)t3(wt)}function Qz(n,e){var t=Wt;Wt|=2;var i=$R(),a=e3();an!==n||Lt!==e?(Wm=null,Xm=ma()+500,bc(n,e)):zc=Yh(n,e);e:do try{if(jt!==0&&wt!==null){e=wt;var s=ca;t:switch(jt){case 1:jt=0,ca=null,ec(n,e,s,1);break;case 2:case 9:if(ZE(s)){jt=0,ca=null,yT(e);break}e=function(){jt!==2&&jt!==9||an!==n||(jt=7),ws(n)},s.then(e,e);break e;case 3:jt=7;break e;case 4:jt=5;break e;case 7:ZE(s)?(jt=0,ca=null,yT(e)):(jt=0,ca=null,ec(n,e,s,7));break;case 5:var l=null;switch(wt.tag){case 26:l=wt.memoizedState;case 5:case 27:var u=wt;if(l?S3(l):u.stateNode.complete){jt=0,ca=null;var c=u.sibling;if(c!==null)wt=c;else{var h=u.return;h!==null?(wt=h,s0(h)):wt=null}break t}}jt=0,ca=null,ec(n,e,s,5);break;case 6:jt=0,ca=null,ec(n,e,s,6);break;case 8:XS(),Sn=6;break e;default:throw Error(ue(462))}}Kz();break}catch(p){KR(n,p)}while(!0);return sr=Hl=null,ot.H=i,ot.A=a,Wt=t,wt!==null?0:(an=null,Lt=0,Qg(),Sn)}function Kz(){for(;wt!==null&&!xI();)t3(wt)}function t3(n){var e=CR(n.alternate,n,gr);n.memoizedProps=n.pendingProps,e===null?s0(n):wt=e}function yT(n){var e=n,t=e.alternate;switch(e.tag){case 15:case 0:e=fT(t,e,e.pendingProps,e.type,void 0,Lt);break;case 11:e=fT(t,e,e.pendingProps,e.type.render,e.ref,Lt);break;case 5:RS(e);default:RR(t,e),e=wt=RC(e,gr),e=CR(t,e,gr)}n.memoizedProps=n.pendingProps,e===null?s0(n):wt=e}function ec(n,e,t,i){sr=Hl=null,RS(e),cc=null,_h=0;var a=e.return;try{if(Fz(n,a,e,t,Lt)){Sn=1,Vm(n,Oa(t,n.current)),wt=null;return}}catch(s){if(a!==null)throw wt=a,s;Sn=1,Vm(n,Oa(t,n.current)),wt=null;return}e.flags&32768?(It||i===1?n=!0:zc||Lt&536870912?n=!1:(to=n=!0,(i===2||i===9||i===3||i===6)&&(i=Sa.current,i!==null&&i.tag===13&&(i.flags|=16384))),n3(e,n)):s0(e)}function s0(n){var e=n;do{if(e.flags&32768){n3(e,to);return}n=e.return;var t=kz(e.alternate,e,gr);if(t!==null){wt=t;return}if(e=e.sibling,e!==null){wt=e;return}wt=e=n}while(e!==null);Sn===0&&(Sn=5)}function n3(n,e){do{var t=Gz(n.alternate,n);if(t!==null){t.flags&=32767,wt=t;return}if(t=n.return,t!==null&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!e&&(n=n.sibling,n!==null)){wt=n;return}wt=n=t}while(n!==null);Sn=6,wt=null}function _T(n,e,t,i,a,s,l,u,c){n.cancelPendingCommit=null;do r0();while(kn!==0);if(Wt&6)throw Error(ue(327));if(e!==null){if(e===n.current)throw Error(ue(177));if(s=e.lanes|e.childLanes,s|=mS,DI(n,t,s,l,u,c),n===an&&(wt=an=null,Lt=0),Sc=e,uo=n,ur=t,xx=s,Sx=a,ZR=i,e.subtreeFlags&10256||e.flags&10256?(n.callbackNode=null,n.callbackPriority=0,tO(Dm,function(){return o3(),null})):(n.callbackNode=null,n.callbackPriority=0),i=(e.flags&13878)!==0,e.subtreeFlags&13878||i){i=ot.T,ot.T=null,a=qt.p,qt.p=2,l=Wt,Wt|=4;try{Xz(n,e,t)}finally{Wt=l,qt.p=a,ot.T=i}}kn=1,i3(),a3(),s3()}}function i3(){if(kn===1){kn=0;var n=uo,e=Sc,t=(e.flags&13878)!==0;if(e.subtreeFlags&13878||t){t=ot.T,ot.T=null;var i=qt.p;qt.p=2;var a=Wt;Wt|=4;try{HR(e,n);var s=Ax,l=SC(n.containerInfo),u=s.focusedElem,c=s.selectionRange;if(l!==u&&u&&u.ownerDocument&&xC(u.ownerDocument.documentElement,u)){if(c!==null&&pS(u)){var h=c.start,p=c.end;if(p===void 0&&(p=h),"selectionStart"in u)u.selectionStart=h,u.selectionEnd=Math.min(p,u.value.length);else{var g=u.ownerDocument||document,m=g&&g.defaultView||window;if(m.getSelection){var v=m.getSelection(),_=u.textContent.length,T=Math.min(c.start,_),b=c.end===void 0?T:Math.min(c.end,_);!v.extend&&T>b&&(l=b,b=T,T=l);var y=VE(u,T),S=VE(u,b);if(y&&S&&(v.rangeCount!==1||v.anchorNode!==y.node||v.anchorOffset!==y.offset||v.focusNode!==S.node||v.focusOffset!==S.offset)){var E=g.createRange();E.setStart(y.node,y.offset),v.removeAllRanges(),T>b?(v.addRange(E),v.extend(S.node,S.offset)):(E.setEnd(S.node,S.offset),v.addRange(E))}}}}for(g=[],v=u;v=v.parentNode;)v.nodeType===1&&g.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<g.length;u++){var A=g[u];A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}eg=!!Tx,Ax=Tx=null}finally{Wt=a,qt.p=i,ot.T=t}}n.current=e,kn=2}}function a3(){if(kn===2){kn=0;var n=uo,e=Sc,t=(e.flags&8772)!==0;if(e.subtreeFlags&8772||t){t=ot.T,ot.T=null;var i=qt.p;qt.p=2;var a=Wt;Wt|=4;try{zR(n,e.alternate,e)}finally{Wt=a,qt.p=i,ot.T=t}}kn=3}}function s3(){if(kn===4||kn===3){kn=0,SI();var n=uo,e=Sc,t=ur,i=ZR;e.subtreeFlags&10256||e.flags&10256?kn=5:(kn=0,Sc=uo=null,r3(n,n.pendingLanes));var a=n.pendingLanes;if(a===0&&(lo=null),oS(t),e=e.stateNode,ga&&typeof ga.onCommitFiberRoot=="function")try{ga.onCommitFiberRoot(qh,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=ot.T,a=qt.p,qt.p=2,ot.T=null;try{for(var s=n.onRecoverableError,l=0;l<i.length;l++){var u=i[l];s(u.value,{componentStack:u.stack})}}finally{ot.T=e,qt.p=a}}ur&3&&r0(),ws(n),a=n.pendingLanes,t&261930&&a&42?n===bx?eh++:(eh=0,bx=n):eh=0,ed(0)}}function r3(n,e){(n.pooledCacheLanes&=e)===0&&(e=n.pooledCache,e!=null&&(n.pooledCache=null,Kh(e)))}function r0(){return i3(),a3(),s3(),o3()}function o3(){if(kn!==5)return!1;var n=uo,e=xx;xx=0;var t=oS(ur),i=ot.T,a=qt.p;try{qt.p=32>t?32:t,ot.T=null,t=Sx,Sx=null;var s=uo,l=ur;if(kn=0,Sc=uo=null,ur=0,Wt&6)throw Error(ue(331));var u=Wt;if(Wt|=4,WR(s.current),kR(s,s.current,l,t),Wt=u,ed(0,!1),ga&&typeof ga.onPostCommitFiberRoot=="function")try{ga.onPostCommitFiberRoot(qh,s)}catch{}return!0}finally{qt.p=a,ot.T=i,r3(n,e)}}function xT(n,e,t){e=Oa(t,e),e=mx(n.stateNode,e,2),n=oo(n,e,2),n!==null&&(Zh(n,2),ws(n))}function Qt(n,e,t){if(n.tag===3)xT(n,n,t);else for(;e!==null;){if(e.tag===3){xT(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(lo===null||!lo.has(i))){n=Oa(t,n),t=bR(2),i=oo(e,t,2),i!==null&&(MR(t,i,e,n),Zh(i,2),ws(i));break}}e=e.return}}function Oy(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new Yz;var a=new Set;i.set(e,a)}else a=i.get(e),a===void 0&&(a=new Set,i.set(e,a));a.has(t)||(kS=!0,a.add(t),n=Jz.bind(null,n,e,t),e.then(n,n))}function Jz(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),n.pingedLanes|=n.suspendedLanes&t,n.warmLanes&=~t,an===n&&(Lt&t)===t&&(Sn===4||Sn===3&&(Lt&62914560)===Lt&&300>ma()-i0?!(Wt&2)&&bc(n,0):GS|=t,xc===Lt&&(xc=0)),ws(n)}function l3(n,e){e===0&&(e=$w()),n=Fl(n,e),n!==null&&(Zh(n,e),ws(n))}function $z(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),l3(n,t)}function eO(n,e){var t=0;switch(n.tag){case 31:case 13:var i=n.stateNode,a=n.memoizedState;a!==null&&(t=a.retryLane);break;case 19:i=n.stateNode;break;case 22:i=n.stateNode._retryCache;break;default:throw Error(ue(314))}i!==null&&i.delete(e),l3(n,t)}function tO(n,e){return sS(n,e)}var Ym=null,ku=null,Mx=!1,Zm=!1,Py=!1,io=0;function ws(n){n!==ku&&n.next===null&&(ku===null?Ym=ku=n:ku=ku.next=n),Zm=!0,Mx||(Mx=!0,iO())}function ed(n,e){if(!Py&&Zm){Py=!0;do for(var t=!1,i=Ym;i!==null;){if(n!==0){var a=i.pendingLanes;if(a===0)var s=0;else{var l=i.suspendedLanes,u=i.pingedLanes;s=(1<<31-va(42|n)+1)-1,s&=a&~(l&~u),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(t=!0,ST(i,s))}else s=Lt,s=qg(i,i===an?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(s&3)||Yh(i,s)||(t=!0,ST(i,s));i=i.next}while(t);Py=!1}}function nO(){u3()}function u3(){Zm=Mx=!1;var n=0;io!==0&&dO()&&(n=io);for(var e=ma(),t=null,i=Ym;i!==null;){var a=i.next,s=c3(i,e);s===0?(i.next=null,t===null?Ym=a:t.next=a,a===null&&(ku=t)):(t=i,(n!==0||s&3)&&(Zm=!0)),i=a}kn!==0&&kn!==5||ed(n),io!==0&&(io=0)}function c3(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,a=n.expirationTimes,s=n.pendingLanes&-62914561;0<s;){var l=31-va(s),u=1<<l,c=a[l];c===-1?(!(u&t)||u&i)&&(a[l]=RI(u,e)):c<=e&&(n.expiredLanes|=u),s&=~u}if(e=an,t=Lt,t=qg(n,n===e?t:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),i=n.callbackNode,t===0||n===e&&(jt===2||jt===9)||n.cancelPendingCommit!==null)return i!==null&&i!==null&&fy(i),n.callbackNode=null,n.callbackPriority=0;if(!(t&3)||Yh(n,t)){if(e=t&-t,e===n.callbackPriority)return e;switch(i!==null&&fy(i),oS(t)){case 2:case 8:t=Kw;break;case 32:t=Dm;break;case 268435456:t=Jw;break;default:t=Dm}return i=f3.bind(null,n),t=sS(t,i),n.callbackPriority=e,n.callbackNode=t,e}return i!==null&&i!==null&&fy(i),n.callbackPriority=2,n.callbackNode=null,2}function f3(n,e){if(kn!==0&&kn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var t=n.callbackNode;if(r0()&&n.callbackNode!==t)return null;var i=Lt;return i=qg(n,n===an?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),i===0?null:(QR(n,i,e),c3(n,ma()),n.callbackNode!=null&&n.callbackNode===t?f3.bind(null,n):null)}function ST(n,e){if(r0())return null;QR(n,e,!0)}function iO(){mO(function(){Wt&6?sS(Qw,nO):u3()})}function WS(){if(io===0){var n=vc;n===0&&(n=tp,tp<<=1,!(tp&261888)&&(tp=256)),io=n}return io}function bT(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:um(""+n)}function MT(n,e){var t=e.ownerDocument.createElement("input");return t.name=e.name,t.value=e.value,n.id&&t.setAttribute("form",n.id),e.parentNode.insertBefore(t,e),n=new FormData(n),t.parentNode.removeChild(t),n}function aO(n,e,t,i,a){if(e==="submit"&&t&&t.stateNode===a){var s=bT((a[Ki]||null).action),l=i.submitter;l&&(e=(e=l[Ki]||null)?bT(e.formAction):l.getAttribute("formAction"),e!==null&&(s=e,l=null));var u=new Yg("action","action",null,i,a);n.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(io!==0){var c=l?MT(a,l):new FormData(a);dx(t,{pending:!0,data:c,method:a.method,action:s},null,c)}}else typeof s=="function"&&(u.preventDefault(),c=l?MT(a,l):new FormData(a),dx(t,{pending:!0,data:c,method:a.method,action:s},s,c))},currentTarget:a}]})}}for(var By=0;By<tx.length;By++){var Fy=tx[By],sO=Fy.toLowerCase(),rO=Fy[0].toUpperCase()+Fy.slice(1);ss(sO,"on"+rO)}ss(MC,"onAnimationEnd");ss(EC,"onAnimationIteration");ss(TC,"onAnimationStart");ss("dblclick","onDoubleClick");ss("focusin","onFocus");ss("focusout","onBlur");ss(bz,"onTransitionRun");ss(Mz,"onTransitionStart");ss(Ez,"onTransitionCancel");ss(AC,"onTransitionEnd");mc("onMouseEnter",["mouseout","mouseover"]);mc("onMouseLeave",["mouseout","mouseover"]);mc("onPointerEnter",["pointerout","pointerover"]);mc("onPointerLeave",["pointerout","pointerover"]);Ol("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ol("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ol("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ol("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ol("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ol("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bh="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(" "),oO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bh));function h3(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],a=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var l=i.length-1;0<=l;l--){var u=i[l],c=u.instance,h=u.currentTarget;if(u=u.listener,c!==s&&a.isPropagationStopped())break e;s=u,a.currentTarget=h;try{s(a)}catch(p){Lm(p)}a.currentTarget=null,s=c}else for(l=0;l<i.length;l++){if(u=i[l],c=u.instance,h=u.currentTarget,u=u.listener,c!==s&&a.isPropagationStopped())break e;s=u,a.currentTarget=h;try{s(a)}catch(p){Lm(p)}a.currentTarget=null,s=c}}}}function At(n,e){var t=e[Y_];t===void 0&&(t=e[Y_]=new Set);var i=n+"__bubble";t.has(i)||(d3(e,n,2,!1),t.add(i))}function Hy(n,e,t){var i=0;e&&(i|=4),d3(t,n,i,e)}var fp="_reactListening"+Math.random().toString(36).slice(2);function qS(n){if(!n[fp]){n[fp]=!0,aC.forEach(function(t){t!=="selectionchange"&&(oO.has(t)||Hy(t,!1,n),Hy(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[fp]||(e[fp]=!0,Hy("selectionchange",!1,e))}}function d3(n,e,t,i){switch(A3(e)){case 2:var a=zO;break;case 8:a=OO;break;default:a=QS}t=a.bind(null,e,t,n),a=void 0,!J_||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),i?a!==void 0?n.addEventListener(e,t,{capture:!0,passive:a}):n.addEventListener(e,t,!0):a!==void 0?n.addEventListener(e,t,{passive:a}):n.addEventListener(e,t,!1)}function Vy(n,e,t,i,a){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var l=i.tag;if(l===3||l===4){var u=i.stateNode.containerInfo;if(u===a)break;if(l===4)for(l=i.return;l!==null;){var c=l.tag;if((c===3||c===4)&&l.stateNode.containerInfo===a)return;l=l.return}for(;u!==null;){if(l=Wu(u),l===null)return;if(c=l.tag,c===5||c===6||c===26||c===27){i=s=l;continue e}u=u.parentNode}}i=i.return}hC(function(){var h=s,p=cS(t),g=[];e:{var m=wC.get(n);if(m!==void 0){var v=Yg,_=n;switch(n){case"keypress":if(fm(t)===0)break e;case"keydown":case"keyup":v=ez;break;case"focusin":_="focus",v=gy;break;case"focusout":_="blur",v=gy;break;case"beforeblur":case"afterblur":v=gy;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":v=UE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=kI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=iz;break;case MC:case EC:case TC:v=WI;break;case AC:v=sz;break;case"scroll":case"scrollend":v=HI;break;case"wheel":v=oz;break;case"copy":case"cut":case"paste":v=YI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=NE;break;case"toggle":case"beforetoggle":v=uz}var T=(e&4)!==0,b=!T&&(n==="scroll"||n==="scrollend"),y=T?m!==null?m+"Capture":null:m;T=[];for(var S=h,E;S!==null;){var A=S;if(E=A.stateNode,A=A.tag,A!==5&&A!==26&&A!==27||E===null||y===null||(A=ph(S,y),A!=null&&T.push(Mh(S,A,E))),b)break;S=S.return}0<T.length&&(m=new v(m,_,null,t,p),g.push({event:m,listeners:T}))}}if(!(e&7)){e:{if(m=n==="mouseover"||n==="pointerover",v=n==="mouseout"||n==="pointerout",m&&t!==K_&&(_=t.relatedTarget||t.fromElement)&&(Wu(_)||_[Uc]))break e;if((v||m)&&(m=p.window===p?p:(m=p.ownerDocument)?m.defaultView||m.parentWindow:window,v?(_=t.relatedTarget||t.toElement,v=h,_=_?Wu(_):null,_!==null&&(b=Wh(_),T=_.tag,_!==b||T!==5&&T!==27&&T!==6)&&(_=null)):(v=null,_=h),v!==_)){if(T=UE,A="onMouseLeave",y="onMouseEnter",S="mouse",(n==="pointerout"||n==="pointerover")&&(T=NE,A="onPointerLeave",y="onPointerEnter",S="pointer"),b=v==null?m:Pf(v),E=_==null?m:Pf(_),m=new T(A,S+"leave",v,t,p),m.target=b,m.relatedTarget=E,A=null,Wu(p)===h&&(T=new T(y,S+"enter",_,t,p),T.target=E,T.relatedTarget=b,A=T),b=A,v&&_)t:{for(T=lO,y=v,S=_,E=0,A=y;A;A=T(A))E++;A=0;for(var I=S;I;I=T(I))A++;for(;0<E-A;)y=T(y),E--;for(;0<A-E;)S=T(S),A--;for(;E--;){if(y===S||S!==null&&y===S.alternate){T=y;break t}y=T(y),S=T(S)}T=null}else T=null;v!==null&&ET(g,m,v,T,!1),_!==null&&b!==null&&ET(g,b,_,T,!0)}}e:{if(m=h?Pf(h):window,v=m.nodeName&&m.nodeName.toLowerCase(),v==="select"||v==="input"&&m.type==="file")var R=PE;else if(OE(m))if(yC)R=_z;else{R=vz;var L=gz}else v=m.nodeName,!v||v.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?h&&uS(h.elementType)&&(R=PE):R=yz;if(R&&(R=R(n,h))){vC(g,R,t,p);break e}L&&L(n,m,h),n==="focusout"&&h&&m.type==="number"&&h.memoizedProps.value!=null&&Q_(m,"number",m.value)}switch(L=h?Pf(h):window,n){case"focusin":(OE(L)||L.contentEditable==="true")&&(Zu=L,$_=h,Wf=null);break;case"focusout":Wf=$_=Zu=null;break;case"mousedown":ex=!0;break;case"contextmenu":case"mouseup":case"dragend":ex=!1,kE(g,t,p);break;case"selectionchange":if(Sz)break;case"keydown":case"keyup":kE(g,t,p)}var z;if(dS)e:{switch(n){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else Yu?mC(n,t)&&(C="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(C="onCompositionStart");C&&(pC&&t.locale!=="ko"&&(Yu||C!=="onCompositionStart"?C==="onCompositionEnd"&&Yu&&(z=dC()):(eo=p,fS="value"in eo?eo.value:eo.textContent,Yu=!0)),L=jm(h,C),0<L.length&&(C=new LE(C,n,null,t,p),g.push({event:C,listeners:L}),z?C.data=z:(z=gC(t),z!==null&&(C.data=z)))),(z=fz?hz(n,t):dz(n,t))&&(C=jm(h,"onBeforeInput"),0<C.length&&(L=new LE("onBeforeInput","beforeinput",null,t,p),g.push({event:L,listeners:C}),L.data=z)),aO(g,n,h,t,p)}h3(g,e)})}function Mh(n,e,t){return{instance:n,listener:e,currentTarget:t}}function jm(n,e){for(var t=e+"Capture",i=[];n!==null;){var a=n,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=ph(n,t),a!=null&&i.unshift(Mh(n,a,s)),a=ph(n,e),a!=null&&i.push(Mh(n,a,s))),n.tag===3)return i;n=n.return}return[]}function lO(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function ET(n,e,t,i,a){for(var s=e._reactName,l=[];t!==null&&t!==i;){var u=t,c=u.alternate,h=u.stateNode;if(u=u.tag,c!==null&&c===i)break;u!==5&&u!==26&&u!==27||h===null||(c=h,a?(h=ph(t,s),h!=null&&l.unshift(Mh(t,h,c))):a||(h=ph(t,s),h!=null&&l.push(Mh(t,h,c)))),t=t.return}l.length!==0&&n.push({event:e,listeners:l})}var uO=/\r\n?/g,cO=/\u0000|\uFFFD/g;function TT(n){return(typeof n=="string"?n:""+n).replace(uO,`
`).replace(cO,"")}function p3(n,e){return e=TT(e),TT(n)===e}function $t(n,e,t,i,a,s){switch(t){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||gc(n,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&gc(n,""+i);break;case"className":ap(n,"class",i);break;case"tabIndex":ap(n,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ap(n,t,i);break;case"style":fC(n,i,s);break;case"data":if(e!=="object"){ap(n,"data",i);break}case"src":case"href":if(i===""&&(e!=="a"||t!=="href")){n.removeAttribute(t);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){n.removeAttribute(t);break}i=um(""+i),n.setAttribute(t,i);break;case"action":case"formAction":if(typeof i=="function"){n.setAttribute(t,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(t==="formAction"?(e!=="input"&&$t(n,e,"name",a.name,a,null),$t(n,e,"formEncType",a.formEncType,a,null),$t(n,e,"formMethod",a.formMethod,a,null),$t(n,e,"formTarget",a.formTarget,a,null)):($t(n,e,"encType",a.encType,a,null),$t(n,e,"method",a.method,a,null),$t(n,e,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){n.removeAttribute(t);break}i=um(""+i),n.setAttribute(t,i);break;case"onClick":i!=null&&(n.onclick=ar);break;case"onScroll":i!=null&&At("scroll",n);break;case"onScrollEnd":i!=null&&At("scrollend",n);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ue(61));if(t=i.__html,t!=null){if(a.children!=null)throw Error(ue(60));n.innerHTML=t}}break;case"multiple":n.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":n.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){n.removeAttribute("xlink:href");break}t=um(""+i),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?n.setAttribute(t,""+i):n.removeAttribute(t);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?n.setAttribute(t,""):n.removeAttribute(t);break;case"capture":case"download":i===!0?n.setAttribute(t,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?n.setAttribute(t,i):n.removeAttribute(t);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?n.setAttribute(t,i):n.removeAttribute(t);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?n.removeAttribute(t):n.setAttribute(t,i);break;case"popover":At("beforetoggle",n),At("toggle",n),lm(n,"popover",i);break;case"xlinkActuate":ks(n,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ks(n,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ks(n,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ks(n,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ks(n,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ks(n,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ks(n,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ks(n,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ks(n,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":lm(n,"is",i);break;case"innerText":case"textContent":break;default:(!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(t=BI.get(t)||t,lm(n,t,i))}}function Ex(n,e,t,i,a,s){switch(t){case"style":fC(n,i,s);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ue(61));if(t=i.__html,t!=null){if(a.children!=null)throw Error(ue(60));n.innerHTML=t}}break;case"children":typeof i=="string"?gc(n,i):(typeof i=="number"||typeof i=="bigint")&&gc(n,""+i);break;case"onScroll":i!=null&&At("scroll",n);break;case"onScrollEnd":i!=null&&At("scrollend",n);break;case"onClick":i!=null&&(n.onclick=ar);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sC.hasOwnProperty(t))e:{if(t[0]==="o"&&t[1]==="n"&&(a=t.endsWith("Capture"),e=t.slice(2,a?t.length-7:void 0),s=n[Ki]||null,s=s!=null?s[t]:null,typeof s=="function"&&n.removeEventListener(e,s,a),typeof i=="function")){typeof s!="function"&&s!==null&&(t in n?n[t]=null:n.hasAttribute(t)&&n.removeAttribute(t)),n.addEventListener(e,i,a);break e}t in n?n[t]=i:i===!0?n.setAttribute(t,""):lm(n,t,i)}}}function hi(n,e,t){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":At("error",n),At("load",n);var i=!1,a=!1,s;for(s in t)if(t.hasOwnProperty(s)){var l=t[s];if(l!=null)switch(s){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ue(137,e));default:$t(n,e,s,l,t,null)}}a&&$t(n,e,"srcSet",t.srcSet,t,null),i&&$t(n,e,"src",t.src,t,null);return;case"input":At("invalid",n);var u=s=l=a=null,c=null,h=null;for(i in t)if(t.hasOwnProperty(i)){var p=t[i];if(p!=null)switch(i){case"name":a=p;break;case"type":l=p;break;case"checked":c=p;break;case"defaultChecked":h=p;break;case"value":s=p;break;case"defaultValue":u=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(ue(137,e));break;default:$t(n,e,i,p,t,null)}}lC(n,s,u,c,h,l,a,!1);return;case"select":At("invalid",n),i=l=s=null;for(a in t)if(t.hasOwnProperty(a)&&(u=t[a],u!=null))switch(a){case"value":s=u;break;case"defaultValue":l=u;break;case"multiple":i=u;default:$t(n,e,a,u,t,null)}e=s,t=l,n.multiple=!!i,e!=null?oc(n,!!i,e,!1):t!=null&&oc(n,!!i,t,!0);return;case"textarea":At("invalid",n),s=a=i=null;for(l in t)if(t.hasOwnProperty(l)&&(u=t[l],u!=null))switch(l){case"value":i=u;break;case"defaultValue":a=u;break;case"children":s=u;break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(ue(91));break;default:$t(n,e,l,u,t,null)}cC(n,i,a,s);return;case"option":for(c in t)if(t.hasOwnProperty(c)&&(i=t[c],i!=null))switch(c){case"selected":n.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:$t(n,e,c,i,t,null)}return;case"dialog":At("beforetoggle",n),At("toggle",n),At("cancel",n),At("close",n);break;case"iframe":case"object":At("load",n);break;case"video":case"audio":for(i=0;i<bh.length;i++)At(bh[i],n);break;case"image":At("error",n),At("load",n);break;case"details":At("toggle",n);break;case"embed":case"source":case"link":At("error",n),At("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(h in t)if(t.hasOwnProperty(h)&&(i=t[h],i!=null))switch(h){case"children":case"dangerouslySetInnerHTML":throw Error(ue(137,e));default:$t(n,e,h,i,t,null)}return;default:if(uS(e)){for(p in t)t.hasOwnProperty(p)&&(i=t[p],i!==void 0&&Ex(n,e,p,i,t,void 0));return}}for(u in t)t.hasOwnProperty(u)&&(i=t[u],i!=null&&$t(n,e,u,i,t,null))}function fO(n,e,t,i){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,l=null,u=null,c=null,h=null,p=null;for(v in t){var g=t[v];if(t.hasOwnProperty(v)&&g!=null)switch(v){case"checked":break;case"value":break;case"defaultValue":c=g;default:i.hasOwnProperty(v)||$t(n,e,v,null,i,g)}}for(var m in i){var v=i[m];if(g=t[m],i.hasOwnProperty(m)&&(v!=null||g!=null))switch(m){case"type":s=v;break;case"name":a=v;break;case"checked":h=v;break;case"defaultChecked":p=v;break;case"value":l=v;break;case"defaultValue":u=v;break;case"children":case"dangerouslySetInnerHTML":if(v!=null)throw Error(ue(137,e));break;default:v!==g&&$t(n,e,m,v,i,g)}}j_(n,l,u,c,h,p,s,a);return;case"select":v=l=u=m=null;for(s in t)if(c=t[s],t.hasOwnProperty(s)&&c!=null)switch(s){case"value":break;case"multiple":v=c;default:i.hasOwnProperty(s)||$t(n,e,s,null,i,c)}for(a in i)if(s=i[a],c=t[a],i.hasOwnProperty(a)&&(s!=null||c!=null))switch(a){case"value":m=s;break;case"defaultValue":u=s;break;case"multiple":l=s;default:s!==c&&$t(n,e,a,s,i,c)}e=u,t=l,i=v,m!=null?oc(n,!!t,m,!1):!!i!=!!t&&(e!=null?oc(n,!!t,e,!0):oc(n,!!t,t?[]:"",!1));return;case"textarea":v=m=null;for(u in t)if(a=t[u],t.hasOwnProperty(u)&&a!=null&&!i.hasOwnProperty(u))switch(u){case"value":break;case"children":break;default:$t(n,e,u,null,i,a)}for(l in i)if(a=i[l],s=t[l],i.hasOwnProperty(l)&&(a!=null||s!=null))switch(l){case"value":m=a;break;case"defaultValue":v=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(ue(91));break;default:a!==s&&$t(n,e,l,a,i,s)}uC(n,m,v);return;case"option":for(var _ in t)if(m=t[_],t.hasOwnProperty(_)&&m!=null&&!i.hasOwnProperty(_))switch(_){case"selected":n.selected=!1;break;default:$t(n,e,_,null,i,m)}for(c in i)if(m=i[c],v=t[c],i.hasOwnProperty(c)&&m!==v&&(m!=null||v!=null))switch(c){case"selected":n.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:$t(n,e,c,m,i,v)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var T in t)m=t[T],t.hasOwnProperty(T)&&m!=null&&!i.hasOwnProperty(T)&&$t(n,e,T,null,i,m);for(h in i)if(m=i[h],v=t[h],i.hasOwnProperty(h)&&m!==v&&(m!=null||v!=null))switch(h){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(ue(137,e));break;default:$t(n,e,h,m,i,v)}return;default:if(uS(e)){for(var b in t)m=t[b],t.hasOwnProperty(b)&&m!==void 0&&!i.hasOwnProperty(b)&&Ex(n,e,b,void 0,i,m);for(p in i)m=i[p],v=t[p],!i.hasOwnProperty(p)||m===v||m===void 0&&v===void 0||Ex(n,e,p,m,i,v);return}}for(var y in t)m=t[y],t.hasOwnProperty(y)&&m!=null&&!i.hasOwnProperty(y)&&$t(n,e,y,null,i,m);for(g in i)m=i[g],v=t[g],!i.hasOwnProperty(g)||m===v||m==null&&v==null||$t(n,e,g,m,i,v)}function AT(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hO(){if(typeof performance.getEntriesByType=="function"){for(var n=0,e=0,t=performance.getEntriesByType("resource"),i=0;i<t.length;i++){var a=t[i],s=a.transferSize,l=a.initiatorType,u=a.duration;if(s&&u&&AT(l)){for(l=0,u=a.responseEnd,i+=1;i<t.length;i++){var c=t[i],h=c.startTime;if(h>u)break;var p=c.transferSize,g=c.initiatorType;p&&AT(g)&&(c=c.responseEnd,l+=p*(c<u?1:(u-h)/(c-h)))}if(--i,e+=8*(s+l)/(a.duration/1e3),n++,10<n)break}}if(0<n)return e/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Tx=null,Ax=null;function Qm(n){return n.nodeType===9?n:n.ownerDocument}function wT(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function m3(n,e){if(n===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&e==="foreignObject"?0:n}function wx(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ky=null;function dO(){var n=window.event;return n&&n.type==="popstate"?n===ky?!1:(ky=n,!0):(ky=null,!1)}var g3=typeof setTimeout=="function"?setTimeout:void 0,pO=typeof clearTimeout=="function"?clearTimeout:void 0,CT=typeof Promise=="function"?Promise:void 0,mO=typeof queueMicrotask=="function"?queueMicrotask:typeof CT<"u"?function(n){return CT.resolve(null).then(n).catch(gO)}:g3;function gO(n){setTimeout(function(){throw n})}function So(n){return n==="head"}function RT(n,e){var t=e,i=0;do{var a=t.nextSibling;if(n.removeChild(t),a&&a.nodeType===8)if(t=a.data,t==="/$"||t==="/&"){if(i===0){n.removeChild(a),Ec(e);return}i--}else if(t==="$"||t==="$?"||t==="$~"||t==="$!"||t==="&")i++;else if(t==="html")th(n.ownerDocument.documentElement);else if(t==="head"){t=n.ownerDocument.head,th(t);for(var s=t.firstChild;s;){var l=s.nextSibling,u=s.nodeName;s[jh]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&s.rel.toLowerCase()==="stylesheet"||t.removeChild(s),s=l}}else t==="body"&&th(n.ownerDocument.body);t=a}while(t);Ec(e)}function DT(n,e){var t=n;n=0;do{var i=t.nextSibling;if(t.nodeType===1?e?(t._stashedDisplay=t.style.display,t.style.display="none"):(t.style.display=t._stashedDisplay||"",t.getAttribute("style")===""&&t.removeAttribute("style")):t.nodeType===3&&(e?(t._stashedText=t.nodeValue,t.nodeValue=""):t.nodeValue=t._stashedText||""),i&&i.nodeType===8)if(t=i.data,t==="/$"){if(n===0)break;n--}else t!=="$"&&t!=="$?"&&t!=="$~"&&t!=="$!"||n++;t=i}while(t)}function Cx(n){var e=n.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var t=e;switch(e=e.nextSibling,t.nodeName){case"HTML":case"HEAD":case"BODY":Cx(t),lS(t);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(t.rel.toLowerCase()==="stylesheet")continue}n.removeChild(t)}}function vO(n,e,t,i){for(;n.nodeType===1;){var a=t;if(n.nodeName.toLowerCase()!==e.toLowerCase()){if(!i&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(i){if(!n[jh])switch(e){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(s=n.getAttribute("rel"),s==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(s!==a.rel||n.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||n.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||n.getAttribute("title")!==(a.title==null?null:a.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(s=n.getAttribute("src"),(s!==(a.src==null?null:a.src)||n.getAttribute("type")!==(a.type==null?null:a.type)||n.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(e==="input"&&n.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&n.getAttribute("name")===s)return n}else return n;if(n=Ha(n.nextSibling),n===null)break}return null}function yO(n,e,t){if(e==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!t||(n=Ha(n.nextSibling),n===null))return null;return n}function v3(n,e){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!e||(n=Ha(n.nextSibling),n===null))return null;return n}function Rx(n){return n.data==="$?"||n.data==="$~"}function Dx(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function _O(n,e){var t=n.ownerDocument;if(n.data==="$~")n._reactRetry=e;else if(n.data!=="$?"||t.readyState!=="loading")e();else{var i=function(){e(),t.removeEventListener("DOMContentLoaded",i)};t.addEventListener("DOMContentLoaded",i),n._reactRetry=i}}function Ha(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==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return n}var Ux=null;function UT(n){n=n.nextSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"||t==="/&"){if(e===0)return Ha(n.nextSibling);e--}else t!=="$"&&t!=="$!"&&t!=="$?"&&t!=="$~"&&t!=="&"||e++}n=n.nextSibling}return null}function LT(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"){if(e===0)return n;e--}else t!=="/$"&&t!=="/&"||e++}n=n.previousSibling}return null}function y3(n,e,t){switch(e=Qm(t),n){case"html":if(n=e.documentElement,!n)throw Error(ue(452));return n;case"head":if(n=e.head,!n)throw Error(ue(453));return n;case"body":if(n=e.body,!n)throw Error(ue(454));return n;default:throw Error(ue(451))}}function th(n){for(var e=n.attributes;e.length;)n.removeAttributeNode(e[0]);lS(n)}var Va=new Map,NT=new Set;function Km(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Sr=qt.d;qt.d={f:xO,r:SO,D:bO,C:MO,L:EO,m:TO,X:wO,S:AO,M:CO};function xO(){var n=Sr.f(),e=a0();return n||e}function SO(n){var e=Lc(n);e!==null&&e.tag===5&&e.type==="form"?fR(e):Sr.r(n)}var Oc=typeof document>"u"?null:document;function _3(n,e,t){var i=Oc;if(i&&typeof e=="string"&&e){var a=za(e);a='link[rel="'+n+'"][href="'+a+'"]',typeof t=="string"&&(a+='[crossorigin="'+t+'"]'),NT.has(a)||(NT.add(a),n={rel:n,crossOrigin:t,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),hi(e,"link",n),ei(e),i.head.appendChild(e)))}}function bO(n){Sr.D(n),_3("dns-prefetch",n,null)}function MO(n,e){Sr.C(n,e),_3("preconnect",n,e)}function EO(n,e,t){Sr.L(n,e,t);var i=Oc;if(i&&n&&e){var a='link[rel="preload"][as="'+za(e)+'"]';e==="image"&&t&&t.imageSrcSet?(a+='[imagesrcset="'+za(t.imageSrcSet)+'"]',typeof t.imageSizes=="string"&&(a+='[imagesizes="'+za(t.imageSizes)+'"]')):a+='[href="'+za(n)+'"]';var s=a;switch(e){case"style":s=Mc(n);break;case"script":s=Pc(n)}Va.has(s)||(n=cn({rel:"preload",href:e==="image"&&t&&t.imageSrcSet?void 0:n,as:e},t),Va.set(s,n),i.querySelector(a)!==null||e==="style"&&i.querySelector(td(s))||e==="script"&&i.querySelector(nd(s))||(e=i.createElement("link"),hi(e,"link",n),ei(e),i.head.appendChild(e)))}}function TO(n,e){Sr.m(n,e);var t=Oc;if(t&&n){var i=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+za(i)+'"][href="'+za(n)+'"]',s=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Pc(n)}if(!Va.has(s)&&(n=cn({rel:"modulepreload",href:n},e),Va.set(s,n),t.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(t.querySelector(nd(s)))return}i=t.createElement("link"),hi(i,"link",n),ei(i),t.head.appendChild(i)}}}function AO(n,e,t){Sr.S(n,e,t);var i=Oc;if(i&&n){var a=rc(i).hoistableStyles,s=Mc(n);e=e||"default";var l=a.get(s);if(!l){var u={loading:0,preload:null};if(l=i.querySelector(td(s)))u.loading=5;else{n=cn({rel:"stylesheet",href:n,"data-precedence":e},t),(t=Va.get(s))&&YS(n,t);var c=l=i.createElement("link");ei(c),hi(c,"link",n),c._p=new Promise(function(h,p){c.onload=h,c.onerror=p}),c.addEventListener("load",function(){u.loading|=1}),c.addEventListener("error",function(){u.loading|=2}),u.loading|=4,_m(l,e,i)}l={type:"stylesheet",instance:l,count:1,state:u},a.set(s,l)}}}function wO(n,e){Sr.X(n,e);var t=Oc;if(t&&n){var i=rc(t).hoistableScripts,a=Pc(n),s=i.get(a);s||(s=t.querySelector(nd(a)),s||(n=cn({src:n,async:!0},e),(e=Va.get(a))&&ZS(n,e),s=t.createElement("script"),ei(s),hi(s,"link",n),t.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(a,s))}}function CO(n,e){Sr.M(n,e);var t=Oc;if(t&&n){var i=rc(t).hoistableScripts,a=Pc(n),s=i.get(a);s||(s=t.querySelector(nd(a)),s||(n=cn({src:n,async:!0,type:"module"},e),(e=Va.get(a))&&ZS(n,e),s=t.createElement("script"),ei(s),hi(s,"link",n),t.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(a,s))}}function IT(n,e,t,i){var a=(a=ao.current)?Km(a):null;if(!a)throw Error(ue(446));switch(n){case"meta":case"title":return null;case"style":return typeof t.precedence=="string"&&typeof t.href=="string"?(e=Mc(t.href),t=rc(a).hoistableStyles,i=t.get(e),i||(i={type:"style",instance:null,count:0,state:null},t.set(e,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(t.rel==="stylesheet"&&typeof t.href=="string"&&typeof t.precedence=="string"){n=Mc(t.href);var s=rc(a).hoistableStyles,l=s.get(n);if(l||(a=a.ownerDocument||a,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(n,l),(s=a.querySelector(td(n)))&&!s._p&&(l.instance=s,l.state.loading=5),Va.has(n)||(t={rel:"preload",as:"style",href:t.href,crossOrigin:t.crossOrigin,integrity:t.integrity,media:t.media,hrefLang:t.hrefLang,referrerPolicy:t.referrerPolicy},Va.set(n,t),s||RO(a,n,t,l.state))),e&&i===null)throw Error(ue(528,""));return l}if(e&&i!==null)throw Error(ue(529,""));return null;case"script":return e=t.async,t=t.src,typeof t=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Pc(t),t=rc(a).hoistableScripts,i=t.get(e),i||(i={type:"script",instance:null,count:0,state:null},t.set(e,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ue(444,n))}}function Mc(n){return'href="'+za(n)+'"'}function td(n){return'link[rel="stylesheet"]['+n+"]"}function x3(n){return cn({},n,{"data-precedence":n.precedence,precedence:null})}function RO(n,e,t,i){n.querySelector('link[rel="preload"][as="style"]['+e+"]")?i.loading=1:(e=n.createElement("link"),i.preload=e,e.addEventListener("load",function(){return i.loading|=1}),e.addEventListener("error",function(){return i.loading|=2}),hi(e,"link",t),ei(e),n.head.appendChild(e))}function Pc(n){return'[src="'+za(n)+'"]'}function nd(n){return"script[async]"+n}function zT(n,e,t){if(e.count++,e.instance===null)switch(e.type){case"style":var i=n.querySelector('style[data-href~="'+za(t.href)+'"]');if(i)return e.instance=i,ei(i),i;var a=cn({},t,{"data-href":t.href,"data-precedence":t.precedence,href:null,precedence:null});return i=(n.ownerDocument||n).createElement("style"),ei(i),hi(i,"style",a),_m(i,t.precedence,n),e.instance=i;case"stylesheet":a=Mc(t.href);var s=n.querySelector(td(a));if(s)return e.state.loading|=4,e.instance=s,ei(s),s;i=x3(t),(a=Va.get(a))&&YS(i,a),s=(n.ownerDocument||n).createElement("link"),ei(s);var l=s;return l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),hi(s,"link",i),e.state.loading|=4,_m(s,t.precedence,n),e.instance=s;case"script":return s=Pc(t.src),(a=n.querySelector(nd(s)))?(e.instance=a,ei(a),a):(i=t,(a=Va.get(s))&&(i=cn({},t),ZS(i,a)),n=n.ownerDocument||n,a=n.createElement("script"),ei(a),hi(a,"link",i),n.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(ue(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,_m(i,t.precedence,n));return e.instance}function _m(n,e,t){for(var i=t.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,s=a,l=0;l<i.length;l++){var u=i[l];if(u.dataset.precedence===e)s=u;else if(s!==a)break}s?s.parentNode.insertBefore(n,s.nextSibling):(e=t.nodeType===9?t.head:t,e.insertBefore(n,e.firstChild))}function YS(n,e){n.crossOrigin==null&&(n.crossOrigin=e.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=e.referrerPolicy),n.title==null&&(n.title=e.title)}function ZS(n,e){n.crossOrigin==null&&(n.crossOrigin=e.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=e.referrerPolicy),n.integrity==null&&(n.integrity=e.integrity)}var xm=null;function OT(n,e,t){if(xm===null){var i=new Map,a=xm=new Map;a.set(t,i)}else a=xm,i=a.get(t),i||(i=new Map,a.set(t,i));if(i.has(n))return i;for(i.set(n,null),t=t.getElementsByTagName(n),a=0;a<t.length;a++){var s=t[a];if(!(s[jh]||s[ui]||n==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var l=s.getAttribute(e)||"";l=n+l;var u=i.get(l);u?u.push(s):i.set(l,[s])}}return i}function PT(n,e,t){n=n.ownerDocument||n,n.head.insertBefore(t,e==="title"?n.querySelector("head > title"):null)}function DO(n,e,t){if(t===1||e.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return n=e.disabled,typeof e.precedence=="string"&&n==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function S3(n){return!(n.type==="stylesheet"&&!(n.state.loading&3))}function UO(n,e,t,i){if(t.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var a=Mc(i.href),s=e.querySelector(td(a));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(n.count++,n=Jm.bind(n),e.then(n,n)),t.state.loading|=4,t.instance=s,ei(s);return}s=e.ownerDocument||e,i=x3(i),(a=Va.get(a))&&YS(i,a),s=s.createElement("link"),ei(s);var l=s;l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),hi(s,"link",i),t.instance=s}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(n.count++,t=Jm.bind(n),e.addEventListener("load",t),e.addEventListener("error",t))}}var Gy=0;function LO(n,e){return n.stylesheets&&n.count===0&&Sm(n,n.stylesheets),0<n.count||0<n.imgCount?function(t){var i=setTimeout(function(){if(n.stylesheets&&Sm(n,n.stylesheets),n.unsuspend){var s=n.unsuspend;n.unsuspend=null,s()}},6e4+e);0<n.imgBytes&&Gy===0&&(Gy=62500*hO());var a=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Sm(n,n.stylesheets),n.unsuspend)){var s=n.unsuspend;n.unsuspend=null,s()}},(n.imgBytes>Gy?50:800)+e);return n.unsuspend=t,function(){n.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function Jm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sm(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var $m=null;function Sm(n,e){n.stylesheets=null,n.unsuspend!==null&&(n.count++,$m=new Map,e.forEach(NO,n),$m=null,Jm.call(n))}function NO(n,e){if(!(e.state.loading&4)){var t=$m.get(n);if(t)var i=t.get(null);else{t=new Map,$m.set(n,t);for(var a=n.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var l=a[s];(l.nodeName==="LINK"||l.getAttribute("media")!=="not all")&&(t.set(l.dataset.precedence,l),i=l)}i&&t.set(null,i)}a=e.instance,l=a.getAttribute("data-precedence"),s=t.get(l)||i,s===i&&t.set(null,a),t.set(l,a),this.count++,i=Jm.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),s?s.parentNode.insertBefore(a,s.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(a,n.firstChild)),e.state.loading|=4}}var Eh={$$typeof:ir,Provider:null,Consumer:null,_currentValue:gl,_currentValue2:gl,_threadCount:0};function IO(n,e,t,i,a,s,l,u,c){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=hy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hy(0),this.hiddenUpdates=hy(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=l,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function b3(n,e,t,i,a,s,l,u,c,h,p,g){return n=new IO(n,e,t,l,c,h,p,g,u),e=1,s===!0&&(e|=24),s=da(3,null,null,e),n.current=s,s.stateNode=n,e=xS(),e.refCount++,n.pooledCache=e,e.refCount++,s.memoizedState={element:i,isDehydrated:t,cache:e},MS(s),n}function M3(n){return n?(n=Ku,n):Ku}function E3(n,e,t,i,a,s){a=M3(a),i.context===null?i.context=a:i.pendingContext=a,i=ro(e),i.payload={element:t},s=s===void 0?null:s,s!==null&&(i.callback=s),t=oo(n,i,e),t!==null&&(ji(t,n,e),Yf(t,n,e))}function BT(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function jS(n,e){BT(n,e),(n=n.alternate)&&BT(n,e)}function T3(n){if(n.tag===13||n.tag===31){var e=Fl(n,67108864);e!==null&&ji(e,n,67108864),jS(n,67108864)}}function FT(n){if(n.tag===13||n.tag===31){var e=ya();e=rS(e);var t=Fl(n,e);t!==null&&ji(t,n,e),jS(n,e)}}var eg=!0;function zO(n,e,t,i){var a=ot.T;ot.T=null;var s=qt.p;try{qt.p=2,QS(n,e,t,i)}finally{qt.p=s,ot.T=a}}function OO(n,e,t,i){var a=ot.T;ot.T=null;var s=qt.p;try{qt.p=8,QS(n,e,t,i)}finally{qt.p=s,ot.T=a}}function QS(n,e,t,i){if(eg){var a=Lx(i);if(a===null)Vy(n,e,i,tg,t),HT(n,i);else if(BO(a,n,e,t,i))i.stopPropagation();else if(HT(n,i),e&4&&-1<PO.indexOf(n)){for(;a!==null;){var s=Lc(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var l=rl(s.pendingLanes);if(l!==0){var u=s;for(u.pendingLanes|=2,u.entangledLanes|=2;l;){var c=1<<31-va(l);u.entanglements[1]|=c,l&=~c}ws(s),!(Wt&6)&&(Xm=ma()+500,ed(0))}}break;case 31:case 13:u=Fl(s,2),u!==null&&ji(u,s,2),a0(),jS(s,2)}if(s=Lx(i),s===null&&Vy(n,e,i,tg,t),s===a)break;a=s}a!==null&&i.stopPropagation()}else Vy(n,e,i,null,t)}}function Lx(n){return n=cS(n),KS(n)}var tg=null;function KS(n){if(tg=null,n=Wu(n),n!==null){var e=Wh(n);if(e===null)n=null;else{var t=e.tag;if(t===13){if(n=Ww(e),n!==null)return n;n=null}else if(t===31){if(n=qw(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 tg=n,null}function A3(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bI()){case Qw:return 2;case Kw:return 8;case Dm:case MI:return 32;case Jw:return 268435456;default:return 32}default:return 32}}var Nx=!1,co=null,fo=null,ho=null,Th=new Map,Ah=new Map,Qr=[],PO="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function HT(n,e){switch(n){case"focusin":case"focusout":co=null;break;case"dragenter":case"dragleave":fo=null;break;case"mouseover":case"mouseout":ho=null;break;case"pointerover":case"pointerout":Th.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ah.delete(e.pointerId)}}function bf(n,e,t,i,a,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[a]},e!==null&&(e=Lc(e),e!==null&&T3(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),n)}function BO(n,e,t,i,a){switch(e){case"focusin":return co=bf(co,n,e,t,i,a),!0;case"dragenter":return fo=bf(fo,n,e,t,i,a),!0;case"mouseover":return ho=bf(ho,n,e,t,i,a),!0;case"pointerover":var s=a.pointerId;return Th.set(s,bf(Th.get(s)||null,n,e,t,i,a)),!0;case"gotpointercapture":return s=a.pointerId,Ah.set(s,bf(Ah.get(s)||null,n,e,t,i,a)),!0}return!1}function w3(n){var e=Wu(n.target);if(e!==null){var t=Wh(e);if(t!==null){if(e=t.tag,e===13){if(e=Ww(t),e!==null){n.blockedOn=e,EE(n.priority,function(){FT(t)});return}}else if(e===31){if(e=qw(t),e!==null){n.blockedOn=e,EE(n.priority,function(){FT(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 bm(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Lx(n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);K_=i,t.target.dispatchEvent(i),K_=null}else return e=Lc(t),e!==null&&T3(e),n.blockedOn=t,!1;e.shift()}return!0}function VT(n,e,t){bm(n)&&t.delete(e)}function FO(){Nx=!1,co!==null&&bm(co)&&(co=null),fo!==null&&bm(fo)&&(fo=null),ho!==null&&bm(ho)&&(ho=null),Th.forEach(VT),Ah.forEach(VT)}function hp(n,e){n.blockedOn===e&&(n.blockedOn=null,Nx||(Nx=!0,Xn.unstable_scheduleCallback(Xn.unstable_NormalPriority,FO)))}var dp=null;function kT(n){dp!==n&&(dp=n,Xn.unstable_scheduleCallback(Xn.unstable_NormalPriority,function(){dp===n&&(dp=null);for(var e=0;e<n.length;e+=3){var t=n[e],i=n[e+1],a=n[e+2];if(typeof i!="function"){if(KS(i||t)===null)continue;break}var s=Lc(t);s!==null&&(n.splice(e,3),e-=3,dx(s,{pending:!0,data:a,method:t.method,action:i},i,a))}}))}function Ec(n){function e(c){return hp(c,n)}co!==null&&hp(co,n),fo!==null&&hp(fo,n),ho!==null&&hp(ho,n),Th.forEach(e),Ah.forEach(e);for(var t=0;t<Qr.length;t++){var i=Qr[t];i.blockedOn===n&&(i.blockedOn=null)}for(;0<Qr.length&&(t=Qr[0],t.blockedOn===null);)w3(t),t.blockedOn===null&&Qr.shift();if(t=(n.ownerDocument||n).$$reactFormReplay,t!=null)for(i=0;i<t.length;i+=3){var a=t[i],s=t[i+1],l=a[Ki]||null;if(typeof s=="function")l||kT(t);else if(l){var u=null;if(s&&s.hasAttribute("formAction")){if(a=s,l=s[Ki]||null)u=l.formAction;else if(KS(a)!==null)continue}else u=l.action;typeof u=="function"?t[i+1]=u:(t.splice(i,3),i-=3),kT(t)}}}function C3(){function n(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(l){return a=l})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),i||setTimeout(t,20)}function t(){if(!i&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(t,100),function(){i=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function JS(n){this._internalRoot=n}o0.prototype.render=JS.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(ue(409));var t=e.current,i=ya();E3(t,i,n,e,null,null)};o0.prototype.unmount=JS.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;E3(n.current,2,null,n,null,null),a0(),e[Uc]=null}};function o0(n){this._internalRoot=n}o0.prototype.unstable_scheduleHydration=function(n){if(n){var e=iC();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Qr.length&&e!==0&&e<Qr[t].priority;t++);Qr.splice(t,0,n),t===0&&w3(n)}};var GT=Gw.version;if(GT!=="19.2.3")throw Error(ue(527,GT,"19.2.3"));qt.findDOMNode=function(n){var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(ue(188)):(n=Object.keys(n).join(","),Error(ue(268,n)));return n=mI(e),n=n!==null?Yw(n):null,n=n===null?null:n.stateNode,n};var HO={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:ot,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var pp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pp.isDisabled&&pp.supportsFiber)try{qh=pp.inject(HO),ga=pp}catch{}}Wg.createRoot=function(n,e){if(!Xw(n))throw Error(ue(299));var t=!1,i="",a=_R,s=xR,l=SR;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(s=e.onCaughtError),e.onRecoverableError!==void 0&&(l=e.onRecoverableError)),e=b3(n,1,!1,null,null,t,i,null,a,s,l,C3),n[Uc]=e.current,qS(n),new JS(e)};Wg.hydrateRoot=function(n,e,t){if(!Xw(n))throw Error(ue(299));var i=!1,a="",s=_R,l=xR,u=SR,c=null;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(u=t.onRecoverableError),t.formState!==void 0&&(c=t.formState)),e=b3(n,1,!0,e,t??null,i,a,c,s,l,u,C3),e.context=M3(null),t=e.current,i=ya(),i=rS(i),a=ro(i),a.callback=null,oo(t,a,i),t=i,e.current.lanes=t,Zh(e,t),ws(e),n[Uc]=e.current,qS(n),new o0(e)};Wg.version="19.2.3";function R3(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(R3)}catch(n){console.error(n)}}R3(),Hw.exports=Wg;var VO=Hw.exports;const g8=nS(VO),kO="modulepreload",GO=function(n){return"/"+n},XT={},v8=function(e,t,i){let a=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(t.map(c=>{if(c=GO(c),c in XT)return;XT[c]=!0;const h=c.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":kO,h||(g.as="script"),g.crossOrigin="",g.href=c,u&&g.setAttribute("nonce",u),document.head.appendChild(g),h)return new Promise((m,v)=>{g.addEventListener("load",m),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return a.then(l=>{for(const u of l||[])u.status==="rejected"&&s(u.reason);return e().catch(s)})};/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const l0="170",XO={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},WO={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},D3=0,Ix=1,U3=2,qO=3,L3=0,u0=1,nh=2,$a=3,vr=0,Ui=1,gs=2,cr=0,Sl=1,zx=2,Ox=3,Px=4,N3=5,Kr=100,I3=101,z3=102,O3=103,P3=104,B3=200,F3=201,H3=202,V3=203,ng=204,ig=205,k3=206,G3=207,X3=208,W3=209,q3=210,Y3=211,Z3=212,j3=213,Q3=214,ag=0,sg=1,rg=2,Dl=3,og=4,lg=5,ug=6,cg=7,id=0,K3=1,J3=2,Ms=0,$3=1,eD=2,tD=3,$S=4,nD=5,iD=6,aD=7,Bx="attached",sD="detached",c0=300,yr=301,yo=302,wh=303,Ch=304,Bc=306,Rh=1e3,Ba=1001,Dh=1002,di=1003,eb=1004,YO=1004,tc=1005,ZO=1005,Gn=1006,ih=1007,jO=1007,xs=1008,QO=1008,ns=1009,tb=1010,nb=1011,Tc=1012,f0=1013,_r=1014,Zi=1015,Fc=1016,h0=1017,d0=1018,Ul=1020,ib=35902,ab=1021,sb=1022,Si=1023,rb=1024,ob=1025,bl=1026,Ll=1027,p0=1028,ad=1029,lb=1030,m0=1031,KO=1032,g0=1033,ah=33776,sh=33777,rh=33778,oh=33779,fg=35840,hg=35841,dg=35842,pg=35843,mg=36196,gg=37492,vg=37496,yg=37808,_g=37809,xg=37810,Sg=37811,bg=37812,Mg=37813,Eg=37814,Tg=37815,Ag=37816,wg=37817,Cg=37818,Rg=37819,Dg=37820,Ug=37821,lh=36492,Lg=36494,Ng=36495,ub=36283,Ig=36284,zg=36285,Og=36286,rD=2200,oD=2201,lD=2202,Uh=2300,Pg=2301,Mm=2302,hl=2400,dl=2401,Lh=2402,v0=2500,cb=2501,JO=0,$O=1,eP=2,uD=3200,cD=3201,tP=3202,nP=3203,bo=0,fD=1,tr="",xi="srgb",Mo="srgb-linear",sd="linear",Zt="srgb",iP=0,ul=7680,aP=7681,sP=7682,rP=7683,oP=34055,lP=34056,uP=5386,cP=512,fP=513,hP=514,dP=515,pP=516,mP=517,gP=518,Fx=519,hD=512,dD=513,pD=514,fb=515,mD=516,gD=517,vD=518,yD=519,Nh=35044,vP=35048,yP=35040,_P=35045,xP=35049,SP=35041,bP=35046,MP=35050,EP=35042,TP="100",Hx="300 es",Ss=2e3,Ih=2001;class Cs{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 a=this._listeners[e];if(a!==void 0){const s=a.indexOf(t);s!==-1&&a.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 a=i.slice(0);for(let s=0,l=a.length;s<l;s++)a[s].call(this,e);e.target=null}}}const vi=["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 WT=1234567;const Ml=Math.PI/180,Ac=180/Math.PI;function _a(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(vi[n&255]+vi[n>>8&255]+vi[n>>16&255]+vi[n>>24&255]+"-"+vi[e&255]+vi[e>>8&255]+"-"+vi[e>>16&15|64]+vi[e>>24&255]+"-"+vi[t&63|128]+vi[t>>8&255]+"-"+vi[t>>16&255]+vi[t>>24&255]+vi[i&255]+vi[i>>8&255]+vi[i>>16&255]+vi[i>>24&255]).toLowerCase()}function bn(n,e,t){return Math.max(e,Math.min(t,n))}function hb(n,e){return(n%e+e)%e}function AP(n,e,t,i,a){return i+(n-e)*(a-i)/(t-e)}function wP(n,e,t){return n!==e?(t-n)/(e-n):0}function uh(n,e,t){return(1-t)*n+t*e}function CP(n,e,t,i){return uh(n,e,1-Math.exp(-t*i))}function RP(n,e=1){return e-Math.abs(hb(n,e*2)-e)}function DP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function UP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function LP(n,e){return n+Math.floor(Math.random()*(e-n+1))}function NP(n,e){return n+Math.random()*(e-n)}function IP(n){return n*(.5-Math.random())}function zP(n){n!==void 0&&(WT=n);let e=WT+=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 OP(n){return n*Ml}function PP(n){return n*Ac}function BP(n){return(n&n-1)===0&&n!==0}function FP(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function HP(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function VP(n,e,t,i,a){const s=Math.cos,l=Math.sin,u=s(t/2),c=l(t/2),h=s((e+i)/2),p=l((e+i)/2),g=s((e-i)/2),m=l((e-i)/2),v=s((i-e)/2),_=l((i-e)/2);switch(a){case"XYX":n.set(u*p,c*g,c*m,u*h);break;case"YZY":n.set(c*m,u*p,c*g,u*h);break;case"ZXZ":n.set(c*g,c*m,u*p,u*h);break;case"XZX":n.set(u*p,c*_,c*v,u*h);break;case"YXY":n.set(c*v,u*p,c*_,u*h);break;case"ZYZ":n.set(c*_,c*v,u*p,u*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+a)}}function Di(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 _t(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 kP={DEG2RAD:Ml,RAD2DEG:Ac,generateUUID:_a,clamp:bn,euclideanModulo:hb,mapLinear:AP,inverseLerp:wP,lerp:uh,damp:CP,pingpong:RP,smoothstep:DP,smootherstep:UP,randInt:LP,randFloat:NP,randFloatSpread:IP,seededRandom:zP,degToRad:OP,radToDeg:PP,isPowerOfTwo:BP,ceilPowerOfTwo:FP,floorPowerOfTwo:HP,setQuaternionFromProperEuler:VP,normalize:_t,denormalize:Di};class he{constructor(e=0,t=0){he.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,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6],this.y=a[1]*t+a[4]*i+a[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(bn(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),a=Math.sin(t),s=this.x-e.x,l=this.y-e.y;return this.x=s*i-l*a+e.x,this.y=s*a+l*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class vt{constructor(e,t,i,a,s,l,u,c,h){vt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,a,s,l,u,c,h)}set(e,t,i,a,s,l,u,c,h){const p=this.elements;return p[0]=e,p[1]=a,p[2]=u,p[3]=t,p[4]=s,p[5]=c,p[6]=i,p[7]=l,p[8]=h,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,a=t.elements,s=this.elements,l=i[0],u=i[3],c=i[6],h=i[1],p=i[4],g=i[7],m=i[2],v=i[5],_=i[8],T=a[0],b=a[3],y=a[6],S=a[1],E=a[4],A=a[7],I=a[2],R=a[5],L=a[8];return s[0]=l*T+u*S+c*I,s[3]=l*b+u*E+c*R,s[6]=l*y+u*A+c*L,s[1]=h*T+p*S+g*I,s[4]=h*b+p*E+g*R,s[7]=h*y+p*A+g*L,s[2]=m*T+v*S+_*I,s[5]=m*b+v*E+_*R,s[8]=m*y+v*A+_*L,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],a=e[2],s=e[3],l=e[4],u=e[5],c=e[6],h=e[7],p=e[8];return t*l*p-t*u*h-i*s*p+i*u*c+a*s*h-a*l*c}invert(){const e=this.elements,t=e[0],i=e[1],a=e[2],s=e[3],l=e[4],u=e[5],c=e[6],h=e[7],p=e[8],g=p*l-u*h,m=u*c-p*s,v=h*s-l*c,_=t*g+i*m+a*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const T=1/_;return e[0]=g*T,e[1]=(a*h-p*i)*T,e[2]=(u*i-a*l)*T,e[3]=m*T,e[4]=(p*t-a*c)*T,e[5]=(a*s-u*t)*T,e[6]=v*T,e[7]=(i*c-h*t)*T,e[8]=(l*t-i*s)*T,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,a,s,l,u){const c=Math.cos(s),h=Math.sin(s);return this.set(i*c,i*h,-i*(c*l+h*u)+l+e,-a*h,a*c,-a*(-h*l+c*u)+u+t,0,0,1),this}scale(e,t){return this.premultiply(Xy.makeScale(e,t)),this}rotate(e){return this.premultiply(Xy.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xy.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 a=0;a<9;a++)if(t[a]!==i[a])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 Xy=new vt;function _D(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const GP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function nc(n,e){return new GP[n](e)}function zh(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function xD(){const n=zh("canvas");return n.style.display="block",n}const qT={};function Hf(n){n in qT||(qT[n]=!0,console.warn(n))}function XP(n,e,t){return new Promise(function(i,a){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:a();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}function WP(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function qP(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ut={enabled:!0,workingColorSpace:Mo,spaces:{},convert:function(n,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===Zt&&(n.r=fr(n.r),n.g=fr(n.g),n.b=fr(n.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(n.applyMatrix3(this.spaces[e].toXYZ),n.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===Zt&&(n.r=dc(n.r),n.g=dc(n.g),n.b=dc(n.b))),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 this.spaces[n].primaries},getTransfer:function(n){return n===tr?sd:this.spaces[n].transfer},getLuminanceCoefficients:function(n,e=this.workingColorSpace){return n.fromArray(this.spaces[e].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,e,t){return n.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function fr(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function dc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const YT=[.64,.33,.3,.6,.15,.06],ZT=[.2126,.7152,.0722],jT=[.3127,.329],QT=new vt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),KT=new vt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ut.define({[Mo]:{primaries:YT,whitePoint:jT,transfer:sd,toXYZ:QT,fromXYZ:KT,luminanceCoefficients:ZT,workingColorSpaceConfig:{unpackColorSpace:xi},outputColorSpaceConfig:{drawingBufferColorSpace:xi}},[xi]:{primaries:YT,whitePoint:jT,transfer:Zt,toXYZ:QT,fromXYZ:KT,luminanceCoefficients:ZT,outputColorSpaceConfig:{drawingBufferColorSpace:xi}}});let xu;class SD{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xu===void 0&&(xu=zh("canvas")),xu.width=e.width,xu.height=e.height;const i=xu.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=xu}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=zh("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const a=i.getImageData(0,0,e.width,e.height),s=a.data;for(let l=0;l<s.length;l++)s[l]=fr(s[l]/255)*255;return i.putImageData(a,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(fr(t[i]/255)*255):t[i]=fr(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 YP=0;class pl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:YP++}),this.uuid=_a(),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:""},a=this.data;if(a!==null){let s;if(Array.isArray(a)){s=[];for(let l=0,u=a.length;l<u;l++)a[l].isDataTexture?s.push(Wy(a[l].image)):s.push(Wy(a[l]))}else s=Wy(a);i.url=s}return t||(e.images[this.uuid]=i),i}}function Wy(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?SD.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 ZP=0;class Mn extends Cs{constructor(e=Mn.DEFAULT_IMAGE,t=Mn.DEFAULT_MAPPING,i=Ba,a=Ba,s=Gn,l=xs,u=Si,c=ns,h=Mn.DEFAULT_ANISOTROPY,p=tr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ZP++}),this.uuid=_a(),this.name="",this.source=new pl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=a,this.magFilter=s,this.minFilter=l,this.anisotropy=h,this.format=u,this.internalFormat=null,this.type=c,this.offset=new he(0,0),this.repeat=new he(1,1),this.center=new he(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new vt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,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!==c0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rh:e.x=e.x-Math.floor(e.x);break;case Ba:e.x=e.x<0?0:1;break;case Dh: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 Rh:e.y=e.y-Math.floor(e.y);break;case Ba:e.y=e.y<0?0:1;break;case Dh: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++}}Mn.DEFAULT_IMAGE=null;Mn.DEFAULT_MAPPING=c0;Mn.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,t=0,i=0,a=1){Pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=a}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,a){return this.x=e,this.y=t,this.z=i,this.w=a,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,a=this.z,s=this.w,l=e.elements;return this.x=l[0]*t+l[4]*i+l[8]*a+l[12]*s,this.y=l[1]*t+l[5]*i+l[9]*a+l[13]*s,this.z=l[2]*t+l[6]*i+l[10]*a+l[14]*s,this.w=l[3]*t+l[7]*i+l[11]*a+l[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,a,s;const c=e.elements,h=c[0],p=c[4],g=c[8],m=c[1],v=c[5],_=c[9],T=c[2],b=c[6],y=c[10];if(Math.abs(p-m)<.01&&Math.abs(g-T)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+m)<.1&&Math.abs(g+T)<.1&&Math.abs(_+b)<.1&&Math.abs(h+v+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,A=(v+1)/2,I=(y+1)/2,R=(p+m)/4,L=(g+T)/4,z=(_+b)/4;return E>A&&E>I?E<.01?(i=0,a=.707106781,s=.707106781):(i=Math.sqrt(E),a=R/i,s=L/i):A>I?A<.01?(i=.707106781,a=0,s=.707106781):(a=Math.sqrt(A),i=R/a,s=z/a):I<.01?(i=.707106781,a=.707106781,s=0):(s=Math.sqrt(I),i=L/s,a=z/s),this.set(i,a,s,t),this}let S=Math.sqrt((b-_)*(b-_)+(g-T)*(g-T)+(m-p)*(m-p));return Math.abs(S)<.001&&(S=1),this.x=(b-_)/S,this.y=(g-T)/S,this.z=(m-p)/S,this.w=Math.acos((h+v+y-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 bD extends Cs{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t);const a={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Mn(a,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 l=i.count;for(let u=0;u<l;u++)this.textures[u]=s.clone(),this.textures[u].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 a=0,s=this.textures.length;a<s;a++)this.textures[a].image.width=e,this.textures[a].image.height=t,this.textures[a].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,a=e.textures.length;i<a;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 pl(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 is extends bD{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class y0 extends Mn{constructor(e=null,t=1,i=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:a},this.magFilter=di,this.minFilter=di,this.wrapR=Ba,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class jP extends is{constructor(e=1,t=1,i=1,a={}){super(e,t,a),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new y0(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class db extends Mn{constructor(e=null,t=1,i=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:a},this.magFilter=di,this.minFilter=di,this.wrapR=Ba,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class QP extends is{constructor(e=1,t=1,i=1,a={}){super(e,t,a),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new db(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class Qi{constructor(e=0,t=0,i=0,a=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=a}static slerpFlat(e,t,i,a,s,l,u){let c=i[a+0],h=i[a+1],p=i[a+2],g=i[a+3];const m=s[l+0],v=s[l+1],_=s[l+2],T=s[l+3];if(u===0){e[t+0]=c,e[t+1]=h,e[t+2]=p,e[t+3]=g;return}if(u===1){e[t+0]=m,e[t+1]=v,e[t+2]=_,e[t+3]=T;return}if(g!==T||c!==m||h!==v||p!==_){let b=1-u;const y=c*m+h*v+p*_+g*T,S=y>=0?1:-1,E=1-y*y;if(E>Number.EPSILON){const I=Math.sqrt(E),R=Math.atan2(I,y*S);b=Math.sin(b*R)/I,u=Math.sin(u*R)/I}const A=u*S;if(c=c*b+m*A,h=h*b+v*A,p=p*b+_*A,g=g*b+T*A,b===1-u){const I=1/Math.sqrt(c*c+h*h+p*p+g*g);c*=I,h*=I,p*=I,g*=I}}e[t]=c,e[t+1]=h,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,i,a,s,l){const u=i[a],c=i[a+1],h=i[a+2],p=i[a+3],g=s[l],m=s[l+1],v=s[l+2],_=s[l+3];return e[t]=u*_+p*g+c*v-h*m,e[t+1]=c*_+p*m+h*g-u*v,e[t+2]=h*_+p*v+u*m-c*g,e[t+3]=p*_-u*g-c*m-h*v,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,a){return this._x=e,this._y=t,this._z=i,this._w=a,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,a=e._y,s=e._z,l=e._order,u=Math.cos,c=Math.sin,h=u(i/2),p=u(a/2),g=u(s/2),m=c(i/2),v=c(a/2),_=c(s/2);switch(l){case"XYZ":this._x=m*p*g+h*v*_,this._y=h*v*g-m*p*_,this._z=h*p*_+m*v*g,this._w=h*p*g-m*v*_;break;case"YXZ":this._x=m*p*g+h*v*_,this._y=h*v*g-m*p*_,this._z=h*p*_-m*v*g,this._w=h*p*g+m*v*_;break;case"ZXY":this._x=m*p*g-h*v*_,this._y=h*v*g+m*p*_,this._z=h*p*_+m*v*g,this._w=h*p*g-m*v*_;break;case"ZYX":this._x=m*p*g-h*v*_,this._y=h*v*g+m*p*_,this._z=h*p*_-m*v*g,this._w=h*p*g+m*v*_;break;case"YZX":this._x=m*p*g+h*v*_,this._y=h*v*g+m*p*_,this._z=h*p*_-m*v*g,this._w=h*p*g-m*v*_;break;case"XZY":this._x=m*p*g-h*v*_,this._y=h*v*g-m*p*_,this._z=h*p*_+m*v*g,this._w=h*p*g+m*v*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,a=Math.sin(i);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],a=t[4],s=t[8],l=t[1],u=t[5],c=t[9],h=t[2],p=t[6],g=t[10],m=i+u+g;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(p-c)*v,this._y=(s-h)*v,this._z=(l-a)*v}else if(i>u&&i>g){const v=2*Math.sqrt(1+i-u-g);this._w=(p-c)/v,this._x=.25*v,this._y=(a+l)/v,this._z=(s+h)/v}else if(u>g){const v=2*Math.sqrt(1+u-i-g);this._w=(s-h)/v,this._x=(a+l)/v,this._y=.25*v,this._z=(c+p)/v}else{const v=2*Math.sqrt(1+g-i-u);this._w=(l-a)/v,this._x=(s+h)/v,this._y=(c+p)/v,this._z=.25*v}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(bn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const a=Math.min(1,t/i);return this.slerp(e,a),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,a=e._y,s=e._z,l=e._w,u=t._x,c=t._y,h=t._z,p=t._w;return this._x=i*p+l*u+a*h-s*c,this._y=a*p+l*c+s*u-i*h,this._z=s*p+l*h+i*c-a*u,this._w=l*p-i*u-a*c-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,a=this._y,s=this._z,l=this._w;let u=l*e._w+i*e._x+a*e._y+s*e._z;if(u<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,u=-u):this.copy(e),u>=1)return this._w=l,this._x=i,this._y=a,this._z=s,this;const c=1-u*u;if(c<=Number.EPSILON){const v=1-t;return this._w=v*l+t*this._w,this._x=v*i+t*this._x,this._y=v*a+t*this._y,this._z=v*s+t*this._z,this.normalize(),this}const h=Math.sqrt(c),p=Math.atan2(h,u),g=Math.sin((1-t)*p)/h,m=Math.sin(t*p)/h;return this._w=l*g+this._w*m,this._x=i*g+this._x*m,this._y=a*g+this._y*m,this._z=s*g+this._z*m,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(),a=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(a*Math.sin(e),a*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 P{constructor(e=0,t=0,i=0){P.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(JT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(JT.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,a=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*a,this.y=s[1]*t+s[4]*i+s[7]*a,this.z=s[2]*t+s[5]*i+s[8]*a,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,a=this.z,s=e.elements,l=1/(s[3]*t+s[7]*i+s[11]*a+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*a+s[12])*l,this.y=(s[1]*t+s[5]*i+s[9]*a+s[13])*l,this.z=(s[2]*t+s[6]*i+s[10]*a+s[14])*l,this}applyQuaternion(e){const t=this.x,i=this.y,a=this.z,s=e.x,l=e.y,u=e.z,c=e.w,h=2*(l*a-u*i),p=2*(u*t-s*a),g=2*(s*i-l*t);return this.x=t+c*h+l*g-u*p,this.y=i+c*p+u*h-s*g,this.z=a+c*g+s*p-l*h,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,a=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*a,this.y=s[1]*t+s[5]*i+s[9]*a,this.z=s[2]*t+s[6]*i+s[10]*a,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,a=e.y,s=e.z,l=t.x,u=t.y,c=t.z;return this.x=a*c-s*u,this.y=s*l-i*c,this.z=i*u-a*l,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 qy.copy(this).projectOnVector(e),this.sub(qy)}reflect(e){return this.sub(qy.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(bn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,a=this.z-e.z;return t*t+i*i+a*a}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 a=Math.sin(t)*e;return this.x=a*Math.sin(i),this.y=Math.cos(t)*e,this.z=a*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(),a=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=a,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 qy=new P,JT=new Qi;class Li{constructor(e=new P(1/0,1/0,1/0),t=new P(-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(Qa.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Qa.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=Qa.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 l=0,u=s.count;l<u;l++)e.isMesh===!0?e.getVertexPosition(l,Qa):Qa.fromBufferAttribute(s,l),Qa.applyMatrix4(e.matrixWorld),this.expandByPoint(Qa);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),mp.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),mp.copy(i.boundingBox)),mp.applyMatrix4(e.matrixWorld),this.union(mp)}const a=e.children;for(let s=0,l=a.length;s<l;s++)this.expandByObject(a[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,Qa),Qa.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(Mf),gp.subVectors(this.max,Mf),Su.subVectors(e.a,Mf),bu.subVectors(e.b,Mf),Mu.subVectors(e.c,Mf),Pr.subVectors(bu,Su),Br.subVectors(Mu,bu),qo.subVectors(Su,Mu);let t=[0,-Pr.z,Pr.y,0,-Br.z,Br.y,0,-qo.z,qo.y,Pr.z,0,-Pr.x,Br.z,0,-Br.x,qo.z,0,-qo.x,-Pr.y,Pr.x,0,-Br.y,Br.x,0,-qo.y,qo.x,0];return!Yy(t,Su,bu,Mu,gp)||(t=[1,0,0,0,1,0,0,0,1],!Yy(t,Su,bu,Mu,gp))?!1:(vp.crossVectors(Pr,Br),t=[vp.x,vp.y,vp.z],Yy(t,Su,bu,Mu,gp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qa).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:(qs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qs),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 qs=[new P,new P,new P,new P,new P,new P,new P,new P],Qa=new P,mp=new Li,Su=new P,bu=new P,Mu=new P,Pr=new P,Br=new P,qo=new P,Mf=new P,gp=new P,vp=new P,Yo=new P;function Yy(n,e,t,i,a){for(let s=0,l=n.length-3;s<=l;s+=3){Yo.fromArray(n,s);const u=a.x*Math.abs(Yo.x)+a.y*Math.abs(Yo.y)+a.z*Math.abs(Yo.z),c=e.dot(Yo),h=t.dot(Yo),p=i.dot(Yo);if(Math.max(-Math.max(c,h,p),Math.min(c,h,p))>u)return!1}return!0}const KP=new Li,Ef=new P,Zy=new P;class bi{constructor(e=new P,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):KP.setFromPoints(e).getCenter(i);let a=0;for(let s=0,l=e.length;s<l;s++)a=Math.max(a,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(a),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;Ef.subVectors(e,this.center);const t=Ef.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),a=(i-this.radius)*.5;this.center.addScaledVector(Ef,a/i),this.radius+=a}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):(Zy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ef.copy(e.center).add(Zy)),this.expandByPoint(Ef.copy(e.center).sub(Zy))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ys=new P,jy=new P,yp=new P,Fr=new P,Qy=new P,_p=new P,Ky=new P;class Hc{constructor(e=new P,t=new P(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,Ys)),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=Ys.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ys.copy(this.origin).addScaledVector(this.direction,t),Ys.distanceToSquared(e))}distanceSqToSegment(e,t,i,a){jy.copy(e).add(t).multiplyScalar(.5),yp.copy(t).sub(e).normalize(),Fr.copy(this.origin).sub(jy);const s=e.distanceTo(t)*.5,l=-this.direction.dot(yp),u=Fr.dot(this.direction),c=-Fr.dot(yp),h=Fr.lengthSq(),p=Math.abs(1-l*l);let g,m,v,_;if(p>0)if(g=l*c-u,m=l*u-c,_=s*p,g>=0)if(m>=-_)if(m<=_){const T=1/p;g*=T,m*=T,v=g*(g+l*m+2*u)+m*(l*g+m+2*c)+h}else m=s,g=Math.max(0,-(l*m+u)),v=-g*g+m*(m+2*c)+h;else m=-s,g=Math.max(0,-(l*m+u)),v=-g*g+m*(m+2*c)+h;else m<=-_?(g=Math.max(0,-(-l*s+u)),m=g>0?-s:Math.min(Math.max(-s,-c),s),v=-g*g+m*(m+2*c)+h):m<=_?(g=0,m=Math.min(Math.max(-s,-c),s),v=m*(m+2*c)+h):(g=Math.max(0,-(l*s+u)),m=g>0?s:Math.min(Math.max(-s,-c),s),v=-g*g+m*(m+2*c)+h);else m=l>0?-s:s,g=Math.max(0,-(l*m+u)),v=-g*g+m*(m+2*c)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,g),a&&a.copy(jy).addScaledVector(yp,m),v}intersectSphere(e,t){Ys.subVectors(e.center,this.origin);const i=Ys.dot(this.direction),a=Ys.dot(Ys)-i*i,s=e.radius*e.radius;if(a>s)return null;const l=Math.sqrt(s-a),u=i-l,c=i+l;return c<0?null:u<0?this.at(c,t):this.at(u,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,a,s,l,u,c;const h=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,m=this.origin;return h>=0?(i=(e.min.x-m.x)*h,a=(e.max.x-m.x)*h):(i=(e.max.x-m.x)*h,a=(e.min.x-m.x)*h),p>=0?(s=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(s=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),i>l||s>a||((s>i||isNaN(i))&&(i=s),(l<a||isNaN(a))&&(a=l),g>=0?(u=(e.min.z-m.z)*g,c=(e.max.z-m.z)*g):(u=(e.max.z-m.z)*g,c=(e.min.z-m.z)*g),i>c||u>a)||((u>i||i!==i)&&(i=u),(c<a||a!==a)&&(a=c),a<0)?null:this.at(i>=0?i:a,t)}intersectsBox(e){return this.intersectBox(e,Ys)!==null}intersectTriangle(e,t,i,a,s){Qy.subVectors(t,e),_p.subVectors(i,e),Ky.crossVectors(Qy,_p);let l=this.direction.dot(Ky),u;if(l>0){if(a)return null;u=1}else if(l<0)u=-1,l=-l;else return null;Fr.subVectors(this.origin,e);const c=u*this.direction.dot(_p.crossVectors(Fr,_p));if(c<0)return null;const h=u*this.direction.dot(Qy.cross(Fr));if(h<0||c+h>l)return null;const p=-u*Fr.dot(Ky);return p<0?null:this.at(p/l,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 lt{constructor(e,t,i,a,s,l,u,c,h,p,g,m,v,_,T,b){lt.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,a,s,l,u,c,h,p,g,m,v,_,T,b)}set(e,t,i,a,s,l,u,c,h,p,g,m,v,_,T,b){const y=this.elements;return y[0]=e,y[4]=t,y[8]=i,y[12]=a,y[1]=s,y[5]=l,y[9]=u,y[13]=c,y[2]=h,y[6]=p,y[10]=g,y[14]=m,y[3]=v,y[7]=_,y[11]=T,y[15]=b,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 lt().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,a=1/Eu.setFromMatrixColumn(e,0).length(),s=1/Eu.setFromMatrixColumn(e,1).length(),l=1/Eu.setFromMatrixColumn(e,2).length();return t[0]=i[0]*a,t[1]=i[1]*a,t[2]=i[2]*a,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]*l,t[9]=i[9]*l,t[10]=i[10]*l,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,a=e.y,s=e.z,l=Math.cos(i),u=Math.sin(i),c=Math.cos(a),h=Math.sin(a),p=Math.cos(s),g=Math.sin(s);if(e.order==="XYZ"){const m=l*p,v=l*g,_=u*p,T=u*g;t[0]=c*p,t[4]=-c*g,t[8]=h,t[1]=v+_*h,t[5]=m-T*h,t[9]=-u*c,t[2]=T-m*h,t[6]=_+v*h,t[10]=l*c}else if(e.order==="YXZ"){const m=c*p,v=c*g,_=h*p,T=h*g;t[0]=m+T*u,t[4]=_*u-v,t[8]=l*h,t[1]=l*g,t[5]=l*p,t[9]=-u,t[2]=v*u-_,t[6]=T+m*u,t[10]=l*c}else if(e.order==="ZXY"){const m=c*p,v=c*g,_=h*p,T=h*g;t[0]=m-T*u,t[4]=-l*g,t[8]=_+v*u,t[1]=v+_*u,t[5]=l*p,t[9]=T-m*u,t[2]=-l*h,t[6]=u,t[10]=l*c}else if(e.order==="ZYX"){const m=l*p,v=l*g,_=u*p,T=u*g;t[0]=c*p,t[4]=_*h-v,t[8]=m*h+T,t[1]=c*g,t[5]=T*h+m,t[9]=v*h-_,t[2]=-h,t[6]=u*c,t[10]=l*c}else if(e.order==="YZX"){const m=l*c,v=l*h,_=u*c,T=u*h;t[0]=c*p,t[4]=T-m*g,t[8]=_*g+v,t[1]=g,t[5]=l*p,t[9]=-u*p,t[2]=-h*p,t[6]=v*g+_,t[10]=m-T*g}else if(e.order==="XZY"){const m=l*c,v=l*h,_=u*c,T=u*h;t[0]=c*p,t[4]=-g,t[8]=h*p,t[1]=m*g+T,t[5]=l*p,t[9]=v*g-_,t[2]=_*g-v,t[6]=u*p,t[10]=T*g+m}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(JP,e,$P)}lookAt(e,t,i){const a=this.elements;return la.subVectors(e,t),la.lengthSq()===0&&(la.z=1),la.normalize(),Hr.crossVectors(i,la),Hr.lengthSq()===0&&(Math.abs(i.z)===1?la.x+=1e-4:la.z+=1e-4,la.normalize(),Hr.crossVectors(i,la)),Hr.normalize(),xp.crossVectors(la,Hr),a[0]=Hr.x,a[4]=xp.x,a[8]=la.x,a[1]=Hr.y,a[5]=xp.y,a[9]=la.y,a[2]=Hr.z,a[6]=xp.z,a[10]=la.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,a=t.elements,s=this.elements,l=i[0],u=i[4],c=i[8],h=i[12],p=i[1],g=i[5],m=i[9],v=i[13],_=i[2],T=i[6],b=i[10],y=i[14],S=i[3],E=i[7],A=i[11],I=i[15],R=a[0],L=a[4],z=a[8],C=a[12],w=a[1],B=a[5],Q=a[9],k=a[13],j=a[2],ae=a[6],V=a[10],ne=a[14],q=a[3],oe=a[7],me=a[11],ye=a[15];return s[0]=l*R+u*w+c*j+h*q,s[4]=l*L+u*B+c*ae+h*oe,s[8]=l*z+u*Q+c*V+h*me,s[12]=l*C+u*k+c*ne+h*ye,s[1]=p*R+g*w+m*j+v*q,s[5]=p*L+g*B+m*ae+v*oe,s[9]=p*z+g*Q+m*V+v*me,s[13]=p*C+g*k+m*ne+v*ye,s[2]=_*R+T*w+b*j+y*q,s[6]=_*L+T*B+b*ae+y*oe,s[10]=_*z+T*Q+b*V+y*me,s[14]=_*C+T*k+b*ne+y*ye,s[3]=S*R+E*w+A*j+I*q,s[7]=S*L+E*B+A*ae+I*oe,s[11]=S*z+E*Q+A*V+I*me,s[15]=S*C+E*k+A*ne+I*ye,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],a=e[8],s=e[12],l=e[1],u=e[5],c=e[9],h=e[13],p=e[2],g=e[6],m=e[10],v=e[14],_=e[3],T=e[7],b=e[11],y=e[15];return _*(+s*c*g-a*h*g-s*u*m+i*h*m+a*u*v-i*c*v)+T*(+t*c*v-t*h*m+s*l*m-a*l*v+a*h*p-s*c*p)+b*(+t*h*g-t*u*v-s*l*g+i*l*v+s*u*p-i*h*p)+y*(-a*u*p-t*c*g+t*u*m+a*l*g-i*l*m+i*c*p)}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 a=this.elements;return e.isVector3?(a[12]=e.x,a[13]=e.y,a[14]=e.z):(a[12]=e,a[13]=t,a[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],a=e[2],s=e[3],l=e[4],u=e[5],c=e[6],h=e[7],p=e[8],g=e[9],m=e[10],v=e[11],_=e[12],T=e[13],b=e[14],y=e[15],S=g*b*h-T*m*h+T*c*v-u*b*v-g*c*y+u*m*y,E=_*m*h-p*b*h-_*c*v+l*b*v+p*c*y-l*m*y,A=p*T*h-_*g*h+_*u*v-l*T*v-p*u*y+l*g*y,I=_*g*c-p*T*c-_*u*m+l*T*m+p*u*b-l*g*b,R=t*S+i*E+a*A+s*I;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/R;return e[0]=S*L,e[1]=(T*m*s-g*b*s-T*a*v+i*b*v+g*a*y-i*m*y)*L,e[2]=(u*b*s-T*c*s+T*a*h-i*b*h-u*a*y+i*c*y)*L,e[3]=(g*c*s-u*m*s-g*a*h+i*m*h+u*a*v-i*c*v)*L,e[4]=E*L,e[5]=(p*b*s-_*m*s+_*a*v-t*b*v-p*a*y+t*m*y)*L,e[6]=(_*c*s-l*b*s-_*a*h+t*b*h+l*a*y-t*c*y)*L,e[7]=(l*m*s-p*c*s+p*a*h-t*m*h-l*a*v+t*c*v)*L,e[8]=A*L,e[9]=(_*g*s-p*T*s-_*i*v+t*T*v+p*i*y-t*g*y)*L,e[10]=(l*T*s-_*u*s+_*i*h-t*T*h-l*i*y+t*u*y)*L,e[11]=(p*u*s-l*g*s-p*i*h+t*g*h+l*i*v-t*u*v)*L,e[12]=I*L,e[13]=(p*T*a-_*g*a+_*i*m-t*T*m-p*i*b+t*g*b)*L,e[14]=(_*u*a-l*T*a-_*i*c+t*T*c+l*i*b-t*u*b)*L,e[15]=(l*g*a-p*u*a+p*i*c-t*g*c-l*i*m+t*u*m)*L,this}scale(e){const t=this.elements,i=e.x,a=e.y,s=e.z;return t[0]*=i,t[4]*=a,t[8]*=s,t[1]*=i,t[5]*=a,t[9]*=s,t[2]*=i,t[6]*=a,t[10]*=s,t[3]*=i,t[7]*=a,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],a=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,a))}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),a=Math.sin(t),s=1-i,l=e.x,u=e.y,c=e.z,h=s*l,p=s*u;return this.set(h*l+i,h*u-a*c,h*c+a*u,0,h*u+a*c,p*u+i,p*c-a*l,0,h*c-a*u,p*c+a*l,s*c*c+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,a,s,l){return this.set(1,i,s,0,e,1,l,0,t,a,1,0,0,0,0,1),this}compose(e,t,i){const a=this.elements,s=t._x,l=t._y,u=t._z,c=t._w,h=s+s,p=l+l,g=u+u,m=s*h,v=s*p,_=s*g,T=l*p,b=l*g,y=u*g,S=c*h,E=c*p,A=c*g,I=i.x,R=i.y,L=i.z;return a[0]=(1-(T+y))*I,a[1]=(v+A)*I,a[2]=(_-E)*I,a[3]=0,a[4]=(v-A)*R,a[5]=(1-(m+y))*R,a[6]=(b+S)*R,a[7]=0,a[8]=(_+E)*L,a[9]=(b-S)*L,a[10]=(1-(m+T))*L,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,this}decompose(e,t,i){const a=this.elements;let s=Eu.set(a[0],a[1],a[2]).length();const l=Eu.set(a[4],a[5],a[6]).length(),u=Eu.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14],Ka.copy(this);const h=1/s,p=1/l,g=1/u;return Ka.elements[0]*=h,Ka.elements[1]*=h,Ka.elements[2]*=h,Ka.elements[4]*=p,Ka.elements[5]*=p,Ka.elements[6]*=p,Ka.elements[8]*=g,Ka.elements[9]*=g,Ka.elements[10]*=g,t.setFromRotationMatrix(Ka),i.x=s,i.y=l,i.z=u,this}makePerspective(e,t,i,a,s,l,u=Ss){const c=this.elements,h=2*s/(t-e),p=2*s/(i-a),g=(t+e)/(t-e),m=(i+a)/(i-a);let v,_;if(u===Ss)v=-(l+s)/(l-s),_=-2*l*s/(l-s);else if(u===Ih)v=-l/(l-s),_=-l*s/(l-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);return c[0]=h,c[4]=0,c[8]=g,c[12]=0,c[1]=0,c[5]=p,c[9]=m,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,a,s,l,u=Ss){const c=this.elements,h=1/(t-e),p=1/(i-a),g=1/(l-s),m=(t+e)*h,v=(i+a)*p;let _,T;if(u===Ss)_=(l+s)*g,T=-2*g;else if(u===Ih)_=s*g,T=-1*g;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-m,c[1]=0,c[5]=2*p,c[9]=0,c[13]=-v,c[2]=0,c[6]=0,c[10]=T,c[14]=-_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let a=0;a<16;a++)if(t[a]!==i[a])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 Eu=new P,Ka=new lt,JP=new P(0,0,0),$P=new P(1,1,1),Hr=new P,xp=new P,la=new P,$T=new lt,eA=new Qi;class ba{constructor(e=0,t=0,i=0,a=ba.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=a}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,a=this._order){return this._x=e,this._y=t,this._z=i,this._order=a,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 a=e.elements,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],p=a[9],g=a[2],m=a[6],v=a[10];switch(t){case"XYZ":this._y=Math.asin(bn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-p,v),this._z=Math.atan2(-l,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-bn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(u,v),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(bn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-g,v),this._z=Math.atan2(-l,h)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-bn(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(m,v),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-l,h));break;case"YZX":this._z=Math.asin(bn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,h),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(u,v));break;case"XZY":this._z=Math.asin(-bn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(u,s)):(this._x=Math.atan2(-p,v),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 $T.makeRotationFromQuaternion(e),this.setFromRotationMatrix($T,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eA.setFromEuler(this),this.setFromQuaternion(eA,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}}ba.DEFAULT_ORDER="XYZ";class wc{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 eB=0;const tA=new P,Tu=new Qi,Zs=new lt,Sp=new P,Tf=new P,tB=new P,nB=new Qi,nA=new P(1,0,0),iA=new P(0,1,0),aA=new P(0,0,1),sA={type:"added"},iB={type:"removed"},Au={type:"childadded",child:null},Jy={type:"childremoved",child:null};class Bt extends Cs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:eB++}),this.uuid=_a(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bt.DEFAULT_UP.clone();const e=new P,t=new ba,i=new Qi,a=new P(1,1,1);function s(){i.setFromEuler(t,!1)}function l(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(l),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:a},modelViewMatrix:{value:new lt},normalMatrix:{value:new vt}}),this.matrix=new lt,this.matrixWorld=new lt,this.matrixAutoUpdate=Bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new wc,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 Tu.setFromAxisAngle(e,t),this.quaternion.multiply(Tu),this}rotateOnWorldAxis(e,t){return Tu.setFromAxisAngle(e,t),this.quaternion.premultiply(Tu),this}rotateX(e){return this.rotateOnAxis(nA,e)}rotateY(e){return this.rotateOnAxis(iA,e)}rotateZ(e){return this.rotateOnAxis(aA,e)}translateOnAxis(e,t){return tA.copy(e).applyQuaternion(this.quaternion),this.position.add(tA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(nA,e)}translateY(e){return this.translateOnAxis(iA,e)}translateZ(e){return this.translateOnAxis(aA,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zs.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Sp.copy(e):Sp.set(e,t,i);const a=this.parent;this.updateWorldMatrix(!0,!1),Tf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zs.lookAt(Tf,Sp,this.up):Zs.lookAt(Sp,Tf,this.up),this.quaternion.setFromRotationMatrix(Zs),a&&(Zs.extractRotation(a.matrixWorld),Tu.setFromRotationMatrix(Zs),this.quaternion.premultiply(Tu.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(sA),Au.child=e,this.dispatchEvent(Au),Au.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(iB),Jy.child=e,this.dispatchEvent(Jy),Jy.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),Zs.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Zs.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zs),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(sA),Au.child=e,this.dispatchEvent(Au),Au.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,a=this.children.length;i<a;i++){const l=this.children[i].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const a=this.children;for(let s=0,l=a.length;s<l;s++)a[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(Tf,e,tB),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tf,nB,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,a=t.length;i<a;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,a=t.length;i<a;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,a=t.length;i<a;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 a=this.children;for(let s=0,l=a.length;s<l;s++)a[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 a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(u=>({boxInitialized:u.boxInitialized,boxMin:u.box.min.toArray(),boxMax:u.box.max.toArray(),sphereInitialized:u.sphereInitialized,sphereRadius:u.sphere.radius,sphereCenter:u.sphere.center.toArray()})),a.maxInstanceCount=this._maxInstanceCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(a.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function s(u,c){return u[c.uuid]===void 0&&(u[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=s(e.geometries,this.geometry);const u=this.geometry.parameters;if(u!==void 0&&u.shapes!==void 0){const c=u.shapes;if(Array.isArray(c))for(let h=0,p=c.length;h<p;h++){const g=c[h];s(e.shapes,g)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const u=[];for(let c=0,h=this.material.length;c<h;c++)u.push(s(e.materials,this.material[c]));a.material=u}else a.material=s(e.materials,this.material);if(this.children.length>0){a.children=[];for(let u=0;u<this.children.length;u++)a.children.push(this.children[u].toJSON(e).object)}if(this.animations.length>0){a.animations=[];for(let u=0;u<this.animations.length;u++){const c=this.animations[u];a.animations.push(s(e.animations,c))}}if(t){const u=l(e.geometries),c=l(e.materials),h=l(e.textures),p=l(e.images),g=l(e.shapes),m=l(e.skeletons),v=l(e.animations),_=l(e.nodes);u.length>0&&(i.geometries=u),c.length>0&&(i.materials=c),h.length>0&&(i.textures=h),p.length>0&&(i.images=p),g.length>0&&(i.shapes=g),m.length>0&&(i.skeletons=m),v.length>0&&(i.animations=v),_.length>0&&(i.nodes=_)}return i.object=a,i;function l(u){const c=[];for(const h in u){const p=u[h];delete p.metadata,c.push(p)}return c}}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 a=e.children[i];this.add(a.clone())}return this}}Bt.DEFAULT_UP=new P(0,1,0);Bt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ja=new P,js=new P,$y=new P,Qs=new P,wu=new P,Cu=new P,rA=new P,e_=new P,t_=new P,n_=new P,i_=new Pt,a_=new Pt,s_=new Pt;class Yi{constructor(e=new P,t=new P,i=new P){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,a){a.subVectors(i,t),Ja.subVectors(e,t),a.cross(Ja);const s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}static getBarycoord(e,t,i,a,s){Ja.subVectors(a,t),js.subVectors(i,t),$y.subVectors(e,t);const l=Ja.dot(Ja),u=Ja.dot(js),c=Ja.dot($y),h=js.dot(js),p=js.dot($y),g=l*h-u*u;if(g===0)return s.set(0,0,0),null;const m=1/g,v=(h*c-u*p)*m,_=(l*p-u*c)*m;return s.set(1-v-_,_,v)}static containsPoint(e,t,i,a){return this.getBarycoord(e,t,i,a,Qs)===null?!1:Qs.x>=0&&Qs.y>=0&&Qs.x+Qs.y<=1}static getInterpolation(e,t,i,a,s,l,u,c){return this.getBarycoord(e,t,i,a,Qs)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,Qs.x),c.addScaledVector(l,Qs.y),c.addScaledVector(u,Qs.z),c)}static getInterpolatedAttribute(e,t,i,a,s,l){return i_.setScalar(0),a_.setScalar(0),s_.setScalar(0),i_.fromBufferAttribute(e,t),a_.fromBufferAttribute(e,i),s_.fromBufferAttribute(e,a),l.setScalar(0),l.addScaledVector(i_,s.x),l.addScaledVector(a_,s.y),l.addScaledVector(s_,s.z),l}static isFrontFacing(e,t,i,a){return Ja.subVectors(i,t),js.subVectors(e,t),Ja.cross(js).dot(a)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,a){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[a]),this}setFromAttributeAndIndices(e,t,i,a){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,a),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 Ja.subVectors(this.c,this.b),js.subVectors(this.a,this.b),Ja.cross(js).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Yi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Yi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,a,s){return Yi.getInterpolation(e,this.a,this.b,this.c,t,i,a,s)}containsPoint(e){return Yi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Yi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,a=this.b,s=this.c;let l,u;wu.subVectors(a,i),Cu.subVectors(s,i),e_.subVectors(e,i);const c=wu.dot(e_),h=Cu.dot(e_);if(c<=0&&h<=0)return t.copy(i);t_.subVectors(e,a);const p=wu.dot(t_),g=Cu.dot(t_);if(p>=0&&g<=p)return t.copy(a);const m=c*g-p*h;if(m<=0&&c>=0&&p<=0)return l=c/(c-p),t.copy(i).addScaledVector(wu,l);n_.subVectors(e,s);const v=wu.dot(n_),_=Cu.dot(n_);if(_>=0&&v<=_)return t.copy(s);const T=v*h-c*_;if(T<=0&&h>=0&&_<=0)return u=h/(h-_),t.copy(i).addScaledVector(Cu,u);const b=p*_-v*g;if(b<=0&&g-p>=0&&v-_>=0)return rA.subVectors(s,a),u=(g-p)/(g-p+(v-_)),t.copy(a).addScaledVector(rA,u);const y=1/(b+T+m);return l=T*y,u=m*y,t.copy(i).addScaledVector(wu,l).addScaledVector(Cu,u)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const MD={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},Vr={h:0,s:0,l:0},bp={h:0,s:0,l:0};function r_(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 Be{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 a=e;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=xi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ut.toWorkingColorSpace(this,t),this}setRGB(e,t,i,a=Ut.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ut.toWorkingColorSpace(this,a),this}setHSL(e,t,i,a=Ut.workingColorSpace){if(e=hb(e,1),t=bn(t,0,1),i=bn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,l=2*i-s;this.r=r_(l,s,e+1/3),this.g=r_(l,s,e),this.b=r_(l,s,e-1/3)}return Ut.toWorkingColorSpace(this,a),this}setStyle(e,t=xi){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const l=a[1],u=a[2];switch(l){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))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(u))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(u))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(a=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=a[1],l=s.length;if(l===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(l===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=xi){const i=MD[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=fr(e.r),this.g=fr(e.g),this.b=fr(e.b),this}copyLinearToSRGB(e){return this.r=dc(e.r),this.g=dc(e.g),this.b=dc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xi){return Ut.fromWorkingColorSpace(yi.copy(this),e),Math.round(bn(yi.r*255,0,255))*65536+Math.round(bn(yi.g*255,0,255))*256+Math.round(bn(yi.b*255,0,255))}getHexString(e=xi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ut.workingColorSpace){Ut.fromWorkingColorSpace(yi.copy(this),t);const i=yi.r,a=yi.g,s=yi.b,l=Math.max(i,a,s),u=Math.min(i,a,s);let c,h;const p=(u+l)/2;if(u===l)c=0,h=0;else{const g=l-u;switch(h=p<=.5?g/(l+u):g/(2-l-u),l){case i:c=(a-s)/g+(a<s?6:0);break;case a:c=(s-i)/g+2;break;case s:c=(i-a)/g+4;break}c/=6}return e.h=c,e.s=h,e.l=p,e}getRGB(e,t=Ut.workingColorSpace){return Ut.fromWorkingColorSpace(yi.copy(this),t),e.r=yi.r,e.g=yi.g,e.b=yi.b,e}getStyle(e=xi){Ut.fromWorkingColorSpace(yi.copy(this),e);const t=yi.r,i=yi.g,a=yi.b;return e!==xi?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(a*255)})`}offsetHSL(e,t,i){return this.getHSL(Vr),this.setHSL(Vr.h+e,Vr.s+t,Vr.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(Vr),e.getHSL(bp);const i=uh(Vr.h,bp.h,t),a=uh(Vr.s,bp.s,t),s=uh(Vr.l,bp.l,t);return this.setHSL(i,a,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,a=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*a,this.g=s[1]*t+s[4]*i+s[7]*a,this.b=s[2]*t+s[5]*i+s[8]*a,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 yi=new Be;Be.NAMES=MD;let aB=0;class Mi extends Cs{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:aB++}),this.uuid=_a(),this.name="",this.blending=Sl,this.side=vr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ng,this.blendDst=ig,this.blendEquation=Kr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Be(0,0,0),this.blendAlpha=0,this.depthFunc=Dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Fx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ul,this.stencilZFail=ul,this.stencilZPass=ul,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 a=this[t];if(a===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(i):a&&a.isVector3&&i&&i.isVector3?a.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!==Sl&&(i.blending=this.blending),this.side!==vr&&(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!==ng&&(i.blendSrc=this.blendSrc),this.blendDst!==ig&&(i.blendDst=this.blendDst),this.blendEquation!==Kr&&(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!==Dl&&(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!==Fx&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ul&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ul&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ul&&(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 a(s){const l=[];for(const u in s){const c=s[u];delete c.metadata,l.push(c)}return l}if(t){const s=a(e.textures),l=a(e.images);s.length>0&&(i.textures=s),l.length>0&&(i.images=l)}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 a=t.length;i=new Array(a);for(let s=0;s!==a;++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 Eo extends Mi{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Be(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 ba,this.combine=id,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 nr=sB();function sB(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),a=new Uint32Array(512);for(let c=0;c<256;++c){const h=c-127;h<-27?(i[c]=0,i[c|256]=32768,a[c]=24,a[c|256]=24):h<-14?(i[c]=1024>>-h-14,i[c|256]=1024>>-h-14|32768,a[c]=-h-1,a[c|256]=-h-1):h<=15?(i[c]=h+15<<10,i[c|256]=h+15<<10|32768,a[c]=13,a[c|256]=13):h<128?(i[c]=31744,i[c|256]=64512,a[c]=24,a[c|256]=24):(i[c]=31744,i[c|256]=64512,a[c]=13,a[c|256]=13)}const s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64);for(let c=1;c<1024;++c){let h=c<<13,p=0;for(;!(h&8388608);)h<<=1,p-=8388608;h&=-8388609,p+=947912704,s[c]=h|p}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)l[c]=c<<23;l[31]=1199570944,l[32]=2147483648;for(let c=33;c<63;++c)l[c]=2147483648+(c-32<<23);l[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(u[c]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:a,mantissaTable:s,exponentTable:l,offsetTable:u}}function Gi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=bn(n,-65504,65504),nr.floatView[0]=n;const e=nr.uint32View[0],t=e>>23&511;return nr.baseTable[t]+((e&8388607)>>nr.shiftTable[t])}function Vf(n){const e=n>>10;return nr.uint32View[0]=nr.mantissaTable[nr.offsetTable[e]+(n&1023)]+nr.exponentTable[e],nr.floatView[0]}const rB={toHalfFloat:Gi,fromHalfFloat:Vf},In=new P,Mp=new he;class tn{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=Nh,this.updateRanges=[],this.gpuType=Zi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let a=0,s=this.itemSize;a<s;a++)this.array[e+a]=t.array[i+a];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++)Mp.fromBufferAttribute(this,t),Mp.applyMatrix3(e),this.setXY(t,Mp.x,Mp.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)In.fromBufferAttribute(this,t),In.applyMatrix3(e),this.setXYZ(t,In.x,In.y,In.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)In.fromBufferAttribute(this,t),In.applyMatrix4(e),this.setXYZ(t,In.x,In.y,In.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)In.fromBufferAttribute(this,t),In.applyNormalMatrix(e),this.setXYZ(t,In.x,In.y,In.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)In.fromBufferAttribute(this,t),In.transformDirection(e),this.setXYZ(t,In.x,In.y,In.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=Di(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=_t(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Di(t,this.array)),t}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Di(t,this.array)),t}setY(e,t){return this.normalized&&(t=_t(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=Di(t,this.array)),t}setZ(e,t){return this.normalized&&(t=_t(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=Di(t,this.array)),t}setW(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,a){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=a,this}setXYZW(e,t,i,a,s){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array),s=_t(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=a,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!==Nh&&(e.usage=this.usage),e}}class oB extends tn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class lB extends tn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class uB extends tn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class cB extends tn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class pb extends tn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class fB extends tn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class mb extends tn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class hB extends tn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Vf(this.array[e*this.itemSize]);return this.normalized&&(t=Di(t,this.array)),t}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize]=Gi(t),this}getY(e){let t=Vf(this.array[e*this.itemSize+1]);return this.normalized&&(t=Di(t,this.array)),t}setY(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+1]=Gi(t),this}getZ(e){let t=Vf(this.array[e*this.itemSize+2]);return this.normalized&&(t=Di(t,this.array)),t}setZ(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+2]=Gi(t),this}getW(e){let t=Vf(this.array[e*this.itemSize+3]);return this.normalized&&(t=Di(t,this.array)),t}setW(e,t){return this.normalized&&(t=_t(t,this.array)),this.array[e*this.itemSize+3]=Gi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array)),this.array[e+0]=Gi(t),this.array[e+1]=Gi(i),this}setXYZ(e,t,i,a){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array)),this.array[e+0]=Gi(t),this.array[e+1]=Gi(i),this.array[e+2]=Gi(a),this}setXYZW(e,t,i,a,s){return e*=this.itemSize,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array),s=_t(s,this.array)),this.array[e+0]=Gi(t),this.array[e+1]=Gi(i),this.array[e+2]=Gi(a),this.array[e+3]=Gi(s),this}}class Ye extends tn{constructor(e,t,i){super(new Float32Array(e),t,i)}}let dB=0;const Da=new lt,o_=new Bt,Ru=new P,ua=new Li,Af=new Li,Jn=new P;class bt extends Cs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dB++}),this.uuid=_a(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(_D(e)?mb:pb)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new vt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(e),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Da.makeRotationFromQuaternion(e),this.applyMatrix4(Da),this}rotateX(e){return Da.makeRotationX(e),this.applyMatrix4(Da),this}rotateY(e){return Da.makeRotationY(e),this.applyMatrix4(Da),this}rotateZ(e){return Da.makeRotationZ(e),this.applyMatrix4(Da),this}translate(e,t,i){return Da.makeTranslation(e,t,i),this.applyMatrix4(Da),this}scale(e,t,i){return Da.makeScale(e,t,i),this.applyMatrix4(Da),this}lookAt(e){return o_.lookAt(e),o_.updateMatrix(),this.applyMatrix4(o_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ru).negate(),this.translate(Ru.x,Ru.y,Ru.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let a=0,s=e.length;a<s;a++){const l=e[a];i.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Ye(i,3))}else{for(let i=0,a=t.count;i<a;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Li);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 P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,a=t.length;i<a;i++){const s=t[i];ua.setFromBufferAttribute(s),this.morphTargetsRelative?(Jn.addVectors(this.boundingBox.min,ua.min),this.boundingBox.expandByPoint(Jn),Jn.addVectors(this.boundingBox.max,ua.max),this.boundingBox.expandByPoint(Jn)):(this.boundingBox.expandByPoint(ua.min),this.boundingBox.expandByPoint(ua.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 bi);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 P,1/0);return}if(e){const i=this.boundingSphere.center;if(ua.setFromBufferAttribute(e),t)for(let s=0,l=t.length;s<l;s++){const u=t[s];Af.setFromBufferAttribute(u),this.morphTargetsRelative?(Jn.addVectors(ua.min,Af.min),ua.expandByPoint(Jn),Jn.addVectors(ua.max,Af.max),ua.expandByPoint(Jn)):(ua.expandByPoint(Af.min),ua.expandByPoint(Af.max))}ua.getCenter(i);let a=0;for(let s=0,l=e.count;s<l;s++)Jn.fromBufferAttribute(e,s),a=Math.max(a,i.distanceToSquared(Jn));if(t)for(let s=0,l=t.length;s<l;s++){const u=t[s],c=this.morphTargetsRelative;for(let h=0,p=u.count;h<p;h++)Jn.fromBufferAttribute(u,h),c&&(Ru.fromBufferAttribute(e,h),Jn.add(Ru)),a=Math.max(a,i.distanceToSquared(Jn))}this.boundingSphere.radius=Math.sqrt(a),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,a=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new tn(new Float32Array(4*i.count),4));const l=this.getAttribute("tangent"),u=[],c=[];for(let z=0;z<i.count;z++)u[z]=new P,c[z]=new P;const h=new P,p=new P,g=new P,m=new he,v=new he,_=new he,T=new P,b=new P;function y(z,C,w){h.fromBufferAttribute(i,z),p.fromBufferAttribute(i,C),g.fromBufferAttribute(i,w),m.fromBufferAttribute(s,z),v.fromBufferAttribute(s,C),_.fromBufferAttribute(s,w),p.sub(h),g.sub(h),v.sub(m),_.sub(m);const B=1/(v.x*_.y-_.x*v.y);isFinite(B)&&(T.copy(p).multiplyScalar(_.y).addScaledVector(g,-v.y).multiplyScalar(B),b.copy(g).multiplyScalar(v.x).addScaledVector(p,-_.x).multiplyScalar(B),u[z].add(T),u[C].add(T),u[w].add(T),c[z].add(b),c[C].add(b),c[w].add(b))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let z=0,C=S.length;z<C;++z){const w=S[z],B=w.start,Q=w.count;for(let k=B,j=B+Q;k<j;k+=3)y(e.getX(k+0),e.getX(k+1),e.getX(k+2))}const E=new P,A=new P,I=new P,R=new P;function L(z){I.fromBufferAttribute(a,z),R.copy(I);const C=u[z];E.copy(C),E.sub(I.multiplyScalar(I.dot(C))).normalize(),A.crossVectors(R,C);const B=A.dot(c[z])<0?-1:1;l.setXYZW(z,E.x,E.y,E.z,B)}for(let z=0,C=S.length;z<C;++z){const w=S[z],B=w.start,Q=w.count;for(let k=B,j=B+Q;k<j;k+=3)L(e.getX(k+0)),L(e.getX(k+1)),L(e.getX(k+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 tn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let m=0,v=i.count;m<v;m++)i.setXYZ(m,0,0,0);const a=new P,s=new P,l=new P,u=new P,c=new P,h=new P,p=new P,g=new P;if(e)for(let m=0,v=e.count;m<v;m+=3){const _=e.getX(m+0),T=e.getX(m+1),b=e.getX(m+2);a.fromBufferAttribute(t,_),s.fromBufferAttribute(t,T),l.fromBufferAttribute(t,b),p.subVectors(l,s),g.subVectors(a,s),p.cross(g),u.fromBufferAttribute(i,_),c.fromBufferAttribute(i,T),h.fromBufferAttribute(i,b),u.add(p),c.add(p),h.add(p),i.setXYZ(_,u.x,u.y,u.z),i.setXYZ(T,c.x,c.y,c.z),i.setXYZ(b,h.x,h.y,h.z)}else for(let m=0,v=t.count;m<v;m+=3)a.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),l.fromBufferAttribute(t,m+2),p.subVectors(l,s),g.subVectors(a,s),p.cross(g),i.setXYZ(m+0,p.x,p.y,p.z),i.setXYZ(m+1,p.x,p.y,p.z),i.setXYZ(m+2,p.x,p.y,p.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Jn.fromBufferAttribute(e,t),Jn.normalize(),e.setXYZ(t,Jn.x,Jn.y,Jn.z)}toNonIndexed(){function e(u,c){const h=u.array,p=u.itemSize,g=u.normalized,m=new h.constructor(c.length*p);let v=0,_=0;for(let T=0,b=c.length;T<b;T++){u.isInterleavedBufferAttribute?v=c[T]*u.data.stride+u.offset:v=c[T]*p;for(let y=0;y<p;y++)m[_++]=h[v++]}return new tn(m,p,g)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new bt,i=this.index.array,a=this.attributes;for(const u in a){const c=a[u],h=e(c,i);t.setAttribute(u,h)}const s=this.morphAttributes;for(const u in s){const c=[],h=s[u];for(let p=0,g=h.length;p<g;p++){const m=h[p],v=e(m,i);c.push(v)}t.morphAttributes[u]=c}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let u=0,c=l.length;u<c;u++){const h=l[u];t.addGroup(h.start,h.count,h.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 c=this.parameters;for(const h in c)c[h]!==void 0&&(e[h]=c[h]);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 c in i){const h=i[c];e.data.attributes[c]=h.toJSON(e.data)}const a={};let s=!1;for(const c in this.morphAttributes){const h=this.morphAttributes[c],p=[];for(let g=0,m=h.length;g<m;g++){const v=h[g];p.push(v.toJSON(e.data))}p.length>0&&(a[c]=p,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const u=this.boundingSphere;return u!==null&&(e.data.boundingSphere={center:u.center.toArray(),radius:u.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 a=e.attributes;for(const h in a){const p=a[h];this.setAttribute(h,p.clone(t))}const s=e.morphAttributes;for(const h in s){const p=[],g=s[h];for(let m=0,v=g.length;m<v;m++)p.push(g[m].clone(t));this.morphAttributes[h]=p}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let h=0,p=l.length;h<p;h++){const g=l[h];this.addGroup(g.start,g.count,g.materialIndex)}const u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oA=new lt,Zo=new Hc,Ep=new bi,lA=new P,Tp=new P,Ap=new P,wp=new P,l_=new P,Cp=new P,uA=new P,Rp=new P;class Fn extends Bt{constructor(e=new bt,t=new Eo){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 a=t[i[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,l=a.length;s<l;s++){const u=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=s}}}}getVertexPosition(e,t){const i=this.geometry,a=i.attributes.position,s=i.morphAttributes.position,l=i.morphTargetsRelative;t.fromBufferAttribute(a,e);const u=this.morphTargetInfluences;if(s&&u){Cp.set(0,0,0);for(let c=0,h=s.length;c<h;c++){const p=u[c],g=s[c];p!==0&&(l_.fromBufferAttribute(g,e),l?Cp.addScaledVector(l_,p):Cp.addScaledVector(l_.sub(t),p))}t.add(Cp)}return t}raycast(e,t){const i=this.geometry,a=this.material,s=this.matrixWorld;a!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ep.copy(i.boundingSphere),Ep.applyMatrix4(s),Zo.copy(e.ray).recast(e.near),!(Ep.containsPoint(Zo.origin)===!1&&(Zo.intersectSphere(Ep,lA)===null||Zo.origin.distanceToSquared(lA)>(e.far-e.near)**2))&&(oA.copy(s).invert(),Zo.copy(e.ray).applyMatrix4(oA),!(i.boundingBox!==null&&Zo.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Zo)))}_computeIntersections(e,t,i){let a;const s=this.geometry,l=this.material,u=s.index,c=s.attributes.position,h=s.attributes.uv,p=s.attributes.uv1,g=s.attributes.normal,m=s.groups,v=s.drawRange;if(u!==null)if(Array.isArray(l))for(let _=0,T=m.length;_<T;_++){const b=m[_],y=l[b.materialIndex],S=Math.max(b.start,v.start),E=Math.min(u.count,Math.min(b.start+b.count,v.start+v.count));for(let A=S,I=E;A<I;A+=3){const R=u.getX(A),L=u.getX(A+1),z=u.getX(A+2);a=Dp(this,y,e,i,h,p,g,R,L,z),a&&(a.faceIndex=Math.floor(A/3),a.face.materialIndex=b.materialIndex,t.push(a))}}else{const _=Math.max(0,v.start),T=Math.min(u.count,v.start+v.count);for(let b=_,y=T;b<y;b+=3){const S=u.getX(b),E=u.getX(b+1),A=u.getX(b+2);a=Dp(this,l,e,i,h,p,g,S,E,A),a&&(a.faceIndex=Math.floor(b/3),t.push(a))}}else if(c!==void 0)if(Array.isArray(l))for(let _=0,T=m.length;_<T;_++){const b=m[_],y=l[b.materialIndex],S=Math.max(b.start,v.start),E=Math.min(c.count,Math.min(b.start+b.count,v.start+v.count));for(let A=S,I=E;A<I;A+=3){const R=A,L=A+1,z=A+2;a=Dp(this,y,e,i,h,p,g,R,L,z),a&&(a.faceIndex=Math.floor(A/3),a.face.materialIndex=b.materialIndex,t.push(a))}}else{const _=Math.max(0,v.start),T=Math.min(c.count,v.start+v.count);for(let b=_,y=T;b<y;b+=3){const S=b,E=b+1,A=b+2;a=Dp(this,l,e,i,h,p,g,S,E,A),a&&(a.faceIndex=Math.floor(b/3),t.push(a))}}}}function pB(n,e,t,i,a,s,l,u){let c;if(e.side===Ui?c=i.intersectTriangle(l,s,a,!0,u):c=i.intersectTriangle(a,s,l,e.side===vr,u),c===null)return null;Rp.copy(u),Rp.applyMatrix4(n.matrixWorld);const h=t.ray.origin.distanceTo(Rp);return h<t.near||h>t.far?null:{distance:h,point:Rp.clone(),object:n}}function Dp(n,e,t,i,a,s,l,u,c,h){n.getVertexPosition(u,Tp),n.getVertexPosition(c,Ap),n.getVertexPosition(h,wp);const p=pB(n,e,t,i,Tp,Ap,wp,uA);if(p){const g=new P;Yi.getBarycoord(uA,Tp,Ap,wp,g),a&&(p.uv=Yi.getInterpolatedAttribute(a,u,c,h,g,new he)),s&&(p.uv1=Yi.getInterpolatedAttribute(s,u,c,h,g,new he)),l&&(p.normal=Yi.getInterpolatedAttribute(l,u,c,h,g,new P),p.normal.dot(i.direction)>0&&p.normal.multiplyScalar(-1));const m={a:u,b:c,c:h,normal:new P,materialIndex:0};Yi.getNormal(Tp,Ap,wp,m.normal),p.face=m,p.barycoord=g}return p}class Vl extends bt{constructor(e=1,t=1,i=1,a=1,s=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:a,heightSegments:s,depthSegments:l};const u=this;a=Math.floor(a),s=Math.floor(s),l=Math.floor(l);const c=[],h=[],p=[],g=[];let m=0,v=0;_("z","y","x",-1,-1,i,t,e,l,s,0),_("z","y","x",1,-1,i,t,-e,l,s,1),_("x","z","y",1,1,e,i,t,a,l,2),_("x","z","y",1,-1,e,i,-t,a,l,3),_("x","y","z",1,-1,e,t,i,a,s,4),_("x","y","z",-1,-1,e,t,-i,a,s,5),this.setIndex(c),this.setAttribute("position",new Ye(h,3)),this.setAttribute("normal",new Ye(p,3)),this.setAttribute("uv",new Ye(g,2));function _(T,b,y,S,E,A,I,R,L,z,C){const w=A/L,B=I/z,Q=A/2,k=I/2,j=R/2,ae=L+1,V=z+1;let ne=0,q=0;const oe=new P;for(let me=0;me<V;me++){const ye=me*B-k;for(let Ie=0;Ie<ae;Ie++){const tt=Ie*w-Q;oe[T]=tt*S,oe[b]=ye*E,oe[y]=j,h.push(oe.x,oe.y,oe.z),oe[T]=0,oe[b]=0,oe[y]=R>0?1:-1,p.push(oe.x,oe.y,oe.z),g.push(Ie/L),g.push(1-me/z),ne+=1}}for(let me=0;me<z;me++)for(let ye=0;ye<L;ye++){const Ie=m+ye+ae*me,tt=m+ye+ae*(me+1),ee=m+(ye+1)+ae*(me+1),ve=m+(ye+1)+ae*me;c.push(Ie,tt,ve),c.push(tt,ee,ve),q+=6}u.addGroup(v,q,C),v+=q,m+=ne}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vl(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Cc(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const a=n[t][i];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=a.clone():Array.isArray(a)?e[t][i]=a.slice():e[t][i]=a}}return e}function Ci(n){const e={};for(let t=0;t<n.length;t++){const i=Cc(n[t]);for(const a in i)e[a]=i[a]}return e}function mB(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function ED(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ut.workingColorSpace}const TD={clone:Cc,merge:Ci};var gB=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,vB=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class as extends Mi{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=gB,this.fragmentShader=vB,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Cc(e.uniforms),this.uniformsGroups=mB(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const a in this.uniforms){const l=this.uniforms[a].value;l&&l.isTexture?t.uniforms[a]={type:"t",value:l.toJSON(e).uuid}:l&&l.isColor?t.uniforms[a]={type:"c",value:l.getHex()}:l&&l.isVector2?t.uniforms[a]={type:"v2",value:l.toArray()}:l&&l.isVector3?t.uniforms[a]={type:"v3",value:l.toArray()}:l&&l.isVector4?t.uniforms[a]={type:"v4",value:l.toArray()}:l&&l.isMatrix3?t.uniforms[a]={type:"m3",value:l.toArray()}:l&&l.isMatrix4?t.uniforms[a]={type:"m4",value:l.toArray()}:t.uniforms[a]={value:l}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class _0 extends Bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new lt,this.projectionMatrix=new lt,this.projectionMatrixInverse=new lt,this.coordinateSystem=Ss}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const kr=new P,cA=new he,fA=new he;class ti extends _0{constructor(e=50,t=1,i=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=a,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ac*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ml*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ac*2*Math.atan(Math.tan(Ml*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){kr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kr.x,kr.y).multiplyScalar(-e/kr.z),kr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(kr.x,kr.y).multiplyScalar(-e/kr.z)}getViewSize(e,t){return this.getViewBounds(e,cA,fA),t.subVectors(fA,cA)}setViewOffset(e,t,i,a,s,l){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ml*.5*this.fov)/this.zoom,i=2*t,a=this.aspect*i,s=-.5*a;const l=this.view;if(this.view!==null&&this.view.enabled){const c=l.fullWidth,h=l.fullHeight;s+=l.offsetX*a/c,t-=l.offsetY*i/h,a*=l.width/c,i*=l.height/h}const u=this.filmOffset;u!==0&&(s+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+a,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Du=-90,Uu=1;class AD extends Bt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const a=new ti(Du,Uu,e,t);a.layers=this.layers,this.add(a);const s=new ti(Du,Uu,e,t);s.layers=this.layers,this.add(s);const l=new ti(Du,Uu,e,t);l.layers=this.layers,this.add(l);const u=new ti(Du,Uu,e,t);u.layers=this.layers,this.add(u);const c=new ti(Du,Uu,e,t);c.layers=this.layers,this.add(c);const h=new ti(Du,Uu,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,a,s,l,u,c]=t;for(const h of t)this.remove(h);if(e===Ss)i.up.set(0,1,0),i.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Ih)i.up.set(0,-1,0),i.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:a}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,l,u,c,h,p]=this.children,g=e.getRenderTarget(),m=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const T=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,a),e.render(t,s),e.setRenderTarget(i,1,a),e.render(t,l),e.setRenderTarget(i,2,a),e.render(t,u),e.setRenderTarget(i,3,a),e.render(t,c),e.setRenderTarget(i,4,a),e.render(t,h),i.texture.generateMipmaps=T,e.setRenderTarget(i,5,a),e.render(t,p),e.setRenderTarget(g,m,v),e.xr.enabled=_,i.texture.needsPMREMUpdate=!0}}class rd extends Mn{constructor(e,t,i,a,s,l,u,c,h,p){e=e!==void 0?e:[],t=t!==void 0?t:yr,super(e,t,i,a,s,l,u,c,h,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class wD extends is{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},a=[i,i,i,i,i,i];this.texture=new rd(a,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Gn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},a=new Vl(5,5,5),s=new as({name:"CubemapFromEquirect",uniforms:Cc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ui,blending:cr});s.uniforms.tEquirect.value=t;const l=new Fn(a,s),u=t.minFilter;return t.minFilter===xs&&(t.minFilter=Gn),new AD(1,10,this).update(e,l),t.minFilter=u,l.geometry.dispose(),l.material.dispose(),this}clear(e,t,i,a){const s=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,i,a);e.setRenderTarget(s)}}const u_=new P,yB=new P,_B=new vt;class qr{constructor(e=new P(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,a){return this.normal.set(e,t,i),this.constant=a,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const a=u_.subVectors(i,t).cross(yB.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(a,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(u_),a=this.normal.dot(i);if(a===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/a;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||_B.getNormalMatrix(e),a=this.coplanarPoint(u_).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-a.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 jo=new bi,Up=new P;class od{constructor(e=new qr,t=new qr,i=new qr,a=new qr,s=new qr,l=new qr){this.planes=[e,t,i,a,s,l]}set(e,t,i,a,s,l){const u=this.planes;return u[0].copy(e),u[1].copy(t),u[2].copy(i),u[3].copy(a),u[4].copy(s),u[5].copy(l),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=Ss){const i=this.planes,a=e.elements,s=a[0],l=a[1],u=a[2],c=a[3],h=a[4],p=a[5],g=a[6],m=a[7],v=a[8],_=a[9],T=a[10],b=a[11],y=a[12],S=a[13],E=a[14],A=a[15];if(i[0].setComponents(c-s,m-h,b-v,A-y).normalize(),i[1].setComponents(c+s,m+h,b+v,A+y).normalize(),i[2].setComponents(c+l,m+p,b+_,A+S).normalize(),i[3].setComponents(c-l,m-p,b-_,A-S).normalize(),i[4].setComponents(c-u,m-g,b-T,A-E).normalize(),t===Ss)i[5].setComponents(c+u,m+g,b+T,A+E).normalize();else if(t===Ih)i[5].setComponents(u,g,T,E).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(),jo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),jo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(jo)}intersectsSprite(e){return jo.center.set(0,0,0),jo.radius=.7071067811865476,jo.applyMatrix4(e.matrixWorld),this.intersectsSphere(jo)}intersectsSphere(e){const t=this.planes,i=e.center,a=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<a)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const a=t[i];if(Up.x=a.normal.x>0?e.max.x:e.min.x,Up.y=a.normal.y>0?e.max.y:e.min.y,Up.z=a.normal.z>0?e.max.z:e.min.z,a.distanceToPoint(Up)<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 CD(){let n=null,e=!1,t=null,i=null;function a(s,l){t(s,l),i=n.requestAnimationFrame(a)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(a),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function xB(n){const e=new WeakMap;function t(u,c){const h=u.array,p=u.usage,g=h.byteLength,m=n.createBuffer();n.bindBuffer(c,m),n.bufferData(c,h,p),u.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)u.isFloat16BufferAttribute?v=n.HALF_FLOAT:v=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:g}}function i(u,c,h){const p=c.array,g=c.updateRanges;if(n.bindBuffer(h,u),g.length===0)n.bufferSubData(h,0,p);else{g.sort((v,_)=>v.start-_.start);let m=0;for(let v=1;v<g.length;v++){const _=g[m],T=g[v];T.start<=_.start+_.count+1?_.count=Math.max(_.count,T.start+T.count-_.start):(++m,g[m]=T)}g.length=m+1;for(let v=0,_=g.length;v<_;v++){const T=g[v];n.bufferSubData(h,T.start*p.BYTES_PER_ELEMENT,p,T.start,T.count)}c.clearUpdateRanges()}c.onUploadCallback()}function a(u){return u.isInterleavedBufferAttribute&&(u=u.data),e.get(u)}function s(u){u.isInterleavedBufferAttribute&&(u=u.data);const c=e.get(u);c&&(n.deleteBuffer(c.buffer),e.delete(u))}function l(u,c){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const p=e.get(u);(!p||p.version<u.version)&&e.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const h=e.get(u);if(h===void 0)e.set(u,t(u,c));else if(h.version<u.version){if(h.size!==u.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(h.buffer,u,c),h.version=u.version}}return{get:a,remove:s,update:l}}class Vc extends bt{constructor(e=1,t=1,i=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:a};const s=e/2,l=t/2,u=Math.floor(i),c=Math.floor(a),h=u+1,p=c+1,g=e/u,m=t/c,v=[],_=[],T=[],b=[];for(let y=0;y<p;y++){const S=y*m-l;for(let E=0;E<h;E++){const A=E*g-s;_.push(A,-S,0),T.push(0,0,1),b.push(E/u),b.push(1-y/c)}}for(let y=0;y<c;y++)for(let S=0;S<u;S++){const E=S+h*y,A=S+h*(y+1),I=S+1+h*(y+1),R=S+1+h*y;v.push(E,A,R),v.push(A,I,R)}this.setIndex(v),this.setAttribute("position",new Ye(_,3)),this.setAttribute("normal",new Ye(T,3)),this.setAttribute("uv",new Ye(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vc(e.width,e.height,e.widthSegments,e.heightSegments)}}var SB=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,bB=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,MB=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,EB=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,TB=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,AB=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,wB=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,CB=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,RB=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,DB=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,UB=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,LB=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,NB=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,IB=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,zB=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,OB=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,PB=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,BB=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,FB=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,HB=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,VB=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,kB=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,GB=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,XB=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,WB=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,qB=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,YB=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,ZB=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,jB=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,QB=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,KB="gl_FragColor = linearToOutputTexel( gl_FragColor );",JB=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,$B=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,e4=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,t4=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,n4=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,i4=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,a4=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,s4=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,r4=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,o4=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,l4=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,u4=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,c4=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,f4=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,h4=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,d4=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,p4=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,m4=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,g4=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,v4=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,y4=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,_4=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,x4=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,S4=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,b4=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,M4=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,E4=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,T4=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,A4=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,w4=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,C4=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,R4=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,D4=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,U4=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,L4=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,N4=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,I4=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,z4=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,O4=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,P4=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,B4=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,F4=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,H4=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,V4=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,k4=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,G4=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,X4=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,W4=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,q4=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,Y4=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,Z4=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,j4=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,Q4=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,K4=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,J4=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,$4=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,eF=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,tF=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,nF=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,iF=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,aF=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,sF=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,rF=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,oF=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,lF=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,uF=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,cF=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,fF=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,hF=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,dF=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,pF=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,mF=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
		
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
		
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,gF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,vF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,yF=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,_F=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const xF=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,SF=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,bF=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,MF=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,EF=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,TF=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,AF=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,wF=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,CF=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,RF=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,DF=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,UF=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,LF=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,NF=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,IF=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,zF=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,OF=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,PF=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,BF=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,FF=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,HF=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,VF=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,kF=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,GF=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,XF=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,WF=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,qF=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,YF=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,ZF=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,jF=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,QF=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,KF=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,JF=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,$F=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,St={alphahash_fragment:SB,alphahash_pars_fragment:bB,alphamap_fragment:MB,alphamap_pars_fragment:EB,alphatest_fragment:TB,alphatest_pars_fragment:AB,aomap_fragment:wB,aomap_pars_fragment:CB,batching_pars_vertex:RB,batching_vertex:DB,begin_vertex:UB,beginnormal_vertex:LB,bsdfs:NB,iridescence_fragment:IB,bumpmap_pars_fragment:zB,clipping_planes_fragment:OB,clipping_planes_pars_fragment:PB,clipping_planes_pars_vertex:BB,clipping_planes_vertex:FB,color_fragment:HB,color_pars_fragment:VB,color_pars_vertex:kB,color_vertex:GB,common:XB,cube_uv_reflection_fragment:WB,defaultnormal_vertex:qB,displacementmap_pars_vertex:YB,displacementmap_vertex:ZB,emissivemap_fragment:jB,emissivemap_pars_fragment:QB,colorspace_fragment:KB,colorspace_pars_fragment:JB,envmap_fragment:$B,envmap_common_pars_fragment:e4,envmap_pars_fragment:t4,envmap_pars_vertex:n4,envmap_physical_pars_fragment:d4,envmap_vertex:i4,fog_vertex:a4,fog_pars_vertex:s4,fog_fragment:r4,fog_pars_fragment:o4,gradientmap_pars_fragment:l4,lightmap_pars_fragment:u4,lights_lambert_fragment:c4,lights_lambert_pars_fragment:f4,lights_pars_begin:h4,lights_toon_fragment:p4,lights_toon_pars_fragment:m4,lights_phong_fragment:g4,lights_phong_pars_fragment:v4,lights_physical_fragment:y4,lights_physical_pars_fragment:_4,lights_fragment_begin:x4,lights_fragment_maps:S4,lights_fragment_end:b4,logdepthbuf_fragment:M4,logdepthbuf_pars_fragment:E4,logdepthbuf_pars_vertex:T4,logdepthbuf_vertex:A4,map_fragment:w4,map_pars_fragment:C4,map_particle_fragment:R4,map_particle_pars_fragment:D4,metalnessmap_fragment:U4,metalnessmap_pars_fragment:L4,morphinstance_vertex:N4,morphcolor_vertex:I4,morphnormal_vertex:z4,morphtarget_pars_vertex:O4,morphtarget_vertex:P4,normal_fragment_begin:B4,normal_fragment_maps:F4,normal_pars_fragment:H4,normal_pars_vertex:V4,normal_vertex:k4,normalmap_pars_fragment:G4,clearcoat_normal_fragment_begin:X4,clearcoat_normal_fragment_maps:W4,clearcoat_pars_fragment:q4,iridescence_pars_fragment:Y4,opaque_fragment:Z4,packing:j4,premultiplied_alpha_fragment:Q4,project_vertex:K4,dithering_fragment:J4,dithering_pars_fragment:$4,roughnessmap_fragment:eF,roughnessmap_pars_fragment:tF,shadowmap_pars_fragment:nF,shadowmap_pars_vertex:iF,shadowmap_vertex:aF,shadowmask_pars_fragment:sF,skinbase_vertex:rF,skinning_pars_vertex:oF,skinning_vertex:lF,skinnormal_vertex:uF,specularmap_fragment:cF,specularmap_pars_fragment:fF,tonemapping_fragment:hF,tonemapping_pars_fragment:dF,transmission_fragment:pF,transmission_pars_fragment:mF,uv_pars_fragment:gF,uv_pars_vertex:vF,uv_vertex:yF,worldpos_vertex:_F,background_vert:xF,background_frag:SF,backgroundCube_vert:bF,backgroundCube_frag:MF,cube_vert:EF,cube_frag:TF,depth_vert:AF,depth_frag:wF,distanceRGBA_vert:CF,distanceRGBA_frag:RF,equirect_vert:DF,equirect_frag:UF,linedashed_vert:LF,linedashed_frag:NF,meshbasic_vert:IF,meshbasic_frag:zF,meshlambert_vert:OF,meshlambert_frag:PF,meshmatcap_vert:BF,meshmatcap_frag:FF,meshnormal_vert:HF,meshnormal_frag:VF,meshphong_vert:kF,meshphong_frag:GF,meshphysical_vert:XF,meshphysical_frag:WF,meshtoon_vert:qF,meshtoon_frag:YF,points_vert:ZF,points_frag:jF,shadow_vert:QF,shadow_frag:KF,sprite_vert:JF,sprite_frag:$F},Re={common:{diffuse:{value:new Be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new vt},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new vt}},envmap:{envMap:{value:null},envMapRotation:{value:new vt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new vt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new vt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new vt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new vt},normalScale:{value:new he(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new vt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new vt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new vt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new vt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Be(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 Be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0},uvTransform:{value:new vt}},sprite:{diffuse:{value:new Be(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new vt},alphaMap:{value:null},alphaMapTransform:{value:new vt},alphaTest:{value:0}}},ts={basic:{uniforms:Ci([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.fog]),vertexShader:St.meshbasic_vert,fragmentShader:St.meshbasic_frag},lambert:{uniforms:Ci([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,Re.lights,{emissive:{value:new Be(0)}}]),vertexShader:St.meshlambert_vert,fragmentShader:St.meshlambert_frag},phong:{uniforms:Ci([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,Re.lights,{emissive:{value:new Be(0)},specular:{value:new Be(1118481)},shininess:{value:30}}]),vertexShader:St.meshphong_vert,fragmentShader:St.meshphong_frag},standard:{uniforms:Ci([Re.common,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.roughnessmap,Re.metalnessmap,Re.fog,Re.lights,{emissive:{value:new Be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag},toon:{uniforms:Ci([Re.common,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.gradientmap,Re.fog,Re.lights,{emissive:{value:new Be(0)}}]),vertexShader:St.meshtoon_vert,fragmentShader:St.meshtoon_frag},matcap:{uniforms:Ci([Re.common,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,{matcap:{value:null}}]),vertexShader:St.meshmatcap_vert,fragmentShader:St.meshmatcap_frag},points:{uniforms:Ci([Re.points,Re.fog]),vertexShader:St.points_vert,fragmentShader:St.points_frag},dashed:{uniforms:Ci([Re.common,Re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:St.linedashed_vert,fragmentShader:St.linedashed_frag},depth:{uniforms:Ci([Re.common,Re.displacementmap]),vertexShader:St.depth_vert,fragmentShader:St.depth_frag},normal:{uniforms:Ci([Re.common,Re.bumpmap,Re.normalmap,Re.displacementmap,{opacity:{value:1}}]),vertexShader:St.meshnormal_vert,fragmentShader:St.meshnormal_frag},sprite:{uniforms:Ci([Re.sprite,Re.fog]),vertexShader:St.sprite_vert,fragmentShader:St.sprite_frag},background:{uniforms:{uvTransform:{value:new vt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:St.background_vert,fragmentShader:St.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new vt}},vertexShader:St.backgroundCube_vert,fragmentShader:St.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:St.cube_vert,fragmentShader:St.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:St.equirect_vert,fragmentShader:St.equirect_frag},distanceRGBA:{uniforms:Ci([Re.common,Re.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:St.distanceRGBA_vert,fragmentShader:St.distanceRGBA_frag},shadow:{uniforms:Ci([Re.lights,Re.fog,{color:{value:new Be(0)},opacity:{value:1}}]),vertexShader:St.shadow_vert,fragmentShader:St.shadow_frag}};ts.physical={uniforms:Ci([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new vt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new vt},clearcoatNormalScale:{value:new he(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new vt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new vt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new vt},sheen:{value:0},sheenColor:{value:new Be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new vt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new vt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new vt},transmissionSamplerSize:{value:new he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new vt},attenuationDistance:{value:0},attenuationColor:{value:new Be(0)},specularColor:{value:new Be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new vt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new vt},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new vt}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag};const Lp={r:0,b:0,g:0},Qo=new ba,e5=new lt;function t5(n,e,t,i,a,s,l){const u=new Be(0);let c=s===!0?0:1,h,p,g=null,m=0,v=null;function _(S){let E=S.isScene===!0?S.background:null;return E&&E.isTexture&&(E=(S.backgroundBlurriness>0?t:e).get(E)),E}function T(S){let E=!1;const A=_(S);A===null?y(u,c):A&&A.isColor&&(y(A,1),E=!0);const I=n.xr.getEnvironmentBlendMode();I==="additive"?i.buffers.color.setClear(0,0,0,1,l):I==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,l),(n.autoClear||E)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function b(S,E){const A=_(E);A&&(A.isCubeTexture||A.mapping===Bc)?(p===void 0&&(p=new Fn(new Vl(1,1,1),new as({name:"BackgroundCubeMaterial",uniforms:Cc(ts.backgroundCube.uniforms),vertexShader:ts.backgroundCube.vertexShader,fragmentShader:ts.backgroundCube.fragmentShader,side:Ui,depthTest:!1,depthWrite:!1,fog:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(I,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(p)),Qo.copy(E.backgroundRotation),Qo.x*=-1,Qo.y*=-1,Qo.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Qo.y*=-1,Qo.z*=-1),p.material.uniforms.envMap.value=A,p.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(e5.makeRotationFromEuler(Qo)),p.material.toneMapped=Ut.getTransfer(A.colorSpace)!==Zt,(g!==A||m!==A.version||v!==n.toneMapping)&&(p.material.needsUpdate=!0,g=A,m=A.version,v=n.toneMapping),p.layers.enableAll(),S.unshift(p,p.geometry,p.material,0,0,null)):A&&A.isTexture&&(h===void 0&&(h=new Fn(new Vc(2,2),new as({name:"BackgroundMaterial",uniforms:Cc(ts.background.uniforms),vertexShader:ts.background.vertexShader,fragmentShader:ts.background.fragmentShader,side:vr,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(h)),h.material.uniforms.t2D.value=A,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.toneMapped=Ut.getTransfer(A.colorSpace)!==Zt,A.matrixAutoUpdate===!0&&A.updateMatrix(),h.material.uniforms.uvTransform.value.copy(A.matrix),(g!==A||m!==A.version||v!==n.toneMapping)&&(h.material.needsUpdate=!0,g=A,m=A.version,v=n.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null))}function y(S,E){S.getRGB(Lp,ED(n)),i.buffers.color.setClear(Lp.r,Lp.g,Lp.b,E,l)}return{getClearColor:function(){return u},setClearColor:function(S,E=1){u.set(S),c=E,y(u,c)},getClearAlpha:function(){return c},setClearAlpha:function(S){c=S,y(u,c)},render:T,addToRenderList:b}}function n5(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},a=m(null);let s=a,l=!1;function u(w,B,Q,k,j){let ae=!1;const V=g(k,Q,B);s!==V&&(s=V,h(s.object)),ae=v(w,k,Q,j),ae&&_(w,k,Q,j),j!==null&&e.update(j,n.ELEMENT_ARRAY_BUFFER),(ae||l)&&(l=!1,A(w,B,Q,k),j!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function c(){return n.createVertexArray()}function h(w){return n.bindVertexArray(w)}function p(w){return n.deleteVertexArray(w)}function g(w,B,Q){const k=Q.wireframe===!0;let j=i[w.id];j===void 0&&(j={},i[w.id]=j);let ae=j[B.id];ae===void 0&&(ae={},j[B.id]=ae);let V=ae[k];return V===void 0&&(V=m(c()),ae[k]=V),V}function m(w){const B=[],Q=[],k=[];for(let j=0;j<t;j++)B[j]=0,Q[j]=0,k[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:Q,attributeDivisors:k,object:w,attributes:{},index:null}}function v(w,B,Q,k){const j=s.attributes,ae=B.attributes;let V=0;const ne=Q.getAttributes();for(const q in ne)if(ne[q].location>=0){const me=j[q];let ye=ae[q];if(ye===void 0&&(q==="instanceMatrix"&&w.instanceMatrix&&(ye=w.instanceMatrix),q==="instanceColor"&&w.instanceColor&&(ye=w.instanceColor)),me===void 0||me.attribute!==ye||ye&&me.data!==ye.data)return!0;V++}return s.attributesNum!==V||s.index!==k}function _(w,B,Q,k){const j={},ae=B.attributes;let V=0;const ne=Q.getAttributes();for(const q in ne)if(ne[q].location>=0){let me=ae[q];me===void 0&&(q==="instanceMatrix"&&w.instanceMatrix&&(me=w.instanceMatrix),q==="instanceColor"&&w.instanceColor&&(me=w.instanceColor));const ye={};ye.attribute=me,me&&me.data&&(ye.data=me.data),j[q]=ye,V++}s.attributes=j,s.attributesNum=V,s.index=k}function T(){const w=s.newAttributes;for(let B=0,Q=w.length;B<Q;B++)w[B]=0}function b(w){y(w,0)}function y(w,B){const Q=s.newAttributes,k=s.enabledAttributes,j=s.attributeDivisors;Q[w]=1,k[w]===0&&(n.enableVertexAttribArray(w),k[w]=1),j[w]!==B&&(n.vertexAttribDivisor(w,B),j[w]=B)}function S(){const w=s.newAttributes,B=s.enabledAttributes;for(let Q=0,k=B.length;Q<k;Q++)B[Q]!==w[Q]&&(n.disableVertexAttribArray(Q),B[Q]=0)}function E(w,B,Q,k,j,ae,V){V===!0?n.vertexAttribIPointer(w,B,Q,j,ae):n.vertexAttribPointer(w,B,Q,k,j,ae)}function A(w,B,Q,k){T();const j=k.attributes,ae=Q.getAttributes(),V=B.defaultAttributeValues;for(const ne in ae){const q=ae[ne];if(q.location>=0){let oe=j[ne];if(oe===void 0&&(ne==="instanceMatrix"&&w.instanceMatrix&&(oe=w.instanceMatrix),ne==="instanceColor"&&w.instanceColor&&(oe=w.instanceColor)),oe!==void 0){const me=oe.normalized,ye=oe.itemSize,Ie=e.get(oe);if(Ie===void 0)continue;const tt=Ie.buffer,ee=Ie.type,ve=Ie.bytesPerElement,Pe=ee===n.INT||ee===n.UNSIGNED_INT||oe.gpuType===f0;if(oe.isInterleavedBufferAttribute){const Ee=oe.data,je=Ee.stride,Qe=oe.offset;if(Ee.isInstancedInterleavedBuffer){for(let nt=0;nt<q.locationSize;nt++)y(q.location+nt,Ee.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=Ee.meshPerAttribute*Ee.count)}else for(let nt=0;nt<q.locationSize;nt++)b(q.location+nt);n.bindBuffer(n.ARRAY_BUFFER,tt);for(let nt=0;nt<q.locationSize;nt++)E(q.location+nt,ye/q.locationSize,ee,me,je*ve,(Qe+ye/q.locationSize*nt)*ve,Pe)}else{if(oe.isInstancedBufferAttribute){for(let Ee=0;Ee<q.locationSize;Ee++)y(q.location+Ee,oe.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ee=0;Ee<q.locationSize;Ee++)b(q.location+Ee);n.bindBuffer(n.ARRAY_BUFFER,tt);for(let Ee=0;Ee<q.locationSize;Ee++)E(q.location+Ee,ye/q.locationSize,ee,me,ye*ve,ye/q.locationSize*Ee*ve,Pe)}}else if(V!==void 0){const me=V[ne];if(me!==void 0)switch(me.length){case 2:n.vertexAttrib2fv(q.location,me);break;case 3:n.vertexAttrib3fv(q.location,me);break;case 4:n.vertexAttrib4fv(q.location,me);break;default:n.vertexAttrib1fv(q.location,me)}}}}S()}function I(){z();for(const w in i){const B=i[w];for(const Q in B){const k=B[Q];for(const j in k)p(k[j].object),delete k[j];delete B[Q]}delete i[w]}}function R(w){if(i[w.id]===void 0)return;const B=i[w.id];for(const Q in B){const k=B[Q];for(const j in k)p(k[j].object),delete k[j];delete B[Q]}delete i[w.id]}function L(w){for(const B in i){const Q=i[B];if(Q[w.id]===void 0)continue;const k=Q[w.id];for(const j in k)p(k[j].object),delete k[j];delete Q[w.id]}}function z(){C(),l=!0,s!==a&&(s=a,h(s.object))}function C(){a.geometry=null,a.program=null,a.wireframe=!1}return{setup:u,reset:z,resetDefaultState:C,dispose:I,releaseStatesOfGeometry:R,releaseStatesOfProgram:L,initAttributes:T,enableAttribute:b,disableUnusedAttributes:S}}function i5(n,e,t){let i;function a(h){i=h}function s(h,p){n.drawArrays(i,h,p),t.update(p,i,1)}function l(h,p,g){g!==0&&(n.drawArraysInstanced(i,h,p,g),t.update(p,i,g))}function u(h,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,h,0,p,0,g);let v=0;for(let _=0;_<g;_++)v+=p[_];t.update(v,i,1)}function c(h,p,g,m){if(g===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<h.length;_++)l(h[_],p[_],m[_]);else{v.multiDrawArraysInstancedWEBGL(i,h,0,p,0,m,0,g);let _=0;for(let T=0;T<g;T++)_+=p[T]*m[T];t.update(_,i,1)}}this.setMode=a,this.render=s,this.renderInstances=l,this.renderMultiDraw=u,this.renderMultiDrawInstances=c}function a5(n,e,t,i){let a;function s(){if(a!==void 0)return a;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");a=n.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a}function l(L){return!(L!==Si&&i.convert(L)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function u(L){const z=L===Fc&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==ns&&i.convert(L)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Zi&&!z)}function c(L){if(L==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const p=c(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);const g=t.logarithmicDepthBuffer===!0,m=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),v=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),T=n.getParameter(n.MAX_TEXTURE_SIZE),b=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),y=n.getParameter(n.MAX_VERTEX_ATTRIBS),S=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),E=n.getParameter(n.MAX_VARYING_VECTORS),A=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),I=_>0,R=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:l,textureTypeReadable:u,precision:h,logarithmicDepthBuffer:g,reverseDepthBuffer:m,maxTextures:v,maxVertexTextures:_,maxTextureSize:T,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:S,maxVaryings:E,maxFragmentUniforms:A,vertexTextures:I,maxSamples:R}}function s5(n){const e=this;let t=null,i=0,a=!1,s=!1;const l=new qr,u=new vt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(g,m){const v=g.length!==0||m||i!==0||a;return a=m,i=g.length,v},this.beginShadows=function(){s=!0,p(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(g,m){t=p(g,m,0)},this.setState=function(g,m,v){const _=g.clippingPlanes,T=g.clipIntersection,b=g.clipShadows,y=n.get(g);if(!a||_===null||_.length===0||s&&!b)s?p(null):h();else{const S=s?0:i,E=S*4;let A=y.clippingState||null;c.value=A,A=p(_,m,E,v);for(let I=0;I!==E;++I)A[I]=t[I];y.clippingState=A,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=S}};function h(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function p(g,m,v,_){const T=g!==null?g.length:0;let b=null;if(T!==0){if(b=c.value,_!==!0||b===null){const y=v+T*4,S=m.matrixWorldInverse;u.getNormalMatrix(S),(b===null||b.length<y)&&(b=new Float32Array(y));for(let E=0,A=v;E!==T;++E,A+=4)l.copy(g[E]).applyMatrix4(S,u),l.normal.toArray(b,A),b[A+3]=l.constant}c.value=b,c.needsUpdate=!0}return e.numPlanes=T,e.numIntersection=0,b}}function r5(n){let e=new WeakMap;function t(l,u){return u===wh?l.mapping=yr:u===Ch&&(l.mapping=yo),l}function i(l){if(l&&l.isTexture){const u=l.mapping;if(u===wh||u===Ch)if(e.has(l)){const c=e.get(l).texture;return t(c,l.mapping)}else{const c=l.image;if(c&&c.height>0){const h=new wD(c.height);return h.fromEquirectangularTexture(n,l),e.set(l,h),l.addEventListener("dispose",a),t(h.texture,l.mapping)}else return null}}return l}function a(l){const u=l.target;u.removeEventListener("dispose",a);const c=e.get(u);c!==void 0&&(e.delete(u),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class ld extends _0{constructor(e=-1,t=1,i=1,a=-1,s=.1,l=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=a,this.near=s,this.far=l,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,a,s,l){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=l,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,a=(this.top+this.bottom)/2;let s=i-e,l=i+e,u=a+t,c=a-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,l=s+h*this.view.width,u-=p*this.view.offsetY,c=u-p*this.view.height}this.projectionMatrix.makeOrthographic(s,l,u,c,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 ic=4,hA=[.125,.215,.35,.446,.526,.582],fl=20,c_=new ld,dA=new Be;let f_=null,h_=0,d_=0,p_=!1;const cl=(1+Math.sqrt(5))/2,Lu=1/cl,pA=[new P(-cl,Lu,0),new P(cl,Lu,0),new P(-Lu,0,cl),new P(Lu,0,cl),new P(0,cl,-Lu),new P(0,cl,Lu),new P(-1,1,-1),new P(1,1,-1),new P(-1,1,1),new P(1,1,1)];class Vx{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,a=100){f_=this._renderer.getRenderTarget(),h_=this._renderer.getActiveCubeFace(),d_=this._renderer.getActiveMipmapLevel(),p_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,a,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=vA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gA(),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(f_,h_,d_),this._renderer.xr.enabled=p_,e.scissorTest=!1,Np(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===yr||e.mapping===yo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),f_=this._renderer.getRenderTarget(),h_=this._renderer.getActiveCubeFace(),d_=this._renderer.getActiveMipmapLevel(),p_=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:Gn,minFilter:Gn,generateMipmaps:!1,type:Fc,format:Si,colorSpace:Mo,depthBuffer:!1},a=mA(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mA(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=o5(s)),this._blurMaterial=l5(s,e,t)}return a}_compileMaterial(e){const t=new Fn(this._lodPlanes[0],e);this._renderer.compile(t,c_)}_sceneToCubeUV(e,t,i,a){const u=new ti(90,1,t,i),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],p=this._renderer,g=p.autoClear,m=p.toneMapping;p.getClearColor(dA),p.toneMapping=Ms,p.autoClear=!1;const v=new Eo({name:"PMREM.Background",side:Ui,depthWrite:!1,depthTest:!1}),_=new Fn(new Vl,v);let T=!1;const b=e.background;b?b.isColor&&(v.color.copy(b),e.background=null,T=!0):(v.color.copy(dA),T=!0);for(let y=0;y<6;y++){const S=y%3;S===0?(u.up.set(0,c[y],0),u.lookAt(h[y],0,0)):S===1?(u.up.set(0,0,c[y]),u.lookAt(0,h[y],0)):(u.up.set(0,c[y],0),u.lookAt(0,0,h[y]));const E=this._cubeSize;Np(a,S*E,y>2?E:0,E,E),p.setRenderTarget(a),T&&p.render(_,u),p.render(e,u)}_.geometry.dispose(),_.material.dispose(),p.toneMapping=m,p.autoClear=g,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,a=e.mapping===yr||e.mapping===yo;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=vA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gA());const s=a?this._cubemapMaterial:this._equirectMaterial,l=new Fn(this._lodPlanes[0],s),u=s.uniforms;u.envMap.value=e;const c=this._cubeSize;Np(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(l,c_)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const a=this._lodPlanes.length;for(let s=1;s<a;s++){const l=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),u=pA[(a-s-1)%pA.length];this._blur(e,s-1,s,l,u)}t.autoClear=i}_blur(e,t,i,a,s){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,i,a,"latitudinal",s),this._halfBlur(l,e,i,i,a,"longitudinal",s)}_halfBlur(e,t,i,a,s,l,u){const c=this._renderer,h=this._blurMaterial;l!=="latitudinal"&&l!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const p=3,g=new Fn(this._lodPlanes[a],h),m=h.uniforms,v=this._sizeLods[i]-1,_=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*fl-1),T=s/_,b=isFinite(s)?1+Math.floor(p*T):fl;b>fl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${fl}`);const y=[];let S=0;for(let L=0;L<fl;++L){const z=L/T,C=Math.exp(-z*z/2);y.push(C),L===0?S+=C:L<b&&(S+=2*C)}for(let L=0;L<y.length;L++)y[L]=y[L]/S;m.envMap.value=e.texture,m.samples.value=b,m.weights.value=y,m.latitudinal.value=l==="latitudinal",u&&(m.poleAxis.value=u);const{_lodMax:E}=this;m.dTheta.value=_,m.mipInt.value=E-i;const A=this._sizeLods[a],I=3*A*(a>E-ic?a-E+ic:0),R=4*(this._cubeSize-A);Np(t,I,R,3*A,2*A),c.setRenderTarget(t),c.render(g,c_)}}function o5(n){const e=[],t=[],i=[];let a=n;const s=n-ic+1+hA.length;for(let l=0;l<s;l++){const u=Math.pow(2,a);t.push(u);let c=1/u;l>n-ic?c=hA[l-n+ic-1]:l===0&&(c=0),i.push(c);const h=1/(u-2),p=-h,g=1+h,m=[p,p,g,p,g,g,p,p,g,g,p,g],v=6,_=6,T=3,b=2,y=1,S=new Float32Array(T*_*v),E=new Float32Array(b*_*v),A=new Float32Array(y*_*v);for(let R=0;R<v;R++){const L=R%3*2/3-1,z=R>2?0:-1,C=[L,z,0,L+2/3,z,0,L+2/3,z+1,0,L,z,0,L+2/3,z+1,0,L,z+1,0];S.set(C,T*_*R),E.set(m,b*_*R);const w=[R,R,R,R,R,R];A.set(w,y*_*R)}const I=new bt;I.setAttribute("position",new tn(S,T)),I.setAttribute("uv",new tn(E,b)),I.setAttribute("faceIndex",new tn(A,y)),e.push(I),a>ic&&a--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function mA(n,e,t){const i=new is(n,e,t);return i.texture.mapping=Bc,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Np(n,e,t,i,a){n.viewport.set(e,t,i,a),n.scissor.set(e,t,i,a)}function l5(n,e,t){const i=new Float32Array(fl),a=new P(0,1,0);return new as({name:"SphericalGaussianBlur",defines:{n:fl,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:a}},vertexShader:gb(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:cr,depthTest:!1,depthWrite:!1})}function gA(){return new as({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:gb(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:cr,depthTest:!1,depthWrite:!1})}function vA(){return new as({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:gb(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:cr,depthTest:!1,depthWrite:!1})}function gb(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function u5(n){let e=new WeakMap,t=null;function i(u){if(u&&u.isTexture){const c=u.mapping,h=c===wh||c===Ch,p=c===yr||c===yo;if(h||p){let g=e.get(u);const m=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==m)return t===null&&(t=new Vx(n)),g=h?t.fromEquirectangular(u,g):t.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,e.set(u,g),g.texture;if(g!==void 0)return g.texture;{const v=u.image;return h&&v&&v.height>0||p&&v&&a(v)?(t===null&&(t=new Vx(n)),g=h?t.fromEquirectangular(u):t.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,e.set(u,g),u.addEventListener("dispose",s),g.texture):null}}}return u}function a(u){let c=0;const h=6;for(let p=0;p<h;p++)u[p]!==void 0&&c++;return c===h}function s(u){const c=u.target;c.removeEventListener("dispose",s);const h=e.get(c);h!==void 0&&(e.delete(c),h.dispose())}function l(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:l}}function c5(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let a;switch(i){case"WEBGL_depth_texture":a=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=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":a=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":a=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=n.getExtension(i)}return e[i]=a,a}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 a=t(i);return a===null&&Hf("THREE.WebGLRenderer: "+i+" extension not supported."),a}}}function f5(n,e,t,i){const a={},s=new WeakMap;function l(g){const m=g.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);for(const _ in m.morphAttributes){const T=m.morphAttributes[_];for(let b=0,y=T.length;b<y;b++)e.remove(T[b])}m.removeEventListener("dispose",l),delete a[m.id];const v=s.get(m);v&&(e.remove(v),s.delete(m)),i.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function u(g,m){return a[m.id]===!0||(m.addEventListener("dispose",l),a[m.id]=!0,t.memory.geometries++),m}function c(g){const m=g.attributes;for(const _ in m)e.update(m[_],n.ARRAY_BUFFER);const v=g.morphAttributes;for(const _ in v){const T=v[_];for(let b=0,y=T.length;b<y;b++)e.update(T[b],n.ARRAY_BUFFER)}}function h(g){const m=[],v=g.index,_=g.attributes.position;let T=0;if(v!==null){const S=v.array;T=v.version;for(let E=0,A=S.length;E<A;E+=3){const I=S[E+0],R=S[E+1],L=S[E+2];m.push(I,R,R,L,L,I)}}else if(_!==void 0){const S=_.array;T=_.version;for(let E=0,A=S.length/3-1;E<A;E+=3){const I=E+0,R=E+1,L=E+2;m.push(I,R,R,L,L,I)}}else return;const b=new(_D(m)?mb:pb)(m,1);b.version=T;const y=s.get(g);y&&e.remove(y),s.set(g,b)}function p(g){const m=s.get(g);if(m){const v=g.index;v!==null&&m.version<v.version&&h(g)}else h(g);return s.get(g)}return{get:u,update:c,getWireframeAttribute:p}}function h5(n,e,t){let i;function a(m){i=m}let s,l;function u(m){s=m.type,l=m.bytesPerElement}function c(m,v){n.drawElements(i,v,s,m*l),t.update(v,i,1)}function h(m,v,_){_!==0&&(n.drawElementsInstanced(i,v,s,m*l,_),t.update(v,i,_))}function p(m,v,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,v,0,s,m,0,_);let b=0;for(let y=0;y<_;y++)b+=v[y];t.update(b,i,1)}function g(m,v,_,T){if(_===0)return;const b=e.get("WEBGL_multi_draw");if(b===null)for(let y=0;y<m.length;y++)h(m[y]/l,v[y],T[y]);else{b.multiDrawElementsInstancedWEBGL(i,v,0,s,m,0,T,0,_);let y=0;for(let S=0;S<_;S++)y+=v[S]*T[S];t.update(y,i,1)}}this.setMode=a,this.setIndex=u,this.render=c,this.renderInstances=h,this.renderMultiDraw=p,this.renderMultiDrawInstances=g}function d5(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,l,u){switch(t.calls++,l){case n.TRIANGLES:t.triangles+=u*(s/3);break;case n.LINES:t.lines+=u*(s/2);break;case n.LINE_STRIP:t.lines+=u*(s-1);break;case n.LINE_LOOP:t.lines+=u*s;break;case n.POINTS:t.points+=u*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",l);break}}function a(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:a,update:i}}function p5(n,e,t){const i=new WeakMap,a=new Pt;function s(l,u,c){const h=l.morphTargetInfluences,p=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,g=p!==void 0?p.length:0;let m=i.get(u);if(m===void 0||m.count!==g){let C=function(){L.dispose(),i.delete(u),u.removeEventListener("dispose",C)};m!==void 0&&m.texture.dispose();const v=u.morphAttributes.position!==void 0,_=u.morphAttributes.normal!==void 0,T=u.morphAttributes.color!==void 0,b=u.morphAttributes.position||[],y=u.morphAttributes.normal||[],S=u.morphAttributes.color||[];let E=0;v===!0&&(E=1),_===!0&&(E=2),T===!0&&(E=3);let A=u.attributes.position.count*E,I=1;A>e.maxTextureSize&&(I=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const R=new Float32Array(A*I*4*g),L=new y0(R,A,I,g);L.type=Zi,L.needsUpdate=!0;const z=E*4;for(let w=0;w<g;w++){const B=b[w],Q=y[w],k=S[w],j=A*I*4*w;for(let ae=0;ae<B.count;ae++){const V=ae*z;v===!0&&(a.fromBufferAttribute(B,ae),R[j+V+0]=a.x,R[j+V+1]=a.y,R[j+V+2]=a.z,R[j+V+3]=0),_===!0&&(a.fromBufferAttribute(Q,ae),R[j+V+4]=a.x,R[j+V+5]=a.y,R[j+V+6]=a.z,R[j+V+7]=0),T===!0&&(a.fromBufferAttribute(k,ae),R[j+V+8]=a.x,R[j+V+9]=a.y,R[j+V+10]=a.z,R[j+V+11]=k.itemSize===4?a.w:1)}}m={count:g,texture:L,size:new he(A,I)},i.set(u,m),u.addEventListener("dispose",C)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)c.getUniforms().setValue(n,"morphTexture",l.morphTexture,t);else{let v=0;for(let T=0;T<h.length;T++)v+=h[T];const _=u.morphTargetsRelative?1:1-v;c.getUniforms().setValue(n,"morphTargetBaseInfluence",_),c.getUniforms().setValue(n,"morphTargetInfluences",h)}c.getUniforms().setValue(n,"morphTargetsTexture",m.texture,t),c.getUniforms().setValue(n,"morphTargetsTextureSize",m.size)}return{update:s}}function m5(n,e,t,i){let a=new WeakMap;function s(c){const h=i.render.frame,p=c.geometry,g=e.get(c,p);if(a.get(g)!==h&&(e.update(g),a.set(g,h)),c.isInstancedMesh&&(c.hasEventListener("dispose",u)===!1&&c.addEventListener("dispose",u),a.get(c)!==h&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),a.set(c,h))),c.isSkinnedMesh){const m=c.skeleton;a.get(m)!==h&&(m.update(),a.set(m,h))}return g}function l(){a=new WeakMap}function u(c){const h=c.target;h.removeEventListener("dispose",u),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:l}}class vb extends Mn{constructor(e,t,i,a,s,l,u,c,h,p=bl){if(p!==bl&&p!==Ll)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&p===bl&&(i=_r),i===void 0&&p===Ll&&(i=Ul),super(null,a,s,l,u,c,p,i,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=u!==void 0?u:di,this.minFilter=c!==void 0?c:di,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 RD=new Mn,yA=new vb(1,1),DD=new y0,UD=new db,LD=new rd,_A=[],xA=[],SA=new Float32Array(16),bA=new Float32Array(9),MA=new Float32Array(4);function kc(n,e,t){const i=n[0];if(i<=0||i>0)return n;const a=e*t;let s=_A[a];if(s===void 0&&(s=new Float32Array(a),_A[a]=s),e!==0){i.toArray(s,0);for(let l=1,u=0;l!==e;++l)u+=t,n[l].toArray(s,u)}return s}function Wn(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 qn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function x0(n,e){let t=xA[e];t===void 0&&(t=new Int32Array(e),xA[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function g5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function v5(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(Wn(t,e))return;n.uniform2fv(this.addr,e),qn(t,e)}}function y5(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(Wn(t,e))return;n.uniform3fv(this.addr,e),qn(t,e)}}function _5(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(Wn(t,e))return;n.uniform4fv(this.addr,e),qn(t,e)}}function x5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Wn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),qn(t,e)}else{if(Wn(t,i))return;MA.set(i),n.uniformMatrix2fv(this.addr,!1,MA),qn(t,i)}}function S5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Wn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),qn(t,e)}else{if(Wn(t,i))return;bA.set(i),n.uniformMatrix3fv(this.addr,!1,bA),qn(t,i)}}function b5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Wn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),qn(t,e)}else{if(Wn(t,i))return;SA.set(i),n.uniformMatrix4fv(this.addr,!1,SA),qn(t,i)}}function M5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function E5(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(Wn(t,e))return;n.uniform2iv(this.addr,e),qn(t,e)}}function T5(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(Wn(t,e))return;n.uniform3iv(this.addr,e),qn(t,e)}}function A5(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(Wn(t,e))return;n.uniform4iv(this.addr,e),qn(t,e)}}function w5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function C5(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(Wn(t,e))return;n.uniform2uiv(this.addr,e),qn(t,e)}}function R5(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(Wn(t,e))return;n.uniform3uiv(this.addr,e),qn(t,e)}}function D5(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(Wn(t,e))return;n.uniform4uiv(this.addr,e),qn(t,e)}}function U5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a);let s;this.type===n.SAMPLER_2D_SHADOW?(yA.compareFunction=fb,s=yA):s=RD,t.setTexture2D(e||s,a)}function L5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTexture3D(e||UD,a)}function N5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTextureCube(e||LD,a)}function I5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTexture2DArray(e||DD,a)}function z5(n){switch(n){case 5126:return g5;case 35664:return v5;case 35665:return y5;case 35666:return _5;case 35674:return x5;case 35675:return S5;case 35676:return b5;case 5124:case 35670:return M5;case 35667:case 35671:return E5;case 35668:case 35672:return T5;case 35669:case 35673:return A5;case 5125:return w5;case 36294:return C5;case 36295:return R5;case 36296:return D5;case 35678:case 36198:case 36298:case 36306:case 35682:return U5;case 35679:case 36299:case 36307:return L5;case 35680:case 36300:case 36308:case 36293:return N5;case 36289:case 36303:case 36311:case 36292:return I5}}function O5(n,e){n.uniform1fv(this.addr,e)}function P5(n,e){const t=kc(e,this.size,2);n.uniform2fv(this.addr,t)}function B5(n,e){const t=kc(e,this.size,3);n.uniform3fv(this.addr,t)}function F5(n,e){const t=kc(e,this.size,4);n.uniform4fv(this.addr,t)}function H5(n,e){const t=kc(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function V5(n,e){const t=kc(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function k5(n,e){const t=kc(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function G5(n,e){n.uniform1iv(this.addr,e)}function X5(n,e){n.uniform2iv(this.addr,e)}function W5(n,e){n.uniform3iv(this.addr,e)}function q5(n,e){n.uniform4iv(this.addr,e)}function Y5(n,e){n.uniform1uiv(this.addr,e)}function Z5(n,e){n.uniform2uiv(this.addr,e)}function j5(n,e){n.uniform3uiv(this.addr,e)}function Q5(n,e){n.uniform4uiv(this.addr,e)}function K5(n,e,t){const i=this.cache,a=e.length,s=x0(t,a);Wn(i,s)||(n.uniform1iv(this.addr,s),qn(i,s));for(let l=0;l!==a;++l)t.setTexture2D(e[l]||RD,s[l])}function J5(n,e,t){const i=this.cache,a=e.length,s=x0(t,a);Wn(i,s)||(n.uniform1iv(this.addr,s),qn(i,s));for(let l=0;l!==a;++l)t.setTexture3D(e[l]||UD,s[l])}function $5(n,e,t){const i=this.cache,a=e.length,s=x0(t,a);Wn(i,s)||(n.uniform1iv(this.addr,s),qn(i,s));for(let l=0;l!==a;++l)t.setTextureCube(e[l]||LD,s[l])}function e6(n,e,t){const i=this.cache,a=e.length,s=x0(t,a);Wn(i,s)||(n.uniform1iv(this.addr,s),qn(i,s));for(let l=0;l!==a;++l)t.setTexture2DArray(e[l]||DD,s[l])}function t6(n){switch(n){case 5126:return O5;case 35664:return P5;case 35665:return B5;case 35666:return F5;case 35674:return H5;case 35675:return V5;case 35676:return k5;case 5124:case 35670:return G5;case 35667:case 35671:return X5;case 35668:case 35672:return W5;case 35669:case 35673:return q5;case 5125:return Y5;case 36294:return Z5;case 36295:return j5;case 36296:return Q5;case 35678:case 36198:case 36298:case 36306:case 35682:return K5;case 35679:case 36299:case 36307:return J5;case 35680:case 36300:case 36308:case 36293:return $5;case 36289:case 36303:case 36311:case 36292:return e6}}class n6{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=z5(t.type)}}class i6{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=t6(t.type)}}class a6{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const a=this.seq;for(let s=0,l=a.length;s!==l;++s){const u=a[s];u.setValue(e,t[u.id],i)}}}const m_=/(\w+)(\])?(\[|\.)?/g;function EA(n,e){n.seq.push(e),n.map[e.id]=e}function s6(n,e,t){const i=n.name,a=i.length;for(m_.lastIndex=0;;){const s=m_.exec(i),l=m_.lastIndex;let u=s[1];const c=s[2]==="]",h=s[3];if(c&&(u=u|0),h===void 0||h==="["&&l+2===a){EA(t,h===void 0?new n6(u,n,e):new i6(u,n,e));break}else{let g=t.map[u];g===void 0&&(g=new a6(u),EA(t,g)),t=g}}}class Em{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){const s=e.getActiveUniform(t,a),l=e.getUniformLocation(t,s.name);s6(s,l,this)}}setValue(e,t,i,a){const s=this.map[t];s!==void 0&&s.setValue(e,i,a)}setOptional(e,t,i){const a=t[i];a!==void 0&&this.setValue(e,i,a)}static upload(e,t,i,a){for(let s=0,l=t.length;s!==l;++s){const u=t[s],c=i[u.id];c.needsUpdate!==!1&&u.setValue(e,c.value,a)}}static seqWithValue(e,t){const i=[];for(let a=0,s=e.length;a!==s;++a){const l=e[a];l.id in t&&i.push(l)}return i}}function TA(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const r6=37297;let o6=0;function l6(n,e){const t=n.split(`
`),i=[],a=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let l=a;l<s;l++){const u=l+1;i.push(`${u===e?">":" "} ${u}: ${t[l]}`)}return i.join(`
`)}const AA=new vt;function u6(n){Ut._getMatrix(AA,Ut.workingColorSpace,n);const e=`mat3( ${AA.elements.map(t=>t.toFixed(4))} )`;switch(Ut.getTransfer(n)){case sd:return[e,"LinearTransferOETF"];case Zt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function wA(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),a=n.getShaderInfoLog(e).trim();if(i&&a==="")return"";const s=/ERROR: 0:(\d+)/.exec(a);if(s){const l=parseInt(s[1]);return t.toUpperCase()+`

`+a+`

`+l6(n.getShaderSource(e),l)}else return a}function c6(n,e){const t=u6(e);return[`vec4 ${n}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function f6(n,e){let t;switch(e){case $3:t="Linear";break;case eD:t="Reinhard";break;case tD:t="Cineon";break;case $S:t="ACESFilmic";break;case iD:t="AgX";break;case aD:t="Neutral";break;case nD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ip=new P;function h6(){Ut.getLuminanceCoefficients(Ip);const n=Ip.x.toFixed(4),e=Ip.y.toFixed(4),t=Ip.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${n}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function d6(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(kf).join(`
`)}function p6(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function m6(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let a=0;a<i;a++){const s=n.getActiveAttrib(e,a),l=s.name;let u=1;s.type===n.FLOAT_MAT2&&(u=2),s.type===n.FLOAT_MAT3&&(u=3),s.type===n.FLOAT_MAT4&&(u=4),t[l]={type:s.type,location:n.getAttribLocation(e,l),locationSize:u}}return t}function kf(n){return n!==""}function CA(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function RA(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const g6=/^[ \t]*#include +<([\w\d./]+)>/gm;function kx(n){return n.replace(g6,y6)}const v6=new Map;function y6(n,e){let t=St[e];if(t===void 0){const i=v6.get(e);if(i!==void 0)t=St[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return kx(t)}const _6=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function DA(n){return n.replace(_6,x6)}function x6(n,e,t,i){let a="";for(let s=parseInt(e);s<parseInt(t);s++)a+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return a}function UA(n){let e=`precision ${n.precision} float;
	precision ${n.precision} int;
	precision ${n.precision} sampler2D;
	precision ${n.precision} samplerCube;
	precision ${n.precision} sampler3D;
	precision ${n.precision} sampler2DArray;
	precision ${n.precision} sampler2DShadow;
	precision ${n.precision} samplerCubeShadow;
	precision ${n.precision} sampler2DArrayShadow;
	precision ${n.precision} isampler2D;
	precision ${n.precision} isampler3D;
	precision ${n.precision} isamplerCube;
	precision ${n.precision} isampler2DArray;
	precision ${n.precision} usampler2D;
	precision ${n.precision} usampler3D;
	precision ${n.precision} usamplerCube;
	precision ${n.precision} usampler2DArray;
	`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function S6(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===u0?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===nh?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===$a&&(e="SHADOWMAP_TYPE_VSM"),e}function b6(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case yr:case yo:e="ENVMAP_TYPE_CUBE";break;case Bc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function M6(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case yo:e="ENVMAP_MODE_REFRACTION";break}return e}function E6(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case id:e="ENVMAP_BLENDING_MULTIPLY";break;case K3:e="ENVMAP_BLENDING_MIX";break;case J3:e="ENVMAP_BLENDING_ADD";break}return e}function T6(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 A6(n,e,t,i){const a=n.getContext(),s=t.defines;let l=t.vertexShader,u=t.fragmentShader;const c=S6(t),h=b6(t),p=M6(t),g=E6(t),m=T6(t),v=d6(t),_=p6(s),T=a.createProgram();let b,y,S=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(kf).join(`
`),b.length>0&&(b+=`
`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(kf).join(`
`),y.length>0&&(y+=`
`)):(b=[UA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+p:"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(kf).join(`
`),y=[UA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+h:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ms?"#define TONE_MAPPING":"",t.toneMapping!==Ms?St.tonemapping_pars_fragment:"",t.toneMapping!==Ms?f6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",St.colorspace_pars_fragment,c6("linearToOutputTexel",t.outputColorSpace),h6(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(kf).join(`
`)),l=kx(l),l=CA(l,t),l=RA(l,t),u=kx(u),u=CA(u,t),u=RA(u,t),l=DA(l),u=DA(u),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
`,b=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+b,y=["#define varying in",t.glslVersion===Hx?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Hx?"":"#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(`
`)+`
`+y);const E=S+b+l,A=S+y+u,I=TA(a,a.VERTEX_SHADER,E),R=TA(a,a.FRAGMENT_SHADER,A);a.attachShader(T,I),a.attachShader(T,R),t.index0AttributeName!==void 0?a.bindAttribLocation(T,0,t.index0AttributeName):t.morphTargets===!0&&a.bindAttribLocation(T,0,"position"),a.linkProgram(T);function L(B){if(n.debug.checkShaderErrors){const Q=a.getProgramInfoLog(T).trim(),k=a.getShaderInfoLog(I).trim(),j=a.getShaderInfoLog(R).trim();let ae=!0,V=!0;if(a.getProgramParameter(T,a.LINK_STATUS)===!1)if(ae=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(a,T,I,R);else{const ne=wA(a,I,"vertex"),q=wA(a,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(T,a.VALIDATE_STATUS)+`

Material Name: `+B.name+`
Material Type: `+B.type+`

Program Info Log: `+Q+`
`+ne+`
`+q)}else Q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Q):(k===""||j==="")&&(V=!1);V&&(B.diagnostics={runnable:ae,programLog:Q,vertexShader:{log:k,prefix:b},fragmentShader:{log:j,prefix:y}})}a.deleteShader(I),a.deleteShader(R),z=new Em(a,T),C=m6(a,T)}let z;this.getUniforms=function(){return z===void 0&&L(this),z};let C;this.getAttributes=function(){return C===void 0&&L(this),C};let w=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=a.getProgramParameter(T,r6)),w},this.destroy=function(){i.releaseStatesOfProgram(this),a.deleteProgram(T),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=o6++,this.cacheKey=e,this.usedTimes=1,this.program=T,this.vertexShader=I,this.fragmentShader=R,this}let w6=0;class C6{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,a=this._getShaderStage(t),s=this._getShaderStage(i),l=this._getShaderCacheForMaterial(e);return l.has(a)===!1&&(l.add(a),a.usedTimes++),l.has(s)===!1&&(l.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 R6(e),t.set(e,i)),i}}class R6{constructor(e){this.id=w6++,this.code=e,this.usedTimes=0}}function D6(n,e,t,i,a,s,l){const u=new wc,c=new C6,h=new Set,p=[],g=a.logarithmicDepthBuffer,m=a.vertexTextures;let v=a.precision;const _={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 T(C){return h.add(C),C===0?"uv":`uv${C}`}function b(C,w,B,Q,k){const j=Q.fog,ae=k.geometry,V=C.isMeshStandardMaterial?Q.environment:null,ne=(C.isMeshStandardMaterial?t:e).get(C.envMap||V),q=ne&&ne.mapping===Bc?ne.image.height:null,oe=_[C.type];C.precision!==null&&(v=a.getMaxPrecision(C.precision),v!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",v,"instead."));const me=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,ye=me!==void 0?me.length:0;let Ie=0;ae.morphAttributes.position!==void 0&&(Ie=1),ae.morphAttributes.normal!==void 0&&(Ie=2),ae.morphAttributes.color!==void 0&&(Ie=3);let tt,ee,ve,Pe;if(oe){const Ft=ts[oe];tt=Ft.vertexShader,ee=Ft.fragmentShader}else tt=C.vertexShader,ee=C.fragmentShader,c.update(C),ve=c.getVertexShaderID(C),Pe=c.getFragmentShaderID(C);const Ee=n.getRenderTarget(),je=n.state.buffers.depth.getReversed(),Qe=k.isInstancedMesh===!0,nt=k.isBatchedMesh===!0,Ct=!!C.map,ce=!!C.matcap,_e=!!ne,F=!!C.aoMap,We=!!C.lightMap,ge=!!C.bumpMap,De=!!C.normalMap,Te=!!C.displacementMap,Ke=!!C.emissiveMap,ze=!!C.metalnessMap,O=!!C.roughnessMap,D=C.anisotropy>0,Z=C.clearcoat>0,re=C.dispersion>0,de=C.iridescence>0,le=C.sheen>0,Xe=C.transmission>0,we=D&&!!C.anisotropyMap,Ce=Z&&!!C.clearcoatMap,mt=Z&&!!C.clearcoatNormalMap,xe=Z&&!!C.clearcoatRoughnessMap,ke=de&&!!C.iridescenceMap,Je=de&&!!C.iridescenceThicknessMap,it=le&&!!C.sheenColorMap,Ge=le&&!!C.sheenRoughnessMap,Rt=!!C.specularMap,ft=!!C.specularColorMap,Kt=!!C.specularIntensityMap,G=Xe&&!!C.transmissionMap,Le=Xe&&!!C.thicknessMap,se=!!C.gradientMap,fe=!!C.alphaMap,Oe=C.alphaTest>0,Ue=!!C.alphaHash,ht=!!C.extensions;let rn=Ms;C.toneMapped&&(Ee===null||Ee.isXRRenderTarget===!0)&&(rn=n.toneMapping);const fn={shaderID:oe,shaderType:C.type,shaderName:C.name,vertexShader:tt,fragmentShader:ee,defines:C.defines,customVertexShaderID:ve,customFragmentShaderID:Pe,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:v,batching:nt,batchingColor:nt&&k._colorsTexture!==null,instancing:Qe,instancingColor:Qe&&k.instanceColor!==null,instancingMorph:Qe&&k.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ee===null?n.outputColorSpace:Ee.isXRRenderTarget===!0?Ee.texture.colorSpace:Mo,alphaToCoverage:!!C.alphaToCoverage,map:Ct,matcap:ce,envMap:_e,envMapMode:_e&&ne.mapping,envMapCubeUVHeight:q,aoMap:F,lightMap:We,bumpMap:ge,normalMap:De,displacementMap:m&&Te,emissiveMap:Ke,normalMapObjectSpace:De&&C.normalMapType===fD,normalMapTangentSpace:De&&C.normalMapType===bo,metalnessMap:ze,roughnessMap:O,anisotropy:D,anisotropyMap:we,clearcoat:Z,clearcoatMap:Ce,clearcoatNormalMap:mt,clearcoatRoughnessMap:xe,dispersion:re,iridescence:de,iridescenceMap:ke,iridescenceThicknessMap:Je,sheen:le,sheenColorMap:it,sheenRoughnessMap:Ge,specularMap:Rt,specularColorMap:ft,specularIntensityMap:Kt,transmission:Xe,transmissionMap:G,thicknessMap:Le,gradientMap:se,opaque:C.transparent===!1&&C.blending===Sl&&C.alphaToCoverage===!1,alphaMap:fe,alphaTest:Oe,alphaHash:Ue,combine:C.combine,mapUv:Ct&&T(C.map.channel),aoMapUv:F&&T(C.aoMap.channel),lightMapUv:We&&T(C.lightMap.channel),bumpMapUv:ge&&T(C.bumpMap.channel),normalMapUv:De&&T(C.normalMap.channel),displacementMapUv:Te&&T(C.displacementMap.channel),emissiveMapUv:Ke&&T(C.emissiveMap.channel),metalnessMapUv:ze&&T(C.metalnessMap.channel),roughnessMapUv:O&&T(C.roughnessMap.channel),anisotropyMapUv:we&&T(C.anisotropyMap.channel),clearcoatMapUv:Ce&&T(C.clearcoatMap.channel),clearcoatNormalMapUv:mt&&T(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:xe&&T(C.clearcoatRoughnessMap.channel),iridescenceMapUv:ke&&T(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&T(C.iridescenceThicknessMap.channel),sheenColorMapUv:it&&T(C.sheenColorMap.channel),sheenRoughnessMapUv:Ge&&T(C.sheenRoughnessMap.channel),specularMapUv:Rt&&T(C.specularMap.channel),specularColorMapUv:ft&&T(C.specularColorMap.channel),specularIntensityMapUv:Kt&&T(C.specularIntensityMap.channel),transmissionMapUv:G&&T(C.transmissionMap.channel),thicknessMapUv:Le&&T(C.thicknessMap.channel),alphaMapUv:fe&&T(C.alphaMap.channel),vertexTangents:!!ae.attributes.tangent&&(De||D),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!ae.attributes.uv&&(Ct||fe),fog:!!j,useFog:C.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:g,reverseDepthBuffer:je,skinning:k.isSkinnedMesh===!0,morphTargets:ae.morphAttributes.position!==void 0,morphNormals:ae.morphAttributes.normal!==void 0,morphColors:ae.morphAttributes.color!==void 0,morphTargetsCount:ye,morphTextureStride:Ie,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:C.dithering,shadowMapEnabled:n.shadowMap.enabled&&B.length>0,shadowMapType:n.shadowMap.type,toneMapping:rn,decodeVideoTexture:Ct&&C.map.isVideoTexture===!0&&Ut.getTransfer(C.map.colorSpace)===Zt,decodeVideoTextureEmissive:Ke&&C.emissiveMap.isVideoTexture===!0&&Ut.getTransfer(C.emissiveMap.colorSpace)===Zt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===gs,flipSided:C.side===Ui,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:ht&&C.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&C.extensions.multiDraw===!0||nt)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return fn.vertexUv1s=h.has(1),fn.vertexUv2s=h.has(2),fn.vertexUv3s=h.has(3),h.clear(),fn}function y(C){const w=[];if(C.shaderID?w.push(C.shaderID):(w.push(C.customVertexShaderID),w.push(C.customFragmentShaderID)),C.defines!==void 0)for(const B in C.defines)w.push(B),w.push(C.defines[B]);return C.isRawShaderMaterial===!1&&(S(w,C),E(w,C),w.push(n.outputColorSpace)),w.push(C.customProgramCacheKey),w.join()}function S(C,w){C.push(w.precision),C.push(w.outputColorSpace),C.push(w.envMapMode),C.push(w.envMapCubeUVHeight),C.push(w.mapUv),C.push(w.alphaMapUv),C.push(w.lightMapUv),C.push(w.aoMapUv),C.push(w.bumpMapUv),C.push(w.normalMapUv),C.push(w.displacementMapUv),C.push(w.emissiveMapUv),C.push(w.metalnessMapUv),C.push(w.roughnessMapUv),C.push(w.anisotropyMapUv),C.push(w.clearcoatMapUv),C.push(w.clearcoatNormalMapUv),C.push(w.clearcoatRoughnessMapUv),C.push(w.iridescenceMapUv),C.push(w.iridescenceThicknessMapUv),C.push(w.sheenColorMapUv),C.push(w.sheenRoughnessMapUv),C.push(w.specularMapUv),C.push(w.specularColorMapUv),C.push(w.specularIntensityMapUv),C.push(w.transmissionMapUv),C.push(w.thicknessMapUv),C.push(w.combine),C.push(w.fogExp2),C.push(w.sizeAttenuation),C.push(w.morphTargetsCount),C.push(w.morphAttributeCount),C.push(w.numDirLights),C.push(w.numPointLights),C.push(w.numSpotLights),C.push(w.numSpotLightMaps),C.push(w.numHemiLights),C.push(w.numRectAreaLights),C.push(w.numDirLightShadows),C.push(w.numPointLightShadows),C.push(w.numSpotLightShadows),C.push(w.numSpotLightShadowsWithMaps),C.push(w.numLightProbes),C.push(w.shadowMapType),C.push(w.toneMapping),C.push(w.numClippingPlanes),C.push(w.numClipIntersection),C.push(w.depthPacking)}function E(C,w){u.disableAll(),w.supportsVertexTextures&&u.enable(0),w.instancing&&u.enable(1),w.instancingColor&&u.enable(2),w.instancingMorph&&u.enable(3),w.matcap&&u.enable(4),w.envMap&&u.enable(5),w.normalMapObjectSpace&&u.enable(6),w.normalMapTangentSpace&&u.enable(7),w.clearcoat&&u.enable(8),w.iridescence&&u.enable(9),w.alphaTest&&u.enable(10),w.vertexColors&&u.enable(11),w.vertexAlphas&&u.enable(12),w.vertexUv1s&&u.enable(13),w.vertexUv2s&&u.enable(14),w.vertexUv3s&&u.enable(15),w.vertexTangents&&u.enable(16),w.anisotropy&&u.enable(17),w.alphaHash&&u.enable(18),w.batching&&u.enable(19),w.dispersion&&u.enable(20),w.batchingColor&&u.enable(21),C.push(u.mask),u.disableAll(),w.fog&&u.enable(0),w.useFog&&u.enable(1),w.flatShading&&u.enable(2),w.logarithmicDepthBuffer&&u.enable(3),w.reverseDepthBuffer&&u.enable(4),w.skinning&&u.enable(5),w.morphTargets&&u.enable(6),w.morphNormals&&u.enable(7),w.morphColors&&u.enable(8),w.premultipliedAlpha&&u.enable(9),w.shadowMapEnabled&&u.enable(10),w.doubleSided&&u.enable(11),w.flipSided&&u.enable(12),w.useDepthPacking&&u.enable(13),w.dithering&&u.enable(14),w.transmission&&u.enable(15),w.sheen&&u.enable(16),w.opaque&&u.enable(17),w.pointsUvs&&u.enable(18),w.decodeVideoTexture&&u.enable(19),w.decodeVideoTextureEmissive&&u.enable(20),w.alphaToCoverage&&u.enable(21),C.push(u.mask)}function A(C){const w=_[C.type];let B;if(w){const Q=ts[w];B=TD.clone(Q.uniforms)}else B=C.uniforms;return B}function I(C,w){let B;for(let Q=0,k=p.length;Q<k;Q++){const j=p[Q];if(j.cacheKey===w){B=j,++B.usedTimes;break}}return B===void 0&&(B=new A6(n,w,C,s),p.push(B)),B}function R(C){if(--C.usedTimes===0){const w=p.indexOf(C);p[w]=p[p.length-1],p.pop(),C.destroy()}}function L(C){c.remove(C)}function z(){c.dispose()}return{getParameters:b,getProgramCacheKey:y,getUniforms:A,acquireProgram:I,releaseProgram:R,releaseShaderCache:L,programs:p,dispose:z}}function U6(){let n=new WeakMap;function e(l){return n.has(l)}function t(l){let u=n.get(l);return u===void 0&&(u={},n.set(l,u)),u}function i(l){n.delete(l)}function a(l,u,c){n.get(l)[u]=c}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:a,dispose:s}}function L6(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 LA(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 NA(){const n=[];let e=0;const t=[],i=[],a=[];function s(){e=0,t.length=0,i.length=0,a.length=0}function l(g,m,v,_,T,b){let y=n[e];return y===void 0?(y={id:g.id,object:g,geometry:m,material:v,groupOrder:_,renderOrder:g.renderOrder,z:T,group:b},n[e]=y):(y.id=g.id,y.object=g,y.geometry=m,y.material=v,y.groupOrder=_,y.renderOrder=g.renderOrder,y.z=T,y.group=b),e++,y}function u(g,m,v,_,T,b){const y=l(g,m,v,_,T,b);v.transmission>0?i.push(y):v.transparent===!0?a.push(y):t.push(y)}function c(g,m,v,_,T,b){const y=l(g,m,v,_,T,b);v.transmission>0?i.unshift(y):v.transparent===!0?a.unshift(y):t.unshift(y)}function h(g,m){t.length>1&&t.sort(g||L6),i.length>1&&i.sort(m||LA),a.length>1&&a.sort(m||LA)}function p(){for(let g=e,m=n.length;g<m;g++){const v=n[g];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:i,transparent:a,init:s,push:u,unshift:c,finish:p,sort:h}}function N6(){let n=new WeakMap;function e(i,a){const s=n.get(i);let l;return s===void 0?(l=new NA,n.set(i,[l])):a>=s.length?(l=new NA,s.push(l)):l=s[a],l}function t(){n=new WeakMap}return{get:e,dispose:t}}function I6(){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 P,color:new Be};break;case"SpotLight":t={position:new P,direction:new P,color:new Be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new Be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new Be,groundColor:new Be};break;case"RectAreaLight":t={color:new Be,position:new P,halfWidth:new P,halfHeight:new P};break}return n[e.id]=t,t}}}function z6(){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 he};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let O6=0;function P6(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function B6(n){const e=new I6,t=z6(),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 h=0;h<9;h++)i.probe.push(new P);const a=new P,s=new lt,l=new lt;function u(h){let p=0,g=0,m=0;for(let C=0;C<9;C++)i.probe[C].set(0,0,0);let v=0,_=0,T=0,b=0,y=0,S=0,E=0,A=0,I=0,R=0,L=0;h.sort(P6);for(let C=0,w=h.length;C<w;C++){const B=h[C],Q=B.color,k=B.intensity,j=B.distance,ae=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)p+=Q.r*k,g+=Q.g*k,m+=Q.b*k;else if(B.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(B.sh.coefficients[V],k);L++}else if(B.isDirectionalLight){const V=e.get(B);if(V.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const ne=B.shadow,q=t.get(B);q.shadowIntensity=ne.intensity,q.shadowBias=ne.bias,q.shadowNormalBias=ne.normalBias,q.shadowRadius=ne.radius,q.shadowMapSize=ne.mapSize,i.directionalShadow[v]=q,i.directionalShadowMap[v]=ae,i.directionalShadowMatrix[v]=B.shadow.matrix,S++}i.directional[v]=V,v++}else if(B.isSpotLight){const V=e.get(B);V.position.setFromMatrixPosition(B.matrixWorld),V.color.copy(Q).multiplyScalar(k),V.distance=j,V.coneCos=Math.cos(B.angle),V.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),V.decay=B.decay,i.spot[T]=V;const ne=B.shadow;if(B.map&&(i.spotLightMap[I]=B.map,I++,ne.updateMatrices(B),B.castShadow&&R++),i.spotLightMatrix[T]=ne.matrix,B.castShadow){const q=t.get(B);q.shadowIntensity=ne.intensity,q.shadowBias=ne.bias,q.shadowNormalBias=ne.normalBias,q.shadowRadius=ne.radius,q.shadowMapSize=ne.mapSize,i.spotShadow[T]=q,i.spotShadowMap[T]=ae,A++}T++}else if(B.isRectAreaLight){const V=e.get(B);V.color.copy(Q).multiplyScalar(k),V.halfWidth.set(B.width*.5,0,0),V.halfHeight.set(0,B.height*.5,0),i.rectArea[b]=V,b++}else if(B.isPointLight){const V=e.get(B);if(V.color.copy(B.color).multiplyScalar(B.intensity),V.distance=B.distance,V.decay=B.decay,B.castShadow){const ne=B.shadow,q=t.get(B);q.shadowIntensity=ne.intensity,q.shadowBias=ne.bias,q.shadowNormalBias=ne.normalBias,q.shadowRadius=ne.radius,q.shadowMapSize=ne.mapSize,q.shadowCameraNear=ne.camera.near,q.shadowCameraFar=ne.camera.far,i.pointShadow[_]=q,i.pointShadowMap[_]=ae,i.pointShadowMatrix[_]=B.shadow.matrix,E++}i.point[_]=V,_++}else if(B.isHemisphereLight){const V=e.get(B);V.skyColor.copy(B.color).multiplyScalar(k),V.groundColor.copy(B.groundColor).multiplyScalar(k),i.hemi[y]=V,y++}}b>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Re.LTC_FLOAT_1,i.rectAreaLTC2=Re.LTC_FLOAT_2):(i.rectAreaLTC1=Re.LTC_HALF_1,i.rectAreaLTC2=Re.LTC_HALF_2)),i.ambient[0]=p,i.ambient[1]=g,i.ambient[2]=m;const z=i.hash;(z.directionalLength!==v||z.pointLength!==_||z.spotLength!==T||z.rectAreaLength!==b||z.hemiLength!==y||z.numDirectionalShadows!==S||z.numPointShadows!==E||z.numSpotShadows!==A||z.numSpotMaps!==I||z.numLightProbes!==L)&&(i.directional.length=v,i.spot.length=T,i.rectArea.length=b,i.point.length=_,i.hemi.length=y,i.directionalShadow.length=S,i.directionalShadowMap.length=S,i.pointShadow.length=E,i.pointShadowMap.length=E,i.spotShadow.length=A,i.spotShadowMap.length=A,i.directionalShadowMatrix.length=S,i.pointShadowMatrix.length=E,i.spotLightMatrix.length=A+I-R,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=R,i.numLightProbes=L,z.directionalLength=v,z.pointLength=_,z.spotLength=T,z.rectAreaLength=b,z.hemiLength=y,z.numDirectionalShadows=S,z.numPointShadows=E,z.numSpotShadows=A,z.numSpotMaps=I,z.numLightProbes=L,i.version=O6++)}function c(h,p){let g=0,m=0,v=0,_=0,T=0;const b=p.matrixWorldInverse;for(let y=0,S=h.length;y<S;y++){const E=h[y];if(E.isDirectionalLight){const A=i.directional[g];A.direction.setFromMatrixPosition(E.matrixWorld),a.setFromMatrixPosition(E.target.matrixWorld),A.direction.sub(a),A.direction.transformDirection(b),g++}else if(E.isSpotLight){const A=i.spot[v];A.position.setFromMatrixPosition(E.matrixWorld),A.position.applyMatrix4(b),A.direction.setFromMatrixPosition(E.matrixWorld),a.setFromMatrixPosition(E.target.matrixWorld),A.direction.sub(a),A.direction.transformDirection(b),v++}else if(E.isRectAreaLight){const A=i.rectArea[_];A.position.setFromMatrixPosition(E.matrixWorld),A.position.applyMatrix4(b),l.identity(),s.copy(E.matrixWorld),s.premultiply(b),l.extractRotation(s),A.halfWidth.set(E.width*.5,0,0),A.halfHeight.set(0,E.height*.5,0),A.halfWidth.applyMatrix4(l),A.halfHeight.applyMatrix4(l),_++}else if(E.isPointLight){const A=i.point[m];A.position.setFromMatrixPosition(E.matrixWorld),A.position.applyMatrix4(b),m++}else if(E.isHemisphereLight){const A=i.hemi[T];A.direction.setFromMatrixPosition(E.matrixWorld),A.direction.transformDirection(b),T++}}}return{setup:u,setupView:c,state:i}}function IA(n){const e=new B6(n),t=[],i=[];function a(p){h.camera=p,t.length=0,i.length=0}function s(p){t.push(p)}function l(p){i.push(p)}function u(){e.setup(t)}function c(p){e.setupView(t,p)}const h={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:h,setupLights:u,setupLightsView:c,pushLight:s,pushShadow:l}}function F6(n){let e=new WeakMap;function t(a,s=0){const l=e.get(a);let u;return l===void 0?(u=new IA(n),e.set(a,[u])):s>=l.length?(u=new IA(n),l.push(u)):u=l[s],u}function i(){e=new WeakMap}return{get:t,dispose:i}}class yb extends Mi{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=uD,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 _b extends Mi{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,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 H6=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,V6=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function k6(n,e,t){let i=new od;const a=new he,s=new he,l=new Pt,u=new yb({depthPacking:cD}),c=new _b,h={},p=t.maxTextureSize,g={[vr]:Ui,[Ui]:vr,[gs]:gs},m=new as({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:H6,fragmentShader:V6}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const _=new bt;_.setAttribute("position",new tn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const T=new Fn(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=u0;let y=this.type;this.render=function(R,L,z){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;const C=n.getRenderTarget(),w=n.getActiveCubeFace(),B=n.getActiveMipmapLevel(),Q=n.state;Q.setBlending(cr),Q.buffers.color.setClear(1,1,1,1),Q.buffers.depth.setTest(!0),Q.setScissorTest(!1);const k=y!==$a&&this.type===$a,j=y===$a&&this.type!==$a;for(let ae=0,V=R.length;ae<V;ae++){const ne=R[ae],q=ne.shadow;if(q===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(q.autoUpdate===!1&&q.needsUpdate===!1)continue;a.copy(q.mapSize);const oe=q.getFrameExtents();if(a.multiply(oe),s.copy(q.mapSize),(a.x>p||a.y>p)&&(a.x>p&&(s.x=Math.floor(p/oe.x),a.x=s.x*oe.x,q.mapSize.x=s.x),a.y>p&&(s.y=Math.floor(p/oe.y),a.y=s.y*oe.y,q.mapSize.y=s.y)),q.map===null||k===!0||j===!0){const ye=this.type!==$a?{minFilter:di,magFilter:di}:{};q.map!==null&&q.map.dispose(),q.map=new is(a.x,a.y,ye),q.map.texture.name=ne.name+".shadowMap",q.camera.updateProjectionMatrix()}n.setRenderTarget(q.map),n.clear();const me=q.getViewportCount();for(let ye=0;ye<me;ye++){const Ie=q.getViewport(ye);l.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),Q.viewport(l),q.updateMatrices(ne,ye),i=q.getFrustum(),A(L,z,q.camera,ne,this.type)}q.isPointLightShadow!==!0&&this.type===$a&&S(q,z),q.needsUpdate=!1}y=this.type,b.needsUpdate=!1,n.setRenderTarget(C,w,B)};function S(R,L){const z=e.update(T);m.defines.VSM_SAMPLES!==R.blurSamples&&(m.defines.VSM_SAMPLES=R.blurSamples,v.defines.VSM_SAMPLES=R.blurSamples,m.needsUpdate=!0,v.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new is(a.x,a.y)),m.uniforms.shadow_pass.value=R.map.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,n.setRenderTarget(R.mapPass),n.clear(),n.renderBufferDirect(L,null,z,m,T,null),v.uniforms.shadow_pass.value=R.mapPass.texture,v.uniforms.resolution.value=R.mapSize,v.uniforms.radius.value=R.radius,n.setRenderTarget(R.map),n.clear(),n.renderBufferDirect(L,null,z,v,T,null)}function E(R,L,z,C){let w=null;const B=z.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(B!==void 0)w=B;else if(w=z.isPointLight===!0?c:u,n.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0){const Q=w.uuid,k=L.uuid;let j=h[Q];j===void 0&&(j={},h[Q]=j);let ae=j[k];ae===void 0&&(ae=w.clone(),j[k]=ae,L.addEventListener("dispose",I)),w=ae}if(w.visible=L.visible,w.wireframe=L.wireframe,C===$a?w.side=L.shadowSide!==null?L.shadowSide:L.side:w.side=L.shadowSide!==null?L.shadowSide:g[L.side],w.alphaMap=L.alphaMap,w.alphaTest=L.alphaTest,w.map=L.map,w.clipShadows=L.clipShadows,w.clippingPlanes=L.clippingPlanes,w.clipIntersection=L.clipIntersection,w.displacementMap=L.displacementMap,w.displacementScale=L.displacementScale,w.displacementBias=L.displacementBias,w.wireframeLinewidth=L.wireframeLinewidth,w.linewidth=L.linewidth,z.isPointLight===!0&&w.isMeshDistanceMaterial===!0){const Q=n.properties.get(w);Q.light=z}return w}function A(R,L,z,C,w){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&w===$a)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,R.matrixWorld);const k=e.update(R),j=R.material;if(Array.isArray(j)){const ae=k.groups;for(let V=0,ne=ae.length;V<ne;V++){const q=ae[V],oe=j[q.materialIndex];if(oe&&oe.visible){const me=E(R,oe,C,w);R.onBeforeShadow(n,R,L,z,k,me,q),n.renderBufferDirect(z,null,k,me,R,q),R.onAfterShadow(n,R,L,z,k,me,q)}}}else if(j.visible){const ae=E(R,j,C,w);R.onBeforeShadow(n,R,L,z,k,ae,null),n.renderBufferDirect(z,null,k,ae,R,null),R.onAfterShadow(n,R,L,z,k,ae,null)}}const Q=R.children;for(let k=0,j=Q.length;k<j;k++)A(Q[k],L,z,C,w)}function I(R){R.target.removeEventListener("dispose",I);for(const z in h){const C=h[z],w=R.target.uuid;w in C&&(C[w].dispose(),delete C[w])}}}const G6={[ag]:sg,[rg]:ug,[og]:cg,[Dl]:lg,[sg]:ag,[ug]:rg,[cg]:og,[lg]:Dl};function X6(n,e){function t(){let G=!1;const Le=new Pt;let se=null;const fe=new Pt(0,0,0,0);return{setMask:function(Oe){se!==Oe&&!G&&(n.colorMask(Oe,Oe,Oe,Oe),se=Oe)},setLocked:function(Oe){G=Oe},setClear:function(Oe,Ue,ht,rn,fn){fn===!0&&(Oe*=rn,Ue*=rn,ht*=rn),Le.set(Oe,Ue,ht,rn),fe.equals(Le)===!1&&(n.clearColor(Oe,Ue,ht,rn),fe.copy(Le))},reset:function(){G=!1,se=null,fe.set(-1,0,0,0)}}}function i(){let G=!1,Le=!1,se=null,fe=null,Oe=null;return{setReversed:function(Ue){if(Le!==Ue){const ht=e.get("EXT_clip_control");Le?ht.clipControlEXT(ht.LOWER_LEFT_EXT,ht.ZERO_TO_ONE_EXT):ht.clipControlEXT(ht.LOWER_LEFT_EXT,ht.NEGATIVE_ONE_TO_ONE_EXT);const rn=Oe;Oe=null,this.setClear(rn)}Le=Ue},getReversed:function(){return Le},setTest:function(Ue){Ue?Ee(n.DEPTH_TEST):je(n.DEPTH_TEST)},setMask:function(Ue){se!==Ue&&!G&&(n.depthMask(Ue),se=Ue)},setFunc:function(Ue){if(Le&&(Ue=G6[Ue]),fe!==Ue){switch(Ue){case ag:n.depthFunc(n.NEVER);break;case sg:n.depthFunc(n.ALWAYS);break;case rg:n.depthFunc(n.LESS);break;case Dl:n.depthFunc(n.LEQUAL);break;case og:n.depthFunc(n.EQUAL);break;case lg:n.depthFunc(n.GEQUAL);break;case ug:n.depthFunc(n.GREATER);break;case cg:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}fe=Ue}},setLocked:function(Ue){G=Ue},setClear:function(Ue){Oe!==Ue&&(Le&&(Ue=1-Ue),n.clearDepth(Ue),Oe=Ue)},reset:function(){G=!1,se=null,fe=null,Oe=null,Le=!1}}}function a(){let G=!1,Le=null,se=null,fe=null,Oe=null,Ue=null,ht=null,rn=null,fn=null;return{setTest:function(Ft){G||(Ft?Ee(n.STENCIL_TEST):je(n.STENCIL_TEST))},setMask:function(Ft){Le!==Ft&&!G&&(n.stencilMask(Ft),Le=Ft)},setFunc:function(Ft,Ii,zi){(se!==Ft||fe!==Ii||Oe!==zi)&&(n.stencilFunc(Ft,Ii,zi),se=Ft,fe=Ii,Oe=zi)},setOp:function(Ft,Ii,zi){(Ue!==Ft||ht!==Ii||rn!==zi)&&(n.stencilOp(Ft,Ii,zi),Ue=Ft,ht=Ii,rn=zi)},setLocked:function(Ft){G=Ft},setClear:function(Ft){fn!==Ft&&(n.clearStencil(Ft),fn=Ft)},reset:function(){G=!1,Le=null,se=null,fe=null,Oe=null,Ue=null,ht=null,rn=null,fn=null}}}const s=new t,l=new i,u=new a,c=new WeakMap,h=new WeakMap;let p={},g={},m=new WeakMap,v=[],_=null,T=!1,b=null,y=null,S=null,E=null,A=null,I=null,R=null,L=new Be(0,0,0),z=0,C=!1,w=null,B=null,Q=null,k=null,j=null;const ae=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,ne=0;const q=n.getParameter(n.VERSION);q.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(q)[1]),V=ne>=1):q.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),V=ne>=2);let oe=null,me={};const ye=n.getParameter(n.SCISSOR_BOX),Ie=n.getParameter(n.VIEWPORT),tt=new Pt().fromArray(ye),ee=new Pt().fromArray(Ie);function ve(G,Le,se,fe){const Oe=new Uint8Array(4),Ue=n.createTexture();n.bindTexture(G,Ue),n.texParameteri(G,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(G,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ht=0;ht<se;ht++)G===n.TEXTURE_3D||G===n.TEXTURE_2D_ARRAY?n.texImage3D(Le,0,n.RGBA,1,1,fe,0,n.RGBA,n.UNSIGNED_BYTE,Oe):n.texImage2D(Le+ht,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Oe);return Ue}const Pe={};Pe[n.TEXTURE_2D]=ve(n.TEXTURE_2D,n.TEXTURE_2D,1),Pe[n.TEXTURE_CUBE_MAP]=ve(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Pe[n.TEXTURE_2D_ARRAY]=ve(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Pe[n.TEXTURE_3D]=ve(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),Ee(n.DEPTH_TEST),l.setFunc(Dl),ge(!1),De(Ix),Ee(n.CULL_FACE),F(cr);function Ee(G){p[G]!==!0&&(n.enable(G),p[G]=!0)}function je(G){p[G]!==!1&&(n.disable(G),p[G]=!1)}function Qe(G,Le){return g[G]!==Le?(n.bindFramebuffer(G,Le),g[G]=Le,G===n.DRAW_FRAMEBUFFER&&(g[n.FRAMEBUFFER]=Le),G===n.FRAMEBUFFER&&(g[n.DRAW_FRAMEBUFFER]=Le),!0):!1}function nt(G,Le){let se=v,fe=!1;if(G){se=m.get(Le),se===void 0&&(se=[],m.set(Le,se));const Oe=G.textures;if(se.length!==Oe.length||se[0]!==n.COLOR_ATTACHMENT0){for(let Ue=0,ht=Oe.length;Ue<ht;Ue++)se[Ue]=n.COLOR_ATTACHMENT0+Ue;se.length=Oe.length,fe=!0}}else se[0]!==n.BACK&&(se[0]=n.BACK,fe=!0);fe&&n.drawBuffers(se)}function Ct(G){return _!==G?(n.useProgram(G),_=G,!0):!1}const ce={[Kr]:n.FUNC_ADD,[I3]:n.FUNC_SUBTRACT,[z3]:n.FUNC_REVERSE_SUBTRACT};ce[O3]=n.MIN,ce[P3]=n.MAX;const _e={[B3]:n.ZERO,[F3]:n.ONE,[H3]:n.SRC_COLOR,[ng]:n.SRC_ALPHA,[q3]:n.SRC_ALPHA_SATURATE,[X3]:n.DST_COLOR,[k3]:n.DST_ALPHA,[V3]:n.ONE_MINUS_SRC_COLOR,[ig]:n.ONE_MINUS_SRC_ALPHA,[W3]:n.ONE_MINUS_DST_COLOR,[G3]:n.ONE_MINUS_DST_ALPHA,[Y3]:n.CONSTANT_COLOR,[Z3]:n.ONE_MINUS_CONSTANT_COLOR,[j3]:n.CONSTANT_ALPHA,[Q3]:n.ONE_MINUS_CONSTANT_ALPHA};function F(G,Le,se,fe,Oe,Ue,ht,rn,fn,Ft){if(G===cr){T===!0&&(je(n.BLEND),T=!1);return}if(T===!1&&(Ee(n.BLEND),T=!0),G!==N3){if(G!==b||Ft!==C){if((y!==Kr||A!==Kr)&&(n.blendEquation(n.FUNC_ADD),y=Kr,A=Kr),Ft)switch(G){case Sl:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zx:n.blendFunc(n.ONE,n.ONE);break;case Ox:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Px:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Sl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zx:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Ox:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Px:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}S=null,E=null,I=null,R=null,L.set(0,0,0),z=0,b=G,C=Ft}return}Oe=Oe||Le,Ue=Ue||se,ht=ht||fe,(Le!==y||Oe!==A)&&(n.blendEquationSeparate(ce[Le],ce[Oe]),y=Le,A=Oe),(se!==S||fe!==E||Ue!==I||ht!==R)&&(n.blendFuncSeparate(_e[se],_e[fe],_e[Ue],_e[ht]),S=se,E=fe,I=Ue,R=ht),(rn.equals(L)===!1||fn!==z)&&(n.blendColor(rn.r,rn.g,rn.b,fn),L.copy(rn),z=fn),b=G,C=!1}function We(G,Le){G.side===gs?je(n.CULL_FACE):Ee(n.CULL_FACE);let se=G.side===Ui;Le&&(se=!se),ge(se),G.blending===Sl&&G.transparent===!1?F(cr):F(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.blendColor,G.blendAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),s.setMask(G.colorWrite);const fe=G.stencilWrite;u.setTest(fe),fe&&(u.setMask(G.stencilWriteMask),u.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),u.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),Ke(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?Ee(n.SAMPLE_ALPHA_TO_COVERAGE):je(n.SAMPLE_ALPHA_TO_COVERAGE)}function ge(G){w!==G&&(G?n.frontFace(n.CW):n.frontFace(n.CCW),w=G)}function De(G){G!==D3?(Ee(n.CULL_FACE),G!==B&&(G===Ix?n.cullFace(n.BACK):G===U3?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):je(n.CULL_FACE),B=G}function Te(G){G!==Q&&(V&&n.lineWidth(G),Q=G)}function Ke(G,Le,se){G?(Ee(n.POLYGON_OFFSET_FILL),(k!==Le||j!==se)&&(n.polygonOffset(Le,se),k=Le,j=se)):je(n.POLYGON_OFFSET_FILL)}function ze(G){G?Ee(n.SCISSOR_TEST):je(n.SCISSOR_TEST)}function O(G){G===void 0&&(G=n.TEXTURE0+ae-1),oe!==G&&(n.activeTexture(G),oe=G)}function D(G,Le,se){se===void 0&&(oe===null?se=n.TEXTURE0+ae-1:se=oe);let fe=me[se];fe===void 0&&(fe={type:void 0,texture:void 0},me[se]=fe),(fe.type!==G||fe.texture!==Le)&&(oe!==se&&(n.activeTexture(se),oe=se),n.bindTexture(G,Le||Pe[G]),fe.type=G,fe.texture=Le)}function Z(){const G=me[oe];G!==void 0&&G.type!==void 0&&(n.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function re(){try{n.compressedTexImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function de(){try{n.compressedTexImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function le(){try{n.texSubImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Xe(){try{n.texSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function we(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ce(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function mt(){try{n.texStorage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function xe(){try{n.texStorage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ke(){try{n.texImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Je(){try{n.texImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function it(G){tt.equals(G)===!1&&(n.scissor(G.x,G.y,G.z,G.w),tt.copy(G))}function Ge(G){ee.equals(G)===!1&&(n.viewport(G.x,G.y,G.z,G.w),ee.copy(G))}function Rt(G,Le){let se=h.get(Le);se===void 0&&(se=new WeakMap,h.set(Le,se));let fe=se.get(G);fe===void 0&&(fe=n.getUniformBlockIndex(Le,G.name),se.set(G,fe))}function ft(G,Le){const fe=h.get(Le).get(G);c.get(Le)!==fe&&(n.uniformBlockBinding(Le,fe,G.__bindingPointIndex),c.set(Le,fe))}function Kt(){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),l.setReversed(!1),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),p={},oe=null,me={},g={},m=new WeakMap,v=[],_=null,T=!1,b=null,y=null,S=null,E=null,A=null,I=null,R=null,L=new Be(0,0,0),z=0,C=!1,w=null,B=null,Q=null,k=null,j=null,tt.set(0,0,n.canvas.width,n.canvas.height),ee.set(0,0,n.canvas.width,n.canvas.height),s.reset(),l.reset(),u.reset()}return{buffers:{color:s,depth:l,stencil:u},enable:Ee,disable:je,bindFramebuffer:Qe,drawBuffers:nt,useProgram:Ct,setBlending:F,setMaterial:We,setFlipSided:ge,setCullFace:De,setLineWidth:Te,setPolygonOffset:Ke,setScissorTest:ze,activeTexture:O,bindTexture:D,unbindTexture:Z,compressedTexImage2D:re,compressedTexImage3D:de,texImage2D:ke,texImage3D:Je,updateUBOMapping:Rt,uniformBlockBinding:ft,texStorage2D:mt,texStorage3D:xe,texSubImage2D:le,texSubImage3D:Xe,compressedTexSubImage2D:we,compressedTexSubImage3D:Ce,scissor:it,viewport:Ge,reset:Kt}}function W6(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 q6(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 Y6(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function Gx(n,e,t,i){const a=Z6(i);switch(t){case ab:return n*e;case rb:return n*e;case ob:return n*e*2;case p0:return n*e/a.components*a.byteLength;case ad:return n*e/a.components*a.byteLength;case lb:return n*e*2/a.components*a.byteLength;case m0:return n*e*2/a.components*a.byteLength;case sb:return n*e*3/a.components*a.byteLength;case Si:return n*e*4/a.components*a.byteLength;case g0:return n*e*4/a.components*a.byteLength;case ah:case sh:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case rh:case oh:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case hg:case pg:return Math.max(n,16)*Math.max(e,8)/4;case fg:case dg:return Math.max(n,8)*Math.max(e,8)/2;case mg:case gg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case vg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case yg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case _g:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case xg:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Sg:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case bg:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Mg:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Eg:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Tg:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ag:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case wg:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Cg:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Rg:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Dg:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Ug:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case lh:case Lg:case Ng:return Math.ceil(n/4)*Math.ceil(e/4)*16;case ub:case Ig:return Math.ceil(n/4)*Math.ceil(e/4)*8;case zg:case Og:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Z6(n){switch(n){case ns:case tb:return{byteLength:1,components:1};case Tc:case nb:case Fc:return{byteLength:2,components:1};case h0:case d0:return{byteLength:2,components:4};case _r:case f0:case Zi:return{byteLength:4,components:1};case ib:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const j6={contain:W6,cover:q6,fill:Y6,getByteLength:Gx};function Q6(n,e,t,i,a,s,l){const u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new he,p=new WeakMap;let g;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(O,D){return v?new OffscreenCanvas(O,D):zh("canvas")}function T(O,D,Z){let re=1;const de=ze(O);if((de.width>Z||de.height>Z)&&(re=Z/Math.max(de.width,de.height)),re<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){const le=Math.floor(re*de.width),Xe=Math.floor(re*de.height);g===void 0&&(g=_(le,Xe));const we=D?_(le,Xe):g;return we.width=le,we.height=Xe,we.getContext("2d").drawImage(O,0,0,le,Xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+le+"x"+Xe+")."),we}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),O;return O}function b(O){return O.generateMipmaps}function y(O){n.generateMipmap(O)}function S(O){return O.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:O.isWebGL3DRenderTarget?n.TEXTURE_3D:O.isWebGLArrayRenderTarget||O.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function E(O,D,Z,re,de=!1){if(O!==null){if(n[O]!==void 0)return n[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let le=D;if(D===n.RED&&(Z===n.FLOAT&&(le=n.R32F),Z===n.HALF_FLOAT&&(le=n.R16F),Z===n.UNSIGNED_BYTE&&(le=n.R8)),D===n.RED_INTEGER&&(Z===n.UNSIGNED_BYTE&&(le=n.R8UI),Z===n.UNSIGNED_SHORT&&(le=n.R16UI),Z===n.UNSIGNED_INT&&(le=n.R32UI),Z===n.BYTE&&(le=n.R8I),Z===n.SHORT&&(le=n.R16I),Z===n.INT&&(le=n.R32I)),D===n.RG&&(Z===n.FLOAT&&(le=n.RG32F),Z===n.HALF_FLOAT&&(le=n.RG16F),Z===n.UNSIGNED_BYTE&&(le=n.RG8)),D===n.RG_INTEGER&&(Z===n.UNSIGNED_BYTE&&(le=n.RG8UI),Z===n.UNSIGNED_SHORT&&(le=n.RG16UI),Z===n.UNSIGNED_INT&&(le=n.RG32UI),Z===n.BYTE&&(le=n.RG8I),Z===n.SHORT&&(le=n.RG16I),Z===n.INT&&(le=n.RG32I)),D===n.RGB_INTEGER&&(Z===n.UNSIGNED_BYTE&&(le=n.RGB8UI),Z===n.UNSIGNED_SHORT&&(le=n.RGB16UI),Z===n.UNSIGNED_INT&&(le=n.RGB32UI),Z===n.BYTE&&(le=n.RGB8I),Z===n.SHORT&&(le=n.RGB16I),Z===n.INT&&(le=n.RGB32I)),D===n.RGBA_INTEGER&&(Z===n.UNSIGNED_BYTE&&(le=n.RGBA8UI),Z===n.UNSIGNED_SHORT&&(le=n.RGBA16UI),Z===n.UNSIGNED_INT&&(le=n.RGBA32UI),Z===n.BYTE&&(le=n.RGBA8I),Z===n.SHORT&&(le=n.RGBA16I),Z===n.INT&&(le=n.RGBA32I)),D===n.RGB&&Z===n.UNSIGNED_INT_5_9_9_9_REV&&(le=n.RGB9_E5),D===n.RGBA){const Xe=de?sd:Ut.getTransfer(re);Z===n.FLOAT&&(le=n.RGBA32F),Z===n.HALF_FLOAT&&(le=n.RGBA16F),Z===n.UNSIGNED_BYTE&&(le=Xe===Zt?n.SRGB8_ALPHA8:n.RGBA8),Z===n.UNSIGNED_SHORT_4_4_4_4&&(le=n.RGBA4),Z===n.UNSIGNED_SHORT_5_5_5_1&&(le=n.RGB5_A1)}return(le===n.R16F||le===n.R32F||le===n.RG16F||le===n.RG32F||le===n.RGBA16F||le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),le}function A(O,D){let Z;return O?D===null||D===_r||D===Ul?Z=n.DEPTH24_STENCIL8:D===Zi?Z=n.DEPTH32F_STENCIL8:D===Tc&&(Z=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):D===null||D===_r||D===Ul?Z=n.DEPTH_COMPONENT24:D===Zi?Z=n.DEPTH_COMPONENT32F:D===Tc&&(Z=n.DEPTH_COMPONENT16),Z}function I(O,D){return b(O)===!0||O.isFramebufferTexture&&O.minFilter!==di&&O.minFilter!==Gn?Math.log2(Math.max(D.width,D.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?D.mipmaps.length:1}function R(O){const D=O.target;D.removeEventListener("dispose",R),z(D),D.isVideoTexture&&p.delete(D)}function L(O){const D=O.target;D.removeEventListener("dispose",L),w(D)}function z(O){const D=i.get(O);if(D.__webglInit===void 0)return;const Z=O.source,re=m.get(Z);if(re){const de=re[D.__cacheKey];de.usedTimes--,de.usedTimes===0&&C(O),Object.keys(re).length===0&&m.delete(Z)}i.remove(O)}function C(O){const D=i.get(O);n.deleteTexture(D.__webglTexture);const Z=O.source,re=m.get(Z);delete re[D.__cacheKey],l.memory.textures--}function w(O){const D=i.get(O);if(O.depthTexture&&(O.depthTexture.dispose(),i.remove(O.depthTexture)),O.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(D.__webglFramebuffer[re]))for(let de=0;de<D.__webglFramebuffer[re].length;de++)n.deleteFramebuffer(D.__webglFramebuffer[re][de]);else n.deleteFramebuffer(D.__webglFramebuffer[re]);D.__webglDepthbuffer&&n.deleteRenderbuffer(D.__webglDepthbuffer[re])}else{if(Array.isArray(D.__webglFramebuffer))for(let re=0;re<D.__webglFramebuffer.length;re++)n.deleteFramebuffer(D.__webglFramebuffer[re]);else n.deleteFramebuffer(D.__webglFramebuffer);if(D.__webglDepthbuffer&&n.deleteRenderbuffer(D.__webglDepthbuffer),D.__webglMultisampledFramebuffer&&n.deleteFramebuffer(D.__webglMultisampledFramebuffer),D.__webglColorRenderbuffer)for(let re=0;re<D.__webglColorRenderbuffer.length;re++)D.__webglColorRenderbuffer[re]&&n.deleteRenderbuffer(D.__webglColorRenderbuffer[re]);D.__webglDepthRenderbuffer&&n.deleteRenderbuffer(D.__webglDepthRenderbuffer)}const Z=O.textures;for(let re=0,de=Z.length;re<de;re++){const le=i.get(Z[re]);le.__webglTexture&&(n.deleteTexture(le.__webglTexture),l.memory.textures--),i.remove(Z[re])}i.remove(O)}let B=0;function Q(){B=0}function k(){const O=B;return O>=a.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+a.maxTextures),B+=1,O}function j(O){const D=[];return D.push(O.wrapS),D.push(O.wrapT),D.push(O.wrapR||0),D.push(O.magFilter),D.push(O.minFilter),D.push(O.anisotropy),D.push(O.internalFormat),D.push(O.format),D.push(O.type),D.push(O.generateMipmaps),D.push(O.premultiplyAlpha),D.push(O.flipY),D.push(O.unpackAlignment),D.push(O.colorSpace),D.join()}function ae(O,D){const Z=i.get(O);if(O.isVideoTexture&&Te(O),O.isRenderTargetTexture===!1&&O.version>0&&Z.__version!==O.version){const re=O.image;if(re===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(Z,O,D);return}}t.bindTexture(n.TEXTURE_2D,Z.__webglTexture,n.TEXTURE0+D)}function V(O,D){const Z=i.get(O);if(O.version>0&&Z.__version!==O.version){ee(Z,O,D);return}t.bindTexture(n.TEXTURE_2D_ARRAY,Z.__webglTexture,n.TEXTURE0+D)}function ne(O,D){const Z=i.get(O);if(O.version>0&&Z.__version!==O.version){ee(Z,O,D);return}t.bindTexture(n.TEXTURE_3D,Z.__webglTexture,n.TEXTURE0+D)}function q(O,D){const Z=i.get(O);if(O.version>0&&Z.__version!==O.version){ve(Z,O,D);return}t.bindTexture(n.TEXTURE_CUBE_MAP,Z.__webglTexture,n.TEXTURE0+D)}const oe={[Rh]:n.REPEAT,[Ba]:n.CLAMP_TO_EDGE,[Dh]:n.MIRRORED_REPEAT},me={[di]:n.NEAREST,[eb]:n.NEAREST_MIPMAP_NEAREST,[tc]:n.NEAREST_MIPMAP_LINEAR,[Gn]:n.LINEAR,[ih]:n.LINEAR_MIPMAP_NEAREST,[xs]:n.LINEAR_MIPMAP_LINEAR},ye={[hD]:n.NEVER,[yD]:n.ALWAYS,[dD]:n.LESS,[fb]:n.LEQUAL,[pD]:n.EQUAL,[vD]:n.GEQUAL,[mD]:n.GREATER,[gD]:n.NOTEQUAL};function Ie(O,D){if(D.type===Zi&&e.has("OES_texture_float_linear")===!1&&(D.magFilter===Gn||D.magFilter===ih||D.magFilter===tc||D.magFilter===xs||D.minFilter===Gn||D.minFilter===ih||D.minFilter===tc||D.minFilter===xs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(O,n.TEXTURE_WRAP_S,oe[D.wrapS]),n.texParameteri(O,n.TEXTURE_WRAP_T,oe[D.wrapT]),(O===n.TEXTURE_3D||O===n.TEXTURE_2D_ARRAY)&&n.texParameteri(O,n.TEXTURE_WRAP_R,oe[D.wrapR]),n.texParameteri(O,n.TEXTURE_MAG_FILTER,me[D.magFilter]),n.texParameteri(O,n.TEXTURE_MIN_FILTER,me[D.minFilter]),D.compareFunction&&(n.texParameteri(O,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(O,n.TEXTURE_COMPARE_FUNC,ye[D.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(D.magFilter===di||D.minFilter!==tc&&D.minFilter!==xs||D.type===Zi&&e.has("OES_texture_float_linear")===!1)return;if(D.anisotropy>1||i.get(D).__currentAnisotropy){const Z=e.get("EXT_texture_filter_anisotropic");n.texParameterf(O,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,a.getMaxAnisotropy())),i.get(D).__currentAnisotropy=D.anisotropy}}}function tt(O,D){let Z=!1;O.__webglInit===void 0&&(O.__webglInit=!0,D.addEventListener("dispose",R));const re=D.source;let de=m.get(re);de===void 0&&(de={},m.set(re,de));const le=j(D);if(le!==O.__cacheKey){de[le]===void 0&&(de[le]={texture:n.createTexture(),usedTimes:0},l.memory.textures++,Z=!0),de[le].usedTimes++;const Xe=de[O.__cacheKey];Xe!==void 0&&(de[O.__cacheKey].usedTimes--,Xe.usedTimes===0&&C(D)),O.__cacheKey=le,O.__webglTexture=de[le].texture}return Z}function ee(O,D,Z){let re=n.TEXTURE_2D;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(re=n.TEXTURE_2D_ARRAY),D.isData3DTexture&&(re=n.TEXTURE_3D);const de=tt(O,D),le=D.source;t.bindTexture(re,O.__webglTexture,n.TEXTURE0+Z);const Xe=i.get(le);if(le.version!==Xe.__version||de===!0){t.activeTexture(n.TEXTURE0+Z);const we=Ut.getPrimaries(Ut.workingColorSpace),Ce=D.colorSpace===tr?null:Ut.getPrimaries(D.colorSpace),mt=D.colorSpace===tr||we===Ce?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,D.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,D.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,mt);let xe=T(D.image,!1,a.maxTextureSize);xe=Ke(D,xe);const ke=s.convert(D.format,D.colorSpace),Je=s.convert(D.type);let it=E(D.internalFormat,ke,Je,D.colorSpace,D.isVideoTexture);Ie(re,D);let Ge;const Rt=D.mipmaps,ft=D.isVideoTexture!==!0,Kt=Xe.__version===void 0||de===!0,G=le.dataReady,Le=I(D,xe);if(D.isDepthTexture)it=A(D.format===Ll,D.type),Kt&&(ft?t.texStorage2D(n.TEXTURE_2D,1,it,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,it,xe.width,xe.height,0,ke,Je,null));else if(D.isDataTexture)if(Rt.length>0){ft&&Kt&&t.texStorage2D(n.TEXTURE_2D,Le,it,Rt[0].width,Rt[0].height);for(let se=0,fe=Rt.length;se<fe;se++)Ge=Rt[se],ft?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,Ge.width,Ge.height,ke,Je,Ge.data):t.texImage2D(n.TEXTURE_2D,se,it,Ge.width,Ge.height,0,ke,Je,Ge.data);D.generateMipmaps=!1}else ft?(Kt&&t.texStorage2D(n.TEXTURE_2D,Le,it,xe.width,xe.height),G&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,xe.width,xe.height,ke,Je,xe.data)):t.texImage2D(n.TEXTURE_2D,0,it,xe.width,xe.height,0,ke,Je,xe.data);else if(D.isCompressedTexture)if(D.isCompressedArrayTexture){ft&&Kt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Le,it,Rt[0].width,Rt[0].height,xe.depth);for(let se=0,fe=Rt.length;se<fe;se++)if(Ge=Rt[se],D.format!==Si)if(ke!==null)if(ft){if(G)if(D.layerUpdates.size>0){const Oe=Gx(Ge.width,Ge.height,D.format,D.type);for(const Ue of D.layerUpdates){const ht=Ge.data.subarray(Ue*Oe/Ge.data.BYTES_PER_ELEMENT,(Ue+1)*Oe/Ge.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,Ue,Ge.width,Ge.height,1,ke,ht)}D.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,0,Ge.width,Ge.height,xe.depth,ke,Ge.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,se,it,Ge.width,Ge.height,xe.depth,0,Ge.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ft?G&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,0,Ge.width,Ge.height,xe.depth,ke,Je,Ge.data):t.texImage3D(n.TEXTURE_2D_ARRAY,se,it,Ge.width,Ge.height,xe.depth,0,ke,Je,Ge.data)}else{ft&&Kt&&t.texStorage2D(n.TEXTURE_2D,Le,it,Rt[0].width,Rt[0].height);for(let se=0,fe=Rt.length;se<fe;se++)Ge=Rt[se],D.format!==Si?ke!==null?ft?G&&t.compressedTexSubImage2D(n.TEXTURE_2D,se,0,0,Ge.width,Ge.height,ke,Ge.data):t.compressedTexImage2D(n.TEXTURE_2D,se,it,Ge.width,Ge.height,0,Ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,Ge.width,Ge.height,ke,Je,Ge.data):t.texImage2D(n.TEXTURE_2D,se,it,Ge.width,Ge.height,0,ke,Je,Ge.data)}else if(D.isDataArrayTexture)if(ft){if(Kt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Le,it,xe.width,xe.height,xe.depth),G)if(D.layerUpdates.size>0){const se=Gx(xe.width,xe.height,D.format,D.type);for(const fe of D.layerUpdates){const Oe=xe.data.subarray(fe*se/xe.data.BYTES_PER_ELEMENT,(fe+1)*se/xe.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,fe,xe.width,xe.height,1,ke,Je,Oe)}D.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,ke,Je,xe.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,it,xe.width,xe.height,xe.depth,0,ke,Je,xe.data);else if(D.isData3DTexture)ft?(Kt&&t.texStorage3D(n.TEXTURE_3D,Le,it,xe.width,xe.height,xe.depth),G&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,ke,Je,xe.data)):t.texImage3D(n.TEXTURE_3D,0,it,xe.width,xe.height,xe.depth,0,ke,Je,xe.data);else if(D.isFramebufferTexture){if(Kt)if(ft)t.texStorage2D(n.TEXTURE_2D,Le,it,xe.width,xe.height);else{let se=xe.width,fe=xe.height;for(let Oe=0;Oe<Le;Oe++)t.texImage2D(n.TEXTURE_2D,Oe,it,se,fe,0,ke,Je,null),se>>=1,fe>>=1}}else if(Rt.length>0){if(ft&&Kt){const se=ze(Rt[0]);t.texStorage2D(n.TEXTURE_2D,Le,it,se.width,se.height)}for(let se=0,fe=Rt.length;se<fe;se++)Ge=Rt[se],ft?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,ke,Je,Ge):t.texImage2D(n.TEXTURE_2D,se,it,ke,Je,Ge);D.generateMipmaps=!1}else if(ft){if(Kt){const se=ze(xe);t.texStorage2D(n.TEXTURE_2D,Le,it,se.width,se.height)}G&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ke,Je,xe)}else t.texImage2D(n.TEXTURE_2D,0,it,ke,Je,xe);b(D)&&y(re),Xe.__version=le.version,D.onUpdate&&D.onUpdate(D)}O.__version=D.version}function ve(O,D,Z){if(D.image.length!==6)return;const re=tt(O,D),de=D.source;t.bindTexture(n.TEXTURE_CUBE_MAP,O.__webglTexture,n.TEXTURE0+Z);const le=i.get(de);if(de.version!==le.__version||re===!0){t.activeTexture(n.TEXTURE0+Z);const Xe=Ut.getPrimaries(Ut.workingColorSpace),we=D.colorSpace===tr?null:Ut.getPrimaries(D.colorSpace),Ce=D.colorSpace===tr||Xe===we?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,D.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,D.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ce);const mt=D.isCompressedTexture||D.image[0].isCompressedTexture,xe=D.image[0]&&D.image[0].isDataTexture,ke=[];for(let fe=0;fe<6;fe++)!mt&&!xe?ke[fe]=T(D.image[fe],!0,a.maxCubemapSize):ke[fe]=xe?D.image[fe].image:D.image[fe],ke[fe]=Ke(D,ke[fe]);const Je=ke[0],it=s.convert(D.format,D.colorSpace),Ge=s.convert(D.type),Rt=E(D.internalFormat,it,Ge,D.colorSpace),ft=D.isVideoTexture!==!0,Kt=le.__version===void 0||re===!0,G=de.dataReady;let Le=I(D,Je);Ie(n.TEXTURE_CUBE_MAP,D);let se;if(mt){ft&&Kt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Le,Rt,Je.width,Je.height);for(let fe=0;fe<6;fe++){se=ke[fe].mipmaps;for(let Oe=0;Oe<se.length;Oe++){const Ue=se[Oe];D.format!==Si?it!==null?ft?G&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe,0,0,Ue.width,Ue.height,it,Ue.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe,Rt,Ue.width,Ue.height,0,Ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ft?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe,0,0,Ue.width,Ue.height,it,Ge,Ue.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe,Rt,Ue.width,Ue.height,0,it,Ge,Ue.data)}}}else{if(se=D.mipmaps,ft&&Kt){se.length>0&&Le++;const fe=ze(ke[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Le,Rt,fe.width,fe.height)}for(let fe=0;fe<6;fe++)if(xe){ft?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,ke[fe].width,ke[fe].height,it,Ge,ke[fe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Rt,ke[fe].width,ke[fe].height,0,it,Ge,ke[fe].data);for(let Oe=0;Oe<se.length;Oe++){const ht=se[Oe].image[fe].image;ft?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe+1,0,0,ht.width,ht.height,it,Ge,ht.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe+1,Rt,ht.width,ht.height,0,it,Ge,ht.data)}}else{ft?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,it,Ge,ke[fe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Rt,it,Ge,ke[fe]);for(let Oe=0;Oe<se.length;Oe++){const Ue=se[Oe];ft?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe+1,0,0,it,Ge,Ue.image[fe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Oe+1,Rt,it,Ge,Ue.image[fe])}}}b(D)&&y(n.TEXTURE_CUBE_MAP),le.__version=de.version,D.onUpdate&&D.onUpdate(D)}O.__version=D.version}function Pe(O,D,Z,re,de,le){const Xe=s.convert(Z.format,Z.colorSpace),we=s.convert(Z.type),Ce=E(Z.internalFormat,Xe,we,Z.colorSpace),mt=i.get(D),xe=i.get(Z);if(xe.__renderTarget=D,!mt.__hasExternalTextures){const ke=Math.max(1,D.width>>le),Je=Math.max(1,D.height>>le);de===n.TEXTURE_3D||de===n.TEXTURE_2D_ARRAY?t.texImage3D(de,le,Ce,ke,Je,D.depth,0,Xe,we,null):t.texImage2D(de,le,Ce,ke,Je,0,Xe,we,null)}t.bindFramebuffer(n.FRAMEBUFFER,O),De(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,re,de,xe.__webglTexture,0,ge(D)):(de===n.TEXTURE_2D||de>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,re,de,xe.__webglTexture,le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ee(O,D,Z){if(n.bindRenderbuffer(n.RENDERBUFFER,O),D.depthBuffer){const re=D.depthTexture,de=re&&re.isDepthTexture?re.type:null,le=A(D.stencilBuffer,de),Xe=D.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,we=ge(D);De(D)?u.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,we,le,D.width,D.height):Z?n.renderbufferStorageMultisample(n.RENDERBUFFER,we,le,D.width,D.height):n.renderbufferStorage(n.RENDERBUFFER,le,D.width,D.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Xe,n.RENDERBUFFER,O)}else{const re=D.textures;for(let de=0;de<re.length;de++){const le=re[de],Xe=s.convert(le.format,le.colorSpace),we=s.convert(le.type),Ce=E(le.internalFormat,Xe,we,le.colorSpace),mt=ge(D);Z&&De(D)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,mt,Ce,D.width,D.height):De(D)?u.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,mt,Ce,D.width,D.height):n.renderbufferStorage(n.RENDERBUFFER,Ce,D.width,D.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function je(O,D){if(D&&D.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,O),!(D.depthTexture&&D.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const re=i.get(D.depthTexture);re.__renderTarget=D,(!re.__webglTexture||D.depthTexture.image.width!==D.width||D.depthTexture.image.height!==D.height)&&(D.depthTexture.image.width=D.width,D.depthTexture.image.height=D.height,D.depthTexture.needsUpdate=!0),ae(D.depthTexture,0);const de=re.__webglTexture,le=ge(D);if(D.depthTexture.format===bl)De(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,de,0,le):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,de,0);else if(D.depthTexture.format===Ll)De(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,de,0,le):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,de,0);else throw new Error("Unknown depthTexture format")}function Qe(O){const D=i.get(O),Z=O.isWebGLCubeRenderTarget===!0;if(D.__boundDepthTexture!==O.depthTexture){const re=O.depthTexture;if(D.__depthDisposeCallback&&D.__depthDisposeCallback(),re){const de=()=>{delete D.__boundDepthTexture,delete D.__depthDisposeCallback,re.removeEventListener("dispose",de)};re.addEventListener("dispose",de),D.__depthDisposeCallback=de}D.__boundDepthTexture=re}if(O.depthTexture&&!D.__autoAllocateDepthBuffer){if(Z)throw new Error("target.depthTexture not supported in Cube render targets");je(D.__webglFramebuffer,O)}else if(Z){D.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(n.FRAMEBUFFER,D.__webglFramebuffer[re]),D.__webglDepthbuffer[re]===void 0)D.__webglDepthbuffer[re]=n.createRenderbuffer(),Ee(D.__webglDepthbuffer[re],O,!1);else{const de=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=D.__webglDepthbuffer[re];n.bindRenderbuffer(n.RENDERBUFFER,le),n.framebufferRenderbuffer(n.FRAMEBUFFER,de,n.RENDERBUFFER,le)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,D.__webglFramebuffer),D.__webglDepthbuffer===void 0)D.__webglDepthbuffer=n.createRenderbuffer(),Ee(D.__webglDepthbuffer,O,!1);else{const re=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,de=D.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,de),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,de)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function nt(O,D,Z){const re=i.get(O);D!==void 0&&Pe(re.__webglFramebuffer,O,O.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),Z!==void 0&&Qe(O)}function Ct(O){const D=O.texture,Z=i.get(O),re=i.get(D);O.addEventListener("dispose",L);const de=O.textures,le=O.isWebGLCubeRenderTarget===!0,Xe=de.length>1;if(Xe||(re.__webglTexture===void 0&&(re.__webglTexture=n.createTexture()),re.__version=D.version,l.memory.textures++),le){Z.__webglFramebuffer=[];for(let we=0;we<6;we++)if(D.mipmaps&&D.mipmaps.length>0){Z.__webglFramebuffer[we]=[];for(let Ce=0;Ce<D.mipmaps.length;Ce++)Z.__webglFramebuffer[we][Ce]=n.createFramebuffer()}else Z.__webglFramebuffer[we]=n.createFramebuffer()}else{if(D.mipmaps&&D.mipmaps.length>0){Z.__webglFramebuffer=[];for(let we=0;we<D.mipmaps.length;we++)Z.__webglFramebuffer[we]=n.createFramebuffer()}else Z.__webglFramebuffer=n.createFramebuffer();if(Xe)for(let we=0,Ce=de.length;we<Ce;we++){const mt=i.get(de[we]);mt.__webglTexture===void 0&&(mt.__webglTexture=n.createTexture(),l.memory.textures++)}if(O.samples>0&&De(O)===!1){Z.__webglMultisampledFramebuffer=n.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let we=0;we<de.length;we++){const Ce=de[we];Z.__webglColorRenderbuffer[we]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,Z.__webglColorRenderbuffer[we]);const mt=s.convert(Ce.format,Ce.colorSpace),xe=s.convert(Ce.type),ke=E(Ce.internalFormat,mt,xe,Ce.colorSpace,O.isXRRenderTarget===!0),Je=ge(O);n.renderbufferStorageMultisample(n.RENDERBUFFER,Je,ke,O.width,O.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+we,n.RENDERBUFFER,Z.__webglColorRenderbuffer[we])}n.bindRenderbuffer(n.RENDERBUFFER,null),O.depthBuffer&&(Z.__webglDepthRenderbuffer=n.createRenderbuffer(),Ee(Z.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(le){t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),Ie(n.TEXTURE_CUBE_MAP,D);for(let we=0;we<6;we++)if(D.mipmaps&&D.mipmaps.length>0)for(let Ce=0;Ce<D.mipmaps.length;Ce++)Pe(Z.__webglFramebuffer[we][Ce],O,D,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+we,Ce);else Pe(Z.__webglFramebuffer[we],O,D,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+we,0);b(D)&&y(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Xe){for(let we=0,Ce=de.length;we<Ce;we++){const mt=de[we],xe=i.get(mt);t.bindTexture(n.TEXTURE_2D,xe.__webglTexture),Ie(n.TEXTURE_2D,mt),Pe(Z.__webglFramebuffer,O,mt,n.COLOR_ATTACHMENT0+we,n.TEXTURE_2D,0),b(mt)&&y(n.TEXTURE_2D)}t.unbindTexture()}else{let we=n.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(we=O.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(we,re.__webglTexture),Ie(we,D),D.mipmaps&&D.mipmaps.length>0)for(let Ce=0;Ce<D.mipmaps.length;Ce++)Pe(Z.__webglFramebuffer[Ce],O,D,n.COLOR_ATTACHMENT0,we,Ce);else Pe(Z.__webglFramebuffer,O,D,n.COLOR_ATTACHMENT0,we,0);b(D)&&y(we),t.unbindTexture()}O.depthBuffer&&Qe(O)}function ce(O){const D=O.textures;for(let Z=0,re=D.length;Z<re;Z++){const de=D[Z];if(b(de)){const le=S(O),Xe=i.get(de).__webglTexture;t.bindTexture(le,Xe),y(le),t.unbindTexture()}}}const _e=[],F=[];function We(O){if(O.samples>0){if(De(O)===!1){const D=O.textures,Z=O.width,re=O.height;let de=n.COLOR_BUFFER_BIT;const le=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Xe=i.get(O),we=D.length>1;if(we)for(let Ce=0;Ce<D.length;Ce++)t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Xe.__webglFramebuffer);for(let Ce=0;Ce<D.length;Ce++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(de|=n.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(de|=n.STENCIL_BUFFER_BIT)),we){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Xe.__webglColorRenderbuffer[Ce]);const mt=i.get(D[Ce]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,mt,0)}n.blitFramebuffer(0,0,Z,re,0,0,Z,re,de,n.NEAREST),c===!0&&(_e.length=0,F.length=0,_e.push(n.COLOR_ATTACHMENT0+Ce),O.depthBuffer&&O.resolveDepthBuffer===!1&&(_e.push(le),F.push(le),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,F)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,_e))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),we)for(let Ce=0;Ce<D.length;Ce++){t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,Xe.__webglColorRenderbuffer[Ce]);const mt=i.get(D[Ce]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,mt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer)}else if(O.depthBuffer&&O.resolveDepthBuffer===!1&&c){const D=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[D])}}}function ge(O){return Math.min(a.maxSamples,O.samples)}function De(O){const D=i.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function Te(O){const D=l.render.frame;p.get(O)!==D&&(p.set(O,D),O.update())}function Ke(O,D){const Z=O.colorSpace,re=O.format,de=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||Z!==Mo&&Z!==tr&&(Ut.getTransfer(Z)===Zt?(re!==Si||de!==ns)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Z)),D}function ze(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(h.width=O.naturalWidth||O.width,h.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(h.width=O.displayWidth,h.height=O.displayHeight):(h.width=O.width,h.height=O.height),h}this.allocateTextureUnit=k,this.resetTextureUnits=Q,this.setTexture2D=ae,this.setTexture2DArray=V,this.setTexture3D=ne,this.setTextureCube=q,this.rebindTextures=nt,this.setupRenderTarget=Ct,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=We,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=Pe,this.useMultisampledRTT=De}function ND(n,e){function t(i,a=tr){let s;const l=Ut.getTransfer(a);if(i===ns)return n.UNSIGNED_BYTE;if(i===h0)return n.UNSIGNED_SHORT_4_4_4_4;if(i===d0)return n.UNSIGNED_SHORT_5_5_5_1;if(i===ib)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===tb)return n.BYTE;if(i===nb)return n.SHORT;if(i===Tc)return n.UNSIGNED_SHORT;if(i===f0)return n.INT;if(i===_r)return n.UNSIGNED_INT;if(i===Zi)return n.FLOAT;if(i===Fc)return n.HALF_FLOAT;if(i===ab)return n.ALPHA;if(i===sb)return n.RGB;if(i===Si)return n.RGBA;if(i===rb)return n.LUMINANCE;if(i===ob)return n.LUMINANCE_ALPHA;if(i===bl)return n.DEPTH_COMPONENT;if(i===Ll)return n.DEPTH_STENCIL;if(i===p0)return n.RED;if(i===ad)return n.RED_INTEGER;if(i===lb)return n.RG;if(i===m0)return n.RG_INTEGER;if(i===g0)return n.RGBA_INTEGER;if(i===ah||i===sh||i===rh||i===oh)if(l===Zt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===ah)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===sh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===rh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===ah)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===sh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===rh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===oh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===fg||i===hg||i===dg||i===pg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===fg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===hg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===dg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===pg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===mg||i===gg||i===vg)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===mg||i===gg)return l===Zt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===vg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===yg||i===_g||i===xg||i===Sg||i===bg||i===Mg||i===Eg||i===Tg||i===Ag||i===wg||i===Cg||i===Rg||i===Dg||i===Ug)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===yg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===_g)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===xg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Sg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===bg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Mg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Eg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Tg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ag)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===wg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Cg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Rg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Dg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ug)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===lh||i===Lg||i===Ng)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===lh)return l===Zt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Lg)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ng)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ub||i===Ig||i===zg||i===Og)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===lh)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ig)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===zg)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Og)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ul?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class ID extends ti{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ac extends Bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const K6={type:"move"};class g_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ac,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 ac,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ac,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),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 a=null,s=null,l=null;const u=this._targetRay,c=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){l=!0;for(const T of e.hand.values()){const b=t.getJointPose(T,i),y=this._getHandJoint(h,T);b!==null&&(y.matrix.fromArray(b.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=b.radius),y.visible=b!==null}const p=h.joints["index-finger-tip"],g=h.joints["thumb-tip"],m=p.position.distanceTo(g.position),v=.02,_=.005;h.inputState.pinching&&m>v+_?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=v-_&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));u!==null&&(a=t.getPose(e.targetRaySpace,i),a===null&&s!==null&&(a=s),a!==null&&(u.matrix.fromArray(a.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,a.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(a.linearVelocity)):u.hasLinearVelocity=!1,a.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(a.angularVelocity)):u.hasAngularVelocity=!1,this.dispatchEvent(K6)))}return u!==null&&(u.visible=a!==null),c!==null&&(c.visible=s!==null),h!==null&&(h.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new ac;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const J6=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,$6=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class eH{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const a=new Mn,s=e.properties.get(a);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=a}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new as({vertexShader:J6,fragmentShader:$6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Fn(new Vc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class tH extends Cs{constructor(e,t){super();const i=this;let a=null,s=1,l=null,u="local-floor",c=1,h=null,p=null,g=null,m=null,v=null,_=null;const T=new eH,b=t.getContextAttributes();let y=null,S=null;const E=[],A=[],I=new he;let R=null;const L=new ti;L.viewport=new Pt;const z=new ti;z.viewport=new Pt;const C=[L,z],w=new ID;let B=null,Q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let ve=E[ee];return ve===void 0&&(ve=new g_,E[ee]=ve),ve.getTargetRaySpace()},this.getControllerGrip=function(ee){let ve=E[ee];return ve===void 0&&(ve=new g_,E[ee]=ve),ve.getGripSpace()},this.getHand=function(ee){let ve=E[ee];return ve===void 0&&(ve=new g_,E[ee]=ve),ve.getHandSpace()};function k(ee){const ve=A.indexOf(ee.inputSource);if(ve===-1)return;const Pe=E[ve];Pe!==void 0&&(Pe.update(ee.inputSource,ee.frame,h||l),Pe.dispatchEvent({type:ee.type,data:ee.inputSource}))}function j(){a.removeEventListener("select",k),a.removeEventListener("selectstart",k),a.removeEventListener("selectend",k),a.removeEventListener("squeeze",k),a.removeEventListener("squeezestart",k),a.removeEventListener("squeezeend",k),a.removeEventListener("end",j),a.removeEventListener("inputsourceschange",ae);for(let ee=0;ee<E.length;ee++){const ve=A[ee];ve!==null&&(A[ee]=null,E[ee].disconnect(ve))}B=null,Q=null,T.reset(),e.setRenderTarget(y),v=null,m=null,g=null,a=null,S=null,tt.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ee){s=ee,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ee){u=ee,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||l},this.setReferenceSpace=function(ee){h=ee},this.getBaseLayer=function(){return m!==null?m:v},this.getBinding=function(){return g},this.getFrame=function(){return _},this.getSession=function(){return a},this.setSession=async function(ee){if(a=ee,a!==null){if(y=e.getRenderTarget(),a.addEventListener("select",k),a.addEventListener("selectstart",k),a.addEventListener("selectend",k),a.addEventListener("squeeze",k),a.addEventListener("squeezestart",k),a.addEventListener("squeezeend",k),a.addEventListener("end",j),a.addEventListener("inputsourceschange",ae),b.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(I),a.renderState.layers===void 0){const ve={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(a,t,ve),a.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),S=new is(v.framebufferWidth,v.framebufferHeight,{format:Si,type:ns,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})}else{let ve=null,Pe=null,Ee=null;b.depth&&(Ee=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ve=b.stencil?Ll:bl,Pe=b.stencil?Ul:_r);const je={colorFormat:t.RGBA8,depthFormat:Ee,scaleFactor:s};g=new XRWebGLBinding(a,t),m=g.createProjectionLayer(je),a.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),S=new is(m.textureWidth,m.textureHeight,{format:Si,type:ns,depthTexture:new vb(m.textureWidth,m.textureHeight,Pe,void 0,void 0,void 0,void 0,void 0,void 0,ve),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(c),h=null,l=await a.requestReferenceSpace(u),tt.setContext(a),tt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode},this.getDepthTexture=function(){return T.getDepthTexture()};function ae(ee){for(let ve=0;ve<ee.removed.length;ve++){const Pe=ee.removed[ve],Ee=A.indexOf(Pe);Ee>=0&&(A[Ee]=null,E[Ee].disconnect(Pe))}for(let ve=0;ve<ee.added.length;ve++){const Pe=ee.added[ve];let Ee=A.indexOf(Pe);if(Ee===-1){for(let Qe=0;Qe<E.length;Qe++)if(Qe>=A.length){A.push(Pe),Ee=Qe;break}else if(A[Qe]===null){A[Qe]=Pe,Ee=Qe;break}if(Ee===-1)break}const je=E[Ee];je&&je.connect(Pe)}}const V=new P,ne=new P;function q(ee,ve,Pe){V.setFromMatrixPosition(ve.matrixWorld),ne.setFromMatrixPosition(Pe.matrixWorld);const Ee=V.distanceTo(ne),je=ve.projectionMatrix.elements,Qe=Pe.projectionMatrix.elements,nt=je[14]/(je[10]-1),Ct=je[14]/(je[10]+1),ce=(je[9]+1)/je[5],_e=(je[9]-1)/je[5],F=(je[8]-1)/je[0],We=(Qe[8]+1)/Qe[0],ge=nt*F,De=nt*We,Te=Ee/(-F+We),Ke=Te*-F;if(ve.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(Ke),ee.translateZ(Te),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),je[10]===-1)ee.projectionMatrix.copy(ve.projectionMatrix),ee.projectionMatrixInverse.copy(ve.projectionMatrixInverse);else{const ze=nt+Te,O=Ct+Te,D=ge-Ke,Z=De+(Ee-Ke),re=ce*Ct/O*ze,de=_e*Ct/O*ze;ee.projectionMatrix.makePerspective(D,Z,re,de,ze,O),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function oe(ee,ve){ve===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(ve.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(a===null)return;let ve=ee.near,Pe=ee.far;T.texture!==null&&(T.depthNear>0&&(ve=T.depthNear),T.depthFar>0&&(Pe=T.depthFar)),w.near=z.near=L.near=ve,w.far=z.far=L.far=Pe,(B!==w.near||Q!==w.far)&&(a.updateRenderState({depthNear:w.near,depthFar:w.far}),B=w.near,Q=w.far),L.layers.mask=ee.layers.mask|2,z.layers.mask=ee.layers.mask|4,w.layers.mask=L.layers.mask|z.layers.mask;const Ee=ee.parent,je=w.cameras;oe(w,Ee);for(let Qe=0;Qe<je.length;Qe++)oe(je[Qe],Ee);je.length===2?q(w,L,z):w.projectionMatrix.copy(L.projectionMatrix),me(ee,w,Ee)};function me(ee,ve,Pe){Pe===null?ee.matrix.copy(ve.matrixWorld):(ee.matrix.copy(Pe.matrixWorld),ee.matrix.invert(),ee.matrix.multiply(ve.matrixWorld)),ee.matrix.decompose(ee.position,ee.quaternion,ee.scale),ee.updateMatrixWorld(!0),ee.projectionMatrix.copy(ve.projectionMatrix),ee.projectionMatrixInverse.copy(ve.projectionMatrixInverse),ee.isPerspectiveCamera&&(ee.fov=Ac*2*Math.atan(1/ee.projectionMatrix.elements[5]),ee.zoom=1)}this.getCamera=function(){return w},this.getFoveation=function(){if(!(m===null&&v===null))return c},this.setFoveation=function(ee){c=ee,m!==null&&(m.fixedFoveation=ee),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ee)},this.hasDepthSensing=function(){return T.texture!==null},this.getDepthSensingMesh=function(){return T.getMesh(w)};let ye=null;function Ie(ee,ve){if(p=ve.getViewerPose(h||l),_=ve,p!==null){const Pe=p.views;v!==null&&(e.setRenderTargetFramebuffer(S,v.framebuffer),e.setRenderTarget(S));let Ee=!1;Pe.length!==w.cameras.length&&(w.cameras.length=0,Ee=!0);for(let Qe=0;Qe<Pe.length;Qe++){const nt=Pe[Qe];let Ct=null;if(v!==null)Ct=v.getViewport(nt);else{const _e=g.getViewSubImage(m,nt);Ct=_e.viewport,Qe===0&&(e.setRenderTargetTextures(S,_e.colorTexture,m.ignoreDepthValues?void 0:_e.depthStencilTexture),e.setRenderTarget(S))}let ce=C[Qe];ce===void 0&&(ce=new ti,ce.layers.enable(Qe),ce.viewport=new Pt,C[Qe]=ce),ce.matrix.fromArray(nt.transform.matrix),ce.matrix.decompose(ce.position,ce.quaternion,ce.scale),ce.projectionMatrix.fromArray(nt.projectionMatrix),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert(),ce.viewport.set(Ct.x,Ct.y,Ct.width,Ct.height),Qe===0&&(w.matrix.copy(ce.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),Ee===!0&&w.cameras.push(ce)}const je=a.enabledFeatures;if(je&&je.includes("depth-sensing")){const Qe=g.getDepthInformation(Pe[0]);Qe&&Qe.isValid&&Qe.texture&&T.init(e,Qe,a.renderState)}}for(let Pe=0;Pe<E.length;Pe++){const Ee=A[Pe],je=E[Pe];Ee!==null&&je!==void 0&&je.update(Ee,ve,h||l)}ye&&ye(ee,ve),ve.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ve}),_=null}const tt=new CD;tt.setAnimationLoop(Ie),this.setAnimationLoop=function(ee){ye=ee},this.dispose=function(){}}}const Ko=new ba,nH=new lt;function iH(n,e){function t(b,y){b.matrixAutoUpdate===!0&&b.updateMatrix(),y.value.copy(b.matrix)}function i(b,y){y.color.getRGB(b.fogColor.value,ED(n)),y.isFog?(b.fogNear.value=y.near,b.fogFar.value=y.far):y.isFogExp2&&(b.fogDensity.value=y.density)}function a(b,y,S,E,A){y.isMeshBasicMaterial||y.isMeshLambertMaterial?s(b,y):y.isMeshToonMaterial?(s(b,y),g(b,y)):y.isMeshPhongMaterial?(s(b,y),p(b,y)):y.isMeshStandardMaterial?(s(b,y),m(b,y),y.isMeshPhysicalMaterial&&v(b,y,A)):y.isMeshMatcapMaterial?(s(b,y),_(b,y)):y.isMeshDepthMaterial?s(b,y):y.isMeshDistanceMaterial?(s(b,y),T(b,y)):y.isMeshNormalMaterial?s(b,y):y.isLineBasicMaterial?(l(b,y),y.isLineDashedMaterial&&u(b,y)):y.isPointsMaterial?c(b,y,S,E):y.isSpriteMaterial?h(b,y):y.isShadowMaterial?(b.color.value.copy(y.color),b.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function s(b,y){b.opacity.value=y.opacity,y.color&&b.diffuse.value.copy(y.color),y.emissive&&b.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.bumpMap&&(b.bumpMap.value=y.bumpMap,t(y.bumpMap,b.bumpMapTransform),b.bumpScale.value=y.bumpScale,y.side===Ui&&(b.bumpScale.value*=-1)),y.normalMap&&(b.normalMap.value=y.normalMap,t(y.normalMap,b.normalMapTransform),b.normalScale.value.copy(y.normalScale),y.side===Ui&&b.normalScale.value.negate()),y.displacementMap&&(b.displacementMap.value=y.displacementMap,t(y.displacementMap,b.displacementMapTransform),b.displacementScale.value=y.displacementScale,b.displacementBias.value=y.displacementBias),y.emissiveMap&&(b.emissiveMap.value=y.emissiveMap,t(y.emissiveMap,b.emissiveMapTransform)),y.specularMap&&(b.specularMap.value=y.specularMap,t(y.specularMap,b.specularMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest);const S=e.get(y),E=S.envMap,A=S.envMapRotation;E&&(b.envMap.value=E,Ko.copy(A),Ko.x*=-1,Ko.y*=-1,Ko.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Ko.y*=-1,Ko.z*=-1),b.envMapRotation.value.setFromMatrix4(nH.makeRotationFromEuler(Ko)),b.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=y.reflectivity,b.ior.value=y.ior,b.refractionRatio.value=y.refractionRatio),y.lightMap&&(b.lightMap.value=y.lightMap,b.lightMapIntensity.value=y.lightMapIntensity,t(y.lightMap,b.lightMapTransform)),y.aoMap&&(b.aoMap.value=y.aoMap,b.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,b.aoMapTransform))}function l(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform))}function u(b,y){b.dashSize.value=y.dashSize,b.totalSize.value=y.dashSize+y.gapSize,b.scale.value=y.scale}function c(b,y,S,E){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.size.value=y.size*S,b.scale.value=E*.5,y.map&&(b.map.value=y.map,t(y.map,b.uvTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function h(b,y){b.diffuse.value.copy(y.color),b.opacity.value=y.opacity,b.rotation.value=y.rotation,y.map&&(b.map.value=y.map,t(y.map,b.mapTransform)),y.alphaMap&&(b.alphaMap.value=y.alphaMap,t(y.alphaMap,b.alphaMapTransform)),y.alphaTest>0&&(b.alphaTest.value=y.alphaTest)}function p(b,y){b.specular.value.copy(y.specular),b.shininess.value=Math.max(y.shininess,1e-4)}function g(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function m(b,y){b.metalness.value=y.metalness,y.metalnessMap&&(b.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,b.metalnessMapTransform)),b.roughness.value=y.roughness,y.roughnessMap&&(b.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,b.roughnessMapTransform)),y.envMap&&(b.envMapIntensity.value=y.envMapIntensity)}function v(b,y,S){b.ior.value=y.ior,y.sheen>0&&(b.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),b.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(b.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,b.sheenColorMapTransform)),y.sheenRoughnessMap&&(b.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,b.sheenRoughnessMapTransform))),y.clearcoat>0&&(b.clearcoat.value=y.clearcoat,b.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(b.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,b.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(b.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===Ui&&b.clearcoatNormalScale.value.negate())),y.dispersion>0&&(b.dispersion.value=y.dispersion),y.iridescence>0&&(b.iridescence.value=y.iridescence,b.iridescenceIOR.value=y.iridescenceIOR,b.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(b.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,b.iridescenceMapTransform)),y.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),y.transmission>0&&(b.transmission.value=y.transmission,b.transmissionSamplerMap.value=S.texture,b.transmissionSamplerSize.value.set(S.width,S.height),y.transmissionMap&&(b.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,b.transmissionMapTransform)),b.thickness.value=y.thickness,y.thicknessMap&&(b.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=y.attenuationDistance,b.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(b.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(b.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=y.specularIntensity,b.specularColor.value.copy(y.specularColor),y.specularColorMap&&(b.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,b.specularColorMapTransform)),y.specularIntensityMap&&(b.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,b.specularIntensityMapTransform))}function _(b,y){y.matcap&&(b.matcap.value=y.matcap)}function T(b,y){const S=e.get(y).light;b.referencePosition.value.setFromMatrixPosition(S.matrixWorld),b.nearDistance.value=S.shadow.camera.near,b.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:a}}function aH(n,e,t,i){let a={},s={},l=[];const u=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function c(S,E){const A=E.program;i.uniformBlockBinding(S,A)}function h(S,E){let A=a[S.id];A===void 0&&(_(S),A=p(S),a[S.id]=A,S.addEventListener("dispose",b));const I=E.program;i.updateUBOMapping(S,I);const R=e.render.frame;s[S.id]!==R&&(m(S),s[S.id]=R)}function p(S){const E=g();S.__bindingPointIndex=E;const A=n.createBuffer(),I=S.__size,R=S.usage;return n.bindBuffer(n.UNIFORM_BUFFER,A),n.bufferData(n.UNIFORM_BUFFER,I,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,E,A),A}function g(){for(let S=0;S<u;S++)if(l.indexOf(S)===-1)return l.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(S){const E=a[S.id],A=S.uniforms,I=S.__cache;n.bindBuffer(n.UNIFORM_BUFFER,E);for(let R=0,L=A.length;R<L;R++){const z=Array.isArray(A[R])?A[R]:[A[R]];for(let C=0,w=z.length;C<w;C++){const B=z[C];if(v(B,R,C,I)===!0){const Q=B.__offset,k=Array.isArray(B.value)?B.value:[B.value];let j=0;for(let ae=0;ae<k.length;ae++){const V=k[ae],ne=T(V);typeof V=="number"||typeof V=="boolean"?(B.__data[0]=V,n.bufferSubData(n.UNIFORM_BUFFER,Q+j,B.__data)):V.isMatrix3?(B.__data[0]=V.elements[0],B.__data[1]=V.elements[1],B.__data[2]=V.elements[2],B.__data[3]=0,B.__data[4]=V.elements[3],B.__data[5]=V.elements[4],B.__data[6]=V.elements[5],B.__data[7]=0,B.__data[8]=V.elements[6],B.__data[9]=V.elements[7],B.__data[10]=V.elements[8],B.__data[11]=0):(V.toArray(B.__data,j),j+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,Q,B.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function v(S,E,A,I){const R=S.value,L=E+"_"+A;if(I[L]===void 0)return typeof R=="number"||typeof R=="boolean"?I[L]=R:I[L]=R.clone(),!0;{const z=I[L];if(typeof R=="number"||typeof R=="boolean"){if(z!==R)return I[L]=R,!0}else if(z.equals(R)===!1)return z.copy(R),!0}return!1}function _(S){const E=S.uniforms;let A=0;const I=16;for(let L=0,z=E.length;L<z;L++){const C=Array.isArray(E[L])?E[L]:[E[L]];for(let w=0,B=C.length;w<B;w++){const Q=C[w],k=Array.isArray(Q.value)?Q.value:[Q.value];for(let j=0,ae=k.length;j<ae;j++){const V=k[j],ne=T(V),q=A%I,oe=q%ne.boundary,me=q+oe;A+=oe,me!==0&&I-me<ne.storage&&(A+=I-me),Q.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),Q.__offset=A,A+=ne.storage}}}const R=A%I;return R>0&&(A+=I-R),S.__size=A,S.__cache={},this}function T(S){const E={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(E.boundary=4,E.storage=4):S.isVector2?(E.boundary=8,E.storage=8):S.isVector3||S.isColor?(E.boundary=16,E.storage=12):S.isVector4?(E.boundary=16,E.storage=16):S.isMatrix3?(E.boundary=48,E.storage=48):S.isMatrix4?(E.boundary=64,E.storage=64):S.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",S),E}function b(S){const E=S.target;E.removeEventListener("dispose",b);const A=l.indexOf(E.__bindingPointIndex);l.splice(A,1),n.deleteBuffer(a[E.id]),delete a[E.id],delete s[E.id]}function y(){for(const S in a)n.deleteBuffer(a[S]);l=[],a={},s={}}return{bind:c,update:h,dispose:y}}class zD{constructor(e={}){const{canvas:t=xD(),context:i=null,depth:a=!0,stencil:s=!1,alpha:l=!1,antialias:u=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:h=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reverseDepthBuffer:m=!1}=e;this.isWebGLRenderer=!0;let v;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=i.getContextAttributes().alpha}else v=l;const _=new Uint32Array(4),T=new Int32Array(4);let b=null,y=null;const S=[],E=[];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=xi,this.toneMapping=Ms,this.toneMappingExposure=1;const A=this;let I=!1,R=0,L=0,z=null,C=-1,w=null;const B=new Pt,Q=new Pt;let k=null;const j=new Be(0);let ae=0,V=t.width,ne=t.height,q=1,oe=null,me=null;const ye=new Pt(0,0,V,ne),Ie=new Pt(0,0,V,ne);let tt=!1;const ee=new od;let ve=!1,Pe=!1;const Ee=new lt,je=new lt,Qe=new P,nt=new Pt,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ce=!1;function _e(){return z===null?q:1}let F=i;function We(N,X){return t.getContext(N,X)}try{const N={alpha:!0,depth:a,stencil:s,antialias:u,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${l0}`),t.addEventListener("webglcontextlost",fe,!1),t.addEventListener("webglcontextrestored",Oe,!1),t.addEventListener("webglcontextcreationerror",Ue,!1),F===null){const X="webgl2";if(F=We(X,N),F===null)throw We(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let ge,De,Te,Ke,ze,O,D,Z,re,de,le,Xe,we,Ce,mt,xe,ke,Je,it,Ge,Rt,ft,Kt,G;function Le(){ge=new c5(F),ge.init(),ft=new ND(F,ge),De=new a5(F,ge,e,ft),Te=new X6(F,ge),De.reverseDepthBuffer&&m&&Te.buffers.depth.setReversed(!0),Ke=new d5(F),ze=new U6,O=new Q6(F,ge,Te,ze,De,ft,Ke),D=new r5(A),Z=new u5(A),re=new xB(F),Kt=new n5(F,re),de=new f5(F,re,Ke,Kt),le=new m5(F,de,re,Ke),it=new p5(F,De,O),xe=new s5(ze),Xe=new D6(A,D,Z,ge,De,Kt,xe),we=new iH(A,ze),Ce=new N6,mt=new F6(ge),Je=new t5(A,D,Z,Te,le,v,c),ke=new k6(A,le,De),G=new aH(F,Ke,De,Te),Ge=new i5(F,ge,Ke),Rt=new h5(F,ge,Ke),Ke.programs=Xe.programs,A.capabilities=De,A.extensions=ge,A.properties=ze,A.renderLists=Ce,A.shadowMap=ke,A.state=Te,A.info=Ke}Le();const se=new tH(A,F);this.xr=se,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const N=ge.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ge.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return q},this.setPixelRatio=function(N){N!==void 0&&(q=N,this.setSize(V,ne,!1))},this.getSize=function(N){return N.set(V,ne)},this.setSize=function(N,X,J=!0){if(se.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=N,ne=X,t.width=Math.floor(N*q),t.height=Math.floor(X*q),J===!0&&(t.style.width=N+"px",t.style.height=X+"px"),this.setViewport(0,0,N,X)},this.getDrawingBufferSize=function(N){return N.set(V*q,ne*q).floor()},this.setDrawingBufferSize=function(N,X,J){V=N,ne=X,q=J,t.width=Math.floor(N*J),t.height=Math.floor(X*J),this.setViewport(0,0,N,X)},this.getCurrentViewport=function(N){return N.copy(B)},this.getViewport=function(N){return N.copy(ye)},this.setViewport=function(N,X,J,$){N.isVector4?ye.set(N.x,N.y,N.z,N.w):ye.set(N,X,J,$),Te.viewport(B.copy(ye).multiplyScalar(q).round())},this.getScissor=function(N){return N.copy(Ie)},this.setScissor=function(N,X,J,$){N.isVector4?Ie.set(N.x,N.y,N.z,N.w):Ie.set(N,X,J,$),Te.scissor(Q.copy(Ie).multiplyScalar(q).round())},this.getScissorTest=function(){return tt},this.setScissorTest=function(N){Te.setScissorTest(tt=N)},this.setOpaqueSort=function(N){oe=N},this.setTransparentSort=function(N){me=N},this.getClearColor=function(N){return N.copy(Je.getClearColor())},this.setClearColor=function(){Je.setClearColor.apply(Je,arguments)},this.getClearAlpha=function(){return Je.getClearAlpha()},this.setClearAlpha=function(){Je.setClearAlpha.apply(Je,arguments)},this.clear=function(N=!0,X=!0,J=!0){let $=0;if(N){let W=!1;if(z!==null){const Me=z.texture.format;W=Me===g0||Me===m0||Me===ad}if(W){const Me=z.texture.type,Ne=Me===ns||Me===_r||Me===Tc||Me===Ul||Me===h0||Me===d0,qe=Je.getClearColor(),Fe=Je.getClearAlpha(),at=qe.r,dt=qe.g,He=qe.b;Ne?(_[0]=at,_[1]=dt,_[2]=He,_[3]=Fe,F.clearBufferuiv(F.COLOR,0,_)):(T[0]=at,T[1]=dt,T[2]=He,T[3]=Fe,F.clearBufferiv(F.COLOR,0,T))}else $|=F.COLOR_BUFFER_BIT}X&&($|=F.DEPTH_BUFFER_BIT),J&&($|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),F.clear($)},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",fe,!1),t.removeEventListener("webglcontextrestored",Oe,!1),t.removeEventListener("webglcontextcreationerror",Ue,!1),Ce.dispose(),mt.dispose(),ze.dispose(),D.dispose(),Z.dispose(),le.dispose(),Kt.dispose(),G.dispose(),Xe.dispose(),se.dispose(),se.removeEventListener("sessionstart",br),se.removeEventListener("sessionend",wo),ls.stop()};function fe(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Oe(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const N=Ke.autoReset,X=ke.enabled,J=ke.autoUpdate,$=ke.needsUpdate,W=ke.type;Le(),Ke.autoReset=N,ke.enabled=X,ke.autoUpdate=J,ke.needsUpdate=$,ke.type=W}function Ue(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function ht(N){const X=N.target;X.removeEventListener("dispose",ht),rn(X)}function rn(N){fn(N),ze.remove(N)}function fn(N){const X=ze.get(N).programs;X!==void 0&&(X.forEach(function(J){Xe.releaseProgram(J)}),N.isShaderMaterial&&Xe.releaseShaderCache(N))}this.renderBufferDirect=function(N,X,J,$,W,Me){X===null&&(X=Ct);const Ne=W.isMesh&&W.matrixWorld.determinant()<0,qe=us(N,X,J,$,W);Te.setMaterial($,Ne);let Fe=J.index,at=1;if($.wireframe===!0){if(Fe=de.getWireframeAttribute(J),Fe===void 0)return;at=2}const dt=J.drawRange,He=J.attributes.position;let ct=dt.start*at,Xt=(dt.start+dt.count)*at;Me!==null&&(ct=Math.max(ct,Me.start*at),Xt=Math.min(Xt,(Me.start+Me.count)*at)),Fe!==null?(ct=Math.max(ct,0),Xt=Math.min(Xt,Fe.count)):He!=null&&(ct=Math.max(ct,0),Xt=Math.min(Xt,He.count));const st=Xt-ct;if(st<0||st===1/0)return;Kt.setup(W,$,qe,J,Fe);let Yn,zt=Ge;if(Fe!==null&&(Yn=re.get(Fe),zt=Rt,zt.setIndex(Yn)),W.isMesh)$.wireframe===!0?(Te.setLineWidth($.wireframeLinewidth*_e()),zt.setMode(F.LINES)):zt.setMode(F.TRIANGLES);else if(W.isLine){let Ze=$.linewidth;Ze===void 0&&(Ze=1),Te.setLineWidth(Ze*_e()),W.isLineSegments?zt.setMode(F.LINES):W.isLineLoop?zt.setMode(F.LINE_LOOP):zt.setMode(F.LINE_STRIP)}else W.isPoints?zt.setMode(F.POINTS):W.isSprite&&zt.setMode(F.TRIANGLES);if(W.isBatchedMesh)if(W._multiDrawInstances!==null)zt.renderMultiDrawInstances(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount,W._multiDrawInstances);else if(ge.get("WEBGL_multi_draw"))zt.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{const Ze=W._multiDrawStarts,Ea=W._multiDrawCounts,Ht=W._multiDrawCount,Ei=Fe?re.get(Fe).bytesPerElement:1,fs=ze.get($).currentProgram.getUniforms();for(let ii=0;ii<Ht;ii++)fs.setValue(F,"_gl_DrawID",ii),zt.render(Ze[ii]/Ei,Ea[ii])}else if(W.isInstancedMesh)zt.renderInstances(ct,st,W.count);else if(J.isInstancedBufferGeometry){const Ze=J._maxInstanceCount!==void 0?J._maxInstanceCount:1/0,Ea=Math.min(J.instanceCount,Ze);zt.renderInstances(ct,st,Ea)}else zt.render(ct,st)};function Ft(N,X,J){N.transparent===!0&&N.side===gs&&N.forceSinglePass===!1?(N.side=Ui,N.needsUpdate=!0,Ds(N,X,J),N.side=vr,N.needsUpdate=!0,Ds(N,X,J),N.side=gs):Ds(N,X,J)}this.compile=function(N,X,J=null){J===null&&(J=N),y=mt.get(J),y.init(X),E.push(y),J.traverseVisible(function(W){W.isLight&&W.layers.test(X.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),N!==J&&N.traverseVisible(function(W){W.isLight&&W.layers.test(X.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),y.setupLights();const $=new Set;return N.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;const Me=W.material;if(Me)if(Array.isArray(Me))for(let Ne=0;Ne<Me.length;Ne++){const qe=Me[Ne];Ft(qe,J,W),$.add(qe)}else Ft(Me,J,W),$.add(Me)}),E.pop(),y=null,$},this.compileAsync=function(N,X,J=null){const $=this.compile(N,X,J);return new Promise(W=>{function Me(){if($.forEach(function(Ne){ze.get(Ne).currentProgram.isReady()&&$.delete(Ne)}),$.size===0){W(N);return}setTimeout(Me,10)}ge.get("KHR_parallel_shader_compile")!==null?Me():setTimeout(Me,10)})};let Ii=null;function zi(N){Ii&&Ii(N)}function br(){ls.stop()}function wo(){ls.start()}const ls=new CD;ls.setAnimationLoop(zi),typeof self<"u"&&ls.setContext(self),this.setAnimationLoop=function(N){Ii=N,se.setAnimationLoop(N),N===null?ls.stop():ls.start()},se.addEventListener("sessionstart",br),se.addEventListener("sessionend",wo),this.render=function(N,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),X.parent===null&&X.matrixWorldAutoUpdate===!0&&X.updateMatrixWorld(),se.enabled===!0&&se.isPresenting===!0&&(se.cameraAutoUpdate===!0&&se.updateCamera(X),X=se.getCamera()),N.isScene===!0&&N.onBeforeRender(A,N,X,z),y=mt.get(N,E.length),y.init(X),E.push(y),je.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),ee.setFromProjectionMatrix(je),Pe=this.localClippingEnabled,ve=xe.init(this.clippingPlanes,Pe),b=Ce.get(N,S.length),b.init(),S.push(b),se.enabled===!0&&se.isPresenting===!0){const Me=A.xr.getDepthSensingMesh();Me!==null&&Mr(Me,X,-1/0,A.sortObjects)}Mr(N,X,0,A.sortObjects),b.finish(),A.sortObjects===!0&&b.sort(oe,me),ce=se.enabled===!1||se.isPresenting===!1||se.hasDepthSensing()===!1,ce&&Je.addToRenderList(b,N),this.info.render.frame++,ve===!0&&xe.beginShadows();const J=y.state.shadowsArray;ke.render(J,N,X),ve===!0&&xe.endShadows(),this.info.autoReset===!0&&this.info.reset();const $=b.opaque,W=b.transmissive;if(y.setupLights(),X.isArrayCamera){const Me=X.cameras;if(W.length>0)for(let Ne=0,qe=Me.length;Ne<qe;Ne++){const Fe=Me[Ne];Xl($,W,N,Fe)}ce&&Je.render(N);for(let Ne=0,qe=Me.length;Ne<qe;Ne++){const Fe=Me[Ne];Co(b,N,Fe,Fe.viewport)}}else W.length>0&&Xl($,W,N,X),ce&&Je.render(N),Co(b,N,X);z!==null&&(O.updateMultisampleRenderTarget(z),O.updateRenderTargetMipmap(z)),N.isScene===!0&&N.onAfterRender(A,N,X),Kt.resetDefaultState(),C=-1,w=null,E.pop(),E.length>0?(y=E[E.length-1],ve===!0&&xe.setGlobalState(A.clippingPlanes,y.state.camera)):y=null,S.pop(),S.length>0?b=S[S.length-1]:b=null};function Mr(N,X,J,$){if(N.visible===!1)return;if(N.layers.test(X.layers)){if(N.isGroup)J=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(X);else if(N.isLight)y.pushLight(N),N.castShadow&&y.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ee.intersectsSprite(N)){$&&nt.setFromMatrixPosition(N.matrixWorld).applyMatrix4(je);const Ne=le.update(N),qe=N.material;qe.visible&&b.push(N,Ne,qe,J,nt.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ee.intersectsObject(N))){const Ne=le.update(N),qe=N.material;if($&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),nt.copy(N.boundingSphere.center)):(Ne.boundingSphere===null&&Ne.computeBoundingSphere(),nt.copy(Ne.boundingSphere.center)),nt.applyMatrix4(N.matrixWorld).applyMatrix4(je)),Array.isArray(qe)){const Fe=Ne.groups;for(let at=0,dt=Fe.length;at<dt;at++){const He=Fe[at],ct=qe[He.materialIndex];ct&&ct.visible&&b.push(N,Ne,ct,J,nt.z,He)}}else qe.visible&&b.push(N,Ne,qe,J,nt.z,null)}}const Me=N.children;for(let Ne=0,qe=Me.length;Ne<qe;Ne++)Mr(Me[Ne],X,J,$)}function Co(N,X,J,$){const W=N.opaque,Me=N.transmissive,Ne=N.transparent;y.setupLightsView(J),ve===!0&&xe.setGlobalState(A.clippingPlanes,J),$&&Te.viewport(B.copy($)),W.length>0&&Ma(W,X,J),Me.length>0&&Ma(Me,X,J),Ne.length>0&&Ma(Ne,X,J),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function Xl(N,X,J,$){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;y.state.transmissionRenderTarget[$.id]===void 0&&(y.state.transmissionRenderTarget[$.id]=new is(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")||ge.has("EXT_color_buffer_float")?Fc:ns,minFilter:xs,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ut.workingColorSpace}));const Me=y.state.transmissionRenderTarget[$.id],Ne=$.viewport||B;Me.setSize(Ne.z,Ne.w);const qe=A.getRenderTarget();A.setRenderTarget(Me),A.getClearColor(j),ae=A.getClearAlpha(),ae<1&&A.setClearColor(16777215,.5),A.clear(),ce&&Je.render(J);const Fe=A.toneMapping;A.toneMapping=Ms;const at=$.viewport;if($.viewport!==void 0&&($.viewport=void 0),y.setupLightsView($),ve===!0&&xe.setGlobalState(A.clippingPlanes,$),Ma(N,J,$),O.updateMultisampleRenderTarget(Me),O.updateRenderTargetMipmap(Me),ge.has("WEBGL_multisampled_render_to_texture")===!1){let dt=!1;for(let He=0,ct=X.length;He<ct;He++){const Xt=X[He],st=Xt.object,Yn=Xt.geometry,zt=Xt.material,Ze=Xt.group;if(zt.side===gs&&st.layers.test($.layers)){const Ea=zt.side;zt.side=Ui,zt.needsUpdate=!0,Wc(st,J,$,Yn,zt,Ze),zt.side=Ea,zt.needsUpdate=!0,dt=!0}}dt===!0&&(O.updateMultisampleRenderTarget(Me),O.updateRenderTargetMipmap(Me))}A.setRenderTarget(qe),A.setClearColor(j,ae),at!==void 0&&($.viewport=at),A.toneMapping=Fe}function Ma(N,X,J){const $=X.isScene===!0?X.overrideMaterial:null;for(let W=0,Me=N.length;W<Me;W++){const Ne=N[W],qe=Ne.object,Fe=Ne.geometry,at=$===null?Ne.material:$,dt=Ne.group;qe.layers.test(J.layers)&&Wc(qe,X,J,Fe,at,dt)}}function Wc(N,X,J,$,W,Me){N.onBeforeRender(A,X,J,$,W,Me),N.modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),W.onBeforeRender(A,X,J,$,N,Me),W.transparent===!0&&W.side===gs&&W.forceSinglePass===!1?(W.side=Ui,W.needsUpdate=!0,A.renderBufferDirect(J,X,$,W,N,Me),W.side=vr,W.needsUpdate=!0,A.renderBufferDirect(J,X,$,W,N,Me),W.side=gs):A.renderBufferDirect(J,X,$,W,N,Me),N.onAfterRender(A,X,J,$,W,Me)}function Ds(N,X,J){X.isScene!==!0&&(X=Ct);const $=ze.get(N),W=y.state.lights,Me=y.state.shadowsArray,Ne=W.state.version,qe=Xe.getParameters(N,W.state,Me,X,J),Fe=Xe.getProgramCacheKey(qe);let at=$.programs;$.environment=N.isMeshStandardMaterial?X.environment:null,$.fog=X.fog,$.envMap=(N.isMeshStandardMaterial?Z:D).get(N.envMap||$.environment),$.envMapRotation=$.environment!==null&&N.envMap===null?X.environmentRotation:N.envMapRotation,at===void 0&&(N.addEventListener("dispose",ht),at=new Map,$.programs=at);let dt=at.get(Fe);if(dt!==void 0){if($.currentProgram===dt&&$.lightsStateVersion===Ne)return ql(N,qe),dt}else qe.uniforms=Xe.getUniforms(N),N.onBeforeCompile(qe,A),dt=Xe.acquireProgram(qe,Fe),at.set(Fe,dt),$.uniforms=qe.uniforms;const He=$.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(He.clippingPlanes=xe.uniform),ql(N,qe),$.needsLights=Ro(N),$.lightsStateVersion=Ne,$.needsLights&&(He.ambientLightColor.value=W.state.ambient,He.lightProbe.value=W.state.probe,He.directionalLights.value=W.state.directional,He.directionalLightShadows.value=W.state.directionalShadow,He.spotLights.value=W.state.spot,He.spotLightShadows.value=W.state.spotShadow,He.rectAreaLights.value=W.state.rectArea,He.ltc_1.value=W.state.rectAreaLTC1,He.ltc_2.value=W.state.rectAreaLTC2,He.pointLights.value=W.state.point,He.pointLightShadows.value=W.state.pointShadow,He.hemisphereLights.value=W.state.hemi,He.directionalShadowMap.value=W.state.directionalShadowMap,He.directionalShadowMatrix.value=W.state.directionalShadowMatrix,He.spotShadowMap.value=W.state.spotShadowMap,He.spotLightMatrix.value=W.state.spotLightMatrix,He.spotLightMap.value=W.state.spotLightMap,He.pointShadowMap.value=W.state.pointShadowMap,He.pointShadowMatrix.value=W.state.pointShadowMatrix),$.currentProgram=dt,$.uniformsList=null,dt}function Wl(N){if(N.uniformsList===null){const X=N.currentProgram.getUniforms();N.uniformsList=Em.seqWithValue(X.seq,N.uniforms)}return N.uniformsList}function ql(N,X){const J=ze.get(N);J.outputColorSpace=X.outputColorSpace,J.batching=X.batching,J.batchingColor=X.batchingColor,J.instancing=X.instancing,J.instancingColor=X.instancingColor,J.instancingMorph=X.instancingMorph,J.skinning=X.skinning,J.morphTargets=X.morphTargets,J.morphNormals=X.morphNormals,J.morphColors=X.morphColors,J.morphTargetsCount=X.morphTargetsCount,J.numClippingPlanes=X.numClippingPlanes,J.numIntersection=X.numClipIntersection,J.vertexAlphas=X.vertexAlphas,J.vertexTangents=X.vertexTangents,J.toneMapping=X.toneMapping}function us(N,X,J,$,W){X.isScene!==!0&&(X=Ct),O.resetTextureUnits();const Me=X.fog,Ne=$.isMeshStandardMaterial?X.environment:null,qe=z===null?A.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Mo,Fe=($.isMeshStandardMaterial?Z:D).get($.envMap||Ne),at=$.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,dt=!!J.attributes.tangent&&(!!$.normalMap||$.anisotropy>0),He=!!J.morphAttributes.position,ct=!!J.morphAttributes.normal,Xt=!!J.morphAttributes.color;let st=Ms;$.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(st=A.toneMapping);const Yn=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,zt=Yn!==void 0?Yn.length:0,Ze=ze.get($),Ea=y.state.lights;if(ve===!0&&(Pe===!0||N!==w)){const ai=N===w&&$.id===C;xe.setState($,N,ai)}let Ht=!1;$.version===Ze.__version?(Ze.needsLights&&Ze.lightsStateVersion!==Ea.state.version||Ze.outputColorSpace!==qe||W.isBatchedMesh&&Ze.batching===!1||!W.isBatchedMesh&&Ze.batching===!0||W.isBatchedMesh&&Ze.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&Ze.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&Ze.instancing===!1||!W.isInstancedMesh&&Ze.instancing===!0||W.isSkinnedMesh&&Ze.skinning===!1||!W.isSkinnedMesh&&Ze.skinning===!0||W.isInstancedMesh&&Ze.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&Ze.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&Ze.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&Ze.instancingMorph===!1&&W.morphTexture!==null||Ze.envMap!==Fe||$.fog===!0&&Ze.fog!==Me||Ze.numClippingPlanes!==void 0&&(Ze.numClippingPlanes!==xe.numPlanes||Ze.numIntersection!==xe.numIntersection)||Ze.vertexAlphas!==at||Ze.vertexTangents!==dt||Ze.morphTargets!==He||Ze.morphNormals!==ct||Ze.morphColors!==Xt||Ze.toneMapping!==st||Ze.morphTargetsCount!==zt)&&(Ht=!0):(Ht=!0,Ze.__version=$.version);let Ei=Ze.currentProgram;Ht===!0&&(Ei=Ds($,X,W));let fs=!1,ii=!1,En=!1;const ut=Ei.getUniforms(),Ti=Ze.uniforms;if(Te.useProgram(Ei.program)&&(fs=!0,ii=!0,En=!0),$.id!==C&&(C=$.id,ii=!0),fs||w!==N){Te.buffers.depth.getReversed()?(Ee.copy(N.projectionMatrix),WP(Ee),qP(Ee),ut.setValue(F,"projectionMatrix",Ee)):ut.setValue(F,"projectionMatrix",N.projectionMatrix),ut.setValue(F,"viewMatrix",N.matrixWorldInverse);const Ta=ut.map.cameraPosition;Ta!==void 0&&Ta.setValue(F,Qe.setFromMatrixPosition(N.matrixWorld)),De.logarithmicDepthBuffer&&ut.setValue(F,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&ut.setValue(F,"isOrthographic",N.isOrthographicCamera===!0),w!==N&&(w=N,ii=!0,En=!0)}if(W.isSkinnedMesh){ut.setOptional(F,W,"bindMatrix"),ut.setOptional(F,W,"bindMatrixInverse");const ai=W.skeleton;ai&&(ai.boneTexture===null&&ai.computeBoneTexture(),ut.setValue(F,"boneTexture",ai.boneTexture,O))}W.isBatchedMesh&&(ut.setOptional(F,W,"batchingTexture"),ut.setValue(F,"batchingTexture",W._matricesTexture,O),ut.setOptional(F,W,"batchingIdTexture"),ut.setValue(F,"batchingIdTexture",W._indirectTexture,O),ut.setOptional(F,W,"batchingColorTexture"),W._colorsTexture!==null&&ut.setValue(F,"batchingColorTexture",W._colorsTexture,O));const ka=J.morphAttributes;if((ka.position!==void 0||ka.normal!==void 0||ka.color!==void 0)&&it.update(W,J,Ei),(ii||Ze.receiveShadow!==W.receiveShadow)&&(Ze.receiveShadow=W.receiveShadow,ut.setValue(F,"receiveShadow",W.receiveShadow)),$.isMeshGouraudMaterial&&$.envMap!==null&&(Ti.envMap.value=Fe,Ti.flipEnvMap.value=Fe.isCubeTexture&&Fe.isRenderTargetTexture===!1?-1:1),$.isMeshStandardMaterial&&$.envMap===null&&X.environment!==null&&(Ti.envMapIntensity.value=X.environmentIntensity),ii&&(ut.setValue(F,"toneMappingExposure",A.toneMappingExposure),Ze.needsLights&&cs(Ti,En),Me&&$.fog===!0&&we.refreshFogUniforms(Ti,Me),we.refreshMaterialUniforms(Ti,$,q,ne,y.state.transmissionRenderTarget[N.id]),Em.upload(F,Wl(Ze),Ti,O)),$.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(Em.upload(F,Wl(Ze),Ti,O),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&ut.setValue(F,"center",W.center),ut.setValue(F,"modelViewMatrix",W.modelViewMatrix),ut.setValue(F,"normalMatrix",W.normalMatrix),ut.setValue(F,"modelMatrix",W.matrixWorld),$.isShaderMaterial||$.isRawShaderMaterial){const ai=$.uniformsGroups;for(let Ta=0,Zn=ai.length;Ta<Zn;Ta++){const Do=ai[Ta];G.update(Do,Ei),G.bind(Do,Ei)}}return Ei}function cs(N,X){N.ambientLightColor.needsUpdate=X,N.lightProbe.needsUpdate=X,N.directionalLights.needsUpdate=X,N.directionalLightShadows.needsUpdate=X,N.pointLights.needsUpdate=X,N.pointLightShadows.needsUpdate=X,N.spotLights.needsUpdate=X,N.spotLightShadows.needsUpdate=X,N.rectAreaLights.needsUpdate=X,N.hemisphereLights.needsUpdate=X}function Ro(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(N,X,J){ze.get(N.texture).__webglTexture=X,ze.get(N.depthTexture).__webglTexture=J;const $=ze.get(N);$.__hasExternalTextures=!0,$.__autoAllocateDepthBuffer=J===void 0,$.__autoAllocateDepthBuffer||ge.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),$.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,X){const J=ze.get(N);J.__webglFramebuffer=X,J.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(N,X=0,J=0){z=N,R=X,L=J;let $=!0,W=null,Me=!1,Ne=!1;if(N){const Fe=ze.get(N);if(Fe.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(F.FRAMEBUFFER,null),$=!1;else if(Fe.__webglFramebuffer===void 0)O.setupRenderTarget(N);else if(Fe.__hasExternalTextures)O.rebindTextures(N,ze.get(N.texture).__webglTexture,ze.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Fe.__boundDepthTexture!==He){if(He!==null&&ze.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(N)}}const at=N.texture;(at.isData3DTexture||at.isDataArrayTexture||at.isCompressedArrayTexture)&&(Ne=!0);const dt=ze.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(dt[X])?W=dt[X][J]:W=dt[X],Me=!0):N.samples>0&&O.useMultisampledRTT(N)===!1?W=ze.get(N).__webglMultisampledFramebuffer:Array.isArray(dt)?W=dt[J]:W=dt,B.copy(N.viewport),Q.copy(N.scissor),k=N.scissorTest}else B.copy(ye).multiplyScalar(q).floor(),Q.copy(Ie).multiplyScalar(q).floor(),k=tt;if(Te.bindFramebuffer(F.FRAMEBUFFER,W)&&$&&Te.drawBuffers(N,W),Te.viewport(B),Te.scissor(Q),Te.setScissorTest(k),Me){const Fe=ze.get(N.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+X,Fe.__webglTexture,J)}else if(Ne){const Fe=ze.get(N.texture),at=X||0;F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,Fe.__webglTexture,J||0,at)}C=-1},this.readRenderTargetPixels=function(N,X,J,$,W,Me,Ne){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=ze.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Ne!==void 0&&(qe=qe[Ne]),qe){Te.bindFramebuffer(F.FRAMEBUFFER,qe);try{const Fe=N.texture,at=Fe.format,dt=Fe.type;if(!De.textureFormatReadable(at)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!De.textureTypeReadable(dt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=N.width-$&&J>=0&&J<=N.height-W&&F.readPixels(X,J,$,W,ft.convert(at),ft.convert(dt),Me)}finally{const Fe=z!==null?ze.get(z).__webglFramebuffer:null;Te.bindFramebuffer(F.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(N,X,J,$,W,Me,Ne){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=ze.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Ne!==void 0&&(qe=qe[Ne]),qe){const Fe=N.texture,at=Fe.format,dt=Fe.type;if(!De.textureFormatReadable(at))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!De.textureTypeReadable(dt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(X>=0&&X<=N.width-$&&J>=0&&J<=N.height-W){Te.bindFramebuffer(F.FRAMEBUFFER,qe);const He=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,He),F.bufferData(F.PIXEL_PACK_BUFFER,Me.byteLength,F.STREAM_READ),F.readPixels(X,J,$,W,ft.convert(at),ft.convert(dt),0);const ct=z!==null?ze.get(z).__webglFramebuffer:null;Te.bindFramebuffer(F.FRAMEBUFFER,ct);const Xt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await XP(F,Xt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,He),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,Me),F.deleteBuffer(He),F.deleteSync(Xt),Me}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,X=null,J=0){N.isTexture!==!0&&(Hf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),X=arguments[0]||null,N=arguments[1]);const $=Math.pow(2,-J),W=Math.floor(N.image.width*$),Me=Math.floor(N.image.height*$),Ne=X!==null?X.x:0,qe=X!==null?X.y:0;O.setTexture2D(N,0),F.copyTexSubImage2D(F.TEXTURE_2D,J,0,0,Ne,qe,W,Me),Te.unbindTexture()},this.copyTextureToTexture=function(N,X,J=null,$=null,W=0){N.isTexture!==!0&&(Hf("WebGLRenderer: copyTextureToTexture function signature has changed."),$=arguments[0]||null,N=arguments[1],X=arguments[2],W=arguments[3]||0,J=null);let Me,Ne,qe,Fe,at,dt,He,ct,Xt;const st=N.isCompressedTexture?N.mipmaps[W]:N.image;J!==null?(Me=J.max.x-J.min.x,Ne=J.max.y-J.min.y,qe=J.isBox3?J.max.z-J.min.z:1,Fe=J.min.x,at=J.min.y,dt=J.isBox3?J.min.z:0):(Me=st.width,Ne=st.height,qe=st.depth||1,Fe=0,at=0,dt=0),$!==null?(He=$.x,ct=$.y,Xt=$.z):(He=0,ct=0,Xt=0);const Yn=ft.convert(X.format),zt=ft.convert(X.type);let Ze;X.isData3DTexture?(O.setTexture3D(X,0),Ze=F.TEXTURE_3D):X.isDataArrayTexture||X.isCompressedArrayTexture?(O.setTexture2DArray(X,0),Ze=F.TEXTURE_2D_ARRAY):(O.setTexture2D(X,0),Ze=F.TEXTURE_2D),F.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,X.flipY),F.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),F.pixelStorei(F.UNPACK_ALIGNMENT,X.unpackAlignment);const Ea=F.getParameter(F.UNPACK_ROW_LENGTH),Ht=F.getParameter(F.UNPACK_IMAGE_HEIGHT),Ei=F.getParameter(F.UNPACK_SKIP_PIXELS),fs=F.getParameter(F.UNPACK_SKIP_ROWS),ii=F.getParameter(F.UNPACK_SKIP_IMAGES);F.pixelStorei(F.UNPACK_ROW_LENGTH,st.width),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,st.height),F.pixelStorei(F.UNPACK_SKIP_PIXELS,Fe),F.pixelStorei(F.UNPACK_SKIP_ROWS,at),F.pixelStorei(F.UNPACK_SKIP_IMAGES,dt);const En=N.isDataArrayTexture||N.isData3DTexture,ut=X.isDataArrayTexture||X.isData3DTexture;if(N.isRenderTargetTexture||N.isDepthTexture){const Ti=ze.get(N),ka=ze.get(X),ai=ze.get(Ti.__renderTarget),Ta=ze.get(ka.__renderTarget);Te.bindFramebuffer(F.READ_FRAMEBUFFER,ai.__webglFramebuffer),Te.bindFramebuffer(F.DRAW_FRAMEBUFFER,Ta.__webglFramebuffer);for(let Zn=0;Zn<qe;Zn++)En&&F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,ze.get(N).__webglTexture,W,dt+Zn),N.isDepthTexture?(ut&&F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,ze.get(X).__webglTexture,W,Xt+Zn),F.blitFramebuffer(Fe,at,Me,Ne,He,ct,Me,Ne,F.DEPTH_BUFFER_BIT,F.NEAREST)):ut?F.copyTexSubImage3D(Ze,W,He,ct,Xt+Zn,Fe,at,Me,Ne):F.copyTexSubImage2D(Ze,W,He,ct,Xt+Zn,Fe,at,Me,Ne);Te.bindFramebuffer(F.READ_FRAMEBUFFER,null),Te.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else ut?N.isDataTexture||N.isData3DTexture?F.texSubImage3D(Ze,W,He,ct,Xt,Me,Ne,qe,Yn,zt,st.data):X.isCompressedArrayTexture?F.compressedTexSubImage3D(Ze,W,He,ct,Xt,Me,Ne,qe,Yn,st.data):F.texSubImage3D(Ze,W,He,ct,Xt,Me,Ne,qe,Yn,zt,st):N.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,W,He,ct,Me,Ne,Yn,zt,st.data):N.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,W,He,ct,st.width,st.height,Yn,st.data):F.texSubImage2D(F.TEXTURE_2D,W,He,ct,Me,Ne,Yn,zt,st);F.pixelStorei(F.UNPACK_ROW_LENGTH,Ea),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Ht),F.pixelStorei(F.UNPACK_SKIP_PIXELS,Ei),F.pixelStorei(F.UNPACK_SKIP_ROWS,fs),F.pixelStorei(F.UNPACK_SKIP_IMAGES,ii),W===0&&X.generateMipmaps&&F.generateMipmap(Ze),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,X,J=null,$=null,W=0){return N.isTexture!==!0&&(Hf("WebGLRenderer: copyTextureToTexture3D function signature has changed."),J=arguments[0]||null,$=arguments[1]||null,N=arguments[2],X=arguments[3],W=arguments[4]||0),Hf('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(N,X,J,$,W)},this.initRenderTarget=function(N){ze.get(N).__webglFramebuffer===void 0&&O.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?O.setTextureCube(N,0):N.isData3DTexture?O.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?O.setTexture2DArray(N,0):O.setTexture2D(N,0),Te.unbindTexture()},this.resetState=function(){R=0,L=0,z=null,Te.reset(),Kt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ss}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ut._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ut._getUnpackColorSpace()}}class S0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Be(e),this.density=t}clone(){return new S0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class b0{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Be(e),this.near=t,this.far=i}clone(){return new b0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class xb extends Bt{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 ba,this.environmentIntensity=1,this.environmentRotation=new ba,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 M0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Nh,this.updateRanges=[],this.version=0,this.uuid=_a()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let a=0,s=this.stride;a<s;a++)this.array[e+a]=t.array[i+a];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=_a()),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=_a()),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 wi=new P;class Nl{constructor(e,t,i,a=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=a}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++)wi.fromBufferAttribute(this,t),wi.applyMatrix4(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyNormalMatrix(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.transformDirection(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=Di(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=_t(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=_t(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=_t(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=Di(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Di(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Di(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Di(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,a){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=a,this}setXYZW(e,t,i,a,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=_t(t,this.array),i=_t(i,this.array),a=_t(a,this.array),s=_t(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=a,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 a=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[a+s])}return new tn(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 Nl(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 a=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[a+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 Sb extends Mi{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new Be(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 Nu;const wf=new P,Iu=new P,zu=new P,Ou=new he,Cf=new he,OD=new lt,zp=new P,Rf=new P,Op=new P,zA=new he,v_=new he,OA=new he;class PD extends Bt{constructor(e=new Sb){if(super(),this.isSprite=!0,this.type="Sprite",Nu===void 0){Nu=new bt;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 M0(t,5);Nu.setIndex([0,1,2,0,2,3]),Nu.setAttribute("position",new Nl(i,3,0,!1)),Nu.setAttribute("uv",new Nl(i,2,3,!1))}this.geometry=Nu,this.material=e,this.center=new he(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Iu.setFromMatrixScale(this.matrixWorld),OD.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zu.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Iu.multiplyScalar(-zu.z);const i=this.material.rotation;let a,s;i!==0&&(s=Math.cos(i),a=Math.sin(i));const l=this.center;Pp(zp.set(-.5,-.5,0),zu,l,Iu,a,s),Pp(Rf.set(.5,-.5,0),zu,l,Iu,a,s),Pp(Op.set(.5,.5,0),zu,l,Iu,a,s),zA.set(0,0),v_.set(1,0),OA.set(1,1);let u=e.ray.intersectTriangle(zp,Rf,Op,!1,wf);if(u===null&&(Pp(Rf.set(-.5,.5,0),zu,l,Iu,a,s),v_.set(0,1),u=e.ray.intersectTriangle(zp,Op,Rf,!1,wf),u===null))return;const c=e.ray.origin.distanceTo(wf);c<e.near||c>e.far||t.push({distance:c,point:wf.clone(),uv:Yi.getInterpolation(wf,zp,Rf,Op,zA,v_,OA,new he),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 Pp(n,e,t,i,a,s){Ou.subVectors(n,t).addScalar(.5).multiply(i),a!==void 0?(Cf.x=s*Ou.x-a*Ou.y,Cf.y=a*Ou.x+s*Ou.y):Cf.copy(Ou),n.copy(e),n.x+=Cf.x,n.y+=Cf.y,n.applyMatrix4(OD)}const Bp=new P,PA=new P;class BD extends Bt{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,a=t.length;i<a;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 a=this.levels;let s;for(s=0;s<a.length&&!(t<a[s].distance);s++);return a.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const a=t.splice(i,1);return this.remove(a[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,a;for(i=1,a=t.length;i<a;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){Bp.setFromMatrixPosition(this.matrixWorld);const a=e.ray.origin.distanceTo(Bp);this.getObjectForDistance(a).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Bp.setFromMatrixPosition(e.matrixWorld),PA.setFromMatrixPosition(this.matrixWorld);const i=Bp.distanceTo(PA)/e.zoom;t[0].object.visible=!0;let a,s;for(a=1,s=t.length;a<s;a++){let l=t[a].distance;if(t[a].object.visible&&(l-=l*t[a].hysteresis),i>=l)t[a-1].object.visible=!1,t[a].object.visible=!0;else break}for(this._currentLevel=a-1;a<s;a++)t[a].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 a=0,s=i.length;a<s;a++){const l=i[a];t.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return t}}const BA=new P,FA=new Pt,HA=new Pt,sH=new P,VA=new lt,Fp=new P,y_=new bi,kA=new lt,__=new Hc;class FD extends Fn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Bx,this.bindMatrix=new lt,this.bindMatrixInverse=new lt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Li),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Fp),this.boundingBox.expandByPoint(Fp)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new bi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Fp),this.boundingSphere.expandByPoint(Fp)}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,a=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),y_.copy(this.boundingSphere),y_.applyMatrix4(a),e.ray.intersectsSphere(y_)!==!1&&(kA.copy(a).invert(),__.copy(e.ray).applyMatrix4(kA),!(this.boundingBox!==null&&__.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,__)))}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 Pt,t=this.geometry.attributes.skinWeight;for(let i=0,a=t.count;i<a;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===Bx?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===sD?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,a=this.geometry;FA.fromBufferAttribute(a.attributes.skinIndex,e),HA.fromBufferAttribute(a.attributes.skinWeight,e),BA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const l=HA.getComponent(s);if(l!==0){const u=FA.getComponent(s);VA.multiplyMatrices(i.bones[u].matrixWorld,i.boneInverses[u]),t.addScaledVector(sH.copy(BA).applyMatrix4(VA),l)}}return t.applyMatrix4(this.bindMatrixInverse)}}class bb extends Bt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Es extends Mn{constructor(e=null,t=1,i=1,a,s,l,u,c,h=di,p=di,g,m){super(null,l,u,c,h,p,a,s,g,m),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const GA=new lt,rH=new lt;class E0{constructor(e=[],t=[]){this.uuid=_a(),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,a=this.bones.length;i<a;i++)this.boneInverses.push(new lt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new lt;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,a=this.boneTexture;for(let s=0,l=e.length;s<l;s++){const u=e[s]?e[s].matrixWorld:rH;GA.multiplyMatrices(u,t[s]),GA.toArray(i,s*16)}a!==null&&(a.needsUpdate=!0)}clone(){return new E0(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 Es(t,e,e,Si,Zi);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 a=this.bones[t];if(a.name===e)return a}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,a=e.bones.length;i<a;i++){const s=e.bones[i];let l=t[s];l===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),l=new bb),this.bones.push(l),this.boneInverses.push(new lt().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 a=0,s=t.length;a<s;a++){const l=t[a];e.bones.push(l.uuid);const u=i[a];e.boneInverses.push(u.toArray())}return e}}class Rc extends tn{constructor(e,t,i,a=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=a}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 Pu=new lt,XA=new lt,Hp=[],WA=new Li,oH=new lt,Df=new Fn,Uf=new bi;class HD extends Fn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Rc(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let a=0;a<i;a++)this.setMatrixAt(a,oH)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Li),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Pu),WA.copy(e.boundingBox).applyMatrix4(Pu),this.boundingBox.union(WA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new bi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Pu),Uf.copy(e.boundingSphere).applyMatrix4(Pu),this.boundingSphere.union(Uf)}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,a=this.morphTexture.source.data.data,s=i.length+1,l=e*s+1;for(let u=0;u<i.length;u++)i[u]=a[l+u]}raycast(e,t){const i=this.matrixWorld,a=this.count;if(Df.geometry=this.geometry,Df.material=this.material,Df.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Uf.copy(this.boundingSphere),Uf.applyMatrix4(i),e.ray.intersectsSphere(Uf)!==!1))for(let s=0;s<a;s++){this.getMatrixAt(s,Pu),XA.multiplyMatrices(i,Pu),Df.matrixWorld=XA,Df.raycast(e,Hp);for(let l=0,u=Hp.length;l<u;l++){const c=Hp[l];c.instanceId=s,c.object=this,t.push(c)}Hp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Rc(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,a=i.length+1;this.morphTexture===null&&(this.morphTexture=new Es(new Float32Array(a*this.count),a,this.count,p0,Zi));const s=this.morphTexture.source.data.data;let l=0;for(let h=0;h<i.length;h++)l+=i[h];const u=this.geometry.morphTargetsRelative?1:1-l,c=a*e;s[c]=u,s.set(i,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function x_(n,e){return n-e}function lH(n,e){return n.z-e.z}function uH(n,e){return e.z-n.z}class cH{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,a){const s=this.pool,l=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const u=s[this.index];l.push(u),this.index++,u.start=e,u.count=t,u.z=i,u.index=a}reset(){this.list.length=0,this.index=0}}const ki=new lt,fH=new Be(1,1,1),S_=new od,Vp=new Li,Jo=new bi,Lf=new P,qA=new P,hH=new P,b_=new cH,_i=new Fn,kp=[];function dH(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const a=n.count;for(let s=0;s<a;s++)for(let l=0;l<i;l++)e.setComponent(s+t,l,n.getComponent(s,l))}else e.array.set(n.array,t*i);e.needsUpdate=!0}function $o(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)e[i]=n[i]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class VD extends Fn{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,i=t*2,a){super(new bt,a),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_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 Es(t,e,e,Si,Zi);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new Es(t,e,e,ad,_r);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 Es(t,e,e,Si,Zi);i.colorSpace=Ut.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,a=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const l=e.getAttribute(s),{array:u,itemSize:c,normalized:h}=l,p=new u.constructor(i*c),g=new tn(p,c,h);t.setAttribute(s,g)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(a):new Uint16Array(a);t.setIndex(new tn(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 a=e.getAttribute(i),s=t.getAttribute(i);if(a.itemSize!==s.itemSize||a.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 Li);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,a=t.length;i<a;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,ki),this.getBoundingBoxAt(s,Vp).applyMatrix4(ki),e.union(Vp)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new bi);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,a=t.length;i<a;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,ki),this.getBoundingSphereAt(s,Jo).applyMatrix4(ki),e.union(Jo)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let a=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(x_),a=this._availableInstanceIds.shift(),this._instanceInfo[a]=i):(a=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;ki.identity().toArray(s.image.data,a*16),s.needsUpdate=!0;const l=this._colorsTexture;return l&&(fH.toArray(l.image.data,a*4),l.needsUpdate=!0),this._visibilityChanged=!0,a}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const a={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;a.vertexStart=this._nextVertexStart,a.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(a.indexStart=this._nextIndexStart,a.reservedIndexCount=i===-1?l.count:i),a.indexStart!==-1&&a.indexStart+a.reservedIndexCount>this._maxIndexCount||a.vertexStart+a.reservedVertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let c;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(x_),c=this._availableGeometryIds.shift(),s[c]=a):(c=this._geometryCount,this._geometryCount++,s.push(a)),this.setGeometryAt(c,e),this._nextIndexStart=a.indexStart+a.reservedIndexCount,this._nextVertexStart=a.vertexStart+a.reservedVertexCount,c}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,a=i.getIndex()!==null,s=i.getIndex(),l=t.getIndex(),u=this._geometryInfo[e];if(a&&l.count>u.reservedIndexCount||t.attributes.position.count>u.reservedVertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=u.vertexStart,h=u.reservedVertexCount;u.vertexCount=t.getAttribute("position").count;for(const p in i.attributes){const g=t.getAttribute(p),m=i.getAttribute(p);dH(g,m,c);const v=g.itemSize;for(let _=g.count,T=h;_<T;_++){const b=c+_;for(let y=0;y<v;y++)m.setComponent(b,y,0)}m.needsUpdate=!0,m.addUpdateRange(c*v,h*v)}if(a){const p=u.indexStart,g=u.reservedIndexCount;u.indexCount=t.getIndex().count;for(let m=0;m<l.count;m++)s.setX(p+m,c+l.getX(m));for(let m=l.count,v=g;m<v;m++)s.setX(p+m,c);s.needsUpdate=!0,s.addUpdateRange(p,u.reservedIndexCount)}return u.start=a?u.indexStart:u.vertexStart,u.count=a?u.indexCount:u.vertexCount,u.boundingBox=null,t.boundingBox!==null&&(u.boundingBox=t.boundingBox.clone()),u.boundingSphere=null,t.boundingSphere!==null&&(u.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let a=0,s=i.length;a<s;a++)i[a].geometryIndex===e&&this.deleteInstance(a);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}optimize(){let e=0,t=0;const i=this._geometryInfo,a=i.map((l,u)=>u).sort((l,u)=>i[l].vertexStart-i[u].vertexStart),s=this.geometry;for(let l=0,u=i.length;l<u;l++){const c=a[l],h=i[c];if(h.active!==!1){if(s.index!==null){if(h.indexStart!==t){const{indexStart:p,vertexStart:g,reservedIndexCount:m}=h,v=s.index,_=v.array,T=e-g;for(let b=p;b<p+m;b++)_[b]=_[b]+T;v.array.copyWithin(t,p,p+m),v.addUpdateRange(t,m),h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:p,reservedVertexCount:g}=h,m=s.attributes;for(const v in m){const _=m[v],{array:T,itemSize:b}=_;T.copyWithin(e*b,p*b,(p+g)*b),_.addUpdateRange(e*b,g*b)}h.vertexStart=e}e+=h.reservedVertexCount,h.start=s.index?h.indexStart:h.vertexStart,this._nextIndexStart=s.index?h.indexStart+h.reservedIndexCount:0,this._nextVertexStart=h.vertexStart+h.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,a=this._geometryInfo[e];if(a.boundingBox===null){const s=new Li,l=i.index,u=i.attributes.position;for(let c=a.start,h=a.start+a.count;c<h;c++){let p=c;l&&(p=l.getX(p)),s.expandByPoint(Lf.fromBufferAttribute(u,p))}a.boundingBox=s}return t.copy(a.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,a=this._geometryInfo[e];if(a.boundingSphere===null){const s=new bi;this.getBoundingBoxAt(e,Vp),Vp.getCenter(s.center);const l=i.index,u=i.attributes.position;let c=0;for(let h=a.start,p=a.start+a.count;h<p;h++){let g=h;l&&(g=l.getX(g)),Lf.fromBufferAttribute(u,g),c=Math.max(c,s.center.distanceToSquared(Lf))}s.radius=Math.sqrt(c),a.boundingSphere=s}return t.copy(a.boundingSphere),t}setMatrixAt(e,t){const i=this._instanceInfo,a=this._matricesTexture,s=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?this:(t.toArray(s,e*16),a.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._instanceInfo,a=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(a,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,a=this._colorsTexture.image.data,s=this._instanceInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(a,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,a=this._instanceInfo;return e>=a.length||a[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._instanceInfo;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._instanceInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const i=this._instanceInfo,a=this._geometryInfo;return e>=i.length||i[e].active===!1||t>=a.length||a[t].active===!1?null:(i[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(x_);t[t.length-1]===i.length;)i.pop(),t.pop();if(e<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const a=new Int32Array(e),s=new Int32Array(e);$o(this._multiDrawCounts,a),$o(this._multiDrawStarts,s),this._multiDrawCounts=a,this._multiDrawStarts=s,this._maxInstanceCount=e;const l=this._indirectTexture,u=this._matricesTexture,c=this._colorsTexture;l.dispose(),this._initIndirectTexture(),$o(l.image.data,this._indirectTexture.image.data),u.dispose(),this._initMatricesTexture(),$o(u.image.data,this._matricesTexture.image.data),c&&(c.dispose(),this._initColorsTexture(),$o(c.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(u=>u.active);if(Math.max(...i.map(u=>u.vertexStart+u.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(c=>c.indexStart+c.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new bt,this._initializeGeometry(s));const l=this.geometry;s.index&&$o(s.index.array,l.index.array);for(const u in s.attributes)$o(s.attributes[u].array,l.attributes[u].array)}raycast(e,t){const i=this._instanceInfo,a=this._geometryInfo,s=this.matrixWorld,l=this.geometry;_i.material=this.material,_i.geometry.index=l.index,_i.geometry.attributes=l.attributes,_i.geometry.boundingBox===null&&(_i.geometry.boundingBox=new Li),_i.geometry.boundingSphere===null&&(_i.geometry.boundingSphere=new bi);for(let u=0,c=i.length;u<c;u++){if(!i[u].visible||!i[u].active)continue;const h=i[u].geometryIndex,p=a[h];_i.geometry.setDrawRange(p.start,p.count),this.getMatrixAt(u,_i.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,_i.geometry.boundingBox),this.getBoundingSphereAt(h,_i.geometry.boundingSphere),_i.raycast(e,kp);for(let g=0,m=kp.length;g<m;g++){const v=kp[g];v.object=this,v.batchId=u,t.push(v)}kp.length=0}_i.material=null,_i.geometry.index=null,_i.geometry.attributes={},_i.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._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,a,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const l=a.getIndex(),u=l===null?1:l.array.BYTES_PER_ELEMENT,c=this._instanceInfo,h=this._multiDrawStarts,p=this._multiDrawCounts,g=this._geometryInfo,m=this.perObjectFrustumCulled,v=this._indirectTexture,_=v.image.data;m&&(ki.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),S_.setFromProjectionMatrix(ki,e.coordinateSystem));let T=0;if(this.sortObjects){ki.copy(this.matrixWorld).invert(),Lf.setFromMatrixPosition(i.matrixWorld).applyMatrix4(ki),qA.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(ki);for(let S=0,E=c.length;S<E;S++)if(c[S].visible&&c[S].active){const A=c[S].geometryIndex;this.getMatrixAt(S,ki),this.getBoundingSphereAt(A,Jo).applyMatrix4(ki);let I=!1;if(m&&(I=!S_.intersectsSphere(Jo)),!I){const R=g[A],L=hH.subVectors(Jo.center,Lf).dot(qA);b_.push(R.start,R.count,L,S)}}const b=b_.list,y=this.customSort;y===null?b.sort(s.transparent?uH:lH):y.call(this,b,i);for(let S=0,E=b.length;S<E;S++){const A=b[S];h[T]=A.start*u,p[T]=A.count,_[T]=A.index,T++}b_.reset()}else for(let b=0,y=c.length;b<y;b++)if(c[b].visible&&c[b].active){const S=c[b].geometryIndex;let E=!1;if(m&&(this.getMatrixAt(b,ki),this.getBoundingSphereAt(S,Jo).applyMatrix4(ki),E=!S_.intersectsSphere(Jo)),!E){const A=g[S];h[T]=A.start*u,p[T]=A.count,_[T]=b,T++}}v.needsUpdate=!0,this._multiDrawCount=T,this._visibilityChanged=!1}onBeforeShadow(e,t,i,a,s,l){this.onBeforeRender(e,null,a,s,l)}}class Ni extends Mi{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Be(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 Bg=new P,Fg=new P,YA=new lt,Nf=new Hc,Gp=new bi,M_=new P,ZA=new P;class _o extends Bt{constructor(e=new bt,t=new Ni){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 a=1,s=t.count;a<s;a++)Bg.fromBufferAttribute(t,a-1),Fg.fromBufferAttribute(t,a),i[a]=i[a-1],i[a]+=Bg.distanceTo(Fg);e.setAttribute("lineDistance",new Ye(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,a=this.matrixWorld,s=e.params.Line.threshold,l=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Gp.copy(i.boundingSphere),Gp.applyMatrix4(a),Gp.radius+=s,e.ray.intersectsSphere(Gp)===!1)return;YA.copy(a).invert(),Nf.copy(e.ray).applyMatrix4(YA);const u=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,h=this.isLineSegments?2:1,p=i.index,m=i.attributes.position;if(p!==null){const v=Math.max(0,l.start),_=Math.min(p.count,l.start+l.count);for(let T=v,b=_-1;T<b;T+=h){const y=p.getX(T),S=p.getX(T+1),E=Xp(this,e,Nf,c,y,S);E&&t.push(E)}if(this.isLineLoop){const T=p.getX(_-1),b=p.getX(v),y=Xp(this,e,Nf,c,T,b);y&&t.push(y)}}else{const v=Math.max(0,l.start),_=Math.min(m.count,l.start+l.count);for(let T=v,b=_-1;T<b;T+=h){const y=Xp(this,e,Nf,c,T,T+1);y&&t.push(y)}if(this.isLineLoop){const T=Xp(this,e,Nf,c,_-1,v);T&&t.push(T)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const a=t[i[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,l=a.length;s<l;s++){const u=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=s}}}}}function Xp(n,e,t,i,a,s){const l=n.geometry.attributes.position;if(Bg.fromBufferAttribute(l,a),Fg.fromBufferAttribute(l,s),t.distanceSqToSegment(Bg,Fg,M_,ZA)>i)return;M_.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(M_);if(!(c<e.near||c>e.far))return{distance:c,point:ZA.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const jA=new P,QA=new P;class Rs extends _o{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 a=0,s=t.count;a<s;a+=2)jA.fromBufferAttribute(t,a),QA.fromBufferAttribute(t,a+1),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+jA.distanceTo(QA);e.setAttribute("lineDistance",new Ye(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class kD extends _o{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Mb extends Mi{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Be(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 KA=new lt,Xx=new Hc,Wp=new bi,qp=new P;class GD extends Bt{constructor(e=new bt,t=new Mb){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,a=this.matrixWorld,s=e.params.Points.threshold,l=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Wp.copy(i.boundingSphere),Wp.applyMatrix4(a),Wp.radius+=s,e.ray.intersectsSphere(Wp)===!1)return;KA.copy(a).invert(),Xx.copy(e.ray).applyMatrix4(KA);const u=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,h=i.index,g=i.attributes.position;if(h!==null){const m=Math.max(0,l.start),v=Math.min(h.count,l.start+l.count);for(let _=m,T=v;_<T;_++){const b=h.getX(_);qp.fromBufferAttribute(g,b),JA(qp,b,c,a,e,t,this)}}else{const m=Math.max(0,l.start),v=Math.min(g.count,l.start+l.count);for(let _=m,T=v;_<T;_++)qp.fromBufferAttribute(g,_),JA(qp,_,c,a,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const a=t[i[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,l=a.length;s<l;s++){const u=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[u]=s}}}}}function JA(n,e,t,i,a,s,l){const u=Xx.distanceSqToPoint(n);if(u<t){const c=new P;Xx.closestPointToPoint(n,c),c.applyMatrix4(i);const h=a.ray.origin.distanceTo(c);if(h<a.near||h>a.far)return;s.push({distance:h,distanceToRay:Math.sqrt(u),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class pH extends Mn{constructor(e,t,i,a,s,l,u,c,h){super(e,t,i,a,s,l,u,c,h),this.isVideoTexture=!0,this.minFilter=l!==void 0?l:Gn,this.magFilter=s!==void 0?s:Gn,this.generateMipmaps=!1;const p=this;function g(){p.needsUpdate=!0,e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(g)}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 mH extends Mn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=di,this.minFilter=di,this.generateMipmaps=!1,this.needsUpdate=!0}}class T0 extends Mn{constructor(e,t,i,a,s,l,u,c,h,p,g,m){super(null,l,u,c,h,p,a,s,g,m),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class gH extends T0{constructor(e,t,i,a,s,l){super(e,t,i,s,l),this.isCompressedArrayTexture=!0,this.image.depth=a,this.wrapR=Ba,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class vH extends T0{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,yr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class yH extends Mn{constructor(e,t,i,a,s,l,u,c,h){super(e,t,i,a,s,l,u,c,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs{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,a=this.getPoint(0),s=0;t.push(0);for(let l=1;l<=e;l++)i=this.getPoint(l/e),s+=i.distanceTo(a),t.push(s),a=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let a=0;const s=i.length;let l;t?l=t:l=e*i[s-1];let u=0,c=s-1,h;for(;u<=c;)if(a=Math.floor(u+(c-u)/2),h=i[a]-l,h<0)u=a+1;else if(h>0)c=a-1;else{c=a;break}if(a=c,i[a]===l)return a/(s-1);const p=i[a],m=i[a+1]-p,v=(l-p)/m;return(a+v)/(s-1)}getTangent(e,t){let a=e-1e-4,s=e+1e-4;a<0&&(a=0),s>1&&(s=1);const l=this.getPoint(a),u=this.getPoint(s),c=t||(l.isVector2?new he:new P);return c.copy(u).sub(l).normalize(),c}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new P,a=[],s=[],l=[],u=new P,c=new lt;for(let v=0;v<=e;v++){const _=v/e;a[v]=this.getTangentAt(_,new P)}s[0]=new P,l[0]=new P;let h=Number.MAX_VALUE;const p=Math.abs(a[0].x),g=Math.abs(a[0].y),m=Math.abs(a[0].z);p<=h&&(h=p,i.set(1,0,0)),g<=h&&(h=g,i.set(0,1,0)),m<=h&&i.set(0,0,1),u.crossVectors(a[0],i).normalize(),s[0].crossVectors(a[0],u),l[0].crossVectors(a[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),l[v]=l[v-1].clone(),u.crossVectors(a[v-1],a[v]),u.length()>Number.EPSILON){u.normalize();const _=Math.acos(bn(a[v-1].dot(a[v]),-1,1));s[v].applyMatrix4(c.makeRotationAxis(u,_))}l[v].crossVectors(a[v],s[v])}if(t===!0){let v=Math.acos(bn(s[0].dot(s[e]),-1,1));v/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(v=-v);for(let _=1;_<=e;_++)s[_].applyMatrix4(c.makeRotationAxis(a[_],v*_)),l[_].crossVectors(a[_],s[_])}return{tangents:a,normals:s,binormals:l}}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 A0 extends rs{constructor(e=0,t=0,i=1,a=1,s=0,l=Math.PI*2,u=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=a,this.aStartAngle=s,this.aEndAngle=l,this.aClockwise=u,this.aRotation=c}getPoint(e,t=new he){const i=t,a=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const l=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=a;for(;s>a;)s-=a;s<Number.EPSILON&&(l?s=0:s=a),this.aClockwise===!0&&!l&&(s===a?s=-a:s=s-a);const u=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(u),h=this.aY+this.yRadius*Math.sin(u);if(this.aRotation!==0){const p=Math.cos(this.aRotation),g=Math.sin(this.aRotation),m=c-this.aX,v=h-this.aY;c=m*p-v*g+this.aX,h=m*g+v*p+this.aY}return i.set(c,h)}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 XD extends A0{constructor(e,t,i,a,s,l){super(e,t,i,i,a,s,l),this.isArcCurve=!0,this.type="ArcCurve"}}function Eb(){let n=0,e=0,t=0,i=0;function a(s,l,u,c){n=s,e=u,t=-3*s+3*l-2*u-c,i=2*s-2*l+u+c}return{initCatmullRom:function(s,l,u,c,h){a(l,u,h*(u-s),h*(c-l))},initNonuniformCatmullRom:function(s,l,u,c,h,p,g){let m=(l-s)/h-(u-s)/(h+p)+(u-l)/p,v=(u-l)/p-(c-l)/(p+g)+(c-u)/g;m*=p,v*=p,a(l,u,m,v)},calc:function(s){const l=s*s,u=l*s;return n+e*s+t*l+i*u}}}const Yp=new P,E_=new Eb,T_=new Eb,A_=new Eb;class WD extends rs{constructor(e=[],t=!1,i="centripetal",a=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=a}getPoint(e,t=new P){const i=t,a=this.points,s=a.length,l=(s-(this.closed?0:1))*e;let u=Math.floor(l),c=l-u;this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/s)+1)*s:c===0&&u===s-1&&(u=s-2,c=1);let h,p;this.closed||u>0?h=a[(u-1)%s]:(Yp.subVectors(a[0],a[1]).add(a[0]),h=Yp);const g=a[u%s],m=a[(u+1)%s];if(this.closed||u+2<s?p=a[(u+2)%s]:(Yp.subVectors(a[s-1],a[s-2]).add(a[s-1]),p=Yp),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let _=Math.pow(h.distanceToSquared(g),v),T=Math.pow(g.distanceToSquared(m),v),b=Math.pow(m.distanceToSquared(p),v);T<1e-4&&(T=1),_<1e-4&&(_=T),b<1e-4&&(b=T),E_.initNonuniformCatmullRom(h.x,g.x,m.x,p.x,_,T,b),T_.initNonuniformCatmullRom(h.y,g.y,m.y,p.y,_,T,b),A_.initNonuniformCatmullRom(h.z,g.z,m.z,p.z,_,T,b)}else this.curveType==="catmullrom"&&(E_.initCatmullRom(h.x,g.x,m.x,p.x,this.tension),T_.initCatmullRom(h.y,g.y,m.y,p.y,this.tension),A_.initCatmullRom(h.z,g.z,m.z,p.z,this.tension));return i.set(E_.calc(c),T_.calc(c),A_.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const a=e.points[t];this.points.push(a.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 a=this.points[t];e.points.push(a.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 a=e.points[t];this.points.push(new P().fromArray(a))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function $A(n,e,t,i,a){const s=(i-e)*.5,l=(a-t)*.5,u=n*n,c=n*u;return(2*t-2*i+s+l)*c+(-3*t+3*i-2*s-l)*u+s*n+t}function _H(n,e){const t=1-n;return t*t*e}function xH(n,e){return 2*(1-n)*n*e}function SH(n,e){return n*n*e}function ch(n,e,t,i){return _H(n,e)+xH(n,t)+SH(n,i)}function bH(n,e){const t=1-n;return t*t*t*e}function MH(n,e){const t=1-n;return 3*t*t*n*e}function EH(n,e){return 3*(1-n)*n*n*e}function TH(n,e){return n*n*n*e}function fh(n,e,t,i,a){return bH(n,e)+MH(n,t)+EH(n,i)+TH(n,a)}class Tb extends rs{constructor(e=new he,t=new he,i=new he,a=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=a}getPoint(e,t=new he){const i=t,a=this.v0,s=this.v1,l=this.v2,u=this.v3;return i.set(fh(e,a.x,s.x,l.x,u.x),fh(e,a.y,s.y,l.y,u.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 qD extends rs{constructor(e=new P,t=new P,i=new P,a=new P){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=a}getPoint(e,t=new P){const i=t,a=this.v0,s=this.v1,l=this.v2,u=this.v3;return i.set(fh(e,a.x,s.x,l.x,u.x),fh(e,a.y,s.y,l.y,u.y),fh(e,a.z,s.z,l.z,u.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 Ab extends rs{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){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 he){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 YD extends rs{constructor(e=new P,t=new P){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new P){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 P){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 wb extends rs{constructor(e=new he,t=new he,i=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new he){const i=t,a=this.v0,s=this.v1,l=this.v2;return i.set(ch(e,a.x,s.x,l.x),ch(e,a.y,s.y,l.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 Cb extends rs{constructor(e=new P,t=new P,i=new P){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new P){const i=t,a=this.v0,s=this.v1,l=this.v2;return i.set(ch(e,a.x,s.x,l.x),ch(e,a.y,s.y,l.y),ch(e,a.z,s.z,l.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 Rb extends rs{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){const i=t,a=this.points,s=(a.length-1)*e,l=Math.floor(s),u=s-l,c=a[l===0?l:l-1],h=a[l],p=a[l>a.length-2?a.length-1:l+1],g=a[l>a.length-3?a.length-1:l+2];return i.set($A(u,c.x,h.x,p.x,g.x),$A(u,c.y,h.y,p.y,g.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const a=e.points[t];this.points.push(a.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const a=this.points[t];e.points.push(a.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const a=e.points[t];this.points.push(new he().fromArray(a))}return this}}var Hg=Object.freeze({__proto__:null,ArcCurve:XD,CatmullRomCurve3:WD,CubicBezierCurve:Tb,CubicBezierCurve3:qD,EllipseCurve:A0,LineCurve:Ab,LineCurve3:YD,QuadraticBezierCurve:wb,QuadraticBezierCurve3:Cb,SplineCurve:Rb});class ZD extends rs{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 Hg[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),a=this.getCurveLengths();let s=0;for(;s<a.length;){if(a[s]>=i){const l=a[s]-i,u=this.curves[s],c=u.getLength(),h=c===0?0:1-l/c;return u.getPointAt(h,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,a=this.curves.length;i<a;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 a=0,s=this.curves;a<s.length;a++){const l=s[a],u=l.isEllipseCurve?e*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?e*l.points.length:e,c=l.getPoints(u);for(let h=0;h<c.length;h++){const p=c[h];i&&i.equals(p)||(t.push(p),i=p)}}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 a=e.curves[t];this.curves.push(a.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 a=this.curves[t];e.curves.push(a.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 a=e.curves[t];this.curves.push(new Hg[a.type]().fromJSON(a))}return this}}class Oh extends ZD{constructor(e){super(),this.type="Path",this.currentPoint=new he,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 Ab(this.currentPoint.clone(),new he(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,a){const s=new wb(this.currentPoint.clone(),new he(e,t),new he(i,a));return this.curves.push(s),this.currentPoint.set(i,a),this}bezierCurveTo(e,t,i,a,s,l){const u=new Tb(this.currentPoint.clone(),new he(e,t),new he(i,a),new he(s,l));return this.curves.push(u),this.currentPoint.set(s,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Rb(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,a,s,l){const u=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+u,t+c,i,a,s,l),this}absarc(e,t,i,a,s,l){return this.absellipse(e,t,i,i,a,s,l),this}ellipse(e,t,i,a,s,l,u,c){const h=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(e+h,t+p,i,a,s,l,u,c),this}absellipse(e,t,i,a,s,l,u,c){const h=new A0(e,t,i,a,s,l,u,c);if(this.curves.length>0){const g=h.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(h);const p=h.getPoint(1);return this.currentPoint.copy(p),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 ud extends bt{constructor(e=[new he(0,-.5),new he(.5,0),new he(0,.5)],t=12,i=0,a=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:a},t=Math.floor(t),a=bn(a,0,Math.PI*2);const s=[],l=[],u=[],c=[],h=[],p=1/t,g=new P,m=new he,v=new P,_=new P,T=new P;let b=0,y=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:b=e[S+1].x-e[S].x,y=e[S+1].y-e[S].y,v.x=y*1,v.y=-b,v.z=y*0,T.copy(v),v.normalize(),c.push(v.x,v.y,v.z);break;case e.length-1:c.push(T.x,T.y,T.z);break;default:b=e[S+1].x-e[S].x,y=e[S+1].y-e[S].y,v.x=y*1,v.y=-b,v.z=y*0,_.copy(v),v.x+=T.x,v.y+=T.y,v.z+=T.z,v.normalize(),c.push(v.x,v.y,v.z),T.copy(_)}for(let S=0;S<=t;S++){const E=i+S*p*a,A=Math.sin(E),I=Math.cos(E);for(let R=0;R<=e.length-1;R++){g.x=e[R].x*A,g.y=e[R].y,g.z=e[R].x*I,l.push(g.x,g.y,g.z),m.x=S/t,m.y=R/(e.length-1),u.push(m.x,m.y);const L=c[3*R+0]*A,z=c[3*R+1],C=c[3*R+0]*I;h.push(L,z,C)}}for(let S=0;S<t;S++)for(let E=0;E<e.length-1;E++){const A=E+S*e.length,I=A,R=A+e.length,L=A+e.length+1,z=A+1;s.push(I,R,z),s.push(L,z,R)}this.setIndex(s),this.setAttribute("position",new Ye(l,3)),this.setAttribute("uv",new Ye(u,2)),this.setAttribute("normal",new Ye(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ud(e.points,e.segments,e.phiStart,e.phiLength)}}class w0 extends ud{constructor(e=1,t=1,i=4,a=8){const s=new Oh;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),a),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:a}}static fromJSON(e){return new w0(e.radius,e.length,e.capSegments,e.radialSegments)}}class C0 extends bt{constructor(e=1,t=32,i=0,a=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:a},t=Math.max(3,t);const s=[],l=[],u=[],c=[],h=new P,p=new he;l.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(let g=0,m=3;g<=t;g++,m+=3){const v=i+g/t*a;h.x=e*Math.cos(v),h.y=e*Math.sin(v),l.push(h.x,h.y,h.z),u.push(0,0,1),p.x=(l[m]/e+1)/2,p.y=(l[m+1]/e+1)/2,c.push(p.x,p.y)}for(let g=1;g<=t;g++)s.push(g,g+1,0);this.setIndex(s),this.setAttribute("position",new Ye(l,3)),this.setAttribute("normal",new Ye(u,3)),this.setAttribute("uv",new Ye(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new C0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Gc extends bt{constructor(e=1,t=1,i=1,a=32,s=1,l=!1,u=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:a,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};const h=this;a=Math.floor(a),s=Math.floor(s);const p=[],g=[],m=[],v=[];let _=0;const T=[],b=i/2;let y=0;S(),l===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(p),this.setAttribute("position",new Ye(g,3)),this.setAttribute("normal",new Ye(m,3)),this.setAttribute("uv",new Ye(v,2));function S(){const A=new P,I=new P;let R=0;const L=(t-e)/i;for(let z=0;z<=s;z++){const C=[],w=z/s,B=w*(t-e)+e;for(let Q=0;Q<=a;Q++){const k=Q/a,j=k*c+u,ae=Math.sin(j),V=Math.cos(j);I.x=B*ae,I.y=-w*i+b,I.z=B*V,g.push(I.x,I.y,I.z),A.set(ae,L,V).normalize(),m.push(A.x,A.y,A.z),v.push(k,1-w),C.push(_++)}T.push(C)}for(let z=0;z<a;z++)for(let C=0;C<s;C++){const w=T[C][z],B=T[C+1][z],Q=T[C+1][z+1],k=T[C][z+1];(e>0||C!==0)&&(p.push(w,B,k),R+=3),(t>0||C!==s-1)&&(p.push(B,Q,k),R+=3)}h.addGroup(y,R,0),y+=R}function E(A){const I=_,R=new he,L=new P;let z=0;const C=A===!0?e:t,w=A===!0?1:-1;for(let Q=1;Q<=a;Q++)g.push(0,b*w,0),m.push(0,w,0),v.push(.5,.5),_++;const B=_;for(let Q=0;Q<=a;Q++){const j=Q/a*c+u,ae=Math.cos(j),V=Math.sin(j);L.x=C*V,L.y=b*w,L.z=C*ae,g.push(L.x,L.y,L.z),m.push(0,w,0),R.x=ae*.5+.5,R.y=V*.5*w+.5,v.push(R.x,R.y),_++}for(let Q=0;Q<a;Q++){const k=I+Q,j=B+Q;A===!0?p.push(j,j+1,k):p.push(j+1,j,k),z+=3}h.addGroup(y,z,A===!0?1:2),y+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class R0 extends Gc{constructor(e=1,t=1,i=32,a=1,s=!1,l=0,u=Math.PI*2){super(0,e,t,i,a,s,l,u),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:a,openEnded:s,thetaStart:l,thetaLength:u}}static fromJSON(e){return new R0(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class To extends bt{constructor(e=[],t=[],i=1,a=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:a};const s=[],l=[];u(a),h(i),p(),this.setAttribute("position",new Ye(s,3)),this.setAttribute("normal",new Ye(s.slice(),3)),this.setAttribute("uv",new Ye(l,2)),a===0?this.computeVertexNormals():this.normalizeNormals();function u(S){const E=new P,A=new P,I=new P;for(let R=0;R<t.length;R+=3)v(t[R+0],E),v(t[R+1],A),v(t[R+2],I),c(E,A,I,S)}function c(S,E,A,I){const R=I+1,L=[];for(let z=0;z<=R;z++){L[z]=[];const C=S.clone().lerp(A,z/R),w=E.clone().lerp(A,z/R),B=R-z;for(let Q=0;Q<=B;Q++)Q===0&&z===R?L[z][Q]=C:L[z][Q]=C.clone().lerp(w,Q/B)}for(let z=0;z<R;z++)for(let C=0;C<2*(R-z)-1;C++){const w=Math.floor(C/2);C%2===0?(m(L[z][w+1]),m(L[z+1][w]),m(L[z][w])):(m(L[z][w+1]),m(L[z+1][w+1]),m(L[z+1][w]))}}function h(S){const E=new P;for(let A=0;A<s.length;A+=3)E.x=s[A+0],E.y=s[A+1],E.z=s[A+2],E.normalize().multiplyScalar(S),s[A+0]=E.x,s[A+1]=E.y,s[A+2]=E.z}function p(){const S=new P;for(let E=0;E<s.length;E+=3){S.x=s[E+0],S.y=s[E+1],S.z=s[E+2];const A=b(S)/2/Math.PI+.5,I=y(S)/Math.PI+.5;l.push(A,1-I)}_(),g()}function g(){for(let S=0;S<l.length;S+=6){const E=l[S+0],A=l[S+2],I=l[S+4],R=Math.max(E,A,I),L=Math.min(E,A,I);R>.9&&L<.1&&(E<.2&&(l[S+0]+=1),A<.2&&(l[S+2]+=1),I<.2&&(l[S+4]+=1))}}function m(S){s.push(S.x,S.y,S.z)}function v(S,E){const A=S*3;E.x=e[A+0],E.y=e[A+1],E.z=e[A+2]}function _(){const S=new P,E=new P,A=new P,I=new P,R=new he,L=new he,z=new he;for(let C=0,w=0;C<s.length;C+=9,w+=6){S.set(s[C+0],s[C+1],s[C+2]),E.set(s[C+3],s[C+4],s[C+5]),A.set(s[C+6],s[C+7],s[C+8]),R.set(l[w+0],l[w+1]),L.set(l[w+2],l[w+3]),z.set(l[w+4],l[w+5]),I.copy(S).add(E).add(A).divideScalar(3);const B=b(I);T(R,w+0,S,B),T(L,w+2,E,B),T(z,w+4,A,B)}}function T(S,E,A,I){I<0&&S.x===1&&(l[E]=S.x-1),A.x===0&&A.z===0&&(l[E]=I/2/Math.PI+.5)}function b(S){return Math.atan2(S.z,-S.x)}function y(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new To(e.vertices,e.indices,e.radius,e.details)}}class D0 extends To{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,a=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,-a,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,l,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new D0(e.radius,e.detail)}}const Zp=new P,jp=new P,w_=new P,Qp=new Yi;class jD extends bt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const a=Math.pow(10,4),s=Math.cos(Ml*t),l=e.getIndex(),u=e.getAttribute("position"),c=l?l.count:u.count,h=[0,0,0],p=["a","b","c"],g=new Array(3),m={},v=[];for(let _=0;_<c;_+=3){l?(h[0]=l.getX(_),h[1]=l.getX(_+1),h[2]=l.getX(_+2)):(h[0]=_,h[1]=_+1,h[2]=_+2);const{a:T,b,c:y}=Qp;if(T.fromBufferAttribute(u,h[0]),b.fromBufferAttribute(u,h[1]),y.fromBufferAttribute(u,h[2]),Qp.getNormal(w_),g[0]=`${Math.round(T.x*a)},${Math.round(T.y*a)},${Math.round(T.z*a)}`,g[1]=`${Math.round(b.x*a)},${Math.round(b.y*a)},${Math.round(b.z*a)}`,g[2]=`${Math.round(y.x*a)},${Math.round(y.y*a)},${Math.round(y.z*a)}`,!(g[0]===g[1]||g[1]===g[2]||g[2]===g[0]))for(let S=0;S<3;S++){const E=(S+1)%3,A=g[S],I=g[E],R=Qp[p[S]],L=Qp[p[E]],z=`${A}_${I}`,C=`${I}_${A}`;C in m&&m[C]?(w_.dot(m[C].normal)<=s&&(v.push(R.x,R.y,R.z),v.push(L.x,L.y,L.z)),m[C]=null):z in m||(m[z]={index0:h[S],index1:h[E],normal:w_.clone()})}}for(const _ in m)if(m[_]){const{index0:T,index1:b}=m[_];Zp.fromBufferAttribute(u,T),jp.fromBufferAttribute(u,b),v.push(Zp.x,Zp.y,Zp.z),v.push(jp.x,jp.y,jp.z)}this.setAttribute("position",new Ye(v,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class El extends Oh{constructor(e){super(e),this.uuid=_a(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,a=this.holes.length;i<a;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 a=e.holes[t];this.holes.push(a.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 a=this.holes[t];e.holes.push(a.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 a=e.holes[t];this.holes.push(new Oh().fromJSON(a))}return this}}const AH={triangulate:function(n,e,t=2){const i=e&&e.length,a=i?e[0]*t:n.length;let s=QD(n,0,a,t,!0);const l=[];if(!s||s.next===s.prev)return l;let u,c,h,p,g,m,v;if(i&&(s=UH(n,e,s,t)),n.length>80*t){u=h=n[0],c=p=n[1];for(let _=t;_<a;_+=t)g=n[_],m=n[_+1],g<u&&(u=g),m<c&&(c=m),g>h&&(h=g),m>p&&(p=m);v=Math.max(h-u,p-c),v=v!==0?32767/v:0}return Ph(s,l,t,u,c,v,0),l}};function QD(n,e,t,i,a){let s,l;if(a===kH(n,e,t,i)>0)for(s=e;s<t;s+=i)l=ew(s,n[s],n[s+1],l);else for(s=t-i;s>=e;s-=i)l=ew(s,n[s],n[s+1],l);return l&&U0(l,l.next)&&(Fh(l),l=l.next),l}function Il(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(U0(t,t.next)||vn(t.prev,t,t.next)===0)){if(Fh(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ph(n,e,t,i,a,s,l){if(!n)return;!l&&s&&OH(n,i,a,s);let u=n,c,h;for(;n.prev!==n.next;){if(c=n.prev,h=n.next,s?CH(n,i,a,s):wH(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(h.i/t|0),Fh(n),n=h.next,u=h.next;continue}if(n=h,n===u){l?l===1?(n=RH(Il(n),e,t),Ph(n,e,t,i,a,s,2)):l===2&&DH(n,e,t,i,a,s):Ph(Il(n),e,t,i,a,s,1);break}}}function wH(n){const e=n.prev,t=n,i=n.next;if(vn(e,t,i)>=0)return!1;const a=e.x,s=t.x,l=i.x,u=e.y,c=t.y,h=i.y,p=a<s?a<l?a:l:s<l?s:l,g=u<c?u<h?u:h:c<h?c:h,m=a>s?a>l?a:l:s>l?s:l,v=u>c?u>h?u:h:c>h?c:h;let _=i.next;for(;_!==e;){if(_.x>=p&&_.x<=m&&_.y>=g&&_.y<=v&&sc(a,u,s,c,l,h,_.x,_.y)&&vn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function CH(n,e,t,i){const a=n.prev,s=n,l=n.next;if(vn(a,s,l)>=0)return!1;const u=a.x,c=s.x,h=l.x,p=a.y,g=s.y,m=l.y,v=u<c?u<h?u:h:c<h?c:h,_=p<g?p<m?p:m:g<m?g:m,T=u>c?u>h?u:h:c>h?c:h,b=p>g?p>m?p:m:g>m?g:m,y=Wx(v,_,e,t,i),S=Wx(T,b,e,t,i);let E=n.prevZ,A=n.nextZ;for(;E&&E.z>=y&&A&&A.z<=S;){if(E.x>=v&&E.x<=T&&E.y>=_&&E.y<=b&&E!==a&&E!==l&&sc(u,p,c,g,h,m,E.x,E.y)&&vn(E.prev,E,E.next)>=0||(E=E.prevZ,A.x>=v&&A.x<=T&&A.y>=_&&A.y<=b&&A!==a&&A!==l&&sc(u,p,c,g,h,m,A.x,A.y)&&vn(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;E&&E.z>=y;){if(E.x>=v&&E.x<=T&&E.y>=_&&E.y<=b&&E!==a&&E!==l&&sc(u,p,c,g,h,m,E.x,E.y)&&vn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;A&&A.z<=S;){if(A.x>=v&&A.x<=T&&A.y>=_&&A.y<=b&&A!==a&&A!==l&&sc(u,p,c,g,h,m,A.x,A.y)&&vn(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function RH(n,e,t){let i=n;do{const a=i.prev,s=i.next.next;!U0(a,s)&&KD(a,i,i.next,s)&&Bh(a,s)&&Bh(s,a)&&(e.push(a.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Fh(i),Fh(i.next),i=n=s),i=i.next}while(i!==n);return Il(i)}function DH(n,e,t,i,a,s){let l=n;do{let u=l.next.next;for(;u!==l.prev;){if(l.i!==u.i&&FH(l,u)){let c=JD(l,u);l=Il(l,l.next),c=Il(c,c.next),Ph(l,e,t,i,a,s,0),Ph(c,e,t,i,a,s,0);return}u=u.next}l=l.next}while(l!==n)}function UH(n,e,t,i){const a=[];let s,l,u,c,h;for(s=0,l=e.length;s<l;s++)u=e[s]*i,c=s<l-1?e[s+1]*i:n.length,h=QD(n,u,c,i,!1),h===h.next&&(h.steiner=!0),a.push(BH(h));for(a.sort(LH),s=0;s<a.length;s++)t=NH(a[s],t);return t}function LH(n,e){return n.x-e.x}function NH(n,e){const t=IH(n,e);if(!t)return e;const i=JD(t,n);return Il(i,i.next),Il(t,t.next)}function IH(n,e){let t=e,i=-1/0,a;const s=n.x,l=n.y;do{if(l<=t.y&&l>=t.next.y&&t.next.y!==t.y){const m=t.x+(l-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=s&&m>i&&(i=m,a=t.x<t.next.x?t:t.next,m===s))return a}t=t.next}while(t!==e);if(!a)return null;const u=a,c=a.x,h=a.y;let p=1/0,g;t=a;do s>=t.x&&t.x>=c&&s!==t.x&&sc(l<h?s:i,l,c,h,l<h?i:s,l,t.x,t.y)&&(g=Math.abs(l-t.y)/(s-t.x),Bh(t,n)&&(g<p||g===p&&(t.x>a.x||t.x===a.x&&zH(a,t)))&&(a=t,p=g)),t=t.next;while(t!==u);return a}function zH(n,e){return vn(n.prev,n,e.prev)<0&&vn(e.next,n,n.next)<0}function OH(n,e,t,i){let a=n;do a.z===0&&(a.z=Wx(a.x,a.y,e,t,i)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==n);a.prevZ.nextZ=null,a.prevZ=null,PH(a)}function PH(n){let e,t,i,a,s,l,u,c,h=1;do{for(t=n,n=null,s=null,l=0;t;){for(l++,i=t,u=0,e=0;e<h&&(u++,i=i.nextZ,!!i);e++);for(c=h;u>0||c>0&&i;)u!==0&&(c===0||!i||t.z<=i.z)?(a=t,t=t.nextZ,u--):(a=i,i=i.nextZ,c--),s?s.nextZ=a:n=a,a.prevZ=s,s=a;t=i}s.nextZ=null,h*=2}while(l>1);return n}function Wx(n,e,t,i,a){return n=(n-t)*a|0,e=(e-i)*a|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 BH(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 sc(n,e,t,i,a,s,l,u){return(a-l)*(e-u)>=(n-l)*(s-u)&&(n-l)*(i-u)>=(t-l)*(e-u)&&(t-l)*(s-u)>=(a-l)*(i-u)}function FH(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!HH(n,e)&&(Bh(n,e)&&Bh(e,n)&&VH(n,e)&&(vn(n.prev,n,e.prev)||vn(n,e.prev,e))||U0(n,e)&&vn(n.prev,n,n.next)>0&&vn(e.prev,e,e.next)>0)}function vn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function U0(n,e){return n.x===e.x&&n.y===e.y}function KD(n,e,t,i){const a=Jp(vn(n,e,t)),s=Jp(vn(n,e,i)),l=Jp(vn(t,i,n)),u=Jp(vn(t,i,e));return!!(a!==s&&l!==u||a===0&&Kp(n,t,e)||s===0&&Kp(n,i,e)||l===0&&Kp(t,n,i)||u===0&&Kp(t,e,i))}function Kp(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 Jp(n){return n>0?1:n<0?-1:0}function HH(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&&KD(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Bh(n,e){return vn(n.prev,n,n.next)<0?vn(n,e,n.next)>=0&&vn(n,n.prev,e)>=0:vn(n,e,n.prev)<0||vn(n,n.next,e)<0}function VH(n,e){let t=n,i=!1;const a=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&a<(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 JD(n,e){const t=new qx(n.i,n.x,n.y),i=new qx(e.i,e.x,e.y),a=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=a,a.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function ew(n,e,t,i){const a=new qx(n,e,t);return i?(a.next=i.next,a.prev=i,i.next.prev=a,i.next=a):(a.prev=a,a.next=a),a}function Fh(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 qx(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 kH(n,e,t,i){let a=0;for(let s=e,l=t-i;s<t;s+=i)a+=(n[l]-n[s])*(n[s+1]+n[l+1]),l=s;return a}class Ts{static area(e){const t=e.length;let i=0;for(let a=t-1,s=0;s<t;a=s++)i+=e[a].x*e[s].y-e[s].x*e[a].y;return i*.5}static isClockWise(e){return Ts.area(e)<0}static triangulateShape(e,t){const i=[],a=[],s=[];tw(e),nw(i,e);let l=e.length;t.forEach(tw);for(let c=0;c<t.length;c++)a.push(l),l+=t[c].length,nw(i,t[c]);const u=AH.triangulate(i,a);for(let c=0;c<u.length;c+=3)s.push(u.slice(c,c+3));return s}}function tw(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function nw(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class L0 extends bt{constructor(e=new El([new he(.5,.5),new he(-.5,.5),new he(-.5,-.5),new he(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,a=[],s=[];for(let u=0,c=e.length;u<c;u++){const h=e[u];l(h)}this.setAttribute("position",new Ye(a,3)),this.setAttribute("uv",new Ye(s,2)),this.computeVertexNormals();function l(u){const c=[],h=t.curveSegments!==void 0?t.curveSegments:12,p=t.steps!==void 0?t.steps:1,g=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,v=t.bevelThickness!==void 0?t.bevelThickness:.2,_=t.bevelSize!==void 0?t.bevelSize:v-.1,T=t.bevelOffset!==void 0?t.bevelOffset:0,b=t.bevelSegments!==void 0?t.bevelSegments:3;const y=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:GH;let E,A=!1,I,R,L,z;y&&(E=y.getSpacedPoints(p),A=!0,m=!1,I=y.computeFrenetFrames(p,!1),R=new P,L=new P,z=new P),m||(b=0,v=0,_=0,T=0);const C=u.extractPoints(h);let w=C.shape;const B=C.holes;if(!Ts.isClockWise(w)){w=w.reverse();for(let ce=0,_e=B.length;ce<_e;ce++){const F=B[ce];Ts.isClockWise(F)&&(B[ce]=F.reverse())}}const k=Ts.triangulateShape(w,B),j=w;for(let ce=0,_e=B.length;ce<_e;ce++){const F=B[ce];w=w.concat(F)}function ae(ce,_e,F){return _e||console.error("THREE.ExtrudeGeometry: vec does not exist"),ce.clone().addScaledVector(_e,F)}const V=w.length,ne=k.length;function q(ce,_e,F){let We,ge,De;const Te=ce.x-_e.x,Ke=ce.y-_e.y,ze=F.x-ce.x,O=F.y-ce.y,D=Te*Te+Ke*Ke,Z=Te*O-Ke*ze;if(Math.abs(Z)>Number.EPSILON){const re=Math.sqrt(D),de=Math.sqrt(ze*ze+O*O),le=_e.x-Ke/re,Xe=_e.y+Te/re,we=F.x-O/de,Ce=F.y+ze/de,mt=((we-le)*O-(Ce-Xe)*ze)/(Te*O-Ke*ze);We=le+Te*mt-ce.x,ge=Xe+Ke*mt-ce.y;const xe=We*We+ge*ge;if(xe<=2)return new he(We,ge);De=Math.sqrt(xe/2)}else{let re=!1;Te>Number.EPSILON?ze>Number.EPSILON&&(re=!0):Te<-Number.EPSILON?ze<-Number.EPSILON&&(re=!0):Math.sign(Ke)===Math.sign(O)&&(re=!0),re?(We=-Ke,ge=Te,De=Math.sqrt(D)):(We=Te,ge=Ke,De=Math.sqrt(D/2))}return new he(We/De,ge/De)}const oe=[];for(let ce=0,_e=j.length,F=_e-1,We=ce+1;ce<_e;ce++,F++,We++)F===_e&&(F=0),We===_e&&(We=0),oe[ce]=q(j[ce],j[F],j[We]);const me=[];let ye,Ie=oe.concat();for(let ce=0,_e=B.length;ce<_e;ce++){const F=B[ce];ye=[];for(let We=0,ge=F.length,De=ge-1,Te=We+1;We<ge;We++,De++,Te++)De===ge&&(De=0),Te===ge&&(Te=0),ye[We]=q(F[We],F[De],F[Te]);me.push(ye),Ie=Ie.concat(ye)}for(let ce=0;ce<b;ce++){const _e=ce/b,F=v*Math.cos(_e*Math.PI/2),We=_*Math.sin(_e*Math.PI/2)+T;for(let ge=0,De=j.length;ge<De;ge++){const Te=ae(j[ge],oe[ge],We);Ee(Te.x,Te.y,-F)}for(let ge=0,De=B.length;ge<De;ge++){const Te=B[ge];ye=me[ge];for(let Ke=0,ze=Te.length;Ke<ze;Ke++){const O=ae(Te[Ke],ye[Ke],We);Ee(O.x,O.y,-F)}}}const tt=_+T;for(let ce=0;ce<V;ce++){const _e=m?ae(w[ce],Ie[ce],tt):w[ce];A?(L.copy(I.normals[0]).multiplyScalar(_e.x),R.copy(I.binormals[0]).multiplyScalar(_e.y),z.copy(E[0]).add(L).add(R),Ee(z.x,z.y,z.z)):Ee(_e.x,_e.y,0)}for(let ce=1;ce<=p;ce++)for(let _e=0;_e<V;_e++){const F=m?ae(w[_e],Ie[_e],tt):w[_e];A?(L.copy(I.normals[ce]).multiplyScalar(F.x),R.copy(I.binormals[ce]).multiplyScalar(F.y),z.copy(E[ce]).add(L).add(R),Ee(z.x,z.y,z.z)):Ee(F.x,F.y,g/p*ce)}for(let ce=b-1;ce>=0;ce--){const _e=ce/b,F=v*Math.cos(_e*Math.PI/2),We=_*Math.sin(_e*Math.PI/2)+T;for(let ge=0,De=j.length;ge<De;ge++){const Te=ae(j[ge],oe[ge],We);Ee(Te.x,Te.y,g+F)}for(let ge=0,De=B.length;ge<De;ge++){const Te=B[ge];ye=me[ge];for(let Ke=0,ze=Te.length;Ke<ze;Ke++){const O=ae(Te[Ke],ye[Ke],We);A?Ee(O.x,O.y+E[p-1].y,E[p-1].x+F):Ee(O.x,O.y,g+F)}}}ee(),ve();function ee(){const ce=a.length/3;if(m){let _e=0,F=V*_e;for(let We=0;We<ne;We++){const ge=k[We];je(ge[2]+F,ge[1]+F,ge[0]+F)}_e=p+b*2,F=V*_e;for(let We=0;We<ne;We++){const ge=k[We];je(ge[0]+F,ge[1]+F,ge[2]+F)}}else{for(let _e=0;_e<ne;_e++){const F=k[_e];je(F[2],F[1],F[0])}for(let _e=0;_e<ne;_e++){const F=k[_e];je(F[0]+V*p,F[1]+V*p,F[2]+V*p)}}i.addGroup(ce,a.length/3-ce,0)}function ve(){const ce=a.length/3;let _e=0;Pe(j,_e),_e+=j.length;for(let F=0,We=B.length;F<We;F++){const ge=B[F];Pe(ge,_e),_e+=ge.length}i.addGroup(ce,a.length/3-ce,1)}function Pe(ce,_e){let F=ce.length;for(;--F>=0;){const We=F;let ge=F-1;ge<0&&(ge=ce.length-1);for(let De=0,Te=p+b*2;De<Te;De++){const Ke=V*De,ze=V*(De+1),O=_e+We+Ke,D=_e+ge+Ke,Z=_e+ge+ze,re=_e+We+ze;Qe(O,D,Z,re)}}}function Ee(ce,_e,F){c.push(ce),c.push(_e),c.push(F)}function je(ce,_e,F){nt(ce),nt(_e),nt(F);const We=a.length/3,ge=S.generateTopUV(i,a,We-3,We-2,We-1);Ct(ge[0]),Ct(ge[1]),Ct(ge[2])}function Qe(ce,_e,F,We){nt(ce),nt(_e),nt(We),nt(_e),nt(F),nt(We);const ge=a.length/3,De=S.generateSideWallUV(i,a,ge-6,ge-3,ge-2,ge-1);Ct(De[0]),Ct(De[1]),Ct(De[3]),Ct(De[1]),Ct(De[2]),Ct(De[3])}function nt(ce){a.push(c[ce*3+0]),a.push(c[ce*3+1]),a.push(c[ce*3+2])}function Ct(ce){s.push(ce.x),s.push(ce.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 XH(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,l=e.shapes.length;s<l;s++){const u=t[e.shapes[s]];i.push(u)}const a=e.options.extrudePath;return a!==void 0&&(e.options.extrudePath=new Hg[a.type]().fromJSON(a)),new L0(i,e.options)}}const GH={generateTopUV:function(n,e,t,i,a){const s=e[t*3],l=e[t*3+1],u=e[i*3],c=e[i*3+1],h=e[a*3],p=e[a*3+1];return[new he(s,l),new he(u,c),new he(h,p)]},generateSideWallUV:function(n,e,t,i,a,s){const l=e[t*3],u=e[t*3+1],c=e[t*3+2],h=e[i*3],p=e[i*3+1],g=e[i*3+2],m=e[a*3],v=e[a*3+1],_=e[a*3+2],T=e[s*3],b=e[s*3+1],y=e[s*3+2];return Math.abs(u-p)<Math.abs(l-h)?[new he(l,1-c),new he(h,1-g),new he(m,1-_),new he(T,1-y)]:[new he(u,1-c),new he(p,1-g),new he(v,1-_),new he(b,1-y)]}};function XH(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,a=n.length;i<a;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 N0 extends To{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,a=[-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(a,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new N0(e.radius,e.detail)}}class cd extends To{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],a=[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,a,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new cd(e.radius,e.detail)}}class I0 extends bt{constructor(e=.5,t=1,i=32,a=1,s=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:a,thetaStart:s,thetaLength:l},i=Math.max(3,i),a=Math.max(1,a);const u=[],c=[],h=[],p=[];let g=e;const m=(t-e)/a,v=new P,_=new he;for(let T=0;T<=a;T++){for(let b=0;b<=i;b++){const y=s+b/i*l;v.x=g*Math.cos(y),v.y=g*Math.sin(y),c.push(v.x,v.y,v.z),h.push(0,0,1),_.x=(v.x/t+1)/2,_.y=(v.y/t+1)/2,p.push(_.x,_.y)}g+=m}for(let T=0;T<a;T++){const b=T*(i+1);for(let y=0;y<i;y++){const S=y+b,E=S,A=S+i+1,I=S+i+2,R=S+1;u.push(E,A,R),u.push(A,I,R)}}this.setIndex(u),this.setAttribute("position",new Ye(c,3)),this.setAttribute("normal",new Ye(h,3)),this.setAttribute("uv",new Ye(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new I0(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class z0 extends bt{constructor(e=new El([new he(0,.5),new he(-.5,-.5),new he(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],a=[],s=[],l=[];let u=0,c=0;if(Array.isArray(e)===!1)h(e);else for(let p=0;p<e.length;p++)h(e[p]),this.addGroup(u,c,p),u+=c,c=0;this.setIndex(i),this.setAttribute("position",new Ye(a,3)),this.setAttribute("normal",new Ye(s,3)),this.setAttribute("uv",new Ye(l,2));function h(p){const g=a.length/3,m=p.extractPoints(t);let v=m.shape;const _=m.holes;Ts.isClockWise(v)===!1&&(v=v.reverse());for(let b=0,y=_.length;b<y;b++){const S=_[b];Ts.isClockWise(S)===!0&&(_[b]=S.reverse())}const T=Ts.triangulateShape(v,_);for(let b=0,y=_.length;b<y;b++){const S=_[b];v=v.concat(S)}for(let b=0,y=v.length;b<y;b++){const S=v[b];a.push(S.x,S.y,0),s.push(0,0,1),l.push(S.x,S.y)}for(let b=0,y=T.length;b<y;b++){const S=T[b],E=S[0]+g,A=S[1]+g,I=S[2]+g;i.push(E,A,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return WH(t,e)}static fromJSON(e,t){const i=[];for(let a=0,s=e.shapes.length;a<s;a++){const l=t[e.shapes[a]];i.push(l)}return new z0(i,e.curveSegments)}}function WH(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const a=n[t];e.shapes.push(a.uuid)}else e.shapes.push(n.uuid);return e}class fd extends bt{constructor(e=1,t=32,i=16,a=0,s=Math.PI*2,l=0,u=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:a,phiLength:s,thetaStart:l,thetaLength:u},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const c=Math.min(l+u,Math.PI);let h=0;const p=[],g=new P,m=new P,v=[],_=[],T=[],b=[];for(let y=0;y<=i;y++){const S=[],E=y/i;let A=0;y===0&&l===0?A=.5/t:y===i&&c===Math.PI&&(A=-.5/t);for(let I=0;I<=t;I++){const R=I/t;g.x=-e*Math.cos(a+R*s)*Math.sin(l+E*u),g.y=e*Math.cos(l+E*u),g.z=e*Math.sin(a+R*s)*Math.sin(l+E*u),_.push(g.x,g.y,g.z),m.copy(g).normalize(),T.push(m.x,m.y,m.z),b.push(R+A,1-E),S.push(h++)}p.push(S)}for(let y=0;y<i;y++)for(let S=0;S<t;S++){const E=p[y][S+1],A=p[y][S],I=p[y+1][S],R=p[y+1][S+1];(y!==0||l>0)&&v.push(E,A,R),(y!==i-1||c<Math.PI)&&v.push(A,I,R)}this.setIndex(v),this.setAttribute("position",new Ye(_,3)),this.setAttribute("normal",new Ye(T,3)),this.setAttribute("uv",new Ye(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fd(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class O0 extends To{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],a=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,a,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new O0(e.radius,e.detail)}}class P0 extends bt{constructor(e=1,t=.4,i=12,a=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:a,arc:s},i=Math.floor(i),a=Math.floor(a);const l=[],u=[],c=[],h=[],p=new P,g=new P,m=new P;for(let v=0;v<=i;v++)for(let _=0;_<=a;_++){const T=_/a*s,b=v/i*Math.PI*2;g.x=(e+t*Math.cos(b))*Math.cos(T),g.y=(e+t*Math.cos(b))*Math.sin(T),g.z=t*Math.sin(b),u.push(g.x,g.y,g.z),p.x=e*Math.cos(T),p.y=e*Math.sin(T),m.subVectors(g,p).normalize(),c.push(m.x,m.y,m.z),h.push(_/a),h.push(v/i)}for(let v=1;v<=i;v++)for(let _=1;_<=a;_++){const T=(a+1)*v+_-1,b=(a+1)*(v-1)+_-1,y=(a+1)*(v-1)+_,S=(a+1)*v+_;l.push(T,b,S),l.push(b,y,S)}this.setIndex(l),this.setAttribute("position",new Ye(u,3)),this.setAttribute("normal",new Ye(c,3)),this.setAttribute("uv",new Ye(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new P0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class B0 extends bt{constructor(e=1,t=.4,i=64,a=8,s=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:a,p:s,q:l},i=Math.floor(i),a=Math.floor(a);const u=[],c=[],h=[],p=[],g=new P,m=new P,v=new P,_=new P,T=new P,b=new P,y=new P;for(let E=0;E<=i;++E){const A=E/i*s*Math.PI*2;S(A,s,l,e,v),S(A+.01,s,l,e,_),b.subVectors(_,v),y.addVectors(_,v),T.crossVectors(b,y),y.crossVectors(T,b),T.normalize(),y.normalize();for(let I=0;I<=a;++I){const R=I/a*Math.PI*2,L=-t*Math.cos(R),z=t*Math.sin(R);g.x=v.x+(L*y.x+z*T.x),g.y=v.y+(L*y.y+z*T.y),g.z=v.z+(L*y.z+z*T.z),c.push(g.x,g.y,g.z),m.subVectors(g,v).normalize(),h.push(m.x,m.y,m.z),p.push(E/i),p.push(I/a)}}for(let E=1;E<=i;E++)for(let A=1;A<=a;A++){const I=(a+1)*(E-1)+(A-1),R=(a+1)*E+(A-1),L=(a+1)*E+A,z=(a+1)*(E-1)+A;u.push(I,R,z),u.push(R,L,z)}this.setIndex(u),this.setAttribute("position",new Ye(c,3)),this.setAttribute("normal",new Ye(h,3)),this.setAttribute("uv",new Ye(p,2));function S(E,A,I,R,L){const z=Math.cos(E),C=Math.sin(E),w=I/A*E,B=Math.cos(w);L.x=R*(2+B)*.5*z,L.y=R*(2+B)*C*.5,L.z=R*Math.sin(w)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new B0(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class F0 extends bt{constructor(e=new Cb(new P(-1,-1,0),new P(-1,1,0),new P(1,1,0)),t=64,i=1,a=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:a,closed:s};const l=e.computeFrenetFrames(t,s);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;const u=new P,c=new P,h=new he;let p=new P;const g=[],m=[],v=[],_=[];T(),this.setIndex(_),this.setAttribute("position",new Ye(g,3)),this.setAttribute("normal",new Ye(m,3)),this.setAttribute("uv",new Ye(v,2));function T(){for(let E=0;E<t;E++)b(E);b(s===!1?t:0),S(),y()}function b(E){p=e.getPointAt(E/t,p);const A=l.normals[E],I=l.binormals[E];for(let R=0;R<=a;R++){const L=R/a*Math.PI*2,z=Math.sin(L),C=-Math.cos(L);c.x=C*A.x+z*I.x,c.y=C*A.y+z*I.y,c.z=C*A.z+z*I.z,c.normalize(),m.push(c.x,c.y,c.z),u.x=p.x+i*c.x,u.y=p.y+i*c.y,u.z=p.z+i*c.z,g.push(u.x,u.y,u.z)}}function y(){for(let E=1;E<=t;E++)for(let A=1;A<=a;A++){const I=(a+1)*(E-1)+(A-1),R=(a+1)*E+(A-1),L=(a+1)*E+A,z=(a+1)*(E-1)+A;_.push(I,R,z),_.push(R,L,z)}}function S(){for(let E=0;E<=t;E++)for(let A=0;A<=a;A++)h.x=E/t,h.y=A/a,v.push(h.x,h.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 F0(new Hg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class $D extends bt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,a=new P,s=new P;if(e.index!==null){const l=e.attributes.position,u=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:u.count,materialIndex:0}]);for(let h=0,p=c.length;h<p;++h){const g=c[h],m=g.start,v=g.count;for(let _=m,T=m+v;_<T;_+=3)for(let b=0;b<3;b++){const y=u.getX(_+b),S=u.getX(_+(b+1)%3);a.fromBufferAttribute(l,y),s.fromBufferAttribute(l,S),iw(a,s,i)===!0&&(t.push(a.x,a.y,a.z),t.push(s.x,s.y,s.z))}}}else{const l=e.attributes.position;for(let u=0,c=l.count/3;u<c;u++)for(let h=0;h<3;h++){const p=3*u+h,g=3*u+(h+1)%3;a.fromBufferAttribute(l,p),s.fromBufferAttribute(l,g),iw(a,s,i)===!0&&(t.push(a.x,a.y,a.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ye(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function iw(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,a=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(a)===!0?!1:(t.add(i),t.add(a),!0)}var aw=Object.freeze({__proto__:null,BoxGeometry:Vl,CapsuleGeometry:w0,CircleGeometry:C0,ConeGeometry:R0,CylinderGeometry:Gc,DodecahedronGeometry:D0,EdgesGeometry:jD,ExtrudeGeometry:L0,IcosahedronGeometry:N0,LatheGeometry:ud,OctahedronGeometry:cd,PlaneGeometry:Vc,PolyhedronGeometry:To,RingGeometry:I0,ShapeGeometry:z0,SphereGeometry:fd,TetrahedronGeometry:O0,TorusGeometry:P0,TorusKnotGeometry:B0,TubeGeometry:F0,WireframeGeometry:$D});class eU extends Mi{static get type(){return"ShadowMaterial"}constructor(e){super(),this.isShadowMaterial=!0,this.color=new Be(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 tU extends as{static get type(){return"RawShaderMaterial"}constructor(e){super(e),this.isRawShaderMaterial=!0}}class Db extends Mi{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new Be(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 Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(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 ba,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 nU extends Db{static get type(){return"MeshPhysicalMaterial"}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new he(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return bn(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 Be(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 Be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Be(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 iU extends Mi{static get type(){return"MeshPhongMaterial"}constructor(e){super(),this.isMeshPhongMaterial=!0,this.color=new Be(16777215),this.specular=new Be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ba,this.combine=id,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 aU extends Mi{static get type(){return"MeshToonMaterial"}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new Be(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(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 sU extends Mi{static get type(){return"MeshNormalMaterial"}constructor(e){super(),this.isMeshNormalMaterial=!0,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(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 rU extends Mi{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new Be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ba,this.combine=id,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 oU extends Mi{static get type(){return"MeshMatcapMaterial"}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new Be(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new he(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 lU extends Ni{static get type(){return"LineDashedMaterial"}constructor(e){super(),this.isLineDashedMaterial=!0,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 ml(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 uU(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function cU(n){function e(a,s){return n[a]-n[s]}const t=n.length,i=new Array(t);for(let a=0;a!==t;++a)i[a]=a;return i.sort(e),i}function Yx(n,e,t){const i=n.length,a=new n.constructor(i);for(let s=0,l=0;l!==i;++s){const u=t[s]*e;for(let c=0;c!==e;++c)a[l++]=n[u+c]}return a}function Ub(n,e,t,i){let a=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[a++];if(s===void 0)return;let l=s[i];if(l!==void 0)if(Array.isArray(l))do l=s[i],l!==void 0&&(e.push(s.time),t.push.apply(t,l)),s=n[a++];while(s!==void 0);else if(l.toArray!==void 0)do l=s[i],l!==void 0&&(e.push(s.time),l.toArray(t,t.length)),s=n[a++];while(s!==void 0);else do l=s[i],l!==void 0&&(e.push(s.time),t.push(l)),s=n[a++];while(s!==void 0)}function qH(n,e,t,i,a=30){const s=n.clone();s.name=e;const l=[];for(let c=0;c<s.tracks.length;++c){const h=s.tracks[c],p=h.getValueSize(),g=[],m=[];for(let v=0;v<h.times.length;++v){const _=h.times[v]*a;if(!(_<t||_>=i)){g.push(h.times[v]);for(let T=0;T<p;++T)m.push(h.values[v*p+T])}}g.length!==0&&(h.times=ml(g,h.times.constructor),h.values=ml(m,h.values.constructor),l.push(h))}s.tracks=l;let u=1/0;for(let c=0;c<s.tracks.length;++c)u>s.tracks[c].times[0]&&(u=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*u);return s.resetDuration(),s}function YH(n,e=0,t=n,i=30){i<=0&&(i=30);const a=t.tracks.length,s=e/i;for(let l=0;l<a;++l){const u=t.tracks[l],c=u.ValueTypeName;if(c==="bool"||c==="string")continue;const h=n.tracks.find(function(y){return y.name===u.name&&y.ValueTypeName===c});if(h===void 0)continue;let p=0;const g=u.getValueSize();u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);let m=0;const v=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=v/3);const _=u.times.length-1;let T;if(s<=u.times[0]){const y=p,S=g-p;T=u.values.slice(y,S)}else if(s>=u.times[_]){const y=_*g+p,S=y+g-p;T=u.values.slice(y,S)}else{const y=u.createInterpolant(),S=p,E=g-p;y.evaluate(s),T=y.resultBuffer.slice(S,E)}c==="quaternion"&&new Qi().fromArray(T).normalize().conjugate().toArray(T);const b=h.times.length;for(let y=0;y<b;++y){const S=y*v+m;if(c==="quaternion")Qi.multiplyQuaternionsFlat(h.values,S,T,0,h.values,S);else{const E=v-m*2;for(let A=0;A<E;++A)h.values[S+A]-=T[A]}}}return n.blendMode=cb,n}const ZH={convertArray:ml,isTypedArray:uU,getKeyframeOrder:cU,sortedArray:Yx,flattenJSON:Ub,subclip:qH,makeClipAdditive:YH};class hd{constructor(e,t,i,a){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=a!==void 0?a: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,a=t[i],s=t[i-1];e:{t:{let l;n:{i:if(!(e<a)){for(let u=i+2;;){if(a===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===u)break;if(s=a,a=t[++i],e<a)break t}l=t.length;break n}if(!(e>=s)){const u=t[1];e<u&&(i=2,s=u);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(a=s,s=t[--i-1],e>=s)break t}l=i,i=0;break n}break e}for(;i<l;){const u=i+l>>>1;e<t[u]?l=u:i=u+1}if(a=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,a)}return this.interpolate_(i,s,e,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,a=this.valueSize,s=e*a;for(let l=0;l!==a;++l)t[l]=i[s+l];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class fU extends hd{constructor(e,t,i,a){super(e,t,i,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:hl,endingEnd:hl}}intervalChanged_(e,t,i){const a=this.parameterPositions;let s=e-2,l=e+1,u=a[s],c=a[l];if(u===void 0)switch(this.getSettings_().endingStart){case dl:s=e,u=2*t-i;break;case Lh:s=a.length-2,u=t+a[s]-a[s+1];break;default:s=e,u=i}if(c===void 0)switch(this.getSettings_().endingEnd){case dl:l=e,c=2*i-t;break;case Lh:l=1,c=i+a[1]-a[0];break;default:l=e-1,c=t}const h=(i-t)*.5,p=this.valueSize;this._weightPrev=h/(t-u),this._weightNext=h/(c-i),this._offsetPrev=s*p,this._offsetNext=l*p}interpolate_(e,t,i,a){const s=this.resultBuffer,l=this.sampleValues,u=this.valueSize,c=e*u,h=c-u,p=this._offsetPrev,g=this._offsetNext,m=this._weightPrev,v=this._weightNext,_=(i-t)/(a-t),T=_*_,b=T*_,y=-m*b+2*m*T-m*_,S=(1+m)*b+(-1.5-2*m)*T+(-.5+m)*_+1,E=(-1-v)*b+(1.5+v)*T+.5*_,A=v*b-v*T;for(let I=0;I!==u;++I)s[I]=y*l[p+I]+S*l[h+I]+E*l[c+I]+A*l[g+I];return s}}class Lb extends hd{constructor(e,t,i,a){super(e,t,i,a)}interpolate_(e,t,i,a){const s=this.resultBuffer,l=this.sampleValues,u=this.valueSize,c=e*u,h=c-u,p=(i-t)/(a-t),g=1-p;for(let m=0;m!==u;++m)s[m]=l[h+m]*g+l[c+m]*p;return s}}class hU extends hd{constructor(e,t,i,a){super(e,t,i,a)}interpolate_(e){return this.copySampleValue_(e-1)}}class os{constructor(e,t,i,a){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=ml(t,this.TimeBufferType),this.values=ml(i,this.ValueBufferType),this.setInterpolation(a||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:ml(e.times,Array),values:ml(e.values,Array)};const a=e.getInterpolation();a!==e.DefaultInterpolation&&(i.interpolation=a)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new hU(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Lb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new fU(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Uh:t=this.InterpolantFactoryMethodDiscrete;break;case Pg:t=this.InterpolantFactoryMethodLinear;break;case Mm: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 Uh;case this.InterpolantFactoryMethodLinear:return Pg;case this.InterpolantFactoryMethodSmooth:return Mm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,a=t.length;i!==a;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,a=t.length;i!==a;++i)t[i]*=e}return this}trim(e,t){const i=this.times,a=i.length;let s=0,l=a-1;for(;s!==a&&i[s]<e;)++s;for(;l!==-1&&i[l]>t;)--l;if(++l,s!==0||l!==a){s>=l&&(l=Math.max(l,1),s=l-1);const u=this.getValueSize();this.times=i.slice(s,l),this.values=this.values.slice(s*u,l*u)}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,a=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let u=0;u!==s;u++){const c=i[u];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,u,c),e=!1;break}if(l!==null&&l>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,u,c,l),e=!1;break}l=c}if(a!==void 0&&uU(a))for(let u=0,c=a.length;u!==c;++u){const h=a[u];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),a=this.getInterpolation()===Mm,s=e.length-1;let l=1;for(let u=1;u<s;++u){let c=!1;const h=e[u],p=e[u+1];if(h!==p&&(u!==1||h!==e[0]))if(a)c=!0;else{const g=u*i,m=g-i,v=g+i;for(let _=0;_!==i;++_){const T=t[g+_];if(T!==t[m+_]||T!==t[v+_]){c=!0;break}}}if(c){if(u!==l){e[l]=e[u];const g=u*i,m=l*i;for(let v=0;v!==i;++v)t[m+v]=t[g+v]}++l}}if(s>0){e[l]=e[s];for(let u=s*i,c=l*i,h=0;h!==i;++h)t[c+h]=t[u+h];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,a=new i(this.name,e,t);return a.createInterpolant=this.createInterpolant,a}}os.prototype.TimeBufferType=Float32Array;os.prototype.ValueBufferType=Float32Array;os.prototype.DefaultInterpolation=Pg;class kl extends os{constructor(e,t,i){super(e,t,i)}}kl.prototype.ValueTypeName="bool";kl.prototype.ValueBufferType=Array;kl.prototype.DefaultInterpolation=Uh;kl.prototype.InterpolantFactoryMethodLinear=void 0;kl.prototype.InterpolantFactoryMethodSmooth=void 0;class Nb extends os{}Nb.prototype.ValueTypeName="color";class Hh extends os{}Hh.prototype.ValueTypeName="number";class dU extends hd{constructor(e,t,i,a){super(e,t,i,a)}interpolate_(e,t,i,a){const s=this.resultBuffer,l=this.sampleValues,u=this.valueSize,c=(i-t)/(a-t);let h=e*u;for(let p=h+u;h!==p;h+=4)Qi.slerpFlat(s,0,l,h-u,l,h,c);return s}}class dd extends os{InterpolantFactoryMethodLinear(e){return new dU(this.times,this.values,this.getValueSize(),e)}}dd.prototype.ValueTypeName="quaternion";dd.prototype.InterpolantFactoryMethodSmooth=void 0;class Gl extends os{constructor(e,t,i){super(e,t,i)}}Gl.prototype.ValueTypeName="string";Gl.prototype.ValueBufferType=Array;Gl.prototype.DefaultInterpolation=Uh;Gl.prototype.InterpolantFactoryMethodLinear=void 0;Gl.prototype.InterpolantFactoryMethodSmooth=void 0;class Vh extends os{}Vh.prototype.ValueTypeName="vector";class kh{constructor(e="",t=-1,i=[],a=v0){this.name=e,this.tracks=i,this.duration=t,this.blendMode=a,this.uuid=_a(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,a=1/(e.fps||1);for(let l=0,u=i.length;l!==u;++l)t.push(QH(i[l]).scale(a));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,a={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,l=i.length;s!==l;++s)t.push(os.toJSON(i[s]));return a}static CreateFromMorphTargetSequence(e,t,i,a){const s=t.length,l=[];for(let u=0;u<s;u++){let c=[],h=[];c.push((u+s-1)%s,u,(u+1)%s),h.push(0,1,0);const p=cU(c);c=Yx(c,1,p),h=Yx(h,1,p),!a&&c[0]===0&&(c.push(s),h.push(h[0])),l.push(new Hh(".morphTargetInfluences["+t[u].name+"]",c,h).scale(1/i))}return new this(e,-1,l)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const a=e;i=a.geometry&&a.geometry.animations||a.animations}for(let a=0;a<i.length;a++)if(i[a].name===t)return i[a];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const a={},s=/^([\w-]*?)([\d]+)$/;for(let u=0,c=e.length;u<c;u++){const h=e[u],p=h.name.match(s);if(p&&p.length>1){const g=p[1];let m=a[g];m||(a[g]=m=[]),m.push(h)}}const l=[];for(const u in a)l.push(this.CreateFromMorphTargetSequence(u,a[u],t,i));return l}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(g,m,v,_,T){if(v.length!==0){const b=[],y=[];Ub(v,b,y,_),b.length!==0&&T.push(new g(m,b,y))}},a=[],s=e.name||"default",l=e.fps||30,u=e.blendMode;let c=e.length||-1;const h=e.hierarchy||[];for(let g=0;g<h.length;g++){const m=h[g].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const v={};let _;for(_=0;_<m.length;_++)if(m[_].morphTargets)for(let T=0;T<m[_].morphTargets.length;T++)v[m[_].morphTargets[T]]=-1;for(const T in v){const b=[],y=[];for(let S=0;S!==m[_].morphTargets.length;++S){const E=m[_];b.push(E.time),y.push(E.morphTarget===T?1:0)}a.push(new Hh(".morphTargetInfluence["+T+"]",b,y))}c=v.length*l}else{const v=".bones["+t[g].name+"]";i(Vh,v+".position",m,"pos",a),i(dd,v+".quaternion",m,"rot",a),i(Vh,v+".scale",m,"scl",a)}}return a.length===0?null:new this(s,c,a,u)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,a=e.length;i!==a;++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 jH(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Hh;case"vector":case"vector2":case"vector3":case"vector4":return Vh;case"color":return Nb;case"quaternion":return dd;case"bool":case"boolean":return kl;case"string":return Gl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function QH(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=jH(n.type);if(n.times===void 0){const t=[],i=[];Ub(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 rr={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 Ib{constructor(e,t,i){const a=this;let s=!1,l=0,u=0,c;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(p){u++,s===!1&&a.onStart!==void 0&&a.onStart(p,l,u),s=!0},this.itemEnd=function(p){l++,a.onProgress!==void 0&&a.onProgress(p,l,u),l===u&&(s=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(p){a.onError!==void 0&&a.onError(p)},this.resolveURL=function(p){return c?c(p):p},this.setURLModifier=function(p){return c=p,this},this.addHandler=function(p,g){return h.push(p,g),this},this.removeHandler=function(p){const g=h.indexOf(p);return g!==-1&&h.splice(g,2),this},this.getHandler=function(p){for(let g=0,m=h.length;g<m;g+=2){const v=h[g],_=h[g+1];if(v.global&&(v.lastIndex=0),v.test(p))return _}return null}}}const pU=new Ib;class $i{constructor(e){this.manager=e!==void 0?e:pU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(a,s){i.load(e,a,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}}$i.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ks={};class KH extends Error{constructor(e,t){super(e),this.response=t}}class xr extends $i{constructor(e){super(e)}load(e,t,i,a){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=rr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ks[e]!==void 0){Ks[e].push({onLoad:t,onProgress:i,onError:a});return}Ks[e]=[],Ks[e].push({onLoad:t,onProgress:i,onError:a});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),u=this.mimeType,c=this.responseType;fetch(l).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const p=Ks[e],g=h.body.getReader(),m=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),v=m?parseInt(m):0,_=v!==0;let T=0;const b=new ReadableStream({start(y){S();function S(){g.read().then(({done:E,value:A})=>{if(E)y.close();else{T+=A.byteLength;const I=new ProgressEvent("progress",{lengthComputable:_,loaded:T,total:v});for(let R=0,L=p.length;R<L;R++){const z=p[R];z.onProgress&&z.onProgress(I)}y.enqueue(A),S()}},E=>{y.error(E)})}}});return new Response(b)}else throw new KH(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(c){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(p=>new DOMParser().parseFromString(p,u));case"json":return h.json();default:if(u===void 0)return h.text();{const g=/charset="?([^;"\s]*)"?/i.exec(u),m=g&&g[1]?g[1].toLowerCase():void 0,v=new TextDecoder(m);return h.arrayBuffer().then(_=>v.decode(_))}}}).then(h=>{rr.add(e,h);const p=Ks[e];delete Ks[e];for(let g=0,m=p.length;g<m;g++){const v=p[g];v.onLoad&&v.onLoad(h)}}).catch(h=>{const p=Ks[e];if(p===void 0)throw this.manager.itemError(e),h;delete Ks[e];for(let g=0,m=p.length;g<m;g++){const v=p[g];v.onError&&v.onError(h)}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 JH extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=new xr(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){try{t(s.parse(JSON.parse(u)))}catch(c){a?a(c):console.error(c),s.manager.itemError(e)}},i,a)}parse(e){const t=[];for(let i=0;i<e.length;i++){const a=kh.parse(e[i]);t.push(a)}return t}}class $H extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=[],u=new T0,c=new xr(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(s.withCredentials);let h=0;function p(g){c.load(e[g],function(m){const v=s.parse(m,!0);l[g]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},h+=1,h===6&&(v.mipmapCount===1&&(u.minFilter=Gn),u.image=l,u.format=v.format,u.needsUpdate=!0,t&&t(u))},i,a)}if(Array.isArray(e))for(let g=0,m=e.length;g<m;++g)p(g);else c.load(e,function(g){const m=s.parse(g,!0);if(m.isCubemap){const v=m.mipmaps.length/m.mipmapCount;for(let _=0;_<v;_++){l[_]={mipmaps:[]};for(let T=0;T<m.mipmapCount;T++)l[_].mipmaps.push(m.mipmaps[_*m.mipmapCount+T]),l[_].format=m.format,l[_].width=m.width,l[_].height=m.height}u.image=l}else u.image.width=m.width,u.image.height=m.height,u.mipmaps=m.mipmaps;m.mipmapCount===1&&(u.minFilter=Gn),u.format=m.format,u.needsUpdate=!0,t&&t(u)},i,a);return u}}class Gh extends $i{constructor(e){super(e)}load(e,t,i,a){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,l=rr.get(e);if(l!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(l),s.manager.itemEnd(e)},0),l;const u=zh("img");function c(){p(),rr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(g){p(),a&&a(g),s.manager.itemError(e),s.manager.itemEnd(e)}function p(){u.removeEventListener("load",c,!1),u.removeEventListener("error",h,!1)}return u.addEventListener("load",c,!1),u.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(u.crossOrigin=this.crossOrigin),s.manager.itemStart(e),u.src=e,u}}class eV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=new rd;s.colorSpace=xi;const l=new Gh(this.manager);l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let u=0;function c(h){l.load(e[h],function(p){s.images[h]=p,u++,u===6&&(s.needsUpdate=!0,t&&t(s))},void 0,a)}for(let h=0;h<e.length;++h)c(h);return s}}class tV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=new Es,u=new xr(this.manager);return u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setPath(this.path),u.setWithCredentials(s.withCredentials),u.load(e,function(c){let h;try{h=s.parse(c)}catch(p){if(a!==void 0)a(p);else{console.error(p);return}}h.image!==void 0?l.image=h.image:h.data!==void 0&&(l.image.width=h.width,l.image.height=h.height,l.image.data=h.data),l.wrapS=h.wrapS!==void 0?h.wrapS:Ba,l.wrapT=h.wrapT!==void 0?h.wrapT:Ba,l.magFilter=h.magFilter!==void 0?h.magFilter:Gn,l.minFilter=h.minFilter!==void 0?h.minFilter:Gn,l.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(l.colorSpace=h.colorSpace),h.flipY!==void 0&&(l.flipY=h.flipY),h.format!==void 0&&(l.format=h.format),h.type!==void 0&&(l.type=h.type),h.mipmaps!==void 0&&(l.mipmaps=h.mipmaps,l.minFilter=xs),h.mipmapCount===1&&(l.minFilter=Gn),h.generateMipmaps!==void 0&&(l.generateMipmaps=h.generateMipmaps),l.needsUpdate=!0,t&&t(l,h)},i,a),l}}class nV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=new Mn,l=new Gh(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,function(u){s.image=u,s.needsUpdate=!0,t!==void 0&&t(s)},i,a),s}}class Ao extends Bt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Be(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 mU extends Ao{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Be(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const C_=new lt,sw=new P,rw=new P;class zb{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new he(512,512),this.map=null,this.mapPass=null,this.matrix=new lt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new od,this._frameExtents=new he(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;sw.setFromMatrixPosition(e.matrixWorld),t.position.copy(sw),rw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(rw),t.updateMatrixWorld(),C_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(C_),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(C_)}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 iV extends zb{constructor(){super(new ti(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Ac*2*e.angle*this.focus,a=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||a!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=a,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class gU extends Ao{constructor(e,t,i=0,a=Math.PI/3,s=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.distance=i,this.angle=a,this.penumbra=s,this.decay=l,this.map=null,this.shadow=new iV}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 ow=new lt,If=new P,R_=new P;class aV extends zb{constructor(){super(new ti(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new he(4,2),this._viewportCount=6,this._viewports=[new Pt(2,1,1,1),new Pt(0,1,1,1),new Pt(3,1,1,1),new Pt(1,1,1,1),new Pt(3,0,1,1),new Pt(1,0,1,1)],this._cubeDirections=[new P(1,0,0),new P(-1,0,0),new P(0,0,1),new P(0,0,-1),new P(0,1,0),new P(0,-1,0)],this._cubeUps=[new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,0,1),new P(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,a=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),If.setFromMatrixPosition(e.matrixWorld),i.position.copy(If),R_.copy(i.position),R_.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(R_),i.updateMatrixWorld(),a.makeTranslation(-If.x,-If.y,-If.z),ow.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ow)}}class vU extends Ao{constructor(e,t,i=0,a=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=a,this.shadow=new aV}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 sV extends zb{constructor(){super(new ld(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class yU extends Ao{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.shadow=new sV}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class _U extends Ao{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xU extends Ao{constructor(e,t,i=10,a=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=a}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 SU{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new P)}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,a=e.y,s=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*a),t.addScaledVector(l[2],.488603*s),t.addScaledVector(l[3],.488603*i),t.addScaledVector(l[4],1.092548*(i*a)),t.addScaledVector(l[5],1.092548*(a*s)),t.addScaledVector(l[6],.315392*(3*s*s-1)),t.addScaledVector(l[7],1.092548*(i*s)),t.addScaledVector(l[8],.546274*(i*i-a*a)),t}getIrradianceAt(e,t){const i=e.x,a=e.y,s=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],2*.511664*a),t.addScaledVector(l[2],2*.511664*s),t.addScaledVector(l[3],2*.511664*i),t.addScaledVector(l[4],2*.429043*i*a),t.addScaledVector(l[5],2*.429043*a*s),t.addScaledVector(l[6],.743125*s*s-.247708),t.addScaledVector(l[7],2*.429043*i*s),t.addScaledVector(l[8],.429043*(i*i-a*a)),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 a=0;a<9;a++)i[a].fromArray(e,t+a*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let a=0;a<9;a++)i[a].toArray(e,t+a*3);return e}static getBasisAt(e,t){const i=e.x,a=e.y,s=e.z;t[0]=.282095,t[1]=.488603*a,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*a,t[5]=1.092548*a*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-a*a)}}class bU extends Ao{constructor(e=new SU,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 H0 extends $i{constructor(e){super(e),this.textures={}}load(e,t,i,a){const s=this,l=new xr(s.manager);l.setPath(s.path),l.setRequestHeader(s.requestHeader),l.setWithCredentials(s.withCredentials),l.load(e,function(u){try{t(s.parse(JSON.parse(u)))}catch(c){a?a(c):console.error(c),s.manager.itemError(e)}},i,a)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const a=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(a.uuid=e.uuid),e.name!==void 0&&(a.name=e.name),e.color!==void 0&&a.color!==void 0&&a.color.setHex(e.color),e.roughness!==void 0&&(a.roughness=e.roughness),e.metalness!==void 0&&(a.metalness=e.metalness),e.sheen!==void 0&&(a.sheen=e.sheen),e.sheenColor!==void 0&&(a.sheenColor=new Be().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(a.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&a.emissive!==void 0&&a.emissive.setHex(e.emissive),e.specular!==void 0&&a.specular!==void 0&&a.specular.setHex(e.specular),e.specularIntensity!==void 0&&(a.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&a.specularColor!==void 0&&a.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(a.shininess=e.shininess),e.clearcoat!==void 0&&(a.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(a.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(a.dispersion=e.dispersion),e.iridescence!==void 0&&(a.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(a.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(a.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(a.transmission=e.transmission),e.thickness!==void 0&&(a.thickness=e.thickness),e.attenuationDistance!==void 0&&(a.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&a.attenuationColor!==void 0&&a.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(a.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(a.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(a.fog=e.fog),e.flatShading!==void 0&&(a.flatShading=e.flatShading),e.blending!==void 0&&(a.blending=e.blending),e.combine!==void 0&&(a.combine=e.combine),e.side!==void 0&&(a.side=e.side),e.shadowSide!==void 0&&(a.shadowSide=e.shadowSide),e.opacity!==void 0&&(a.opacity=e.opacity),e.transparent!==void 0&&(a.transparent=e.transparent),e.alphaTest!==void 0&&(a.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(a.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(a.depthFunc=e.depthFunc),e.depthTest!==void 0&&(a.depthTest=e.depthTest),e.depthWrite!==void 0&&(a.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(a.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(a.blendSrc=e.blendSrc),e.blendDst!==void 0&&(a.blendDst=e.blendDst),e.blendEquation!==void 0&&(a.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(a.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(a.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(a.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&a.blendColor!==void 0&&a.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(a.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(a.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(a.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(a.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(a.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(a.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(a.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(a.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(a.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(a.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(a.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(a.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(a.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(a.rotation=e.rotation),e.linewidth!==void 0&&(a.linewidth=e.linewidth),e.dashSize!==void 0&&(a.dashSize=e.dashSize),e.gapSize!==void 0&&(a.gapSize=e.gapSize),e.scale!==void 0&&(a.scale=e.scale),e.polygonOffset!==void 0&&(a.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(a.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(a.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(a.dithering=e.dithering),e.alphaToCoverage!==void 0&&(a.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(a.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(a.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(a.visible=e.visible),e.toneMapped!==void 0&&(a.toneMapped=e.toneMapped),e.userData!==void 0&&(a.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?a.vertexColors=e.vertexColors>0:a.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const l=e.uniforms[s];switch(a.uniforms[s]={},l.type){case"t":a.uniforms[s].value=i(l.value);break;case"c":a.uniforms[s].value=new Be().setHex(l.value);break;case"v2":a.uniforms[s].value=new he().fromArray(l.value);break;case"v3":a.uniforms[s].value=new P().fromArray(l.value);break;case"v4":a.uniforms[s].value=new Pt().fromArray(l.value);break;case"m3":a.uniforms[s].value=new vt().fromArray(l.value);break;case"m4":a.uniforms[s].value=new lt().fromArray(l.value);break;default:a.uniforms[s].value=l.value}}if(e.defines!==void 0&&(a.defines=e.defines),e.vertexShader!==void 0&&(a.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(a.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(a.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)a.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(a.lights=e.lights),e.clipping!==void 0&&(a.clipping=e.clipping),e.size!==void 0&&(a.size=e.size),e.sizeAttenuation!==void 0&&(a.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(a.map=i(e.map)),e.matcap!==void 0&&(a.matcap=i(e.matcap)),e.alphaMap!==void 0&&(a.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(a.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(a.bumpScale=e.bumpScale),e.normalMap!==void 0&&(a.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(a.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),a.normalScale=new he().fromArray(s)}return e.displacementMap!==void 0&&(a.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(a.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(a.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(a.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(a.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(a.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(a.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(a.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(a.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(a.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(a.envMap=i(e.envMap)),e.envMapRotation!==void 0&&a.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(a.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(a.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(a.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(a.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(a.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(a.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(a.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(a.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(a.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(a.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(a.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(a.clearcoatNormalScale=new he().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(a.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(a.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(a.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(a.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(a.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(a.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(a.sheenRoughnessMap=i(e.sheenRoughnessMap)),a}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return H0.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:eU,SpriteMaterial:Sb,RawShaderMaterial:tU,ShaderMaterial:as,PointsMaterial:Mb,MeshPhysicalMaterial:nU,MeshStandardMaterial:Db,MeshPhongMaterial:iU,MeshToonMaterial:aU,MeshNormalMaterial:sU,MeshLambertMaterial:rU,MeshDepthMaterial:yb,MeshDistanceMaterial:_b,MeshBasicMaterial:Eo,MeshMatcapMaterial:oU,LineDashedMaterial:lU,LineBasicMaterial:Ni,Material:Mi};return new t[e]}}class Zx{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,a=e.length;i<a;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 MU extends bt{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 EU extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=new xr(s.manager);l.setPath(s.path),l.setRequestHeader(s.requestHeader),l.setWithCredentials(s.withCredentials),l.load(e,function(u){try{t(s.parse(JSON.parse(u)))}catch(c){a?a(c):console.error(c),s.manager.itemError(e)}},i,a)}parse(e){const t={},i={};function a(v,_){if(t[_]!==void 0)return t[_];const b=v.interleavedBuffers[_],y=s(v,b.buffer),S=nc(b.type,y),E=new M0(S,b.stride);return E.uuid=b.uuid,t[_]=E,E}function s(v,_){if(i[_]!==void 0)return i[_];const b=v.arrayBuffers[_],y=new Uint32Array(b).buffer;return i[_]=y,y}const l=e.isInstancedBufferGeometry?new MU:new bt,u=e.data.index;if(u!==void 0){const v=nc(u.type,u.array);l.setIndex(new tn(v,1))}const c=e.data.attributes;for(const v in c){const _=c[v];let T;if(_.isInterleavedBufferAttribute){const b=a(e.data,_.data);T=new Nl(b,_.itemSize,_.offset,_.normalized)}else{const b=nc(_.type,_.array),y=_.isInstancedBufferAttribute?Rc:tn;T=new y(b,_.itemSize,_.normalized)}_.name!==void 0&&(T.name=_.name),_.usage!==void 0&&T.setUsage(_.usage),l.setAttribute(v,T)}const h=e.data.morphAttributes;if(h)for(const v in h){const _=h[v],T=[];for(let b=0,y=_.length;b<y;b++){const S=_[b];let E;if(S.isInterleavedBufferAttribute){const A=a(e.data,S.data);E=new Nl(A,S.itemSize,S.offset,S.normalized)}else{const A=nc(S.type,S.array);E=new tn(A,S.itemSize,S.normalized)}S.name!==void 0&&(E.name=S.name),T.push(E)}l.morphAttributes[v]=T}e.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);const g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(let v=0,_=g.length;v!==_;++v){const T=g[v];l.addGroup(T.start,T.count,T.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const v=new P;m.center!==void 0&&v.fromArray(m.center),l.boundingSphere=new bi(v,m.radius)}return e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}class rV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=this.path===""?Zx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||l;const u=new xr(this.manager);u.setPath(this.path),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(c){let h=null;try{h=JSON.parse(c)}catch(g){a!==void 0&&a(g),console.error("THREE:ObjectLoader: Can't parse "+e+".",g.message);return}const p=h.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){a!==void 0&&a(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},i,a)}async loadAsync(e,t){const i=this,a=this.path===""?Zx.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const s=new xr(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const l=await s.loadAsync(e,t),u=JSON.parse(l),c=u.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(u)}parse(e,t){const i=this.parseAnimations(e.animations),a=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,a),l=this.parseImages(e.images,function(){t!==void 0&&t(h)}),u=this.parseTextures(e.textures,l),c=this.parseMaterials(e.materials,u),h=this.parseObject(e.object,s,c,u,i),p=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,p),this.bindLightTargets(h),t!==void 0){let g=!1;for(const m in l)if(l[m].data instanceof HTMLImageElement){g=!0;break}g===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),a=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),l=this.parseTextures(e.textures,s),u=this.parseMaterials(e.materials,l),c=this.parseObject(e.object,a,u,l,t),h=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,h),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let i=0,a=e.length;i<a;i++){const s=new El().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},a={};if(t.traverse(function(s){s.isBone&&(a[s.uuid]=s)}),e!==void 0)for(let s=0,l=e.length;s<l;s++){const u=new E0().fromJSON(e[s],a);i[u.uuid]=u}return i}parseGeometries(e,t){const i={};if(e!==void 0){const a=new EU;for(let s=0,l=e.length;s<l;s++){let u;const c=e[s];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":u=a.parse(c);break;default:c.type in aw?u=aw[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}u.uuid=c.uuid,c.name!==void 0&&(u.name=c.name),c.userData!==void 0&&(u.userData=c.userData),i[c.uuid]=u}}return i}parseMaterials(e,t){const i={},a={};if(e!==void 0){const s=new H0;s.setTextures(t);for(let l=0,u=e.length;l<u;l++){const c=e[l];i[c.uuid]===void 0&&(i[c.uuid]=s.parse(c)),a[c.uuid]=i[c.uuid]}}return a}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const a=e[i],s=kh.parse(a);t[s.uuid]=s}return t}parseImages(e,t){const i=this,a={};let s;function l(c){return i.manager.itemStart(c),s.load(c,function(){i.manager.itemEnd(c)},void 0,function(){i.manager.itemError(c),i.manager.itemEnd(c)})}function u(c){if(typeof c=="string"){const h=c,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:i.resourcePath+h;return l(p)}else return c.data?{data:nc(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new Ib(t);s=new Gh(c),s.setCrossOrigin(this.crossOrigin);for(let h=0,p=e.length;h<p;h++){const g=e[h],m=g.url;if(Array.isArray(m)){const v=[];for(let _=0,T=m.length;_<T;_++){const b=m[_],y=u(b);y!==null&&(y instanceof HTMLImageElement?v.push(y):v.push(new Es(y.data,y.width,y.height)))}a[g.uuid]=new pl(v)}else{const v=u(g.url);a[g.uuid]=new pl(v)}}}return a}async parseImagesAsync(e){const t=this,i={};let a;async function s(l){if(typeof l=="string"){const u=l,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u)?u:t.resourcePath+u;return await a.loadAsync(c)}else return l.data?{data:nc(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){a=new Gh(this.manager),a.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l<u;l++){const c=e[l],h=c.url;if(Array.isArray(h)){const p=[];for(let g=0,m=h.length;g<m;g++){const v=h[g],_=await s(v);_!==null&&(_ instanceof HTMLImageElement?p.push(_):p.push(new Es(_.data,_.width,_.height)))}i[c.uuid]=new pl(p)}else{const p=await s(c.url);i[c.uuid]=new pl(p)}}}return i}parseTextures(e,t){function i(s,l){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),l[s])}const a={};if(e!==void 0)for(let s=0,l=e.length;s<l;s++){const u=e[s];u.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',u.uuid),t[u.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",u.image);const c=t[u.image],h=c.data;let p;Array.isArray(h)?(p=new rd,h.length===6&&(p.needsUpdate=!0)):(h&&h.data?p=new Es:p=new Mn,h&&(p.needsUpdate=!0)),p.source=c,p.uuid=u.uuid,u.name!==void 0&&(p.name=u.name),u.mapping!==void 0&&(p.mapping=i(u.mapping,oV)),u.channel!==void 0&&(p.channel=u.channel),u.offset!==void 0&&p.offset.fromArray(u.offset),u.repeat!==void 0&&p.repeat.fromArray(u.repeat),u.center!==void 0&&p.center.fromArray(u.center),u.rotation!==void 0&&(p.rotation=u.rotation),u.wrap!==void 0&&(p.wrapS=i(u.wrap[0],lw),p.wrapT=i(u.wrap[1],lw)),u.format!==void 0&&(p.format=u.format),u.internalFormat!==void 0&&(p.internalFormat=u.internalFormat),u.type!==void 0&&(p.type=u.type),u.colorSpace!==void 0&&(p.colorSpace=u.colorSpace),u.minFilter!==void 0&&(p.minFilter=i(u.minFilter,uw)),u.magFilter!==void 0&&(p.magFilter=i(u.magFilter,uw)),u.anisotropy!==void 0&&(p.anisotropy=u.anisotropy),u.flipY!==void 0&&(p.flipY=u.flipY),u.generateMipmaps!==void 0&&(p.generateMipmaps=u.generateMipmaps),u.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=u.premultiplyAlpha),u.unpackAlignment!==void 0&&(p.unpackAlignment=u.unpackAlignment),u.compareFunction!==void 0&&(p.compareFunction=u.compareFunction),u.userData!==void 0&&(p.userData=u.userData),a[u.uuid]=p}return a}parseObject(e,t,i,a,s){let l;function u(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function c(m){if(m!==void 0){if(Array.isArray(m)){const v=[];for(let _=0,T=m.length;_<T;_++){const b=m[_];i[b]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",b),v.push(i[b])}return v}return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),i[m]}}function h(m){return a[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),a[m]}let p,g;switch(e.type){case"Scene":l=new xb,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new Be(e.background):l.background=h(e.background)),e.environment!==void 0&&(l.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?l.fog=new b0(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new S0(e.fog.color,e.fog.density)),e.fog.name!==""&&(l.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(l.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(l.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&l.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":l=new ti(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(l.focus=e.focus),e.zoom!==void 0&&(l.zoom=e.zoom),e.filmGauge!==void 0&&(l.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(l.filmOffset=e.filmOffset),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new ld(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(l.zoom=e.zoom),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new _U(e.color,e.intensity);break;case"DirectionalLight":l=new yU(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new vU(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new xU(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new gU(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"";break;case"HemisphereLight":l=new mU(e.color,e.groundColor,e.intensity);break;case"LightProbe":l=new bU().fromJSON(e);break;case"SkinnedMesh":p=u(e.geometry),g=c(e.material),l=new FD(p,g),e.bindMode!==void 0&&(l.bindMode=e.bindMode),e.bindMatrix!==void 0&&l.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(l.skeleton=e.skeleton);break;case"Mesh":p=u(e.geometry),g=c(e.material),l=new Fn(p,g);break;case"InstancedMesh":p=u(e.geometry),g=c(e.material);const m=e.count,v=e.instanceMatrix,_=e.instanceColor;l=new HD(p,g,m),l.instanceMatrix=new Rc(new Float32Array(v.array),16),_!==void 0&&(l.instanceColor=new Rc(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":p=u(e.geometry),g=c(e.material),l=new VD(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,g),l.geometry=p,l.perObjectFrustumCulled=e.perObjectFrustumCulled,l.sortObjects=e.sortObjects,l._drawRanges=e.drawRanges,l._reservedRanges=e.reservedRanges,l._visibility=e.visibility,l._active=e.active,l._bounds=e.bounds.map(T=>{const b=new Li;b.min.fromArray(T.boxMin),b.max.fromArray(T.boxMax);const y=new bi;return y.radius=T.sphereRadius,y.center.fromArray(T.sphereCenter),{boxInitialized:T.boxInitialized,box:b,sphereInitialized:T.sphereInitialized,sphere:y}}),l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._geometryCount=e.geometryCount,l._matricesTexture=h(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":l=new BD;break;case"Line":l=new _o(u(e.geometry),c(e.material));break;case"LineLoop":l=new kD(u(e.geometry),c(e.material));break;case"LineSegments":l=new Rs(u(e.geometry),c(e.material));break;case"PointCloud":case"Points":l=new GD(u(e.geometry),c(e.material));break;case"Sprite":l=new PD(c(e.material));break;case"Group":l=new ac;break;case"Bone":l=new bb;break;default:l=new Bt}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let v=0;v<m.length;v++)l.add(this.parseObject(m[v],t,i,a,s))}if(e.animations!==void 0){const m=e.animations;for(let v=0;v<m.length;v++){const _=m[v];l.animations.push(s[_])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const m=e.levels;for(let v=0;v<m.length;v++){const _=m[v],T=l.getObjectByProperty("uuid",_.object);T!==void 0&&l.addLevel(T,_.distance,_.hysteresis)}}return l}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const a=t[i.skeleton];a===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(a,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,a=e.getObjectByProperty("uuid",i);a!==void 0?t.target=a:t.target=new Bt}})}}const oV={UVMapping:c0,CubeReflectionMapping:yr,CubeRefractionMapping:yo,EquirectangularReflectionMapping:wh,EquirectangularRefractionMapping:Ch,CubeUVReflectionMapping:Bc},lw={RepeatWrapping:Rh,ClampToEdgeWrapping:Ba,MirroredRepeatWrapping:Dh},uw={NearestFilter:di,NearestMipmapNearestFilter:eb,NearestMipmapLinearFilter:tc,LinearFilter:Gn,LinearMipmapNearestFilter:ih,LinearMipmapLinearFilter:xs};class lV extends $i{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,a){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,l=rr.get(e);if(l!==void 0){if(s.manager.itemStart(e),l.then){l.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{a&&a(h)});return}return setTimeout(function(){t&&t(l),s.manager.itemEnd(e)},0),l}const u={};u.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",u.headers=this.requestHeader;const c=fetch(e,u).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return rr.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){a&&a(h),rr.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});rr.add(e,c),s.manager.itemStart(e)}}let $p;class Ob{static getContext(){return $p===void 0&&($p=new(window.AudioContext||window.webkitAudioContext)),$p}static setContext(e){$p=e}}class uV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=new xr(this.manager);l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{const h=c.slice(0);Ob.getContext().decodeAudioData(h,function(g){t(g)}).catch(u)}catch(h){u(h)}},i,a);function u(c){a?a(c):console.error(c),s.manager.itemError(e)}}}const cw=new lt,fw=new lt,el=new lt;class cV{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ti,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ti,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,el.copy(e.projectionMatrix);const a=t.eyeSep/2,s=a*t.near/t.focus,l=t.near*Math.tan(Ml*t.fov*.5)/t.zoom;let u,c;fw.elements[12]=-a,cw.elements[12]=a,u=-l*t.aspect+s,c=l*t.aspect+s,el.elements[0]=2*t.near/(c-u),el.elements[8]=(c+u)/(c-u),this.cameraL.projectionMatrix.copy(el),u=-l*t.aspect-s,c=l*t.aspect-s,el.elements[0]=2*t.near/(c-u),el.elements[8]=(c+u)/(c-u),this.cameraR.projectionMatrix.copy(el)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(fw),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(cw)}}class Pb{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=hw(),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=hw();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function hw(){return performance.now()}const tl=new P,dw=new Qi,fV=new P,nl=new P;class hV extends Bt{constructor(){super(),this.type="AudioListener",this.context=Ob.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Pb}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(tl,dw,fV),nl.set(0,0,-1).applyQuaternion(dw),t.positionX){const a=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(tl.x,a),t.positionY.linearRampToValueAtTime(tl.y,a),t.positionZ.linearRampToValueAtTime(tl.z,a),t.forwardX.linearRampToValueAtTime(nl.x,a),t.forwardY.linearRampToValueAtTime(nl.y,a),t.forwardZ.linearRampToValueAtTime(nl.z,a),t.upX.linearRampToValueAtTime(i.x,a),t.upY.linearRampToValueAtTime(i.y,a),t.upZ.linearRampToValueAtTime(i.z,a)}else t.setPosition(tl.x,tl.y,tl.z),t.setOrientation(nl.x,nl.y,nl.z,i.x,i.y,i.z)}}class TU extends Bt{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(e=0){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.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){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 il=new P,pw=new Qi,dV=new P,al=new P;class pV extends TU{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(il,pw,dV),al.set(0,0,1).applyQuaternion(pw);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(il.x,i),t.positionY.linearRampToValueAtTime(il.y,i),t.positionZ.linearRampToValueAtTime(il.z,i),t.orientationX.linearRampToValueAtTime(al.x,i),t.orientationY.linearRampToValueAtTime(al.y,i),t.orientationZ.linearRampToValueAtTime(al.z,i)}else t.setPosition(il.x,il.y,il.z),t.setOrientation(al.x,al.y,al.z)}}class mV{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 AU{constructor(e,t,i){this.binding=e,this.valueSize=i;let a,s,l;switch(t){case"quaternion":a=this._slerp,s=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":a=this._select,s=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:a=this._lerp,s=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=a,this._mixBufferRegionAdditive=s,this._setIdentity=l,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,a=this.valueSize,s=e*a+a;let l=this.cumulativeWeight;if(l===0){for(let u=0;u!==a;++u)i[s+u]=i[u];l=t}else{l+=t;const u=t/l;this._mixBufferRegion(i,s,0,u,a)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,a=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,a,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,a=e*t+t,s=this.cumulativeWeight,l=this.cumulativeWeightAdditive,u=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(i,a,c,1-s,t)}l>0&&this._mixBufferRegionAdditive(i,a,this._addIndex*t,1,t);for(let c=t,h=t+t;c!==h;++c)if(i[c]!==i[c+t]){u.setValue(i,a);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,a=i*this._origIndex;e.getValue(t,a);for(let s=i,l=a;s!==l;++s)t[s]=t[a+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,a,s){if(a>=.5)for(let l=0;l!==s;++l)e[t+l]=e[i+l]}_slerp(e,t,i,a){Qi.slerpFlat(e,t,e,t,e,i,a)}_slerpAdditive(e,t,i,a,s){const l=this._workIndex*s;Qi.multiplyQuaternionsFlat(e,l,e,t,e,i),Qi.slerpFlat(e,t,e,t,e,l,a)}_lerp(e,t,i,a,s){const l=1-a;for(let u=0;u!==s;++u){const c=t+u;e[c]=e[c]*l+e[i+u]*a}}_lerpAdditive(e,t,i,a,s){for(let l=0;l!==s;++l){const u=t+l;e[u]=e[u]+e[i+l]*a}}}const Bb="\\[\\]\\.:\\/",gV=new RegExp("["+Bb+"]","g"),Fb="[^"+Bb+"]",vV="[^"+Bb.replace("\\.","")+"]",yV=/((?:WC+[\/:])*)/.source.replace("WC",Fb),_V=/(WCOD+)?/.source.replace("WCOD",vV),xV=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Fb),SV=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Fb),bV=new RegExp("^"+yV+_V+xV+SV+"$"),MV=["material","materials","bones","map"];class EV{constructor(e,t,i){const a=i||Ot.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,a)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,a=this._bindings[i];a!==void 0&&a.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let a=this._targetGroup.nCachedObjects_,s=i.length;a!==s;++a)i[a].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 Ot{constructor(e,t,i){this.path=t,this.parsedPath=i||Ot.parseTrackName(t),this.node=Ot.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 Ot.Composite(e,t,i):new Ot(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(gV,"")}static parseTrackName(e){const t=bV.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]},a=i.nodeName&&i.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){const s=i.nodeName.substring(a+1);MV.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,a),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 l=0;l<s.length;l++){const u=s[l];if(u.name===t||u.uuid===t)return u;const c=i(u.children);if(c)return c}return null},a=i(e.children);if(a)return a}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 a=0,s=i.length;a!==s;++a)e[t++]=i[a]}_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 a=0,s=i.length;a!==s;++a)i[a]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let a=0,s=i.length;a!==s;++a)i[a]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let a=0,s=i.length;a!==s;++a)i[a]=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,a=t.propertyName;let s=t.propertyIndex;if(e||(e=Ot.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 h=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 p=0;p<e.length;p++)if(e[p].name===h){h=p;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(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const l=e[a];if(l===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+a+" but it wasn't found.",e);return}let u=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?u=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(u=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(a==="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])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=s}else l.fromArray!==void 0&&l.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=a;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ot.Composite=EV;Ot.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ot.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ot.prototype.GetterByBindingType=[Ot.prototype._getValue_direct,Ot.prototype._getValue_array,Ot.prototype._getValue_arrayElement,Ot.prototype._getValue_toArray];Ot.prototype.SetterByBindingTypeAndVersioning=[[Ot.prototype._setValue_direct,Ot.prototype._setValue_direct_setNeedsUpdate,Ot.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ot.prototype._setValue_array,Ot.prototype._setValue_array_setNeedsUpdate,Ot.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ot.prototype._setValue_arrayElement,Ot.prototype._setValue_arrayElement_setNeedsUpdate,Ot.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ot.prototype._setValue_fromArray,Ot.prototype._setValue_fromArray_setNeedsUpdate,Ot.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class TV{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_a(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,a=arguments.length;i!==a;++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,a=this._parsedPaths,s=this._bindings,l=s.length;let u,c=e.length,h=this.nCachedObjects_;for(let p=0,g=arguments.length;p!==g;++p){const m=arguments[p],v=m.uuid;let _=t[v];if(_===void 0){_=c++,t[v]=_,e.push(m);for(let T=0,b=l;T!==b;++T)s[T].push(new Ot(m,i[T],a[T]))}else if(_<h){u=e[_];const T=--h,b=e[T];t[b.uuid]=_,e[_]=b,t[v]=T,e[T]=m;for(let y=0,S=l;y!==S;++y){const E=s[y],A=E[T];let I=E[_];E[_]=A,I===void 0&&(I=new Ot(m,i[y],a[y])),E[T]=I}}else e[_]!==u&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,a=i.length;let s=this.nCachedObjects_;for(let l=0,u=arguments.length;l!==u;++l){const c=arguments[l],h=c.uuid,p=t[h];if(p!==void 0&&p>=s){const g=s++,m=e[g];t[m.uuid]=p,e[p]=m,t[h]=g,e[g]=c;for(let v=0,_=a;v!==_;++v){const T=i[v],b=T[g],y=T[p];T[p]=b,T[g]=y}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,a=i.length;let s=this.nCachedObjects_,l=e.length;for(let u=0,c=arguments.length;u!==c;++u){const h=arguments[u],p=h.uuid,g=t[p];if(g!==void 0)if(delete t[p],g<s){const m=--s,v=e[m],_=--l,T=e[_];t[v.uuid]=g,e[g]=v,t[T.uuid]=m,e[m]=T,e.pop();for(let b=0,y=a;b!==y;++b){const S=i[b],E=S[m],A=S[_];S[g]=E,S[m]=A,S.pop()}}else{const m=--l,v=e[m];m>0&&(t[v.uuid]=g),e[g]=v,e.pop();for(let _=0,T=a;_!==T;++_){const b=i[_];b[g]=b[m],b.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let a=i[e];const s=this._bindings;if(a!==void 0)return s[a];const l=this._paths,u=this._parsedPaths,c=this._objects,h=c.length,p=this.nCachedObjects_,g=new Array(h);a=s.length,i[e]=a,l.push(e),u.push(t),s.push(g);for(let m=p,v=c.length;m!==v;++m){const _=c[m];g[m]=new Ot(_,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const a=this._paths,s=this._parsedPaths,l=this._bindings,u=l.length-1,c=l[u],h=e[u];t[h]=i,l[i]=c,l.pop(),s[i]=s[u],s.pop(),a[i]=a[u],a.pop()}}}class wU{constructor(e,t,i=null,a=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=a;const s=t.tracks,l=s.length,u=new Array(l),c={endingStart:hl,endingEnd:hl};for(let h=0;h!==l;++h){const p=s[h].createInterpolant(null);u[h]=p,p.settings=c}this._interpolantSettings=c,this._interpolants=u,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=oD,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 a=this._clip.duration,s=e._clip.duration,l=s/a,u=a/s;e.warp(1,l,t),this.warp(u,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 a=this._mixer,s=a.time,l=this.timeScale;let u=this._timeScaleInterpolant;u===null&&(u=a._lendControlInterpolant(),this._timeScaleInterpolant=u);const c=u.parameterPositions,h=u.sampleValues;return c[0]=s,c[1]=s+i,h[0]=e/l,h[1]=t/l,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,a){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*i;c<0||i===0?t=0:(this._startTime=null,t=i*c)}t*=this._updateTimeScale(e);const l=this._updateTime(t),u=this._updateWeight(e);if(u>0){const c=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case cb:for(let p=0,g=c.length;p!==g;++p)c[p].evaluate(l),h[p].accumulateAdditive(u);break;case v0:default:for(let p=0,g=c.length;p!==g;++p)c[p].evaluate(l),h[p].accumulate(a,u)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const a=i.evaluate(e)[0];t*=a,e>i.parameterPositions[1]&&(this.stopFading(),a===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 a=i.evaluate(e)[0];t*=a,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 a=this.time+e,s=this._loopCount;const l=i===lD;if(e===0)return s===-1?a:l&&(s&1)===1?t-a:a;if(i===rD){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(a>=t)a=t;else if(a<0)a=0;else{this.time=a;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=a,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,l)):this._setEndings(this.repetitions===0,!0,l)),a>=t||a<0){const u=Math.floor(a/t);a-=t*u,s+=Math.abs(u);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=e>0?t:0,this.time=a,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const h=e<0;this._setEndings(h,!h,l)}else this._setEndings(!1,!1,l);this._loopCount=s,this.time=a,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:u})}}else this.time=a;if(l&&(s&1)===1)return t-a}return a}_setEndings(e,t,i){const a=this._interpolantSettings;i?(a.endingStart=dl,a.endingEnd=dl):(e?a.endingStart=this.zeroSlopeAtStart?dl:hl:a.endingStart=Lh,t?a.endingEnd=this.zeroSlopeAtEnd?dl:hl:a.endingEnd=Lh)}_scheduleFading(e,t,i){const a=this._mixer,s=a.time;let l=this._weightInterpolant;l===null&&(l=a._lendControlInterpolant(),this._weightInterpolant=l);const u=l.parameterPositions,c=l.sampleValues;return u[0]=s,c[0]=t,u[1]=s+e,c[1]=i,this}}const AV=new Float32Array(1);class wV extends Cs{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,a=e._clip.tracks,s=a.length,l=e._propertyBindings,u=e._interpolants,c=i.uuid,h=this._bindingsByRootAndName;let p=h[c];p===void 0&&(p={},h[c]=p);for(let g=0;g!==s;++g){const m=a[g],v=m.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[g]=_;else{if(_=l[g],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,c,v));continue}const T=t&&t._propertyBindings[g].binding.parsedPath;_=new AU(Ot.create(i,v,T),m.ValueTypeName,m.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,c,v),l[g]=_}u[g].resultBuffer=_.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,a=e._clip.uuid,s=this._actionsByClip[a];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,a,i)}const t=e._propertyBindings;for(let i=0,a=t.length;i!==a;++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,a=t.length;i!==a;++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 a=this._actions,s=this._actionsByClip;let l=s[t];if(l===void 0)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=l;else{const u=l.knownActions;e._byClipCacheIndex=u.length,u.push(e)}e._cacheIndex=a.length,a.push(e),l.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],a=e._cacheIndex;i._cacheIndex=a,t[a]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,l=this._actionsByClip,u=l[s],c=u.knownActions,h=c[c.length-1],p=e._byClipCacheIndex;h._byClipCacheIndex=p,c[p]=h,c.pop(),e._byClipCacheIndex=null;const g=u.actionByRoot,m=(e._localRoot||this._root).uuid;delete g[m],c.length===0&&delete l[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,a=t.length;i!==a;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,a=this._nActiveActions++,s=t[a];e._cacheIndex=a,t[a]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,a=--this._nActiveActions,s=t[a];e._cacheIndex=a,t[a]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const a=this._bindingsByRootAndName,s=this._bindings;let l=a[t];l===void 0&&(l={},a[t]=l),l[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,a=i.rootNode.uuid,s=i.path,l=this._bindingsByRootAndName,u=l[a],c=t[t.length-1],h=e._cacheIndex;c._cacheIndex=h,t[h]=c,t.pop(),delete u[s],Object.keys(u).length===0&&delete l[a]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,a=this._nActiveBindings++,s=t[a];e._cacheIndex=a,t[a]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,a=--this._nActiveBindings,s=t[a];e._cacheIndex=a,t[a]=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 Lb(new Float32Array(2),new Float32Array(2),1,AV),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,a=--this._nActiveControlInterpolants,s=t[a];e.__cacheIndex=a,t[a]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const a=t||this._root,s=a.uuid;let l=typeof e=="string"?kh.findByName(a,e):e;const u=l!==null?l.uuid:e,c=this._actionsByClip[u];let h=null;if(i===void 0&&(l!==null?i=l.blendMode:i=v0),c!==void 0){const g=c.actionByRoot[s];if(g!==void 0&&g.blendMode===i)return g;h=c.knownActions[0],l===null&&(l=h._clip)}if(l===null)return null;const p=new wU(this,l,t,i);return this._bindAction(p,h),this._addInactiveAction(p,u,s),p}existingAction(e,t){const i=t||this._root,a=i.uuid,s=typeof e=="string"?kh.findByName(i,e):e,l=s?s.uuid:e,u=this._actionsByClip[l];return u!==void 0&&u.actionByRoot[a]||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,a=this.time+=e,s=Math.sign(e),l=this._accuIndex^=1;for(let h=0;h!==i;++h)t[h]._update(a,e,s,l);const u=this._bindings,c=this._nActiveBindings;for(let h=0;h!==c;++h)u[h].apply(l);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,a=this._actionsByClip,s=a[i];if(s!==void 0){const l=s.knownActions;for(let u=0,c=l.length;u!==c;++u){const h=l[u];this._deactivateAction(h);const p=h._cacheIndex,g=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,g._cacheIndex=p,t[p]=g,t.pop(),this._removeInactiveBindingsForAction(h)}delete a[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const l in i){const u=i[l].actionByRoot,c=u[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const a=this._bindingsByRootAndName,s=a[t];if(s!==void 0)for(const l in s){const u=s[l];u.restoreOriginalState(),this._removeInactiveBinding(u)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Hb{constructor(e){this.value=e}clone(){return new Hb(this.value.clone===void 0?this.value:this.value.clone())}}let CV=0;class RV extends Cs{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:CV++}),this.name="",this.usage=Nh,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,a=t.length;i<a;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let l=0;l<s.length;l++)this.uniforms.push(s[l].clone())}return this}clone(){return new this.constructor().copy(this)}}class DV extends M0{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 UV{constructor(e,t,i,a,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=a,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 mw=new lt;class CU{constructor(e,t,i=0,a=1/0){this.ray=new Hc(e,t),this.near=i,this.far=a,this.camera=null,this.layers=new wc,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 mw.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(mw),this}intersectObject(e,t=!0,i=[]){return jx(e,this,i,t),i.sort(gw),i}intersectObjects(e,t=!0,i=[]){for(let a=0,s=e.length;a<s;a++)jx(e[a],this,i,t);return i.sort(gw),i}}function gw(n,e){return n.distance-e.distance}function jx(n,e,t,i){let a=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(a=!1),a===!0&&i===!0){const s=n.children;for(let l=0,u=s.length;l<u;l++)jx(s[l],e,t,!0)}}class LV{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(bn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class NV{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 Vb{constructor(e,t,i,a){Vb.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,a)}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,a){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=a,this}}const vw=new he;class IV{constructor(e=new he(1/0,1/0),t=new he(-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=vw.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,vw).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 yw=new P,em=new P;class zV{constructor(e=new P,t=new P){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){yw.subVectors(e,this.start),em.subVectors(this.end,this.start);const i=em.dot(em);let s=em.dot(yw)/i;return t&&(s=bn(s,0,1)),s}closestPointToPoint(e,t,i){const a=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(a).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 _w=new P;class OV extends Bt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new bt,a=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let l=0,u=1,c=32;l<c;l++,u++){const h=l/c*Math.PI*2,p=u/c*Math.PI*2;a.push(Math.cos(h),Math.sin(h),1,Math.cos(p),Math.sin(p),1)}i.setAttribute("position",new Ye(a,3));const s=new Ni({fog:!1,toneMapped:!1});this.cone=new Rs(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),_w.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_w),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Gr=new P,tm=new lt,D_=new lt;class PV extends Rs{constructor(e){const t=RU(e),i=new bt,a=[],s=[],l=new Be(0,0,1),u=new Be(0,1,0);for(let h=0;h<t.length;h++){const p=t[h];p.parent&&p.parent.isBone&&(a.push(0,0,0),a.push(0,0,0),s.push(l.r,l.g,l.b),s.push(u.r,u.g,u.b))}i.setAttribute("position",new Ye(a,3)),i.setAttribute("color",new Ye(s,3));const c=new Ni({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c),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,a=i.getAttribute("position");D_.copy(this.root.matrixWorld).invert();for(let s=0,l=0;s<t.length;s++){const u=t[s];u.parent&&u.parent.isBone&&(tm.multiplyMatrices(D_,u.matrixWorld),Gr.setFromMatrixPosition(tm),a.setXYZ(l,Gr.x,Gr.y,Gr.z),tm.multiplyMatrices(D_,u.parent.matrixWorld),Gr.setFromMatrixPosition(tm),a.setXYZ(l+1,Gr.x,Gr.y,Gr.z),l+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function RU(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,RU(n.children[t]));return e}class BV extends Fn{constructor(e,t,i){const a=new fd(t,4,2),s=new Eo({wireframe:!0,fog:!1,toneMapped:!1});super(a,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 FV=new P,xw=new Be,Sw=new Be;class HV extends Bt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const a=new cd(t);a.rotateY(Math.PI*.5),this.material=new Eo({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=a.getAttribute("position"),l=new Float32Array(s.count*3);a.setAttribute("color",new tn(l,3)),this.add(new Fn(a,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");xw.copy(this.light.color),Sw.copy(this.light.groundColor);for(let i=0,a=t.count;i<a;i++){const s=i<a/2?xw:Sw;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(FV.setFromMatrixPosition(this.light.matrixWorld).negate())}}class VV extends Rs{constructor(e=10,t=10,i=4473924,a=8947848){i=new Be(i),a=new Be(a);const s=t/2,l=e/t,u=e/2,c=[],h=[];for(let m=0,v=0,_=-u;m<=t;m++,_+=l){c.push(-u,0,_,u,0,_),c.push(_,0,-u,_,0,u);const T=m===s?i:a;T.toArray(h,v),v+=3,T.toArray(h,v),v+=3,T.toArray(h,v),v+=3,T.toArray(h,v),v+=3}const p=new bt;p.setAttribute("position",new Ye(c,3)),p.setAttribute("color",new Ye(h,3));const g=new Ni({vertexColors:!0,toneMapped:!1});super(p,g),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class kV extends Rs{constructor(e=10,t=16,i=8,a=64,s=4473924,l=8947848){s=new Be(s),l=new Be(l);const u=[],c=[];if(t>1)for(let g=0;g<t;g++){const m=g/t*(Math.PI*2),v=Math.sin(m)*e,_=Math.cos(m)*e;u.push(0,0,0),u.push(v,0,_);const T=g&1?s:l;c.push(T.r,T.g,T.b),c.push(T.r,T.g,T.b)}for(let g=0;g<i;g++){const m=g&1?s:l,v=e-e/i*g;for(let _=0;_<a;_++){let T=_/a*(Math.PI*2),b=Math.sin(T)*v,y=Math.cos(T)*v;u.push(b,0,y),c.push(m.r,m.g,m.b),T=(_+1)/a*(Math.PI*2),b=Math.sin(T)*v,y=Math.cos(T)*v,u.push(b,0,y),c.push(m.r,m.g,m.b)}}const h=new bt;h.setAttribute("position",new Ye(u,3)),h.setAttribute("color",new Ye(c,3));const p=new Ni({vertexColors:!0,toneMapped:!1});super(h,p),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const bw=new P,nm=new P,Mw=new P;class GV extends Bt{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 a=new bt;a.setAttribute("position",new Ye([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Ni({fog:!1,toneMapped:!1});this.lightPlane=new _o(a,s),this.add(this.lightPlane),a=new bt,a.setAttribute("position",new Ye([0,0,0,0,0,1],3)),this.targetLine=new _o(a,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),bw.setFromMatrixPosition(this.light.matrixWorld),nm.setFromMatrixPosition(this.light.target.matrixWorld),Mw.subVectors(nm,bw),this.lightPlane.lookAt(nm),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(nm),this.targetLine.scale.z=Mw.length()}}const im=new P,_n=new _0;class XV extends Rs{constructor(e){const t=new bt,i=new Ni({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],s=[],l={};u("n1","n2"),u("n2","n4"),u("n4","n3"),u("n3","n1"),u("f1","f2"),u("f2","f4"),u("f4","f3"),u("f3","f1"),u("n1","f1"),u("n2","f2"),u("n3","f3"),u("n4","f4"),u("p","n1"),u("p","n2"),u("p","n3"),u("p","n4"),u("u1","u2"),u("u2","u3"),u("u3","u1"),u("c","t"),u("p","c"),u("cn1","cn2"),u("cn3","cn4"),u("cf1","cf2"),u("cf3","cf4");function u(_,T){c(_),c(T)}function c(_){a.push(0,0,0),s.push(0,0,0),l[_]===void 0&&(l[_]=[]),l[_].push(a.length/3-1)}t.setAttribute("position",new Ye(a,3)),t.setAttribute("color",new Ye(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=l,this.update();const h=new Be(16755200),p=new Be(16711680),g=new Be(43775),m=new Be(16777215),v=new Be(3355443);this.setColors(h,p,g,m,v)}setColors(e,t,i,a,s){const u=this.geometry.getAttribute("color");u.setXYZ(0,e.r,e.g,e.b),u.setXYZ(1,e.r,e.g,e.b),u.setXYZ(2,e.r,e.g,e.b),u.setXYZ(3,e.r,e.g,e.b),u.setXYZ(4,e.r,e.g,e.b),u.setXYZ(5,e.r,e.g,e.b),u.setXYZ(6,e.r,e.g,e.b),u.setXYZ(7,e.r,e.g,e.b),u.setXYZ(8,e.r,e.g,e.b),u.setXYZ(9,e.r,e.g,e.b),u.setXYZ(10,e.r,e.g,e.b),u.setXYZ(11,e.r,e.g,e.b),u.setXYZ(12,e.r,e.g,e.b),u.setXYZ(13,e.r,e.g,e.b),u.setXYZ(14,e.r,e.g,e.b),u.setXYZ(15,e.r,e.g,e.b),u.setXYZ(16,e.r,e.g,e.b),u.setXYZ(17,e.r,e.g,e.b),u.setXYZ(18,e.r,e.g,e.b),u.setXYZ(19,e.r,e.g,e.b),u.setXYZ(20,e.r,e.g,e.b),u.setXYZ(21,e.r,e.g,e.b),u.setXYZ(22,e.r,e.g,e.b),u.setXYZ(23,e.r,e.g,e.b),u.setXYZ(24,t.r,t.g,t.b),u.setXYZ(25,t.r,t.g,t.b),u.setXYZ(26,t.r,t.g,t.b),u.setXYZ(27,t.r,t.g,t.b),u.setXYZ(28,t.r,t.g,t.b),u.setXYZ(29,t.r,t.g,t.b),u.setXYZ(30,t.r,t.g,t.b),u.setXYZ(31,t.r,t.g,t.b),u.setXYZ(32,i.r,i.g,i.b),u.setXYZ(33,i.r,i.g,i.b),u.setXYZ(34,i.r,i.g,i.b),u.setXYZ(35,i.r,i.g,i.b),u.setXYZ(36,i.r,i.g,i.b),u.setXYZ(37,i.r,i.g,i.b),u.setXYZ(38,a.r,a.g,a.b),u.setXYZ(39,a.r,a.g,a.b),u.setXYZ(40,s.r,s.g,s.b),u.setXYZ(41,s.r,s.g,s.b),u.setXYZ(42,s.r,s.g,s.b),u.setXYZ(43,s.r,s.g,s.b),u.setXYZ(44,s.r,s.g,s.b),u.setXYZ(45,s.r,s.g,s.b),u.setXYZ(46,s.r,s.g,s.b),u.setXYZ(47,s.r,s.g,s.b),u.setXYZ(48,s.r,s.g,s.b),u.setXYZ(49,s.r,s.g,s.b),u.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,a=1;_n.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),An("c",t,e,_n,0,0,-1),An("t",t,e,_n,0,0,1),An("n1",t,e,_n,-i,-a,-1),An("n2",t,e,_n,i,-a,-1),An("n3",t,e,_n,-i,a,-1),An("n4",t,e,_n,i,a,-1),An("f1",t,e,_n,-i,-a,1),An("f2",t,e,_n,i,-a,1),An("f3",t,e,_n,-i,a,1),An("f4",t,e,_n,i,a,1),An("u1",t,e,_n,i*.7,a*1.1,-1),An("u2",t,e,_n,-i*.7,a*1.1,-1),An("u3",t,e,_n,0,a*2,-1),An("cf1",t,e,_n,-i,0,1),An("cf2",t,e,_n,i,0,1),An("cf3",t,e,_n,0,-a,1),An("cf4",t,e,_n,0,a,1),An("cn1",t,e,_n,-i,0,-1),An("cn2",t,e,_n,i,0,-1),An("cn3",t,e,_n,0,-a,-1),An("cn4",t,e,_n,0,a,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function An(n,e,t,i,a,s,l){im.set(a,s,l).unproject(i);const u=e[n];if(u!==void 0){const c=t.getAttribute("position");for(let h=0,p=u.length;h<p;h++)c.setXYZ(u[h],im.x,im.y,im.z)}}const am=new Li;class WV extends Rs{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]),a=new Float32Array(8*3),s=new bt;s.setIndex(new tn(i,1)),s.setAttribute("position",new tn(a,3)),super(s,new Ni({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&&am.setFromObject(this.object),am.isEmpty())return;const t=am.min,i=am.max,a=this.geometry.attributes.position,s=a.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,a.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 qV extends Rs{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]),a=[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 bt;s.setIndex(new tn(i,1)),s.setAttribute("position",new Ye(a,3)),super(s,new Ni({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 YV extends _o{constructor(e,t=1,i=16776960){const a=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],l=new bt;l.setAttribute("position",new Ye(s,3)),l.computeBoundingSphere(),super(l,new Ni({color:a,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const u=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new bt;c.setAttribute("position",new Ye(u,3)),c.computeBoundingSphere(),this.add(new Fn(c,new Eo({color:a,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 Ew=new P;let sm,U_;class ZV extends Bt{constructor(e=new P(0,0,1),t=new P(0,0,0),i=1,a=16776960,s=i*.2,l=s*.2){super(),this.type="ArrowHelper",sm===void 0&&(sm=new bt,sm.setAttribute("position",new Ye([0,0,0,0,1,0],3)),U_=new Gc(0,.5,1,5,1),U_.translate(0,-.5,0)),this.position.copy(t),this.line=new _o(sm,new Ni({color:a,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Fn(U_,new Eo({color:a,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,l)}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{Ew.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ew,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 jV extends Rs{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],a=new bt;a.setAttribute("position",new Ye(t,3)),a.setAttribute("color",new Ye(i,3));const s=new Ni({vertexColors:!0,toneMapped:!1});super(a,s),this.type="AxesHelper"}setColors(e,t,i){const a=new Be,s=this.geometry.attributes.color.array;return a.set(e),a.toArray(s,0),a.toArray(s,3),a.set(t),a.toArray(s,6),a.toArray(s,9),a.set(i),a.toArray(s,12),a.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class QV{constructor(){this.type="ShapePath",this.color=new Be,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Oh,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,a){return this.currentPath.quadraticCurveTo(e,t,i,a),this}bezierCurveTo(e,t,i,a,s,l){return this.currentPath.bezierCurveTo(e,t,i,a,s,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const S=[];for(let E=0,A=y.length;E<A;E++){const I=y[E],R=new El;R.curves=I.curves,S.push(R)}return S}function i(y,S){const E=S.length;let A=!1;for(let I=E-1,R=0;R<E;I=R++){let L=S[I],z=S[R],C=z.x-L.x,w=z.y-L.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(L=S[R],C=-C,z=S[I],w=-w),y.y<L.y||y.y>z.y)continue;if(y.y===L.y){if(y.x===L.x)return!0}else{const B=w*(y.x-L.x)-C*(y.y-L.y);if(B===0)return!0;if(B<0)continue;A=!A}}else{if(y.y!==L.y)continue;if(z.x<=y.x&&y.x<=L.x||L.x<=y.x&&y.x<=z.x)return!0}}return A}const a=Ts.isClockWise,s=this.subPaths;if(s.length===0)return[];let l,u,c;const h=[];if(s.length===1)return u=s[0],c=new El,c.curves=u.curves,h.push(c),h;let p=!a(s[0].getPoints());p=e?!p:p;const g=[],m=[];let v=[],_=0,T;m[_]=void 0,v[_]=[];for(let y=0,S=s.length;y<S;y++)u=s[y],T=u.getPoints(),l=a(T),l=e?!l:l,l?(!p&&m[_]&&_++,m[_]={s:new El,p:T},m[_].s.curves=u.curves,p&&_++,v[_]=[]):v[_].push({h:u,p:T[0]});if(!m[0])return t(s);if(m.length>1){let y=!1,S=0;for(let E=0,A=m.length;E<A;E++)g[E]=[];for(let E=0,A=m.length;E<A;E++){const I=v[E];for(let R=0;R<I.length;R++){const L=I[R];let z=!0;for(let C=0;C<m.length;C++)i(L.p,m[C].p)&&(E!==C&&S++,z?(z=!1,g[C].push(L)):y=!0);z&&g[E].push(L)}}S>0&&y===!1&&(v=g)}let b;for(let y=0,S=m.length;y<S;y++){c=m[y].s,h.push(c),b=v[y];for(let E=0,A=b.length;E<A;E++)c.holes.push(b[E].h)}return h}}class KV extends Cs{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class JV extends is{constructor(e=1,t=1,i=1,a={}){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,{...a,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:l0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=l0);const $V=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:$S,AddEquation:Kr,AddOperation:J3,AdditiveAnimationBlendMode:cb,AdditiveBlending:zx,AgXToneMapping:iD,AlphaFormat:ab,AlwaysCompare:yD,AlwaysDepth:sg,AlwaysStencilFunc:Fx,AmbientLight:_U,AnimationAction:wU,AnimationClip:kh,AnimationLoader:JH,AnimationMixer:wV,AnimationObjectGroup:TV,AnimationUtils:ZH,ArcCurve:XD,ArrayCamera:ID,ArrowHelper:ZV,AttachedBindMode:Bx,Audio:TU,AudioAnalyser:mV,AudioContext:Ob,AudioListener:hV,AudioLoader:uV,AxesHelper:jV,BackSide:Ui,BasicDepthPacking:uD,BasicShadowMap:L3,BatchedMesh:VD,Bone:bb,BooleanKeyframeTrack:kl,Box2:IV,Box3:Li,Box3Helper:qV,BoxGeometry:Vl,BoxHelper:WV,BufferAttribute:tn,BufferGeometry:bt,BufferGeometryLoader:EU,ByteType:tb,Cache:rr,Camera:_0,CameraHelper:XV,CanvasTexture:yH,CapsuleGeometry:w0,CatmullRomCurve3:WD,CineonToneMapping:tD,CircleGeometry:C0,ClampToEdgeWrapping:Ba,Clock:Pb,Color:Be,ColorKeyframeTrack:Nb,ColorManagement:Ut,CompressedArrayTexture:gH,CompressedCubeTexture:vH,CompressedTexture:T0,CompressedTextureLoader:$H,ConeGeometry:R0,ConstantAlphaFactor:j3,ConstantColorFactor:Y3,Controls:KV,CubeCamera:AD,CubeReflectionMapping:yr,CubeRefractionMapping:yo,CubeTexture:rd,CubeTextureLoader:eV,CubeUVReflectionMapping:Bc,CubicBezierCurve:Tb,CubicBezierCurve3:qD,CubicInterpolant:fU,CullFaceBack:Ix,CullFaceFront:U3,CullFaceFrontBack:qO,CullFaceNone:D3,Curve:rs,CurvePath:ZD,CustomBlending:N3,CustomToneMapping:nD,CylinderGeometry:Gc,Cylindrical:NV,Data3DTexture:db,DataArrayTexture:y0,DataTexture:Es,DataTextureLoader:tV,DataUtils:rB,DecrementStencilOp:rP,DecrementWrapStencilOp:lP,DefaultLoadingManager:pU,DepthFormat:bl,DepthStencilFormat:Ll,DepthTexture:vb,DetachedBindMode:sD,DirectionalLight:yU,DirectionalLightHelper:GV,DiscreteInterpolant:hU,DodecahedronGeometry:D0,DoubleSide:gs,DstAlphaFactor:k3,DstColorFactor:X3,DynamicCopyUsage:MP,DynamicDrawUsage:vP,DynamicReadUsage:xP,EdgesGeometry:jD,EllipseCurve:A0,EqualCompare:pD,EqualDepth:og,EqualStencilFunc:hP,EquirectangularReflectionMapping:wh,EquirectangularRefractionMapping:Ch,Euler:ba,EventDispatcher:Cs,ExtrudeGeometry:L0,FileLoader:xr,Float16BufferAttribute:hB,Float32BufferAttribute:Ye,FloatType:Zi,Fog:b0,FogExp2:S0,FramebufferTexture:mH,FrontSide:vr,Frustum:od,GLBufferAttribute:UV,GLSL1:TP,GLSL3:Hx,GreaterCompare:mD,GreaterDepth:ug,GreaterEqualCompare:vD,GreaterEqualDepth:lg,GreaterEqualStencilFunc:gP,GreaterStencilFunc:pP,GridHelper:VV,Group:ac,HalfFloatType:Fc,HemisphereLight:mU,HemisphereLightHelper:HV,IcosahedronGeometry:N0,ImageBitmapLoader:lV,ImageLoader:Gh,ImageUtils:SD,IncrementStencilOp:sP,IncrementWrapStencilOp:oP,InstancedBufferAttribute:Rc,InstancedBufferGeometry:MU,InstancedInterleavedBuffer:DV,InstancedMesh:HD,Int16BufferAttribute:cB,Int32BufferAttribute:fB,Int8BufferAttribute:oB,IntType:f0,InterleavedBuffer:M0,InterleavedBufferAttribute:Nl,Interpolant:hd,InterpolateDiscrete:Uh,InterpolateLinear:Pg,InterpolateSmooth:Mm,InvertStencilOp:uP,KeepStencilOp:ul,KeyframeTrack:os,LOD:BD,LatheGeometry:ud,Layers:wc,LessCompare:dD,LessDepth:rg,LessEqualCompare:fb,LessEqualDepth:Dl,LessEqualStencilFunc:dP,LessStencilFunc:fP,Light:Ao,LightProbe:bU,Line:_o,Line3:zV,LineBasicMaterial:Ni,LineCurve:Ab,LineCurve3:YD,LineDashedMaterial:lU,LineLoop:kD,LineSegments:Rs,LinearFilter:Gn,LinearInterpolant:Lb,LinearMipMapLinearFilter:QO,LinearMipMapNearestFilter:jO,LinearMipmapLinearFilter:xs,LinearMipmapNearestFilter:ih,LinearSRGBColorSpace:Mo,LinearToneMapping:$3,LinearTransfer:sd,Loader:$i,LoaderUtils:Zx,LoadingManager:Ib,LoopOnce:rD,LoopPingPong:lD,LoopRepeat:oD,LuminanceAlphaFormat:ob,LuminanceFormat:rb,MOUSE:XO,Material:Mi,MaterialLoader:H0,MathUtils:kP,Matrix2:Vb,Matrix3:vt,Matrix4:lt,MaxEquation:P3,Mesh:Fn,MeshBasicMaterial:Eo,MeshDepthMaterial:yb,MeshDistanceMaterial:_b,MeshLambertMaterial:rU,MeshMatcapMaterial:oU,MeshNormalMaterial:sU,MeshPhongMaterial:iU,MeshPhysicalMaterial:nU,MeshStandardMaterial:Db,MeshToonMaterial:aU,MinEquation:O3,MirroredRepeatWrapping:Dh,MixOperation:K3,MultiplyBlending:Px,MultiplyOperation:id,NearestFilter:di,NearestMipMapLinearFilter:ZO,NearestMipMapNearestFilter:YO,NearestMipmapLinearFilter:tc,NearestMipmapNearestFilter:eb,NeutralToneMapping:aD,NeverCompare:hD,NeverDepth:ag,NeverStencilFunc:cP,NoBlending:cr,NoColorSpace:tr,NoToneMapping:Ms,NormalAnimationBlendMode:v0,NormalBlending:Sl,NotEqualCompare:gD,NotEqualDepth:cg,NotEqualStencilFunc:mP,NumberKeyframeTrack:Hh,Object3D:Bt,ObjectLoader:rV,ObjectSpaceNormalMap:fD,OctahedronGeometry:cd,OneFactor:F3,OneMinusConstantAlphaFactor:Q3,OneMinusConstantColorFactor:Z3,OneMinusDstAlphaFactor:G3,OneMinusDstColorFactor:W3,OneMinusSrcAlphaFactor:ig,OneMinusSrcColorFactor:V3,OrthographicCamera:ld,PCFShadowMap:u0,PCFSoftShadowMap:nh,PMREMGenerator:Vx,Path:Oh,PerspectiveCamera:ti,Plane:qr,PlaneGeometry:Vc,PlaneHelper:YV,PointLight:vU,PointLightHelper:BV,Points:GD,PointsMaterial:Mb,PolarGridHelper:kV,PolyhedronGeometry:To,PositionalAudio:pV,PropertyBinding:Ot,PropertyMixer:AU,QuadraticBezierCurve:wb,QuadraticBezierCurve3:Cb,Quaternion:Qi,QuaternionKeyframeTrack:dd,QuaternionLinearInterpolant:dU,RED_GREEN_RGTC2_Format:zg,RED_RGTC1_Format:ub,REVISION:l0,RGBADepthPacking:cD,RGBAFormat:Si,RGBAIntegerFormat:g0,RGBA_ASTC_10x10_Format:Rg,RGBA_ASTC_10x5_Format:Ag,RGBA_ASTC_10x6_Format:wg,RGBA_ASTC_10x8_Format:Cg,RGBA_ASTC_12x10_Format:Dg,RGBA_ASTC_12x12_Format:Ug,RGBA_ASTC_4x4_Format:yg,RGBA_ASTC_5x4_Format:_g,RGBA_ASTC_5x5_Format:xg,RGBA_ASTC_6x5_Format:Sg,RGBA_ASTC_6x6_Format:bg,RGBA_ASTC_8x5_Format:Mg,RGBA_ASTC_8x6_Format:Eg,RGBA_ASTC_8x8_Format:Tg,RGBA_BPTC_Format:lh,RGBA_ETC2_EAC_Format:vg,RGBA_PVRTC_2BPPV1_Format:pg,RGBA_PVRTC_4BPPV1_Format:dg,RGBA_S3TC_DXT1_Format:sh,RGBA_S3TC_DXT3_Format:rh,RGBA_S3TC_DXT5_Format:oh,RGBDepthPacking:tP,RGBFormat:sb,RGBIntegerFormat:KO,RGB_BPTC_SIGNED_Format:Lg,RGB_BPTC_UNSIGNED_Format:Ng,RGB_ETC1_Format:mg,RGB_ETC2_Format:gg,RGB_PVRTC_2BPPV1_Format:hg,RGB_PVRTC_4BPPV1_Format:fg,RGB_S3TC_DXT1_Format:ah,RGDepthPacking:nP,RGFormat:lb,RGIntegerFormat:m0,RawShaderMaterial:tU,Ray:Hc,Raycaster:CU,RectAreaLight:xU,RedFormat:p0,RedIntegerFormat:ad,ReinhardToneMapping:eD,RenderTarget:bD,RepeatWrapping:Rh,ReplaceStencilOp:aP,ReverseSubtractEquation:z3,RingGeometry:I0,SIGNED_RED_GREEN_RGTC2_Format:Og,SIGNED_RED_RGTC1_Format:Ig,SRGBColorSpace:xi,SRGBTransfer:Zt,Scene:xb,ShaderChunk:St,ShaderLib:ts,ShaderMaterial:as,ShadowMaterial:eU,Shape:El,ShapeGeometry:z0,ShapePath:QV,ShapeUtils:Ts,ShortType:nb,Skeleton:E0,SkeletonHelper:PV,SkinnedMesh:FD,Source:pl,Sphere:bi,SphereGeometry:fd,Spherical:LV,SphericalHarmonics3:SU,SplineCurve:Rb,SpotLight:gU,SpotLightHelper:OV,Sprite:PD,SpriteMaterial:Sb,SrcAlphaFactor:ng,SrcAlphaSaturateFactor:q3,SrcColorFactor:H3,StaticCopyUsage:bP,StaticDrawUsage:Nh,StaticReadUsage:_P,StereoCamera:cV,StreamCopyUsage:EP,StreamDrawUsage:yP,StreamReadUsage:SP,StringKeyframeTrack:Gl,SubtractEquation:I3,SubtractiveBlending:Ox,TOUCH:WO,TangentSpaceNormalMap:bo,TetrahedronGeometry:O0,Texture:Mn,TextureLoader:nV,TextureUtils:j6,TorusGeometry:P0,TorusKnotGeometry:B0,Triangle:Yi,TriangleFanDrawMode:eP,TriangleStripDrawMode:$O,TrianglesDrawMode:JO,TubeGeometry:F0,UVMapping:c0,Uint16BufferAttribute:pb,Uint32BufferAttribute:mb,Uint8BufferAttribute:lB,Uint8ClampedBufferAttribute:uB,Uniform:Hb,UniformsGroup:RV,UniformsLib:Re,UniformsUtils:TD,UnsignedByteType:ns,UnsignedInt248Type:Ul,UnsignedInt5999Type:ib,UnsignedIntType:_r,UnsignedShort4444Type:h0,UnsignedShort5551Type:d0,UnsignedShortType:Tc,VSMShadowMap:$a,Vector2:he,Vector3:P,Vector4:Pt,VectorKeyframeTrack:Vh,VideoTexture:pH,WebGL3DRenderTarget:QP,WebGLArrayRenderTarget:jP,WebGLCoordinateSystem:Ss,WebGLCubeRenderTarget:wD,WebGLMultipleRenderTargets:JV,WebGLRenderTarget:is,WebGLRenderer:zD,WebGLUtils:ND,WebGPUCoordinateSystem:Ih,WireframeGeometry:$D,WrapAroundEnding:Lh,ZeroCurvatureEnding:hl,ZeroFactor:B3,ZeroSlopeEnding:dl,ZeroStencilOp:iP,createCanvasElement:xD},Symbol.toStringTag,{value:"Module"}));var DU={exports:{}},UU={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var V0=pt,ek=hI;function tk(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var nk=typeof Object.is=="function"?Object.is:tk,ik=ek.useSyncExternalStore,ak=V0.useRef,sk=V0.useEffect,rk=V0.useMemo,ok=V0.useDebugValue;UU.useSyncExternalStoreWithSelector=function(n,e,t,i,a){var s=ak(null);if(s.current===null){var l={hasValue:!1,value:null};s.current=l}else l=s.current;s=rk(function(){function c(v){if(!h){if(h=!0,p=v,v=i(v),a!==void 0&&l.hasValue){var _=l.value;if(a(_,v))return g=_}return g=v}if(_=g,nk(p,v))return _;var T=i(v);return a!==void 0&&a(_,T)?(p=v,_):(p=v,g=T)}var h=!1,p,g,m=t===void 0?null:t;return[function(){return c(e())},m===null?void 0:function(){return c(m())}]},[e,t,i,a]);var u=ik(n,s[0],s[1]);return sk(function(){l.hasValue=!0,l.value=u},[u]),ok(u),u};DU.exports=UU;var lk=DU.exports;const uk=nS(lk),Tw=n=>{let e;const t=new Set,i=(h,p)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const m=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(v=>v(e,m))}},a=()=>e,u={setState:i,getState:a,getInitialState:()=>c,subscribe:h=>(t.add(h),()=>t.delete(h))},c=e=n(i,a,u);return u},ck=n=>n?Tw(n):Tw,{useSyncExternalStoreWithSelector:fk}=uk,hk=n=>n;function dk(n,e=hk,t){const i=fk(n.subscribe,n.getState,n.getInitialState,e,t);return Fw.useDebugValue(i),i}const Aw=(n,e)=>{const t=ck(n),i=(a,s=e)=>dk(t,a,s);return Object.assign(i,t),i},pk=(n,e)=>n?Aw(n,e):Aw;function kb(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const a=kb(i,e,t);if(a)return a;i=e?null:i.sibling}}function LU(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const Gb=LU(pt.createContext(null));class NU extends pt.Component{render(){return pt.createElement(Gb.Provider,{value:this._reactInternals},this.props.children)}}function IU(){const n=pt.useContext(Gb);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=pt.useId();return pt.useMemo(()=>{for(const t of[n,n==null?void 0:n.alternate]){if(!t)continue;const i=kb(t,!1,a=>{let s=a.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(i)return i}},[n,e])}const mk=Symbol.for("react.context"),gk=n=>n!==null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===mk;function vk(){const n=IU(),[e]=pt.useState(()=>new Map);e.clear();let t=n;for(;t;){const i=t.type;gk(i)&&i!==Gb&&!e.has(i)&&e.set(i,pt.use(LU(i))),t=t.return}return e}function yk(){const n=vk();return pt.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>pt.createElement(e,null,pt.createElement(t.Provider,{...i,value:n.get(t)})),e=>pt.createElement(NU,{...e})),[n])}function zU(n){let e=n.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const OU=n=>n&&n.isOrthographicCamera,_k=n=>n&&n.hasOwnProperty("current"),xk=n=>n!=null&&(typeof n=="string"||typeof n=="number"||n.isColor),pd=((n,e)=>typeof window<"u"&&(((n=window.document)==null?void 0:n.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?pt.useLayoutEffect:pt.useEffect;function PU(n){const e=pt.useRef(n);return pd(()=>void(e.current=n),[n]),e}function Sk(){const n=IU(),e=yk();return pt.useMemo(()=>({children:t})=>{const a=!!kb(n,!0,s=>s.type===pt.StrictMode)?pt.StrictMode:pt.Fragment;return fa.jsx(a,{children:fa.jsx(e,{children:t})})},[n,e])}function bk({set:n}){return pd(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}const Mk=(n=>(n=class extends pt.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},n.getDerivedStateFromError=()=>({error:!0}),n))();function BU(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}function Bu(n){var e;return(e=n.__r3f)==null?void 0:e.root.getState()}const gn={obj:n=>n===Object(n)&&!gn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,nul:n=>n===null,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:a=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(gn.str(n)||gn.num(n)||gn.boo(n))return n===e;const s=gn.obj(n);if(s&&i==="reference")return n===e;const l=gn.arr(n);if(l&&t==="reference")return n===e;if((l||s)&&n===e)return!0;let u;for(u in n)if(!(u in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(u in a?e:n)if(!gn.equ(n[u],e[u],{strict:a,objects:"reference"}))return!1}else for(u in a?e:n)if(n[u]!==e[u])return!1;if(gn.und(u)){if(l&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function Ek(n){n.type!=="Scene"&&(n.dispose==null||n.dispose());for(const e in n){const t=n[e];(t==null?void 0:t.type)!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const FU=["children","key","ref"];function Tk(n){const e={};for(const t in n)FU.includes(t)||(e[t]=n[t]);return e}function Vg(n,e,t,i){const a=n;let s=a==null?void 0:a.__r3f;return s||(s={root:e,type:t,parent:null,children:[],props:Tk(i),object:a,eventCount:0,handlers:{},isHidden:!1},a&&(a.__r3f=s)),s}function Xh(n,e){if(!e.includes("-"))return{root:n,key:e,target:n[e]};if(e in n)return{root:n,key:e,target:n[e]};let t=n;const i=e.split("-");for(const a of i){if(typeof t!="object"||t===null){if(t!==void 0){const s=i.slice(i.indexOf(a)).join("-");return{root:t,key:s,target:void 0}}return{root:n,key:e,target:void 0}}e=a,n=t,t=t[e]}return{root:n,key:e,target:t}}const ww=/-\d+$/;function kg(n,e){if(gn.str(e.props.attach)){if(ww.test(e.props.attach)){const a=e.props.attach.replace(ww,""),{root:s,key:l}=Xh(n.object,a);Array.isArray(s[l])||(s[l]=[])}const{root:t,key:i}=Xh(n.object,e.props.attach);e.previousAttach=t[i],t[i]=e.object}else gn.fun(e.props.attach)&&(e.previousAttach=e.props.attach(n.object,e.object))}function Gg(n,e){if(gn.str(e.props.attach)){const{root:t,key:i}=Xh(n.object,e.props.attach),a=e.previousAttach;a===void 0?delete t[i]:t[i]=a}else e.previousAttach==null||e.previousAttach(n.object,e.object);delete e.previousAttach}const Qx=[...FU,"args","dispose","attach","object","onUpdate","dispose"],Cw=new Map;function Ak(n){let e=Cw.get(n.constructor);try{e||(e=new n.constructor,Cw.set(n.constructor,e))}catch{}return e}function wk(n,e){const t={};for(const i in e)if(!Qx.includes(i)&&!gn.equ(e[i],n.props[i])){t[i]=e[i];for(const a in e)a.startsWith(`${i}-`)&&(t[a]=e[a])}for(const i in n.props){if(Qx.includes(i)||e.hasOwnProperty(i))continue;const{root:a,key:s}=Xh(n.object,i);if(a.constructor&&a.constructor.length===0){const l=Ak(a);gn.und(l)||(t[s]=l[s])}else t[s]=0}return t}const Ck=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],Rk=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Jr(n,e){var t;const i=n.__r3f,a=i&&zU(i).getState(),s=i==null?void 0:i.eventCount;for(const u in e){let c=e[u];if(Qx.includes(u))continue;if(i&&Rk.test(u)){typeof c=="function"?i.handlers[u]=c:delete i.handlers[u],i.eventCount=Object.keys(i.handlers).length;continue}if(c===void 0)continue;let{root:h,key:p,target:g}=Xh(n,u);if(g===void 0&&(typeof h!="object"||h===null))throw Error(`R3F: Cannot set "${u}". Ensure it is an object before setting "${p}".`);if(g instanceof wc&&c instanceof wc)g.mask=c.mask;else if(g instanceof Be&&xk(c))g.set(c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&c!=null&&c.constructor&&g.constructor===c.constructor)g.copy(c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(c))typeof g.fromArray=="function"?g.fromArray(c):g.set(...c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof c=="number")typeof g.setScalar=="function"?g.setScalar(c):g.set(c);else{var l;h[p]=c,a&&!a.linear&&Ck.includes(p)&&(l=h[p])!=null&&l.isTexture&&h[p].format===Si&&h[p].type===ns&&(h[p].colorSpace=xi)}}if(i!=null&&i.parent&&a!=null&&a.internal&&(t=i.object)!=null&&t.isObject3D&&s!==i.eventCount){const u=i.object,c=a.internal.interaction.indexOf(u);c>-1&&a.internal.interaction.splice(c,1),i.eventCount&&u.raycast!==null&&a.internal.interaction.push(u)}return i&&i.props.attach===void 0&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&Xc(i),n}function Xc(n){var e;if(!n.parent)return;n.props.onUpdate==null||n.props.onUpdate(n.object);const t=(e=n.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function Dk(n,e){n.manual||(OU(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix())}const qi=n=>n==null?void 0:n.isObject3D;function rm(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function HU(n,e,t,i){const a=t.get(e);a&&(t.delete(e),t.size===0&&(n.delete(i),a.target.releasePointerCapture(i)))}function Uk(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,a)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(a)}),t.capturedMap.forEach((i,a)=>{HU(t.capturedMap,e,i,a)})}function Lk(n){function e(c){const{internal:h}=n.getState(),p=c.offsetX-h.initialClick[0],g=c.offsetY-h.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(c){return c.filter(h=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=h.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function i(c,h){const p=n.getState(),g=new Set,m=[],v=h?h(p.internal.interaction):p.internal.interaction;for(let y=0;y<v.length;y++){const S=Bu(v[y]);S&&(S.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(c,p);function _(y){const S=Bu(y);if(!S||!S.events.enabled||S.raycaster.camera===null)return[];if(S.raycaster.camera===void 0){var E;S.events.compute==null||S.events.compute(c,S,(E=S.previousRoot)==null?void 0:E.getState()),S.raycaster.camera===void 0&&(S.raycaster.camera=null)}return S.raycaster.camera?S.raycaster.intersectObject(y,!0):[]}let T=v.flatMap(_).sort((y,S)=>{const E=Bu(y.object),A=Bu(S.object);return!E||!A?y.distance-S.distance:A.events.priority-E.events.priority||y.distance-S.distance}).filter(y=>{const S=rm(y);return g.has(S)?!1:(g.add(S),!0)});p.events.filter&&(T=p.events.filter(T,p));for(const y of T){let S=y.object;for(;S;){var b;(b=S.__r3f)!=null&&b.eventCount&&m.push({...y,eventObject:S}),S=S.parent}}if("pointerId"in c&&p.internal.capturedMap.has(c.pointerId))for(let y of p.internal.capturedMap.get(c.pointerId).values())g.has(rm(y.intersection))||m.push(y.intersection);return m}function a(c,h,p,g){if(c.length){const m={stopped:!1};for(const v of c){let _=Bu(v.object);if(_||v.object.traverseAncestors(T=>{const b=Bu(T);if(b)return _=b,!1}),_){const{raycaster:T,pointer:b,camera:y,internal:S}=_,E=new P(b.x,b.y,0).unproject(y),A=C=>{var w,B;return(w=(B=S.capturedMap.get(C))==null?void 0:B.has(v.eventObject))!=null?w:!1},I=C=>{const w={intersection:v,target:h.target};S.capturedMap.has(C)?S.capturedMap.get(C).set(v.eventObject,w):S.capturedMap.set(C,new Map([[v.eventObject,w]])),h.target.setPointerCapture(C)},R=C=>{const w=S.capturedMap.get(C);w&&HU(S.capturedMap,v.eventObject,w,C)};let L={};for(let C in h){let w=h[C];typeof w!="function"&&(L[C]=w)}let z={...v,...L,pointer:b,intersections:c,stopped:m.stopped,delta:p,unprojectedPoint:E,ray:T.ray,camera:y,stopPropagation(){const C="pointerId"in h&&S.capturedMap.get(h.pointerId);if((!C||C.has(v.eventObject))&&(z.stopped=m.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(w=>w.eventObject===v.eventObject))){const w=c.slice(0,c.indexOf(v));s([...w,v])}},target:{hasPointerCapture:A,setPointerCapture:I,releasePointerCapture:R},currentTarget:{hasPointerCapture:A,setPointerCapture:I,releasePointerCapture:R},nativeEvent:h};if(g(z),m.stopped===!0)break}}}return c}function s(c){const{internal:h}=n.getState();for(const p of h.hovered.values())if(!c.length||!c.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const m=p.eventObject.__r3f;if(h.hovered.delete(rm(p)),m!=null&&m.eventCount){const v=m.handlers,_={...p,intersections:c};v.onPointerOut==null||v.onPointerOut(_),v.onPointerLeave==null||v.onPointerLeave(_)}}}function l(c,h){for(let p=0;p<h.length;p++){const g=h[p].__r3f;g==null||g.handlers.onPointerMissed==null||g.handlers.onPointerMissed(c)}}function u(c){switch(c){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:p}=n.getState();"pointerId"in h&&p.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(h.pointerId)&&(p.capturedMap.delete(h.pointerId),s([]))})}}return function(p){const{onPointerMissed:g,internal:m}=n.getState();m.lastEvent.current=p;const v=c==="onPointerMove",_=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",b=i(p,v?t:void 0),y=_?e(p):0;c==="onPointerDown"&&(m.initialClick=[p.offsetX,p.offsetY],m.initialHits=b.map(E=>E.eventObject)),_&&!b.length&&y<=2&&(l(p,m.interaction),g&&g(p)),v&&s(b);function S(E){const A=E.eventObject,I=A.__r3f;if(!(I!=null&&I.eventCount))return;const R=I.handlers;if(v){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const L=rm(E),z=m.hovered.get(L);z?z.stopped&&E.stopPropagation():(m.hovered.set(L,E),R.onPointerOver==null||R.onPointerOver(E),R.onPointerEnter==null||R.onPointerEnter(E))}R.onPointerMove==null||R.onPointerMove(E)}else{const L=R[c];L?(!_||m.initialHits.includes(A))&&(l(p,m.interaction.filter(z=>!m.initialHits.includes(z))),L(E)):_&&m.initialHits.includes(A)&&l(p,m.interaction.filter(z=>!m.initialHits.includes(z)))}}a(b,p,y,S)}}return{handlePointer:u}}const Rw=n=>!!(n!=null&&n.render),VU=pt.createContext(null),Nk=(n,e)=>{const t=pk((u,c)=>{const h=new P,p=new P,g=new P;function m(y=c().camera,S=p,E=c().size){const{width:A,height:I,top:R,left:L}=E,z=A/I;S.isVector3?g.copy(S):g.set(...S);const C=y.getWorldPosition(h).distanceTo(g);if(OU(y))return{width:A/y.zoom,height:I/y.zoom,top:R,left:L,factor:1,distance:C,aspect:z};{const w=y.fov*Math.PI/180,B=2*Math.tan(w/2)*C,Q=B*(A/I);return{width:Q,height:B,top:R,left:L,factor:A/Q,distance:C,aspect:z}}}let v;const _=y=>u(S=>({performance:{...S.performance,current:y}})),T=new he;return{set:u,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(y=1)=>n(c(),y),advance:(y,S)=>e(y,S,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Pb,pointer:T,mouse:T,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=c();v&&clearTimeout(v),y.performance.current!==y.performance.min&&_(y.performance.min),v=setTimeout(()=>_(c().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:y=>u(S=>({...S,events:{...S.events,...y}})),setSize:(y,S,E=0,A=0)=>{const I=c().camera,R={width:y,height:S,top:E,left:A};u(L=>({size:R,viewport:{...L.viewport,...m(I,p,R)}}))},setDpr:y=>u(S=>{const E=BU(y);return{viewport:{...S.viewport,dpr:E,initialDpr:S.viewport.initialDpr||E}}}),setFrameloop:(y="always")=>{const S=c().clock;S.stop(),S.elapsedTime=0,y!=="never"&&(S.start(),S.elapsedTime=0),u(()=>({frameloop:y}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:pt.createRef(),active:!1,frames:0,priority:0,subscribe:(y,S,E)=>{const A=c().internal;return A.priority=A.priority+(S>0?1:0),A.subscribers.push({ref:y,priority:S,store:E}),A.subscribers=A.subscribers.sort((I,R)=>I.priority-R.priority),()=>{const I=c().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(S>0?1:0),I.subscribers=I.subscribers.filter(R=>R.ref!==y))}}}}}),i=t.getState();let a=i.size,s=i.viewport.dpr,l=i.camera;return t.subscribe(()=>{const{camera:u,size:c,viewport:h,gl:p,set:g}=t.getState();if(c.width!==a.width||c.height!==a.height||h.dpr!==s){a=c,s=h.dpr,Dk(u,c),h.dpr>0&&p.setPixelRatio(h.dpr);const m=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(c.width,c.height,m)}u!==l&&(l=u,g(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(u)}})))}),t.subscribe(u=>n(u)),t};function kU(){const n=pt.useContext(VU);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function _8(n=t=>t,e){return kU()(n,e)}function x8(n,e=0){const t=kU(),i=t.getState().internal.subscribe,a=PU(n);return pd(()=>i(a,e,t),[e,i,t]),null}/**
 * @license React
 * react-reconciler-constants.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */const Ik=1,zk=8,Ok=32,Pk=2;var Bk={version:"9.5.0"};function Fk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Dw={exports:{}},Uw={exports:{}},Lw;function Hk(){return Lw||(Lw=1,function(n){n.exports=function(e){function t(r,o,f,d){return new gL(r,o,f,d)}function i(){}function a(r){var o="https://react.dev/errors/"+r;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)o+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){var o=r,f=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,o.flags&4098&&(f=o.return),r=o.return;while(r)}return o.tag===3?f:null}function l(r){if(s(r)!==r)throw Error(a(188))}function u(r){var o=r.alternate;if(!o){if(o=s(r),o===null)throw Error(a(188));return o!==r?null:r}for(var f=r,d=o;;){var x=f.return;if(x===null)break;var M=x.alternate;if(M===null){if(d=x.return,d!==null){f=d;continue}break}if(x.child===M.child){for(M=x.child;M;){if(M===f)return l(x),r;if(M===d)return l(x),o;M=M.sibling}throw Error(a(188))}if(f.return!==d.return)f=x,d=M;else{for(var U=!1,H=x.child;H;){if(H===f){U=!0,f=x,d=M;break}if(H===d){U=!0,d=x,f=M;break}H=H.sibling}if(!U){for(H=M.child;H;){if(H===f){U=!0,f=M,d=x;break}if(H===d){U=!0,d=M,f=x;break}H=H.sibling}if(!U)throw Error(a(189))}}if(f.alternate!==d)throw Error(a(190))}if(f.tag!==3)throw Error(a(188));return f.stateNode.current===f?r:o}function c(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(o=c(r),o!==null)return o;r=r.sibling}return null}function h(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(r.tag!==4&&(o=h(r),o!==null))return o;r=r.sibling}return null}function p(r){return r===null||typeof r!="object"?null:(r=F1&&r[F1]||r["@@iterator"],typeof r=="function"?r:null)}function g(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===SL?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case Jl:return"Fragment";case Cv:return"Profiler";case P1:return"StrictMode";case Dv:return"Suspense";case Uv:return"SuspenseList";case Nv:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case Kl:return"Portal";case Ar:return r.displayName||"Context";case B1:return(r._context.displayName||"Context")+".Consumer";case Rv:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Lv:return o=r.displayName||null,o!==null?o:g(r.type)||"Memo";case wr:o=r._payload,r=r._init;try{return g(r(o))}catch{}}return null}function m(r){return{current:r}}function v(r){0>tu||(r.current=Fv[tu],Fv[tu]=null,tu--)}function _(r,o){tu++,Fv[tu]=r.current,r.current=o}function T(r){return r>>>=0,r===0?32:31-(jN(r)/QN|0)|0}function b(r){var o=r&42;if(o!==0)return o;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function y(r,o,f){var d=r.pendingLanes;if(d===0)return 0;var x=0,M=r.suspendedLanes,U=r.pingedLanes;r=r.warmLanes;var H=d&134217727;return H!==0?(d=H&~M,d!==0?x=b(d):(U&=H,U!==0?x=b(U):f||(f=H&~r,f!==0&&(x=b(f))))):(H=d&~M,H!==0?x=b(H):U!==0?x=b(U):f||(f=d&~r,f!==0&&(x=b(f)))),x===0?0:o!==0&&o!==x&&!(o&M)&&(M=x&-x,f=o&-o,M>=f||M===32&&(f&4194048)!==0)?o:x}function S(r,o){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&o)===0}function E(r,o){switch(r){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function A(){var r=zd;return zd<<=1,!(zd&62914560)&&(zd=4194304),r}function I(r){for(var o=[],f=0;31>f;f++)o.push(r);return o}function R(r,o){r.pendingLanes|=o,o!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function L(r,o,f,d,x,M){var U=r.pendingLanes;r.pendingLanes=f,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=f,r.entangledLanes&=f,r.errorRecoveryDisabledLanes&=f,r.shellSuspendCounter=0;var H=r.entanglements,ie=r.expirationTimes,pe=r.hiddenUpdates;for(f=U&~f;0<f;){var Ae=31-na(f),Se=1<<Ae;H[Ae]=0,ie[Ae]=-1;var Ve=pe[Ae];if(Ve!==null)for(pe[Ae]=null,Ae=0;Ae<Ve.length;Ae++){var gt=Ve[Ae];gt!==null&&(gt.lane&=-536870913)}f&=~Se}d!==0&&z(r,d,0),M!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=M&~(U&~o))}function z(r,o,f){r.pendingLanes|=o,r.suspendedLanes&=~o;var d=31-na(o);r.entangledLanes|=o,r.entanglements[d]=r.entanglements[d]|1073741824|f&261930}function C(r,o){var f=r.entangledLanes|=o;for(r=r.entanglements;f;){var d=31-na(f),x=1<<d;x&o|r[d]&o&&(r[d]|=o),f&=~x}}function w(r,o){var f=o&-o;return f=f&42?1:B(f),f&(r.suspendedLanes|o)?0:f}function B(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Q(r){return r&=-r,2<r?8<r?r&134217727?32:268435456:8:2}function k(r){if(typeof tI=="function"&&nI(r),ia&&typeof ia.setStrictMode=="function")try{ia.setStrictMode(af,r)}catch{}}function j(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}function ae(r){if(kv===void 0)try{throw Error()}catch(f){var o=f.stack.trim().match(/\n( *(at )?)/);kv=o&&o[1]||"",fE=-1<f.stack.indexOf(`
    at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+kv+r+fE}function V(r,o){if(!r||Gv)return"";Gv=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(gt){var Ve=gt}Reflect.construct(r,[],Se)}else{try{Se.call()}catch(gt){Ve=gt}r.call(Se.prototype)}}else{try{throw Error()}catch(gt){Ve=gt}(Se=r())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(gt){if(gt&&Ve&&typeof gt.stack=="string")return[gt.stack,Ve.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var M=d.DetermineComponentFrameRoot(),U=M[0],H=M[1];if(U&&H){var ie=U.split(`
`),pe=H.split(`
`);for(x=d=0;d<ie.length&&!ie[d].includes("DetermineComponentFrameRoot");)d++;for(;x<pe.length&&!pe[x].includes("DetermineComponentFrameRoot");)x++;if(d===ie.length||x===pe.length)for(d=ie.length-1,x=pe.length-1;1<=d&&0<=x&&ie[d]!==pe[x];)x--;for(;1<=d&&0<=x;d--,x--)if(ie[d]!==pe[x]){if(d!==1||x!==1)do if(d--,x--,0>x||ie[d]!==pe[x]){var Ae=`
`+ie[d].replace(" at new "," at ");return r.displayName&&Ae.includes("<anonymous>")&&(Ae=Ae.replace("<anonymous>",r.displayName)),Ae}while(1<=d&&0<=x);break}}}finally{Gv=!1,Error.prepareStackTrace=f}return(f=r?r.displayName||r.name:"")?ae(f):""}function ne(r,o){switch(r.tag){case 26:case 27:case 5:return ae(r.type);case 16:return ae("Lazy");case 13:return r.child!==o&&o!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return V(r.type,!1);case 11:return V(r.type.render,!1);case 1:return V(r.type,!0);case 31:return ae("Activity");default:return""}}function q(r){try{var o="",f=null;do o+=ne(r,f),f=r,r=r.return;while(r);return o}catch(d){return`
Error generating stack: `+d.message+`
`+d.stack}}function oe(r,o){if(typeof r=="object"&&r!==null){var f=hE.get(r);return f!==void 0?f:(o={value:r,source:o,stack:q(o)},hE.set(r,o),o)}return{value:r,source:o,stack:q(o)}}function me(r,o){iu[au++]=sf,iu[au++]=Pd,Pd=r,sf=o}function ye(r,o,f){Aa[wa++]=ps,Aa[wa++]=ms,Aa[wa++]=Cr,Cr=r;var d=ps;r=ms;var x=32-na(d)-1;d&=~(1<<x),f+=1;var M=32-na(o)+x;if(30<M){var U=x-x%5;M=(d&(1<<U)-1).toString(32),d>>=U,x-=U,ps=1<<32-na(o)+x|f<<x|d,ms=M+r}else ps=1<<M|f<<x|d,ms=r}function Ie(r){r.return!==null&&(me(r,1),ye(r,1,0))}function tt(r){for(;r===Pd;)Pd=iu[--au],iu[au]=null,sf=iu[--au],iu[au]=null;for(;r===Cr;)Cr=Aa[--wa],Aa[wa]=null,ms=Aa[--wa],Aa[wa]=null,ps=Aa[--wa],Aa[wa]=null}function ee(r,o){Aa[wa++]=ps,Aa[wa++]=ms,Aa[wa++]=Cr,ps=o.id,ms=o.overflow,Cr=r}function ve(r,o){_(Rr,o),_(rf,r),_(ri,null),r=EL(o),v(ri),_(ri,r)}function Pe(){v(ri),v(rf),v(Rr)}function Ee(r){r.memoizedState!==null&&_(Bd,r);var o=ri.current,f=TL(o,r.type);o!==f&&(_(rf,r),_(ri,f))}function je(r){rf.current===r&&(v(ri),v(rf)),Bd.current===r&&(v(Bd),zs?Oo._currentValue=$l:Oo._currentValue2=$l)}function Qe(r){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw We(oe(o,r)),Xv}function nt(r,o){if(!gi)throw Error(a(175));TN(r.stateNode,r.type,r.memoizedProps,o,r)||Qe(r,!0)}function Ct(r){for(oi=r.return;oi;)switch(oi.tag){case 5:case 31:case 13:Ca=!1;return;case 27:case 3:Ca=!0;return;default:oi=oi.return}}function ce(r){if(!gi||r!==oi)return!1;if(!Nt)return Ct(r),Nt=!0,!1;var o=r.tag;if(Hn?o!==3&&o!==27&&(o!==5||J1(r.type)&&!Ld(r.type,r.memoizedProps))&&dn&&Qe(r):o!==3&&(o!==5||J1(r.type)&&!Ld(r.type,r.memoizedProps))&&dn&&Qe(r),Ct(r),o===13){if(!gi)throw Error(a(316));if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));dn=DN(r)}else if(o===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));dn=RN(r)}else dn=Hn&&o===27?mN(r.type,dn):oi?K1(r.stateNode):null;return!0}function _e(){gi&&(dn=oi=null,Nt=!1)}function F(){var r=Dr;return r!==null&&(Fi===null?Fi=r:Fi.push.apply(Fi,r),Dr=null),r}function We(r){Dr===null?Dr=[r]:Dr.push(r)}function ge(r,o,f){zs?(_(Fd,o._currentValue),o._currentValue=f):(_(Fd,o._currentValue2),o._currentValue2=f)}function De(r){var o=Fd.current;zs?r._currentValue=o:r._currentValue2=o,v(Fd)}function Te(r,o,f){for(;r!==null;){var d=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),r===f)break;r=r.return}}function Ke(r,o,f,d){var x=r.child;for(x!==null&&(x.return=r);x!==null;){var M=x.dependencies;if(M!==null){var U=x.child;M=M.firstContext;e:for(;M!==null;){var H=M;M=x;for(var ie=0;ie<o.length;ie++)if(H.context===o[ie]){M.lanes|=f,H=M.alternate,H!==null&&(H.lanes|=f),Te(M.return,f,r),d||(U=null);break e}M=H.next}}else if(x.tag===18){if(U=x.return,U===null)throw Error(a(341));U.lanes|=f,M=U.alternate,M!==null&&(M.lanes|=f),Te(U,f,r),U=null}else U=x.child;if(U!==null)U.return=x;else for(U=x;U!==null;){if(U===r){U=null;break}if(x=U.sibling,x!==null){x.return=U.return,U=x;break}U=U.return}x=U}}function ze(r,o,f,d){r=null;for(var x=o,M=!1;x!==null;){if(!M){if(x.flags&524288)M=!0;else if(x.flags&262144)break}if(x.tag===10){var U=x.alternate;if(U===null)throw Error(a(387));if(U=U.memoizedProps,U!==null){var H=x.type;aa(x.pendingProps.value,U.value)||(r!==null?r.push(H):r=[H])}}else if(x===Bd.current){if(U=x.alternate,U===null)throw Error(a(387));U.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(Oo):r=[Oo])}x=x.return}r!==null&&Ke(o,r,f,d),o.flags|=262144}function O(r){for(r=r.firstContext;r!==null;){var o=r.context;if(!aa(zs?o._currentValue:o._currentValue2,r.memoizedValue))return!0;r=r.next}return!1}function D(r){Po=r,Ps=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Z(r){return de(Po,r)}function re(r,o){return Po===null&&D(r),de(r,o)}function de(r,o){var f=zs?o._currentValue:o._currentValue2;if(o={context:o,memoizedValue:f,next:null},Ps===null){if(r===null)throw Error(a(308));Ps=o,r.dependencies={lanes:0,firstContext:o},r.flags|=524288}else Ps=Ps.next=o;return f}function le(){return{controller:new aI,data:new Map,refCount:0}}function Xe(r){r.refCount--,r.refCount===0&&sI(rI,function(){r.controller.abort()})}function we(){}function Ce(r){r!==su&&r.next===null&&(su===null?Hd=su=r:su=su.next=r),Vd=!0,Wv||(Wv=!0,Rt())}function mt(r,o){if(!qv&&Vd){qv=!0;do for(var f=!1,d=Hd;d!==null;){if(r!==0){var x=d.pendingLanes;if(x===0)var M=0;else{var U=d.suspendedLanes,H=d.pingedLanes;M=(1<<31-na(42|r)+1)-1,M&=x&~(U&~H),M=M&201326741?M&201326741|1:M?M|2:0}M!==0&&(f=!0,Ge(d,M))}else M=Dt,M=y(d,d===nn?M:0,d.cancelPendingCommit!==null||d.timeoutHandle!==zo),!(M&3)||S(d,M)||(f=!0,Ge(d,M));d=d.next}while(f);qv=!1}}function xe(){ke()}function ke(){Vd=Wv=!1;var r=0;Bo!==0&&IL()&&(r=Bo);for(var o=Pi(),f=null,d=Hd;d!==null;){var x=d.next,M=Je(d,o);M===0?(d.next=null,f===null?Hd=x:f.next=x,x===null&&(su=f)):(f=d,(r!==0||M&3)&&(Vd=!0)),d=x}Vn!==0&&Vn!==5||mt(r),Bo!==0&&(Bo=0)}function Je(r,o){for(var f=r.suspendedLanes,d=r.pingedLanes,x=r.expirationTimes,M=r.pendingLanes&-62914561;0<M;){var U=31-na(M),H=1<<U,ie=x[U];ie===-1?(!(H&f)||H&d)&&(x[U]=E(H,o)):ie<=o&&(r.expiredLanes|=H),M&=~H}if(o=nn,f=Dt,f=y(r,r===o?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==zo),d=r.callbackNode,f===0||r===o&&(Yt===2||Yt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Hv(d),r.callbackNode=null,r.callbackPriority=0;if(!(f&3)||S(r,f)){if(o=f&-f,o===r.callbackPriority)return o;switch(d!==null&&Hv(d),Q(f)){case 2:case 8:f=$N;break;case 32:f=Vv;break;case 268435456:f=eI;break;default:f=Vv}return d=it.bind(null,r),f=Od(f,d),r.callbackPriority=o,r.callbackNode=f,o}return d!==null&&d!==null&&Hv(d),r.callbackPriority=2,r.callbackNode=null,2}function it(r,o){if(Vn!==0&&Vn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var f=r.callbackNode;if($c()&&r.callbackNode!==f)return null;var d=Dt;return d=y(r,r===nn?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==zo),d===0?null:(h1(r,d,o),Je(r,Pi()),r.callbackNode!=null&&r.callbackNode===f?it.bind(null,r):null)}function Ge(r,o){if($c())return null;h1(r,o,!0)}function Rt(){VL?kL(function(){Et&6?Od(uE,xe):ke()}):Od(uE,xe)}function ft(){if(Bo===0){var r=ru;r===0&&(r=Nd,Nd<<=1,!(Nd&261888)&&(Nd=256)),Bo=r}return Bo}function Kt(r,o){if(of===null){var f=of=[];Yv=0,ru=ft(),ou={status:"pending",value:void 0,then:function(d){f.push(d)}}}return Yv++,o.then(G,G),o}function G(){if(--Yv===0&&of!==null){ou!==null&&(ou.status="fulfilled");var r=of;of=null,ru=0,ou=null;for(var o=0;o<r.length;o++)(0,r[o])()}}function Le(r,o){var f=[],d={status:"pending",value:null,reason:null,then:function(x){f.push(x)}};return r.then(function(){d.status="fulfilled",d.value=o;for(var x=0;x<f.length;x++)(0,f[x])(o)},function(x){for(d.status="rejected",d.reason=x,x=0;x<f.length;x++)(0,f[x])(void 0)}),d}function se(){var r=Fo.current;return r!==null?r:nn.pooledCache}function fe(r,o){o===null?_(Fo,Fo.current):_(Fo,o.pool)}function Oe(){var r=se();return r===null?null:{parent:zs?pn._currentValue:pn._currentValue2,pool:r}}function Ue(r,o){if(aa(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var f=Object.keys(r),d=Object.keys(o);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++){var x=f[d];if(!iI.call(o,x)||!aa(r[x],o[x]))return!1}return!0}function ht(r){return r=r.status,r==="fulfilled"||r==="rejected"}function rn(r,o,f){switch(f=r[f],f===void 0?r.push(o):f!==o&&(o.then(we,we),o=f),o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,Ii(r),r;default:if(typeof o.status=="string")o.then(we,we);else{if(r=nn,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=o,r.status="pending",r.then(function(d){if(o.status==="pending"){var x=o;x.status="fulfilled",x.value=d}},function(d){if(o.status==="pending"){var x=o;x.status="rejected",x.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,Ii(r),r}throw Ho=o,lu}}function fn(r){try{var o=r._init;return o(r._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(Ho=f,lu):f}}function Ft(){if(Ho===null)throw Error(a(459));var r=Ho;return Ho=null,r}function Ii(r){if(r===lu||r===kd)throw Error(a(483))}function zi(r){var o=lf;return lf+=1,uu===null&&(uu=[]),rn(uu,r,o)}function br(r,o){o=o.props.ref,r.ref=o!==void 0?o:null}function wo(r,o){throw o.$$typeof===_L?Error(a(525)):(r=Object.prototype.toString.call(o),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r)))}function ls(r){function o(K,Y){if(r){var te=K.deletions;te===null?(K.deletions=[Y],K.flags|=16):te.push(Y)}}function f(K,Y){if(!r)return null;for(;Y!==null;)o(K,Y),Y=Y.sibling;return null}function d(K){for(var Y=new Map;K!==null;)K.key!==null?Y.set(K.key,K):Y.set(K.index,K),K=K.sibling;return Y}function x(K,Y){return K=Is(K,Y),K.index=0,K.sibling=null,K}function M(K,Y,te){return K.index=te,r?(te=K.alternate,te!==null?(te=te.index,te<Y?(K.flags|=67108866,Y):te):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function U(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function H(K,Y,te,be){return Y===null||Y.tag!==6?(Y=Ev(te,K.mode,be),Y.return=K,Y):(Y=x(Y,te),Y.return=K,Y)}function ie(K,Y,te,be){var et=te.type;return et===Jl?Ae(K,Y,te.props.children,be,te.key):Y!==null&&(Y.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===wr&&fn(et)===Y.type)?(Y=x(Y,te.props),br(Y,te),Y.return=K,Y):(Y=Rd(te.type,te.key,te.props,null,K.mode,be),br(Y,te),Y.return=K,Y)}function pe(K,Y,te,be){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=Tv(te,K.mode,be),Y.return=K,Y):(Y=x(Y,te.children||[]),Y.return=K,Y)}function Ae(K,Y,te,be,et){return Y===null||Y.tag!==7?(Y=Io(te,K.mode,be,et),Y.return=K,Y):(Y=x(Y,te),Y.return=K,Y)}function Se(K,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Ev(""+Y,K.mode,te),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case Dd:return te=Rd(Y.type,Y.key,Y.props,null,K.mode,te),br(te,Y),te.return=K,te;case Kl:return Y=Tv(Y,K.mode,te),Y.return=K,Y;case wr:return Y=fn(Y),Se(K,Y,te)}if(Ud(Y)||p(Y))return Y=Io(Y,K.mode,te,null),Y.return=K,Y;if(typeof Y.then=="function")return Se(K,zi(Y),te);if(Y.$$typeof===Ar)return Se(K,re(K,Y),te);wo(K,Y)}return null}function Ve(K,Y,te,be){var et=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return et!==null?null:H(K,Y,""+te,be);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case Dd:return te.key===et?ie(K,Y,te,be):null;case Kl:return te.key===et?pe(K,Y,te,be):null;case wr:return te=fn(te),Ve(K,Y,te,be)}if(Ud(te)||p(te))return et!==null?null:Ae(K,Y,te,be,null);if(typeof te.then=="function")return Ve(K,Y,zi(te),be);if(te.$$typeof===Ar)return Ve(K,Y,re(K,te),be);wo(K,te)}return null}function gt(K,Y,te,be,et){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return K=K.get(te)||null,H(Y,K,""+be,et);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case Dd:return K=K.get(be.key===null?te:be.key)||null,ie(Y,K,be,et);case Kl:return K=K.get(be.key===null?te:be.key)||null,pe(Y,K,be,et);case wr:return be=fn(be),gt(K,Y,te,be,et)}if(Ud(be)||p(be))return K=K.get(te)||null,Ae(Y,K,be,et,null);if(typeof be.then=="function")return gt(K,Y,te,zi(be),et);if(be.$$typeof===Ar)return gt(K,Y,te,re(Y,be),et);wo(Y,be)}return null}function Nn(K,Y,te,be){for(var et=null,mn=null,rt=Y,kt=Y=0,Kn=null;rt!==null&&kt<te.length;kt++){rt.index>kt?(Kn=rt,rt=null):Kn=rt.sibling;var Gt=Ve(K,rt,te[kt],be);if(Gt===null){rt===null&&(rt=Kn);break}r&&rt&&Gt.alternate===null&&o(K,rt),Y=M(Gt,Y,kt),mn===null?et=Gt:mn.sibling=Gt,mn=Gt,rt=Kn}if(kt===te.length)return f(K,rt),Nt&&me(K,kt),et;if(rt===null){for(;kt<te.length;kt++)rt=Se(K,te[kt],be),rt!==null&&(Y=M(rt,Y,kt),mn===null?et=rt:mn.sibling=rt,mn=rt);return Nt&&me(K,kt),et}for(rt=d(rt);kt<te.length;kt++)Kn=gt(rt,K,kt,te[kt],be),Kn!==null&&(r&&Kn.alternate!==null&&rt.delete(Kn.key===null?kt:Kn.key),Y=M(Kn,Y,kt),mn===null?et=Kn:mn.sibling=Kn,mn=Kn);return r&&rt.forEach(function(Or){return o(K,Or)}),Nt&&me(K,kt),et}function mf(K,Y,te,be){if(te==null)throw Error(a(151));for(var et=null,mn=null,rt=Y,kt=Y=0,Kn=null,Gt=te.next();rt!==null&&!Gt.done;kt++,Gt=te.next()){rt.index>kt?(Kn=rt,rt=null):Kn=rt.sibling;var Or=Ve(K,rt,Gt.value,be);if(Or===null){rt===null&&(rt=Kn);break}r&&rt&&Or.alternate===null&&o(K,rt),Y=M(Or,Y,kt),mn===null?et=Or:mn.sibling=Or,mn=Or,rt=Kn}if(Gt.done)return f(K,rt),Nt&&me(K,kt),et;if(rt===null){for(;!Gt.done;kt++,Gt=te.next())Gt=Se(K,Gt.value,be),Gt!==null&&(Y=M(Gt,Y,kt),mn===null?et=Gt:mn.sibling=Gt,mn=Gt);return Nt&&me(K,kt),et}for(rt=d(rt);!Gt.done;kt++,Gt=te.next())Gt=gt(rt,K,kt,Gt.value,be),Gt!==null&&(r&&Gt.alternate!==null&&rt.delete(Gt.key===null?kt:Gt.key),Y=M(Gt,Y,kt),mn===null?et=Gt:mn.sibling=Gt,mn=Gt);return r&&rt.forEach(function(cI){return o(K,cI)}),Nt&&me(K,kt),et}function Xo(K,Y,te,be){if(typeof te=="object"&&te!==null&&te.type===Jl&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case Dd:e:{for(var et=te.key;Y!==null;){if(Y.key===et){if(et=te.type,et===Jl){if(Y.tag===7){f(K,Y.sibling),be=x(Y,te.props.children),be.return=K,K=be;break e}}else if(Y.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===wr&&fn(et)===Y.type){f(K,Y.sibling),be=x(Y,te.props),br(be,te),be.return=K,K=be;break e}f(K,Y);break}else o(K,Y);Y=Y.sibling}te.type===Jl?(be=Io(te.props.children,K.mode,be,te.key),be.return=K,K=be):(be=Rd(te.type,te.key,te.props,null,K.mode,be),br(be,te),be.return=K,K=be)}return U(K);case Kl:e:{for(et=te.key;Y!==null;){if(Y.key===et)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){f(K,Y.sibling),be=x(Y,te.children||[]),be.return=K,K=be;break e}else{f(K,Y);break}else o(K,Y);Y=Y.sibling}be=Tv(te,K.mode,be),be.return=K,K=be}return U(K);case wr:return te=fn(te),Xo(K,Y,te,be)}if(Ud(te))return Nn(K,Y,te,be);if(p(te)){if(et=p(te),typeof et!="function")throw Error(a(150));return te=et.call(te),mf(K,Y,te,be)}if(typeof te.then=="function")return Xo(K,Y,zi(te),be);if(te.$$typeof===Ar)return Xo(K,Y,re(K,te),be);wo(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Y!==null&&Y.tag===6?(f(K,Y.sibling),be=x(Y,te),be.return=K,K=be):(f(K,Y),be=Ev(te,K.mode,be),be.return=K,K=be),U(K)):f(K,Y)}return function(K,Y,te,be){try{lf=0;var et=Xo(K,Y,te,be);return uu=null,et}catch(rt){if(rt===lu||rt===kd)throw rt;var mn=t(29,rt,null,K.mode);return mn.lanes=be,mn.return=K,mn}finally{}}}function Mr(){for(var r=cu,o=jv=cu=0;o<r;){var f=Ra[o];Ra[o++]=null;var d=Ra[o];Ra[o++]=null;var x=Ra[o];Ra[o++]=null;var M=Ra[o];if(Ra[o++]=null,d!==null&&x!==null){var U=d.pending;U===null?x.next=x:(x.next=U.next,U.next=x),d.pending=x}M!==0&&Wc(f,x,M)}}function Co(r,o,f,d){Ra[cu++]=r,Ra[cu++]=o,Ra[cu++]=f,Ra[cu++]=d,jv|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Xl(r,o,f,d){return Co(r,o,f,d),Ds(r)}function Ma(r,o){return Co(r,null,null,o),Ds(r)}function Wc(r,o,f){r.lanes|=f;var d=r.alternate;d!==null&&(d.lanes|=f);for(var x=!1,M=r.return;M!==null;)M.childLanes|=f,d=M.alternate,d!==null&&(d.childLanes|=f),M.tag===22&&(r=M.stateNode,r===null||r._visibility&1||(x=!0)),r=M,M=M.return;return r.tag===3?(M=r.stateNode,x&&o!==null&&(x=31-na(f),r=M.hiddenUpdates,d=r[x],d===null?r[x]=[o]:d.push(o),o.lane=f|536870912),M):null}function Ds(r){if(50<pf)throw pf=0,oy=null,Error(a(185));for(var o=r.return;o!==null;)r=o,o=r.return;return r.tag===3?r.stateNode:null}function Wl(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ql(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function us(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function cs(r,o,f){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var x=d.pending;return x===null?o.next=o:(o.next=x.next,x.next=o),d.pending=o,o=Ds(r),Wc(r,null,f),o}return Co(r,d,o,f),Ds(r)}function Ro(r,o,f){if(o=o.updateQueue,o!==null&&(o=o.shared,(f&4194048)!==0)){var d=o.lanes;d&=r.pendingLanes,f|=d,o.lanes=f,C(r,f)}}function N(r,o){var f=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,f===d)){var x=null,M=null;if(f=f.firstBaseUpdate,f!==null){do{var U={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};M===null?x=M=U:M=M.next=U,f=f.next}while(f!==null);M===null?x=M=o:M=M.next=o}else x=M=o;f={baseState:d.baseState,firstBaseUpdate:x,lastBaseUpdate:M,shared:d.shared,callbacks:d.callbacks},r.updateQueue=f;return}r=f.lastBaseUpdate,r===null?f.firstBaseUpdate=o:r.next=o,f.lastBaseUpdate=o}function X(){if(Qv){var r=ou;if(r!==null)throw r}}function J(r,o,f,d){Qv=!1;var x=r.updateQueue;Ur=!1;var M=x.firstBaseUpdate,U=x.lastBaseUpdate,H=x.shared.pending;if(H!==null){x.shared.pending=null;var ie=H,pe=ie.next;ie.next=null,U===null?M=pe:U.next=pe,U=ie;var Ae=r.alternate;Ae!==null&&(Ae=Ae.updateQueue,H=Ae.lastBaseUpdate,H!==U&&(H===null?Ae.firstBaseUpdate=pe:H.next=pe,Ae.lastBaseUpdate=ie))}if(M!==null){var Se=x.baseState;U=0,Ae=pe=ie=null,H=M;do{var Ve=H.lane&-536870913,gt=Ve!==H.lane;if(gt?(Dt&Ve)===Ve:(d&Ve)===Ve){Ve!==0&&Ve===ru&&(Qv=!0),Ae!==null&&(Ae=Ae.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Nn=r,mf=H;Ve=o;var Xo=f;switch(mf.tag){case 1:if(Nn=mf.payload,typeof Nn=="function"){Se=Nn.call(Xo,Se,Ve);break e}Se=Nn;break e;case 3:Nn.flags=Nn.flags&-65537|128;case 0:if(Nn=mf.payload,Ve=typeof Nn=="function"?Nn.call(Xo,Se,Ve):Nn,Ve==null)break e;Se=wv({},Se,Ve);break e;case 2:Ur=!0}}Ve=H.callback,Ve!==null&&(r.flags|=64,gt&&(r.flags|=8192),gt=x.callbacks,gt===null?x.callbacks=[Ve]:gt.push(Ve))}else gt={lane:Ve,tag:H.tag,payload:H.payload,callback:H.callback,next:null},Ae===null?(pe=Ae=gt,ie=Se):Ae=Ae.next=gt,U|=Ve;if(H=H.next,H===null){if(H=x.shared.pending,H===null)break;gt=H,H=gt.next,gt.next=null,x.lastBaseUpdate=gt,x.shared.pending=null}}while(!0);Ae===null&&(ie=Se),x.baseState=ie,x.firstBaseUpdate=pe,x.lastBaseUpdate=Ae,M===null&&(x.shared.lanes=0),Nr|=U,r.lanes=U,r.memoizedState=Se}}function $(r,o){if(typeof r!="function")throw Error(a(191,r));r.call(o)}function W(r,o){var f=r.callbacks;if(f!==null)for(r.callbacks=null,r=0;r<f.length;r++)$(f[r],o)}function Me(r,o){r=Hs,_(Xd,r),_(fu,o),Hs=r|o.baseLanes}function Ne(){_(Xd,Hs),_(fu,fu.current)}function qe(){Hs=Xd.current,v(fu),v(Xd)}function Fe(r){var o=r.alternate;_(Tn,Tn.current&1),_(sa,r),Ya===null&&(o===null||fu.current!==null||o.memoizedState!==null)&&(Ya=r)}function at(r){_(Tn,Tn.current),_(sa,r),Ya===null&&(Ya=r)}function dt(r){r.tag===22?(_(Tn,Tn.current),_(sa,r),Ya===null&&(Ya=r)):He()}function He(){_(Tn,Tn.current),_(sa,sa.current)}function ct(r){v(sa),Ya===r&&(Ya=null),v(Tn)}function Xt(r){for(var o=r;o!==null;){if(o.tag===13){var f=o.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||Ov(f)||Pv(f)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if(o.flags&128)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}function st(){throw Error(a(321))}function Yn(r,o){if(o===null)return!1;for(var f=0;f<o.length&&f<r.length;f++)if(!aa(r[f],o[f]))return!1;return!0}function zt(r,o,f,d,x,M){return Bs=M,yt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,$e.H=r===null||r.memoizedState===null?mE:Kv,ko=!1,M=f(d,x),ko=!1,hu&&(M=Ea(o,f,d,x)),Ze(r),M}function Ze(r){$e.H=cf;var o=Jt!==null&&Jt.next!==null;if(Bs=0,Rn=Jt=yt=null,Wd=!1,uf=0,du=null,o)throw Error(a(300));r===null||Dn||(r=r.dependencies,r!==null&&O(r)&&(Dn=!0))}function Ea(r,o,f,d){yt=r;var x=0;do{if(hu&&(du=null),uf=0,hu=!1,25<=x)throw Error(a(301));if(x+=1,Rn=Jt=null,r.updateQueue!=null){var M=r.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}$e.H=gE,M=o(f,d)}while(hu);return M}function Ht(){var r=$e.H,o=r.useState()[0];return o=typeof o.then=="function"?ka(o):o,r=r.useState()[0],(Jt!==null?Jt.memoizedState:null)!==r&&(yt.flags|=1024),o}function Ei(){var r=qd!==0;return qd=0,r}function fs(r,o,f){o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~f}function ii(r){if(Wd){for(r=r.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Wd=!1}Bs=0,Rn=Jt=yt=null,hu=!1,uf=qd=0,du=null}function En(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?yt.memoizedState=Rn=r:Rn=Rn.next=r,Rn}function ut(){if(Jt===null){var r=yt.alternate;r=r!==null?r.memoizedState:null}else r=Jt.next;var o=Rn===null?yt.memoizedState:Rn.next;if(o!==null)Rn=o,Jt=r;else{if(r===null)throw yt.alternate===null?Error(a(467)):Error(a(310));Jt=r,r={memoizedState:Jt.memoizedState,baseState:Jt.baseState,baseQueue:Jt.baseQueue,queue:Jt.queue,next:null},Rn===null?yt.memoizedState=Rn=r:Rn=Rn.next=r}return Rn}function Ti(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ka(r){var o=uf;return uf+=1,du===null&&(du=[]),r=rn(du,r,o),o=yt,(Rn===null?o.memoizedState:Rn.next)===null&&(o=o.alternate,$e.H=o===null||o.memoizedState===null?mE:Kv),r}function ai(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return ka(r);if(r.$$typeof===Ar)return Z(r)}throw Error(a(438,String(r)))}function Ta(r){var o=null,f=yt.updateQueue;if(f!==null&&(o=f.memoCache),o==null){var d=yt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(x){return x.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),f===null&&(f=Ti(),yt.updateQueue=f),f.memoCache=o,f=o.data[o.index],f===void 0)for(f=o.data[o.index]=Array(r),d=0;d<r;d++)f[d]=xL;return o.index++,f}function Zn(r,o){return typeof o=="function"?o(r):o}function Do(r){var o=ut();return G0(o,Jt,r)}function G0(r,o,f){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=f;var x=r.baseQueue,M=d.pending;if(M!==null){if(x!==null){var U=x.next;x.next=M.next,M.next=U}o.baseQueue=x=M,d.pending=null}if(M=r.baseState,x===null)r.memoizedState=M;else{o=x.next;var H=U=null,ie=null,pe=o,Ae=!1;do{var Se=pe.lane&-536870913;if(Se!==pe.lane?(Dt&Se)===Se:(Bs&Se)===Se){var Ve=pe.revertLane;if(Ve===0)ie!==null&&(ie=ie.next={lane:0,revertLane:0,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),Se===ru&&(Ae=!0);else if((Bs&Ve)===Ve){pe=pe.next,Ve===ru&&(Ae=!0);continue}else Se={lane:0,revertLane:pe.revertLane,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ie===null?(H=ie=Se,U=M):ie=ie.next=Se,yt.lanes|=Ve,Nr|=Ve;Se=pe.action,ko&&f(M,Se),M=pe.hasEagerState?pe.eagerState:f(M,Se)}else Ve={lane:Se,revertLane:pe.revertLane,gesture:pe.gesture,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ie===null?(H=ie=Ve,U=M):ie=ie.next=Ve,yt.lanes|=Se,Nr|=Se;pe=pe.next}while(pe!==null&&pe!==o);if(ie===null?U=M:ie.next=H,!aa(M,r.memoizedState)&&(Dn=!0,Ae&&(f=ou,f!==null)))throw f;r.memoizedState=M,r.baseState=U,r.baseQueue=ie,d.lastRenderedState=M}return x===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function X0(r){var o=ut(),f=o.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=r;var d=f.dispatch,x=f.pending,M=o.memoizedState;if(x!==null){f.pending=null;var U=x=x.next;do M=r(M,U.action),U=U.next;while(U!==x);aa(M,o.memoizedState)||(Dn=!0),o.memoizedState=M,o.baseQueue===null&&(o.baseState=M),f.lastRenderedState=M}return[M,d]}function Wb(r,o,f){var d=yt,x=ut(),M=Nt;if(M){if(f===void 0)throw Error(a(407));f=f()}else f=o();var U=!aa((Jt||x).memoizedState,f);if(U&&(x.memoizedState=f,Dn=!0),x=x.queue,Y0(Zb.bind(null,d,x,r),[r]),x.getSnapshot!==o||U||Rn!==null&&Rn.memoizedState.tag&1){if(d.flags|=2048,Yl(9,{destroy:void 0},Yb.bind(null,d,x,f,o),null),nn===null)throw Error(a(349));M||Bs&127||qb(d,o,f)}return f}function qb(r,o,f){r.flags|=16384,r={getSnapshot:o,value:f},o=yt.updateQueue,o===null?(o=Ti(),yt.updateQueue=o,o.stores=[r]):(f=o.stores,f===null?o.stores=[r]:f.push(r))}function Yb(r,o,f,d){o.value=f,o.getSnapshot=d,jb(o)&&Qb(r)}function Zb(r,o,f){return f(function(){jb(o)&&Qb(r)})}function jb(r){var o=r.getSnapshot;r=r.value;try{var f=o();return!aa(r,f)}catch{return!0}}function Qb(r){var o=Ma(r,2);o!==null&&Oi(o,r,2)}function W0(r){var o=En();if(typeof r=="function"){var f=r;if(r=f(),ko){k(!0);try{f()}finally{k(!1)}}}return o.memoizedState=o.baseState=r,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zn,lastRenderedState:r},o}function Kb(r,o,f,d){return r.baseState=f,G0(r,Jt,typeof d=="function"?d:Zn)}function QU(r,o,f,d,x){if(vd(r))throw Error(a(485));if(r=o.action,r!==null){var M={payload:x,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(U){M.listeners.push(U)}};$e.T!==null?f(!0):M.isTransition=!1,d(M),f=o.pending,f===null?(M.next=o.pending=M,Jb(o,M)):(M.next=f.next,o.pending=f.next=M)}}function Jb(r,o){var f=o.action,d=o.payload,x=r.state;if(o.isTransition){var M=$e.T,U={};$e.T=U;try{var H=f(x,d),ie=$e.S;ie!==null&&ie(U,H),$b(r,o,H)}catch(pe){q0(r,o,pe)}finally{M!==null&&U.types!==null&&(M.types=U.types),$e.T=M}}else try{M=f(x,d),$b(r,o,M)}catch(pe){q0(r,o,pe)}}function $b(r,o,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(d){eM(r,o,d)},function(d){return q0(r,o,d)}):eM(r,o,f)}function eM(r,o,f){o.status="fulfilled",o.value=f,tM(o),r.state=f,o=r.pending,o!==null&&(f=o.next,f===o?r.pending=null:(f=f.next,o.next=f,Jb(r,f)))}function q0(r,o,f){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=f,tM(o),o=o.next;while(o!==d)}r.action=null}function tM(r){r=r.listeners;for(var o=0;o<r.length;o++)(0,r[o])()}function nM(r,o){return o}function iM(r,o){if(Nt){var f=nn.formState;if(f!==null){e:{var d=yt;if(Nt){if(dn){var x=dN(dn,Ca);if(x){dn=K1(x),d=pN(x);break e}}Qe(d)}d=!1}d&&(o=f[0])}}f=En(),f.memoizedState=f.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nM,lastRenderedState:o},f.queue=d,f=SM.bind(null,yt,d),d.dispatch=f,d=W0(!1);var M=K0.bind(null,yt,!1,d.queue);return d=En(),x={state:o,dispatch:null,action:r,pending:null},d.queue=x,f=QU.bind(null,yt,x,M,f),x.dispatch=f,d.memoizedState=r,[o,f,!1]}function aM(r){var o=ut();return sM(o,Jt,r)}function sM(r,o,f){if(o=G0(r,o,nM)[0],r=Do(Zn)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=ka(o)}catch(U){throw U===lu?kd:U}else d=o;o=ut();var x=o.queue,M=x.dispatch;return f!==o.memoizedState&&(yt.flags|=2048,Yl(9,{destroy:void 0},KU.bind(null,x,f),null)),[d,M,r]}function KU(r,o){r.action=o}function rM(r){var o=ut(),f=Jt;if(f!==null)return sM(o,f,r);ut(),o=o.memoizedState,f=ut();var d=f.queue.dispatch;return f.memoizedState=r,[o,d,!1]}function Yl(r,o,f,d){return r={tag:r,create:f,deps:d,inst:o,next:null},o=yt.updateQueue,o===null&&(o=Ti(),yt.updateQueue=o),f=o.lastEffect,f===null?o.lastEffect=r.next=r:(d=f.next,f.next=r,r.next=d,o.lastEffect=r),r}function oM(){return ut().memoizedState}function md(r,o,f,d){var x=En();yt.flags|=r,x.memoizedState=Yl(1|o,{destroy:void 0},f,d===void 0?null:d)}function gd(r,o,f,d){var x=ut();d=d===void 0?null:d;var M=x.memoizedState.inst;Jt!==null&&d!==null&&Yn(d,Jt.memoizedState.deps)?x.memoizedState=Yl(o,M,f,d):(yt.flags|=r,x.memoizedState=Yl(1|o,M,f,d))}function lM(r,o){md(8390656,8,r,o)}function Y0(r,o){gd(2048,8,r,o)}function JU(r){yt.flags|=4;var o=yt.updateQueue;if(o===null)o=Ti(),yt.updateQueue=o,o.events=[r];else{var f=o.events;f===null?o.events=[r]:f.push(r)}}function uM(r){var o=ut().memoizedState;return JU({ref:o,nextImpl:r}),function(){if(Et&2)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function cM(r,o){return gd(4,2,r,o)}function fM(r,o){return gd(4,4,r,o)}function hM(r,o){if(typeof o=="function"){r=r();var f=o(r);return function(){typeof f=="function"?f():o(null)}}if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function dM(r,o,f){f=f!=null?f.concat([r]):null,gd(4,4,hM.bind(null,o,r),f)}function Z0(){}function pM(r,o){var f=ut();o=o===void 0?null:o;var d=f.memoizedState;return o!==null&&Yn(o,d[1])?d[0]:(f.memoizedState=[r,o],r)}function mM(r,o){var f=ut();o=o===void 0?null:o;var d=f.memoizedState;if(o!==null&&Yn(o,d[1]))return d[0];if(d=r(),ko){k(!0);try{r()}finally{k(!1)}}return f.memoizedState=[d,o],d}function j0(r,o,f){return f===void 0||Bs&1073741824&&!(Dt&261930)?r.memoizedState=o:(r.memoizedState=f,r=f1(),yt.lanes|=r,Nr|=r,f)}function gM(r,o,f,d){return aa(f,o)?f:fu.current!==null?(r=j0(r,f,d),aa(r,o)||(Dn=!0),r):!(Bs&42)||Bs&1073741824&&!(Dt&261930)?(Dn=!0,r.memoizedState=f):(r=f1(),yt.lanes|=r,Nr|=r,o)}function vM(r,o,f,d,x){var M=Os();jn(M!==0&&8>M?M:8);var U=$e.T,H={};$e.T=H,K0(r,!1,o,f);try{var ie=x(),pe=$e.S;if(pe!==null&&pe(H,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Ae=Le(ie,d);qc(r,o,Ae,ea(r))}else qc(r,o,d,ea(r))}catch(Se){qc(r,o,{then:function(){},status:"rejected",reason:Se},ea())}finally{jn(M),U!==null&&H.types!==null&&(U.types=H.types),$e.T=U}}function yM(r){var o=r.memoizedState;if(o!==null)return o;o={memoizedState:$l,baseState:$l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zn,lastRenderedState:$l},next:null};var f={};return o.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zn,lastRenderedState:f},next:null},r.memoizedState=o,r=r.alternate,r!==null&&(r.memoizedState=o),o}function Q0(){return Z(Oo)}function _M(){return ut().memoizedState}function xM(){return ut().memoizedState}function $U(r){for(var o=r.return;o!==null;){switch(o.tag){case 24:case 3:var f=ea();r=us(f);var d=cs(o,r,f);d!==null&&(Oi(d,o,f),Ro(d,o,f)),o={cache:le()},r.payload=o;return}o=o.return}}function eL(r,o,f){var d=ea();f={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},vd(r)?bM(o,f):(f=Xl(r,o,f,d),f!==null&&(Oi(f,r,d),MM(f,o,d)))}function SM(r,o,f){var d=ea();qc(r,o,f,d)}function qc(r,o,f,d){var x={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(vd(r))bM(o,x);else{var M=r.alternate;if(r.lanes===0&&(M===null||M.lanes===0)&&(M=o.lastRenderedReducer,M!==null))try{var U=o.lastRenderedState,H=M(U,f);if(x.hasEagerState=!0,x.eagerState=H,aa(H,U))return Co(r,o,x,0),nn===null&&Mr(),!1}catch{}finally{}if(f=Xl(r,o,x,d),f!==null)return Oi(f,r,d),MM(f,o,d),!0}return!1}function K0(r,o,f,d){if(d={lane:2,revertLane:ft(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},vd(r)){if(o)throw Error(a(479))}else o=Xl(r,f,d,2),o!==null&&Oi(o,r,2)}function vd(r){var o=r.alternate;return r===yt||o!==null&&o===yt}function bM(r,o){hu=Wd=!0;var f=r.pending;f===null?o.next=o:(o.next=f.next,f.next=o),r.pending=o}function MM(r,o,f){if(f&4194048){var d=o.lanes;d&=r.pendingLanes,f|=d,o.lanes=f,C(r,f)}}function J0(r,o,f,d){o=r.memoizedState,f=f(d,o),f=f==null?o:wv({},o,f),r.memoizedState=f,r.lanes===0&&(r.updateQueue.baseState=f)}function EM(r,o,f,d,x,M,U){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,M,U):o.prototype&&o.prototype.isPureReactComponent?!Ue(f,d)||!Ue(x,M):!0}function TM(r,o,f,d){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(f,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(f,d),o.state!==r&&Jv.enqueueReplaceState(o,o.state,null)}function Uo(r,o){var f=o;if("ref"in o){f={};for(var d in o)d!=="ref"&&(f[d]=o[d])}if(r=r.defaultProps){f===o&&(f=wv({},f));for(var x in r)f[x]===void 0&&(f[x]=r[x])}return f}function yd(r,o){try{var f=r.onUncaughtError;f(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function AM(r,o,f){try{var d=r.onCaughtError;d(f.value,{componentStack:f.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function $0(r,o,f){return f=us(f),f.tag=3,f.payload={element:null},f.callback=function(){yd(r,o)},f}function wM(r){return r=us(r),r.tag=3,r}function CM(r,o,f,d){var x=f.type.getDerivedStateFromError;if(typeof x=="function"){var M=d.value;r.payload=function(){return x(M)},r.callback=function(){AM(o,f,d)}}var U=f.stateNode;U!==null&&typeof U.componentDidCatch=="function"&&(r.callback=function(){AM(o,f,d),typeof x!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function tL(r,o,f,d,x){if(f.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=f.alternate,o!==null&&ze(o,f,x,!0),f=sa.current,f!==null){switch(f.tag){case 31:case 13:return Ya===null?wd():f.alternate===null&&yn===0&&(yn=3),f.flags&=-257,f.flags|=65536,f.lanes=x,d===Gd?f.flags|=16384:(o=f.updateQueue,o===null?f.updateQueue=new Set([d]):o.add(d),bv(r,d,x)),!1;case 22:return f.flags|=65536,d===Gd?f.flags|=16384:(o=f.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},f.updateQueue=o):(f=o.retryQueue,f===null?o.retryQueue=new Set([d]):f.add(d)),bv(r,d,x)),!1}throw Error(a(435,f.tag))}return bv(r,d,x),wd(),!1}if(Nt)return o=sa.current,o!==null?(!(o.flags&65536)&&(o.flags|=256),o.flags|=65536,o.lanes=x,d!==Xv&&(r=Error(a(422),{cause:d}),We(oe(r,f)))):(d!==Xv&&(o=Error(a(423),{cause:d}),We(oe(o,f))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,d=oe(d,f),x=$0(r.stateNode,d,x),N(r,x),yn!==4&&(yn=2)),!1;var M=Error(a(520),{cause:d});if(M=oe(M,f),hf===null?hf=[M]:hf.push(M),yn!==4&&(yn=2),o===null)return!0;d=oe(d,f),f=o;do{switch(f.tag){case 3:return f.flags|=65536,r=x&-x,f.lanes|=r,r=$0(f.stateNode,d,r),N(f,r),!1;case 1:if(o=f.type,M=f.stateNode,(f.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(Ir===null||!Ir.has(M))))return f.flags|=65536,x&=-x,f.lanes|=x,x=wM(x),CM(x,r,f,d),N(f,x),!1}f=f.return}while(f!==null);return!1}function si(r,o,f,d){o.child=r===null?pE(o,null,f,d):Vo(o,r.child,f,d)}function RM(r,o,f,d,x){f=f.render;var M=o.ref;if("ref"in d){var U={};for(var H in d)H!=="ref"&&(U[H]=d[H])}else U=d;return D(o),d=zt(r,o,f,U,M,x),H=Ei(),r!==null&&!Dn?(fs(r,o,x),Us(r,o,x)):(Nt&&H&&Ie(o),o.flags|=1,si(r,o,d,x),o.child)}function DM(r,o,f,d,x){if(r===null){var M=f.type;return typeof M=="function"&&!Mv(M)&&M.defaultProps===void 0&&f.compare===null?(o.tag=15,o.type=M,UM(r,o,M,d,x)):(r=Rd(f.type,null,d,o,o.mode,x),r.ref=o.ref,r.return=o,o.child=r)}if(M=r.child,!rv(r,x)){var U=M.memoizedProps;if(f=f.compare,f=f!==null?f:Ue,f(U,d)&&r.ref===o.ref)return Us(r,o,x)}return o.flags|=1,r=Is(M,d),r.ref=o.ref,r.return=o,o.child=r}function UM(r,o,f,d,x){if(r!==null){var M=r.memoizedProps;if(Ue(M,d)&&r.ref===o.ref)if(Dn=!1,o.pendingProps=d=M,rv(r,x))r.flags&131072&&(Dn=!0);else return o.lanes=r.lanes,Us(r,o,x)}return ev(r,o,f,d,x)}function LM(r,o,f,d){var x=d.children,M=r!==null?r.memoizedState:null;if(r===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if(o.flags&128){if(M=M!==null?M.baseLanes|f:f,r!==null){for(d=o.child=r.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~M}else d=0,o.child=null;return NM(r,o,M,f,d)}if(f&536870912)o.memoizedState={baseLanes:0,cachePool:null},r!==null&&fe(o,M!==null?M.cachePool:null),M!==null?Me(o,M):Ne(),dt(o);else return d=o.lanes=536870912,NM(r,o,M!==null?M.baseLanes|f:f,f,d)}else M!==null?(fe(o,M.cachePool),Me(o,M),He(),o.memoizedState=null):(r!==null&&fe(o,null),Ne(),He());return si(r,o,x,f),o.child}function Yc(r,o){return r!==null&&r.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function NM(r,o,f,d,x){var M=se();return M=M===null?null:{parent:zs?pn._currentValue:pn._currentValue2,pool:M},o.memoizedState={baseLanes:f,cachePool:M},r!==null&&fe(o,null),Ne(),dt(o),r!==null&&ze(r,o,d,!0),o.childLanes=x,null}function _d(r,o){return o=Sd({mode:o.mode,children:o.children},r.mode),o.ref=r.ref,r.child=o,o.return=r,o}function IM(r,o,f){return Vo(o,r.child,null,f),r=_d(o,o.pendingProps),r.flags|=2,ct(o),o.memoizedState=null,r}function nL(r,o,f){var d=o.pendingProps,x=(o.flags&128)!==0;if(o.flags&=-129,r===null){if(Nt){if(d.mode==="hidden")return r=_d(o,d),o.lanes=536870912,Yc(null,r);if(at(o),(r=dn)?(r=MN(r,Ca),r!==null&&(o.memoizedState={dehydrated:r,treeContext:Cr!==null?{id:ps,overflow:ms}:null,retryLane:536870912,hydrationErrors:null},f=U1(r),f.return=o,o.child=f,oi=o,dn=null)):r=null,r===null)throw Qe(o);return o.lanes=536870912,null}return _d(o,d)}var M=r.memoizedState;if(M!==null){var U=M.dehydrated;if(at(o),x)if(o.flags&256)o.flags&=-257,o=IM(r,o,f);else if(o.memoizedState!==null)o.child=r.child,o.flags|=128,o=null;else throw Error(a(558));else if(Dn||ze(r,o,f,!1),x=(f&r.childLanes)!==0,Dn||x){if(d=nn,d!==null&&(U=w(d,f),U!==0&&U!==M.retryLane))throw M.retryLane=U,Ma(r,U),Oi(d,r,U),$v;wd(),o=IM(r,o,f)}else r=M.treeContext,gi&&(dn=yN(U),oi=o,Nt=!0,Dr=null,Ca=!1,r!==null&&ee(o,r)),o=_d(o,d),o.flags|=4096;return o}return r=Is(r.child,{mode:d.mode,children:d.children}),r.ref=o.ref,o.child=r,r.return=o,r}function xd(r,o){var f=o.ref;if(f===null)r!==null&&r.ref!==null&&(o.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(a(284));(r===null||r.ref!==f)&&(o.flags|=4194816)}}function ev(r,o,f,d,x){return D(o),f=zt(r,o,f,d,void 0,x),d=Ei(),r!==null&&!Dn?(fs(r,o,x),Us(r,o,x)):(Nt&&d&&Ie(o),o.flags|=1,si(r,o,f,x),o.child)}function zM(r,o,f,d,x,M){return D(o),o.updateQueue=null,f=Ea(o,d,f,x),Ze(r),d=Ei(),r!==null&&!Dn?(fs(r,o,M),Us(r,o,M)):(Nt&&d&&Ie(o),o.flags|=1,si(r,o,f,M),o.child)}function OM(r,o,f,d,x){if(D(o),o.stateNode===null){var M=nu,U=f.contextType;typeof U=="object"&&U!==null&&(M=Z(U)),M=new f(d,M),o.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=Jv,o.stateNode=M,M._reactInternals=o,M=o.stateNode,M.props=d,M.state=o.memoizedState,M.refs={},Wl(o),U=f.contextType,M.context=typeof U=="object"&&U!==null?Z(U):nu,M.state=o.memoizedState,U=f.getDerivedStateFromProps,typeof U=="function"&&(J0(o,f,U,d),M.state=o.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(U=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),U!==M.state&&Jv.enqueueReplaceState(M,M.state,null),J(o,d,M,x),X(),M.state=o.memoizedState),typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(r===null){M=o.stateNode;var H=o.memoizedProps,ie=Uo(f,H);M.props=ie;var pe=M.context,Ae=f.contextType;U=nu,typeof Ae=="object"&&Ae!==null&&(U=Z(Ae));var Se=f.getDerivedStateFromProps;Ae=typeof Se=="function"||typeof M.getSnapshotBeforeUpdate=="function",H=o.pendingProps!==H,Ae||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(H||pe!==U)&&TM(o,M,d,U),Ur=!1;var Ve=o.memoizedState;M.state=Ve,J(o,d,M,x),X(),pe=o.memoizedState,H||Ve!==pe||Ur?(typeof Se=="function"&&(J0(o,f,Se,d),pe=o.memoizedState),(ie=Ur||EM(o,f,ie,d,Ve,pe,U))?(Ae||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=pe),M.props=d,M.state=pe,M.context=U,d=ie):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{M=o.stateNode,ql(r,o),U=o.memoizedProps,Ae=Uo(f,U),M.props=Ae,Se=o.pendingProps,Ve=M.context,pe=f.contextType,ie=nu,typeof pe=="object"&&pe!==null&&(ie=Z(pe)),H=f.getDerivedStateFromProps,(pe=typeof H=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(U!==Se||Ve!==ie)&&TM(o,M,d,ie),Ur=!1,Ve=o.memoizedState,M.state=Ve,J(o,d,M,x),X();var gt=o.memoizedState;U!==Se||Ve!==gt||Ur||r!==null&&r.dependencies!==null&&O(r.dependencies)?(typeof H=="function"&&(J0(o,f,H,d),gt=o.memoizedState),(Ae=Ur||EM(o,f,Ae,d,Ve,gt,ie)||r!==null&&r.dependencies!==null&&O(r.dependencies))?(pe||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(d,gt,ie),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(d,gt,ie)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||U===r.memoizedProps&&Ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&Ve===r.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=gt),M.props=d,M.state=gt,M.context=ie,d=Ae):(typeof M.componentDidUpdate!="function"||U===r.memoizedProps&&Ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&Ve===r.memoizedState||(o.flags|=1024),d=!1)}return M=d,xd(r,o),d=(o.flags&128)!==0,M||d?(M=o.stateNode,f=d&&typeof f.getDerivedStateFromError!="function"?null:M.render(),o.flags|=1,r!==null&&d?(o.child=Vo(o,r.child,null,x),o.child=Vo(o,null,f,x)):si(r,o,f,x),o.memoizedState=M.state,r=o.child):r=Us(r,o,x),r}function PM(r,o,f,d){return _e(),o.flags|=256,si(r,o,f,d),o.child}function tv(r){return{baseLanes:r,cachePool:Oe()}}function nv(r,o,f){return r=r!==null?r.childLanes&~f:0,o&&(r|=oa),r}function BM(r,o,f){var d=o.pendingProps,x=!1,M=(o.flags&128)!==0,U;if((U=M)||(U=r!==null&&r.memoizedState===null?!1:(Tn.current&2)!==0),U&&(x=!0,o.flags&=-129),U=(o.flags&32)!==0,o.flags&=-33,r===null){if(Nt){if(x?Fe(o):He(),(r=dn)?(r=EN(r,Ca),r!==null&&(o.memoizedState={dehydrated:r,treeContext:Cr!==null?{id:ps,overflow:ms}:null,retryLane:536870912,hydrationErrors:null},f=U1(r),f.return=o,o.child=f,oi=o,dn=null)):r=null,r===null)throw Qe(o);return Pv(r)?o.lanes=32:o.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(He(),x=o.mode,H=Sd({mode:"hidden",children:H},x),d=Io(d,x,f,null),H.return=o,d.return=o,H.sibling=d,o.child=H,d=o.child,d.memoizedState=tv(f),d.childLanes=nv(r,U,f),o.memoizedState=ey,Yc(null,d)):(Fe(o),iv(o,H))}var ie=r.memoizedState;if(ie!==null&&(H=ie.dehydrated,H!==null)){if(M)o.flags&256?(Fe(o),o.flags&=-257,o=av(r,o,f)):o.memoizedState!==null?(He(),o.child=r.child,o.flags|=128,o=null):(He(),H=d.fallback,x=o.mode,d=Sd({mode:"visible",children:d.children},x),H=Io(H,x,f,null),H.flags|=2,d.return=o,H.return=o,d.sibling=H,o.child=d,Vo(o,r.child,null,f),d=o.child,d.memoizedState=tv(f),d.childLanes=nv(r,U,f),o.memoizedState=ey,o=Yc(null,d));else if(Fe(o),Pv(H))U=fN(H).digest,d=Error(a(419)),d.stack="",d.digest=U,We({value:d,source:null,stack:null}),o=av(r,o,f);else if(Dn||ze(r,o,f,!1),U=(f&r.childLanes)!==0,Dn||U){if(U=nn,U!==null&&(d=w(U,f),d!==0&&d!==ie.retryLane))throw ie.retryLane=d,Ma(r,d),Oi(U,r,d),$v;Ov(H)||wd(),o=av(r,o,f)}else Ov(H)?(o.flags|=192,o.child=r.child,o=null):(r=ie.treeContext,gi&&(dn=_N(H),oi=o,Nt=!0,Dr=null,Ca=!1,r!==null&&ee(o,r)),o=iv(o,d.children),o.flags|=4096);return o}return x?(He(),H=d.fallback,x=o.mode,ie=r.child,M=ie.sibling,d=Is(ie,{mode:"hidden",children:d.children}),d.subtreeFlags=ie.subtreeFlags&65011712,M!==null?H=Is(M,H):(H=Io(H,x,f,null),H.flags|=2),H.return=o,d.return=o,d.sibling=H,o.child=d,Yc(null,d),d=o.child,H=r.child.memoizedState,H===null?H=tv(f):(x=H.cachePool,x!==null?(ie=zs?pn._currentValue:pn._currentValue2,x=x.parent!==ie?{parent:ie,pool:ie}:x):x=Oe(),H={baseLanes:H.baseLanes|f,cachePool:x}),d.memoizedState=H,d.childLanes=nv(r,U,f),o.memoizedState=ey,Yc(r.child,d)):(Fe(o),f=r.child,r=f.sibling,f=Is(f,{mode:"visible",children:d.children}),f.return=o,f.sibling=null,r!==null&&(U=o.deletions,U===null?(o.deletions=[r],o.flags|=16):U.push(r)),o.child=f,o.memoizedState=null,f)}function iv(r,o){return o=Sd({mode:"visible",children:o},r.mode),o.return=r,r.child=o}function Sd(r,o){return r=t(22,r,null,o),r.lanes=0,r}function av(r,o,f){return Vo(o,r.child,null,f),r=iv(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function FM(r,o,f){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o),Te(r.return,o,f)}function sv(r,o,f,d,x,M){var U=r.memoizedState;U===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:f,tailMode:x,treeForkCount:M}:(U.isBackwards=o,U.rendering=null,U.renderingStartTime=0,U.last=d,U.tail=f,U.tailMode=x,U.treeForkCount=M)}function HM(r,o,f){var d=o.pendingProps,x=d.revealOrder,M=d.tail;d=d.children;var U=Tn.current,H=(U&2)!==0;if(H?(U=U&1|2,o.flags|=128):U&=1,_(Tn,U),si(r,o,d,f),d=Nt?sf:0,!H&&r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&FM(r,f,o);else if(r.tag===19)FM(r,f,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(x){case"forwards":for(f=o.child,x=null;f!==null;)r=f.alternate,r!==null&&Xt(r)===null&&(x=f),f=f.sibling;f=x,f===null?(x=o.child,o.child=null):(x=f.sibling,f.sibling=null),sv(o,!1,x,f,M,d);break;case"backwards":case"unstable_legacy-backwards":for(f=null,x=o.child,o.child=null;x!==null;){if(r=x.alternate,r!==null&&Xt(r)===null){o.child=x;break}r=x.sibling,x.sibling=f,f=x,x=r}sv(o,!0,f,null,M,d);break;case"together":sv(o,!1,null,null,void 0,d);break;default:o.memoizedState=null}return o.child}function Us(r,o,f){if(r!==null&&(o.dependencies=r.dependencies),Nr|=o.lanes,(f&o.childLanes)===0)if(r!==null){if(ze(r,o,f,!1),(f&o.childLanes)===0)return null}else return null;if(r!==null&&o.child!==r.child)throw Error(a(153));if(o.child!==null){for(r=o.child,f=Is(r,r.pendingProps),o.child=f,f.return=o;r.sibling!==null;)r=r.sibling,f=f.sibling=Is(r,r.pendingProps),f.return=o;f.sibling=null}return o.child}function rv(r,o){return r.lanes&o?!0:(r=r.dependencies,!!(r!==null&&O(r)))}function iL(r,o,f){switch(o.tag){case 3:ve(o,o.stateNode.containerInfo),ge(o,pn,r.memoizedState.cache),_e();break;case 27:case 5:Ee(o);break;case 4:ve(o,o.stateNode.containerInfo);break;case 10:ge(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,at(o),null;break;case 13:var d=o.memoizedState;if(d!==null)return d.dehydrated!==null?(Fe(o),o.flags|=128,null):f&o.child.childLanes?BM(r,o,f):(Fe(o),r=Us(r,o,f),r!==null?r.sibling:null);Fe(o);break;case 19:var x=(r.flags&128)!==0;if(d=(f&o.childLanes)!==0,d||(ze(r,o,f,!1),d=(f&o.childLanes)!==0),x){if(d)return HM(r,o,f);o.flags|=128}if(x=o.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),_(Tn,Tn.current),d)break;return null;case 22:return o.lanes=0,LM(r,o,f,o.pendingProps);case 24:ge(o,pn,r.memoizedState.cache)}return Us(r,o,f)}function VM(r,o,f){if(r!==null)if(r.memoizedProps!==o.pendingProps)Dn=!0;else{if(!rv(r,f)&&!(o.flags&128))return Dn=!1,iL(r,o,f);Dn=(r.flags&131072)!==0}else Dn=!1,Nt&&o.flags&1048576&&ye(o,sf,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(r=fn(o.elementType),o.type=r,typeof r=="function")Mv(r)?(d=Uo(r,d),o.tag=1,o=OM(null,o,r,d,f)):(o.tag=0,o=ev(null,o,r,d,f));else{if(r!=null){var x=r.$$typeof;if(x===Rv){o.tag=11,o=RM(null,o,r,d,f);break e}else if(x===Lv){o.tag=14,o=DM(null,o,r,d,f);break e}}throw o=g(r)||r,Error(a(306,o,""))}}return o;case 0:return ev(r,o,o.type,o.pendingProps,f);case 1:return d=o.type,x=Uo(d,o.pendingProps),OM(r,o,d,x,f);case 3:e:{if(ve(o,o.stateNode.containerInfo),r===null)throw Error(a(387));var M=o.pendingProps;x=o.memoizedState,d=x.element,ql(r,o),J(o,M,null,f);var U=o.memoizedState;if(M=U.cache,ge(o,pn,M),M!==x.cache&&Ke(o,[pn],f,!0),X(),M=U.element,gi&&x.isDehydrated)if(x={element:M,isDehydrated:!1,cache:U.cache},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){o=PM(r,o,M,f);break e}else if(M!==d){d=oe(Error(a(424)),o),We(d),o=PM(r,o,M,f);break e}else for(gi&&(dn=vN(o.stateNode.containerInfo),oi=o,Nt=!0,Dr=null,Ca=!0),f=pE(o,null,M,f),o.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(_e(),M===d){o=Us(r,o,f);break e}si(r,o,M,f)}o=o.child}return o;case 26:if(qa)return xd(r,o),r===null?(f=eE(o.type,null,o.pendingProps,null))?o.memoizedState=f:Nt||(o.stateNode=XN(o.type,o.pendingProps,Rr.current,o)):o.memoizedState=eE(o.type,r.memoizedProps,o.pendingProps,r.memoizedState),null;case 27:if(Hn)return Ee(o),r===null&&Hn&&Nt&&(d=o.stateNode=rE(o.type,o.pendingProps,Rr.current,ri.current,!1),oi=o,Ca=!0,dn=xN(o.type,d,dn)),si(r,o,o.pendingProps.children,f),xd(r,o),r===null&&(o.flags|=4194304),o.child;case 5:return r===null&&Nt&&(VN(o.type,o.pendingProps,ri.current),(x=d=dn)&&(d=SN(d,o.type,o.pendingProps,Ca),d!==null?(o.stateNode=d,oi=o,dn=gN(d),Ca=!1,x=!0):x=!1),x||Qe(o)),Ee(o),x=o.type,M=o.pendingProps,U=r!==null?r.memoizedProps:null,d=M.children,Ld(x,M)?d=null:U!==null&&Ld(x,U)&&(o.flags|=32),o.memoizedState!==null&&(x=zt(r,o,Ht,null,null,f),zs?Oo._currentValue=x:Oo._currentValue2=x),xd(r,o),si(r,o,d,f),o.child;case 6:return r===null&&Nt&&(kN(o.pendingProps,ri.current),(r=f=dn)&&(f=bN(f,o.pendingProps,Ca),f!==null?(o.stateNode=f,oi=o,dn=null,r=!0):r=!1),r||Qe(o)),null;case 13:return BM(r,o,f);case 4:return ve(o,o.stateNode.containerInfo),d=o.pendingProps,r===null?o.child=Vo(o,null,d,f):si(r,o,d,f),o.child;case 11:return RM(r,o,o.type,o.pendingProps,f);case 7:return si(r,o,o.pendingProps,f),o.child;case 8:return si(r,o,o.pendingProps.children,f),o.child;case 12:return si(r,o,o.pendingProps.children,f),o.child;case 10:return d=o.pendingProps,ge(o,o.type,d.value),si(r,o,d.children,f),o.child;case 9:return x=o.type._context,d=o.pendingProps.children,D(o),x=Z(x),d=d(x),o.flags|=1,si(r,o,d,f),o.child;case 14:return DM(r,o,o.type,o.pendingProps,f);case 15:return UM(r,o,o.type,o.pendingProps,f);case 19:return HM(r,o,f);case 31:return nL(r,o,f);case 22:return LM(r,o,f,o.pendingProps);case 24:return D(o),d=Z(pn),r===null?(x=se(),x===null&&(x=nn,M=le(),x.pooledCache=M,M.refCount++,M!==null&&(x.pooledCacheLanes|=f),x=M),o.memoizedState={parent:d,cache:x},Wl(o),ge(o,pn,x)):(r.lanes&f&&(ql(r,o),J(o,null,null,f),X()),x=r.memoizedState,M=o.memoizedState,x.parent!==d?(x={parent:d,cache:d},o.memoizedState=x,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=x),ge(o,pn,d)):(d=M.cache,ge(o,pn,d),d!==x.cache&&Ke(o,[pn],f,!0))),si(r,o,o.pendingProps.children,f),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function Ga(r){r.flags|=4}function bd(r){ds&&(r.flags|=8)}function kM(r,o){if(r!==null&&r.child===o.child)return!1;if(o.flags&16)return!0;for(r=o.child;r!==null;){if(r.flags&8218||r.subtreeFlags&8218)return!0;r=r.sibling}return!1}function ov(r,o,f,d){if(mi)for(f=o.child;f!==null;){if(f.tag===5||f.tag===6)Iv(r,f.stateNode);else if(!(f.tag===4||Hn&&f.tag===27)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===o)break;for(;f.sibling===null;){if(f.return===null||f.return===o)return;f=f.return}f.sibling.return=f.return,f=f.sibling}else if(ds)for(var x=o.child;x!==null;){if(x.tag===5){var M=x.stateNode;f&&d&&(M=j1(M,x.type,x.memoizedProps)),Iv(r,M)}else if(x.tag===6)M=x.stateNode,f&&d&&(M=Q1(M,x.memoizedProps)),Iv(r,M);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)M=x.child,M!==null&&(M.return=x),ov(r,x,!0,!0);else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===o)break;for(;x.sibling===null;){if(x.return===null||x.return===o)return;x=x.return}x.sibling.return=x.return,x=x.sibling}}function GM(r,o,f,d){var x=!1;if(ds)for(var M=o.child;M!==null;){if(M.tag===5){var U=M.stateNode;f&&d&&(U=j1(U,M.type,M.memoizedProps)),Y1(r,U)}else if(M.tag===6)U=M.stateNode,f&&d&&(U=Q1(U,M.memoizedProps)),Y1(r,U);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)x=M.child,x!==null&&(x.return=M),GM(r,M,!0,!0),x=!0;else if(M.child!==null){M.child.return=M,M=M.child;continue}}if(M===o)break;for(;M.sibling===null;){if(M.return===null||M.return===o)return x;M=M.return}M.sibling.return=M.return,M=M.sibling}return x}function XM(r,o){if(ds&&kM(r,o)){r=o.stateNode;var f=r.containerInfo,d=q1();GM(d,o,!1,!1),r.pendingChildren=d,Ga(o),cN(f,d)}}function lv(r,o,f,d){if(mi)r.memoizedProps!==d&&Ga(o);else if(ds){var x=r.stateNode,M=r.memoizedProps;if((r=kM(r,o))||M!==d){var U=ri.current;M=uN(x,f,M,d,!r,null),M===x?o.stateNode=x:(bd(o),V1(M,f,d,U)&&Ga(o),o.stateNode=M,r&&ov(M,o,!1,!1))}else o.stateNode=x}}function uv(r,o,f,d,x){if(r.mode&32&&(f===null?OL(o,d):PL(o,f,d))){if(r.flags|=16777216,(x&335544128)===x||zv(o,d))if(G1(r.stateNode,o,d))r.flags|=8192;else if(g1())r.flags|=8192;else throw Ho=Gd,Zv}else r.flags&=-16777217}function WM(r,o){if(qN(o)){if(r.flags|=16777216,!sE(o))if(g1())r.flags|=8192;else throw Ho=Gd,Zv}else r.flags&=-16777217}function Md(r,o){o!==null&&(r.flags|=4),r.flags&16384&&(o=r.tag!==22?A():536870912,r.lanes|=o,gu|=o)}function Zc(r,o){if(!Nt)switch(r.tailMode){case"hidden":o=r.tail;for(var f=null;o!==null;)o.alternate!==null&&(f=o),o=o.sibling;f===null?r.tail=null:f.sibling=null;break;case"collapsed":f=r.tail;for(var d=null;f!==null;)f.alternate!==null&&(d=f),f=f.sibling;d===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function on(r){var o=r.alternate!==null&&r.alternate.child===r.child,f=0,d=0;if(o)for(var x=r.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=r,x=x.sibling;else for(x=r.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=r,x=x.sibling;return r.subtreeFlags|=d,r.childLanes=f,o}function aL(r,o,f){var d=o.pendingProps;switch(tt(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(o),null;case 1:return on(o),null;case 3:return f=o.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),De(pn),Pe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(ce(o)?Ga(o):r===null||r.memoizedState.isDehydrated&&!(o.flags&256)||(o.flags|=1024,F())),XM(r,o),on(o),null;case 26:if(qa){var x=o.type,M=o.memoizedState;return r===null?(Ga(o),M!==null?(on(o),WM(o,M)):(on(o),uv(o,x,null,d,f))):M?M!==r.memoizedState?(Ga(o),on(o),WM(o,M)):(on(o),o.flags&=-16777217):(M=r.memoizedProps,mi?M!==d&&Ga(o):lv(r,o,x,d),on(o),uv(o,x,M,d,f)),null}case 27:if(Hn){if(je(o),f=Rr.current,x=o.type,r!==null&&o.stateNode!=null)mi?r.memoizedProps!==d&&Ga(o):lv(r,o,x,d);else{if(!d){if(o.stateNode===null)throw Error(a(166));return on(o),null}r=ri.current,ce(o)?nt(o,r):(r=rE(x,d,f,r,!0),o.stateNode=r,Ga(o))}return on(o),null}case 5:if(je(o),x=o.type,r!==null&&o.stateNode!=null)lv(r,o,x,d);else{if(!d){if(o.stateNode===null)throw Error(a(166));return on(o),null}if(M=ri.current,ce(o))nt(o,M),zN(o.stateNode,x,d,M)&&(o.flags|=64);else{var U=CL(x,d,Rr.current,M,o);bd(o),ov(U,o,!1,!1),o.stateNode=U,V1(U,x,d,M)&&Ga(o)}}return on(o),uv(o,o.type,r===null?null:r.memoizedProps,o.pendingProps,f),null;case 6:if(r&&o.stateNode!=null)f=r.memoizedProps,mi?f!==d&&Ga(o):ds&&(f!==d?(r=Rr.current,f=ri.current,bd(o),o.stateNode=k1(d,r,f,o)):o.stateNode=r.stateNode);else{if(typeof d!="string"&&o.stateNode===null)throw Error(a(166));if(r=Rr.current,f=ri.current,ce(o)){if(!gi)throw Error(a(176));if(r=o.stateNode,f=o.memoizedProps,d=null,x=oi,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}AN(r,f,o,d)||Qe(o,!0)}else bd(o),o.stateNode=k1(d,r,f,o)}return on(o),null;case 31:if(f=o.memoizedState,r===null||r.memoizedState!==null){if(d=ce(o),f!==null){if(r===null){if(!d)throw Error(a(318));if(!gi)throw Error(a(556));if(r=o.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));wN(r,o)}else _e(),!(o.flags&128)&&(o.memoizedState=null),o.flags|=4;on(o),r=!1}else f=F(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=f),r=!0;if(!r)return o.flags&256?(ct(o),o):(ct(o),null);if(o.flags&128)throw Error(a(558))}return on(o),null;case 13:if(d=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=ce(o),d!==null&&d.dehydrated!==null){if(r===null){if(!x)throw Error(a(318));if(!gi)throw Error(a(344));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(a(317));CN(x,o)}else _e(),!(o.flags&128)&&(o.memoizedState=null),o.flags|=4;on(o),x=!1}else x=F(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return o.flags&256?(ct(o),o):(ct(o),null)}return ct(o),o.flags&128?(o.lanes=f,o):(f=d!==null,r=r!==null&&r.memoizedState!==null,f&&(d=o.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),M=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(M=d.memoizedState.cachePool.pool),M!==x&&(d.flags|=2048)),f!==r&&f&&(o.child.flags|=8192),Md(o,o.updateQueue),on(o),null);case 4:return Pe(),XM(r,o),r===null&&LL(o.stateNode.containerInfo),on(o),null;case 10:return De(o.type),on(o),null;case 19:if(v(Tn),d=o.memoizedState,d===null)return on(o),null;if(x=(o.flags&128)!==0,M=d.rendering,M===null)if(x)Zc(d,!1);else{if(yn!==0||r!==null&&r.flags&128)for(r=o.child;r!==null;){if(M=Xt(r),M!==null){for(o.flags|=128,Zc(d,!1),r=M.updateQueue,o.updateQueue=r,Md(o,r),o.subtreeFlags=0,r=f,f=o.child;f!==null;)D1(f,r),f=f.sibling;return _(Tn,Tn.current&1|2),Nt&&me(o,d.treeForkCount),o.child}r=r.sibling}d.tail!==null&&Pi()>df&&(o.flags|=128,x=!0,Zc(d,!1),o.lanes=4194304)}else{if(!x)if(r=Xt(M),r!==null){if(o.flags|=128,x=!0,r=r.updateQueue,o.updateQueue=r,Md(o,r),Zc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!M.alternate&&!Nt)return on(o),null}else 2*Pi()-d.renderingStartTime>df&&f!==536870912&&(o.flags|=128,x=!0,Zc(d,!1),o.lanes=4194304);d.isBackwards?(M.sibling=o.child,o.child=M):(r=d.last,r!==null?r.sibling=M:o.child=M,d.last=M)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Pi(),r.sibling=null,f=Tn.current,_(Tn,x?f&1|2:f&1),Nt&&me(o,d.treeForkCount),r):(on(o),null);case 22:case 23:return ct(o),qe(),d=o.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?f&536870912&&!(o.flags&128)&&(on(o),o.subtreeFlags&6&&(o.flags|=8192)):on(o),f=o.updateQueue,f!==null&&Md(o,f.retryQueue),f=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==f&&(o.flags|=2048),r!==null&&v(Fo),null;case 24:return f=null,r!==null&&(f=r.memoizedState.cache),o.memoizedState.cache!==f&&(o.flags|=2048),De(pn),on(o),null;case 25:return null;case 30:return null}throw Error(a(156,o.tag))}function sL(r,o){switch(tt(o),o.tag){case 1:return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return De(pn),Pe(),r=o.flags,r&65536&&!(r&128)?(o.flags=r&-65537|128,o):null;case 26:case 27:case 5:return je(o),null;case 31:if(o.memoizedState!==null){if(ct(o),o.alternate===null)throw Error(a(340));_e()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 13:if(ct(o),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(a(340));_e()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return v(Tn),null;case 4:return Pe(),null;case 10:return De(o.type),null;case 22:case 23:return ct(o),qe(),r!==null&&v(Fo),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 24:return De(pn),null;case 25:return null;default:return null}}function qM(r,o){switch(tt(o),o.tag){case 3:De(pn),Pe();break;case 26:case 27:case 5:je(o);break;case 4:Pe();break;case 31:o.memoizedState!==null&&ct(o);break;case 13:ct(o);break;case 19:v(Tn);break;case 10:De(o.type);break;case 22:case 23:ct(o),qe(),r!==null&&v(Fo);break;case 24:De(pn)}}function jc(r,o){try{var f=o.updateQueue,d=f!==null?f.lastEffect:null;if(d!==null){var x=d.next;f=x;do{if((f.tag&r)===r){d=void 0;var M=f.create,U=f.inst;d=M(),U.destroy=d}f=f.next}while(f!==x)}}catch(H){Vt(o,o.return,H)}}function Er(r,o,f){try{var d=o.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var M=x.next;d=M;do{if((d.tag&r)===r){var U=d.inst,H=U.destroy;if(H!==void 0){U.destroy=void 0,x=o;var ie=f,pe=H;try{pe()}catch(Ae){Vt(x,ie,Ae)}}}d=d.next}while(d!==M)}}catch(Ae){Vt(o,o.return,Ae)}}function YM(r){var o=r.updateQueue;if(o!==null){var f=r.stateNode;try{W(o,f)}catch(d){Vt(r,r.return,d)}}}function ZM(r,o,f){f.props=Uo(r.type,r.memoizedProps),f.state=r.memoizedState;try{f.componentWillUnmount()}catch(d){Vt(r,o,d)}}function Qc(r,o){try{var f=r.ref;if(f!==null){switch(r.tag){case 26:case 27:case 5:var d=ef(r.stateNode);break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof f=="function"?r.refCleanup=f(d):f.current=d}}catch(x){Vt(r,o,x)}}function hs(r,o){var f=r.ref,d=r.refCleanup;if(f!==null)if(typeof d=="function")try{d()}catch(x){Vt(r,o,x)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(x){Vt(r,o,x)}else f.current=null}function jM(r){var o=r.type,f=r.memoizedProps,d=r.stateNode;try{JL(d,o,f,r)}catch(x){Vt(r,r.return,x)}}function cv(r,o,f){try{$L(r.stateNode,r.type,f,o,r)}catch(d){Vt(r,r.return,d)}}function QM(r){return r.tag===5||r.tag===3||(qa?r.tag===26:!1)||(Hn?r.tag===27&&eu(r.type):!1)||r.tag===4}function fv(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||QM(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(Hn&&r.tag===27&&eu(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function hv(r,o,f){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?tN(f,r,o):QL(f,r);else if(d!==4&&(Hn&&d===27&&eu(r.type)&&(f=r.stateNode,o=null),r=r.child,r!==null))for(hv(r,o,f),r=r.sibling;r!==null;)hv(r,o,f),r=r.sibling}function Ed(r,o,f){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?eN(f,r,o):jL(f,r);else if(d!==4&&(Hn&&d===27&&eu(r.type)&&(f=r.stateNode),r=r.child,r!==null))for(Ed(r,o,f),r=r.sibling;r!==null;)Ed(r,o,f),r=r.sibling}function KM(r,o,f){r=r.containerInfo;try{Z1(r,f)}catch(d){Vt(o,o.return,d)}}function JM(r){var o=r.stateNode,f=r.memoizedProps;try{ZN(r.type,f,o,r)}catch(d){Vt(r,r.return,d)}}function rL(r,o){for(AL(r.containerInfo),Qn=o;Qn!==null;)if(r=Qn,o=r.child,(r.subtreeFlags&1028)!==0&&o!==null)o.return=r,Qn=o;else for(;Qn!==null;){r=Qn;var f=r.alternate;switch(o=r.flags,r.tag){case 0:if(o&4&&(o=r.updateQueue,o=o!==null?o.events:null,o!==null))for(var d=0;d<o.length;d++){var x=o[d];x.ref.impl=x.nextImpl}break;case 11:case 15:break;case 1:if(o&1024&&f!==null){o=void 0,d=r,x=f.memoizedProps,f=f.memoizedState;var M=d.stateNode;try{var U=Uo(d.type,x);o=M.getSnapshotBeforeUpdate(U,f),M.__reactInternalSnapshotBeforeUpdate=o}catch(H){Vt(d,d.return,H)}}break;case 3:o&1024&&mi&&lN(r.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(o&1024)throw Error(a(163))}if(o=r.sibling,o!==null){o.return=r.return,Qn=o;break}Qn=r.return}}function $M(r,o,f){var d=f.flags;switch(f.tag){case 0:case 11:case 15:Ls(r,f),d&4&&jc(5,f);break;case 1:if(Ls(r,f),d&4)if(r=f.stateNode,o===null)try{r.componentDidMount()}catch(U){Vt(f,f.return,U)}else{var x=Uo(f.type,o.memoizedProps);o=o.memoizedState;try{r.componentDidUpdate(x,o,r.__reactInternalSnapshotBeforeUpdate)}catch(U){Vt(f,f.return,U)}}d&64&&YM(f),d&512&&Qc(f,f.return);break;case 3:if(Ls(r,f),d&64&&(d=f.updateQueue,d!==null)){if(r=null,f.child!==null)switch(f.child.tag){case 27:case 5:r=ef(f.child.stateNode);break;case 1:r=f.child.stateNode}try{W(d,r)}catch(U){Vt(f,f.return,U)}}break;case 27:Hn&&o===null&&d&4&&JM(f);case 26:case 5:if(Ls(r,f),o===null){if(d&4)jM(f);else if(d&64){r=f.type,o=f.memoizedProps,x=f.stateNode;try{UN(x,r,o,f)}catch(U){Vt(f,f.return,U)}}}d&512&&Qc(f,f.return);break;case 12:Ls(r,f);break;case 31:Ls(r,f),d&4&&t1(r,f);break;case 13:Ls(r,f),d&4&&n1(r,f),d&64&&(d=f.memoizedState,d!==null&&(d=d.dehydrated,d!==null&&(f=dL.bind(null,f),hN(d,f))));break;case 22:if(d=f.memoizedState!==null||Fs,!d){o=o!==null&&o.memoizedState!==null||Un,x=Fs;var M=Un;Fs=d,(Un=o)&&!M?Ns(r,f,(f.subtreeFlags&8772)!==0):Ls(r,f),Fs=x,Un=M}break;case 30:break;default:Ls(r,f)}}function e1(r){var o=r.alternate;o!==null&&(r.alternate=null,e1(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&zL(o)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Xa(r,o,f){for(f=f.child;f!==null;)dv(r,o,f),f=f.sibling}function dv(r,o,f){if(ia&&typeof ia.onCommitFiberUnmount=="function")try{ia.onCommitFiberUnmount(af,f)}catch{}switch(f.tag){case 26:if(qa){Un||hs(f,o),Xa(r,o,f),f.memoizedState?nE(f.memoizedState):f.stateNode&&aE(f.stateNode);break}case 27:if(Hn){Un||hs(f,o);var d=Ln,x=Bi;eu(f.type)&&(Ln=f.stateNode,Bi=!1),Xa(r,o,f),oE(f.stateNode),Ln=d,Bi=x;break}case 5:Un||hs(f,o);case 6:if(mi){if(d=Ln,x=Bi,Ln=null,Xa(r,o,f),Ln=d,Bi=x,Ln!==null)if(Bi)try{iN(Ln,f.stateNode)}catch(M){Vt(f,o,M)}else try{nN(Ln,f.stateNode)}catch(M){Vt(f,o,M)}}else Xa(r,o,f);break;case 18:mi&&Ln!==null&&(Bi?BN(Ln,f.stateNode):PN(Ln,f.stateNode));break;case 4:mi?(d=Ln,x=Bi,Ln=f.stateNode.containerInfo,Bi=!0,Xa(r,o,f),Ln=d,Bi=x):(ds&&KM(f.stateNode,f,q1()),Xa(r,o,f));break;case 0:case 11:case 14:case 15:Er(2,f,o),Un||Er(4,f,o),Xa(r,o,f);break;case 1:Un||(hs(f,o),d=f.stateNode,typeof d.componentWillUnmount=="function"&&ZM(f,o,d)),Xa(r,o,f);break;case 21:Xa(r,o,f);break;case 22:Un=(d=Un)||f.memoizedState!==null,Xa(r,o,f),Un=d;break;default:Xa(r,o,f)}}function t1(r,o){if(gi&&o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{NN(r)}catch(f){Vt(o,o.return,f)}}}function n1(r,o){if(gi&&o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{IN(r)}catch(f){Vt(o,o.return,f)}}function oL(r){switch(r.tag){case 31:case 13:case 19:var o=r.stateNode;return o===null&&(o=r.stateNode=new vE),o;case 22:return r=r.stateNode,o=r._retryCache,o===null&&(o=r._retryCache=new vE),o;default:throw Error(a(435,r.tag))}}function Td(r,o){var f=oL(r);o.forEach(function(d){if(!f.has(d)){f.add(d);var x=pL.bind(null,r,d);d.then(x,x)}})}function pi(r,o){var f=o.deletions;if(f!==null)for(var d=0;d<f.length;d++){var x=f[d],M=r,U=o;if(mi){var H=U;e:for(;H!==null;){switch(H.tag){case 27:if(Hn){if(eu(H.type)){Ln=H.stateNode,Bi=!1;break e}break}case 5:Ln=H.stateNode,Bi=!1;break e;case 3:case 4:Ln=H.stateNode.containerInfo,Bi=!0;break e}H=H.return}if(Ln===null)throw Error(a(160));dv(M,U,x),Ln=null,Bi=!1}else dv(M,U,x);M=x.alternate,M!==null&&(M.return=null),x.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)i1(o,r),o=o.sibling}function i1(r,o){var f=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:pi(o,r),Ai(r),d&4&&(Er(3,r,r.return),jc(3,r),Er(5,r,r.return));break;case 1:pi(o,r),Ai(r),d&512&&(Un||f===null||hs(f,f.return)),d&64&&Fs&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(f=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=f===null?d:f.concat(d))));break;case 26:if(qa){var x=Za;if(pi(o,r),Ai(r),d&512&&(Un||f===null||hs(f,f.return)),d&4){d=f!==null?f.memoizedState:null;var M=r.memoizedState;f===null?M===null?r.stateNode===null?r.stateNode=GN(x,r.type,r.memoizedProps,r):iE(x,r.type,r.stateNode):r.stateNode=tE(x,M,r.memoizedProps):d!==M?(d===null?f.stateNode!==null&&aE(f.stateNode):nE(d),M===null?iE(x,r.type,r.stateNode):tE(x,M,r.memoizedProps)):M===null&&r.stateNode!==null&&cv(r,r.memoizedProps,f.memoizedProps)}break}case 27:if(Hn){pi(o,r),Ai(r),d&512&&(Un||f===null||hs(f,f.return)),f!==null&&d&4&&cv(r,r.memoizedProps,f.memoizedProps);break}case 5:if(pi(o,r),Ai(r),d&512&&(Un||f===null||hs(f,f.return)),mi){if(r.flags&32){x=r.stateNode;try{W1(x)}catch(Se){Vt(r,r.return,Se)}}d&4&&r.stateNode!=null&&(x=r.memoizedProps,cv(r,x,f!==null?f.memoizedProps:x)),d&1024&&(ty=!0)}else ds&&r.alternate!==null&&(r.alternate.stateNode=r.stateNode);break;case 6:if(pi(o,r),Ai(r),d&4&&mi){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,f=f!==null?f.memoizedProps:d,x=r.stateNode;try{KL(x,f,d)}catch(Se){Vt(r,r.return,Se)}}break;case 3:if(qa?(WN(),x=Za,Za=Bv(o.containerInfo),pi(o,r),Za=x):pi(o,r),Ai(r),d&4){if(mi&&gi&&f!==null&&f.memoizedState.isDehydrated)try{LN(o.containerInfo)}catch(Se){Vt(r,r.return,Se)}if(ds){d=o.containerInfo,f=o.pendingChildren;try{Z1(d,f)}catch(Se){Vt(r,r.return,Se)}}}ty&&(ty=!1,a1(r));break;case 4:qa?(f=Za,Za=Bv(r.stateNode.containerInfo),pi(o,r),Ai(r),Za=f):(pi(o,r),Ai(r)),d&4&&ds&&KM(r.stateNode,r,r.stateNode.pendingChildren);break;case 12:pi(o,r),Ai(r);break;case 31:pi(o,r),Ai(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Td(r,d)));break;case 13:pi(o,r),Ai(r),r.child.flags&8192&&r.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(Jd=Pi()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Td(r,d)));break;case 22:x=r.memoizedState!==null;var U=f!==null&&f.memoizedState!==null,H=Fs,ie=Un;if(Fs=H||x,Un=ie||U,pi(o,r),Un=ie,Fs=H,Ai(r),d&8192&&(o=r.stateNode,o._visibility=x?o._visibility&-2:o._visibility|1,x&&(f===null||U||Fs||Un||Lo(r)),mi)){e:if(f=null,mi)for(o=r;;){if(o.tag===5||qa&&o.tag===26){if(f===null){U=f=o;try{M=U.stateNode,x?aN(M):rN(U.stateNode,U.memoizedProps)}catch(Se){Vt(U,U.return,Se)}}}else if(o.tag===6){if(f===null){U=o;try{var pe=U.stateNode;x?sN(pe):oN(pe,U.memoizedProps)}catch(Se){Vt(U,U.return,Se)}}}else if(o.tag===18){if(f===null){U=o;try{var Ae=U.stateNode;x?FN(Ae):HN(U.stateNode)}catch(Se){Vt(U,U.return,Se)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===r)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break e;for(;o.sibling===null;){if(o.return===null||o.return===r)break e;f===o&&(f=null),o=o.return}f===o&&(f=null),o.sibling.return=o.return,o=o.sibling}}d&4&&(d=r.updateQueue,d!==null&&(f=d.retryQueue,f!==null&&(d.retryQueue=null,Td(r,f))));break;case 19:pi(o,r),Ai(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Td(r,d)));break;case 30:break;case 21:break;default:pi(o,r),Ai(r)}}function Ai(r){var o=r.flags;if(o&2){try{for(var f,d=r.return;d!==null;){if(QM(d)){f=d;break}d=d.return}if(mi){if(f==null)throw Error(a(160));switch(f.tag){case 27:if(Hn){var x=f.stateNode,M=fv(r);Ed(r,M,x);break}case 5:var U=f.stateNode;f.flags&32&&(W1(U),f.flags&=-33);var H=fv(r);Ed(r,H,U);break;case 3:case 4:var ie=f.stateNode.containerInfo,pe=fv(r);hv(r,pe,ie);break;default:throw Error(a(161))}}}catch(Ae){Vt(r,r.return,Ae)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function a1(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var o=r;a1(o),o.tag===5&&o.flags&1024&&HL(o.stateNode),r=r.sibling}}function Ls(r,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)$M(r,o.alternate,o),o=o.sibling}function Lo(r){for(r=r.child;r!==null;){var o=r;switch(o.tag){case 0:case 11:case 14:case 15:Er(4,o,o.return),Lo(o);break;case 1:hs(o,o.return);var f=o.stateNode;typeof f.componentWillUnmount=="function"&&ZM(o,o.return,f),Lo(o);break;case 27:Hn&&oE(o.stateNode);case 26:case 5:hs(o,o.return),Lo(o);break;case 22:o.memoizedState===null&&Lo(o);break;case 30:Lo(o);break;default:Lo(o)}r=r.sibling}}function Ns(r,o,f){for(f=f&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var d=o.alternate,x=r,M=o,U=M.flags;switch(M.tag){case 0:case 11:case 15:Ns(x,M,f),jc(4,M);break;case 1:if(Ns(x,M,f),d=M,x=d.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(pe){Vt(d,d.return,pe)}if(d=M,x=d.updateQueue,x!==null){var H=d.stateNode;try{var ie=x.shared.hiddenCallbacks;if(ie!==null)for(x.shared.hiddenCallbacks=null,x=0;x<ie.length;x++)$(ie[x],H)}catch(pe){Vt(d,d.return,pe)}}f&&U&64&&YM(M),Qc(M,M.return);break;case 27:Hn&&JM(M);case 26:case 5:Ns(x,M,f),f&&d===null&&U&4&&jM(M),Qc(M,M.return);break;case 12:Ns(x,M,f);break;case 31:Ns(x,M,f),f&&U&4&&t1(x,M);break;case 13:Ns(x,M,f),f&&U&4&&n1(x,M);break;case 22:M.memoizedState===null&&Ns(x,M,f),Qc(M,M.return);break;case 30:break;default:Ns(x,M,f)}o=o.sibling}}function pv(r,o){var f=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),r=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(r=o.memoizedState.cachePool.pool),r!==f&&(r!=null&&r.refCount++,f!=null&&Xe(f))}function mv(r,o){r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&Xe(r))}function Wa(r,o,f,d){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)s1(r,o,f,d),o=o.sibling}function s1(r,o,f,d){var x=o.flags;switch(o.tag){case 0:case 11:case 15:Wa(r,o,f,d),x&2048&&jc(9,o);break;case 1:Wa(r,o,f,d);break;case 3:Wa(r,o,f,d),x&2048&&(r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&Xe(r)));break;case 12:if(x&2048){Wa(r,o,f,d),r=o.stateNode;try{var M=o.memoizedProps,U=M.id,H=M.onPostCommit;typeof H=="function"&&H(U,o.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(ie){Vt(o,o.return,ie)}}else Wa(r,o,f,d);break;case 31:Wa(r,o,f,d);break;case 13:Wa(r,o,f,d);break;case 23:break;case 22:M=o.stateNode,U=o.alternate,o.memoizedState!==null?M._visibility&2?Wa(r,o,f,d):Kc(r,o):M._visibility&2?Wa(r,o,f,d):(M._visibility|=2,Zl(r,o,f,d,(o.subtreeFlags&10256)!==0||!1)),x&2048&&pv(U,o);break;case 24:Wa(r,o,f,d),x&2048&&mv(o.alternate,o);break;default:Wa(r,o,f,d)}}function Zl(r,o,f,d,x){for(x=x&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var M=r,U=o,H=f,ie=d,pe=U.flags;switch(U.tag){case 0:case 11:case 15:Zl(M,U,H,ie,x),jc(8,U);break;case 23:break;case 22:var Ae=U.stateNode;U.memoizedState!==null?Ae._visibility&2?Zl(M,U,H,ie,x):Kc(M,U):(Ae._visibility|=2,Zl(M,U,H,ie,x)),x&&pe&2048&&pv(U.alternate,U);break;case 24:Zl(M,U,H,ie,x),x&&pe&2048&&mv(U.alternate,U);break;default:Zl(M,U,H,ie,x)}o=o.sibling}}function Kc(r,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var f=r,d=o,x=d.flags;switch(d.tag){case 22:Kc(f,d),x&2048&&pv(d.alternate,d);break;case 24:Kc(f,d),x&2048&&mv(d.alternate,d);break;default:Kc(f,d)}o=o.sibling}}function No(r,o,f){if(r.subtreeFlags&pu)for(r=r.child;r!==null;)r1(r,o,f),r=r.sibling}function r1(r,o,f){switch(r.tag){case 26:if(No(r,o,f),r.flags&pu)if(r.memoizedState!==null)YN(f,Za,r.memoizedState,r.memoizedProps);else{var d=r.stateNode,x=r.type;r=r.memoizedProps,((o&335544128)===o||zv(x,r))&&X1(f,d,x,r)}break;case 5:No(r,o,f),r.flags&pu&&(d=r.stateNode,x=r.type,r=r.memoizedProps,((o&335544128)===o||zv(x,r))&&X1(f,d,x,r));break;case 3:case 4:qa?(d=Za,Za=Bv(r.stateNode.containerInfo),No(r,o,f),Za=d):No(r,o,f);break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=pu,pu=16777216,No(r,o,f),pu=d):No(r,o,f));break;default:No(r,o,f)}}function o1(r){var o=r.alternate;if(o!==null&&(r=o.child,r!==null)){o.child=null;do o=r.sibling,r.sibling=null,r=o;while(r!==null)}}function Jc(r){var o=r.deletions;if(r.flags&16){if(o!==null)for(var f=0;f<o.length;f++){var d=o[f];Qn=d,u1(d,r)}o1(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)l1(r),r=r.sibling}function l1(r){switch(r.tag){case 0:case 11:case 15:Jc(r),r.flags&2048&&Er(9,r,r.return);break;case 3:Jc(r);break;case 12:Jc(r);break;case 22:var o=r.stateNode;r.memoizedState!==null&&o._visibility&2&&(r.return===null||r.return.tag!==13)?(o._visibility&=-3,Ad(r)):Jc(r);break;default:Jc(r)}}function Ad(r){var o=r.deletions;if(r.flags&16){if(o!==null)for(var f=0;f<o.length;f++){var d=o[f];Qn=d,u1(d,r)}o1(r)}for(r=r.child;r!==null;){switch(o=r,o.tag){case 0:case 11:case 15:Er(8,o,o.return),Ad(o);break;case 22:f=o.stateNode,f._visibility&2&&(f._visibility&=-3,Ad(o));break;default:Ad(o)}r=r.sibling}}function u1(r,o){for(;Qn!==null;){var f=Qn;switch(f.tag){case 0:case 11:case 15:Er(8,f,o);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var d=f.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Xe(f.memoizedState.cache)}if(d=f.child,d!==null)d.return=f,Qn=d;else e:for(f=r;Qn!==null;){d=Qn;var x=d.sibling,M=d.return;if(e1(d),d===f){Qn=null;break e}if(x!==null){x.return=M,Qn=x;break e}Qn=M}}}function gv(r){var o=UL(r);if(o!=null){if(typeof o.memoizedProps["data-testname"]!="string")throw Error(a(364));return o}if(r=GL(r),r===null)throw Error(a(362));return r.stateNode.current}function vv(r,o){var f=r.tag;switch(o.$$typeof){case Yd:if(r.type===o.value)return!0;break;case Zd:e:{for(o=o.value,r=[r,0],f=0;f<r.length;){var d=r[f++],x=d.tag,M=r[f++],U=o[M];if(x!==5&&x!==26&&x!==27||!nf(d)){for(;U!=null&&vv(d,U);)M++,U=o[M];if(M===o.length){o=!0;break e}else for(d=d.child;d!==null;)r.push(d,M),d=d.sibling}}o=!1}return o;case jd:if((f===5||f===26||f===27)&&qL(r.stateNode,o.value))return!0;break;case Kd:if((f===5||f===6||f===26||f===27)&&(r=WL(r),r!==null&&0<=r.indexOf(o.value)))return!0;break;case Qd:if((f===5||f===26||f===27)&&(r=r.memoizedProps["data-testname"],typeof r=="string"&&r.toLowerCase()===o.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function yv(r){switch(r.$$typeof){case Yd:return"<"+(g(r.value)||"Unknown")+">";case Zd:return":has("+(yv(r)||"")+")";case jd:return'[role="'+r.value+'"]';case Kd:return'"'+r.value+'"';case Qd:return'[data-testname="'+r.value+'"]';default:throw Error(a(365))}}function c1(r,o){var f=[];r=[r,0];for(var d=0;d<r.length;){var x=r[d++],M=x.tag,U=r[d++],H=o[U];if(M!==5&&M!==26&&M!==27||!nf(x)){for(;H!=null&&vv(x,H);)U++,H=o[U];if(U===o.length)f.push(x);else for(x=x.child;x!==null;)r.push(x,U),x=x.sibling}}return f}function _v(r,o){if(!tf)throw Error(a(363));r=gv(r),r=c1(r,o),o=[],r=Array.from(r);for(var f=0;f<r.length;){var d=r[f++],x=d.tag;if(x===5||x===26||x===27)nf(d)||o.push(d.stateNode);else for(d=d.child;d!==null;)r.push(d),d=d.sibling}return o}function ea(){return Et&2&&Dt!==0?Dt&-Dt:$e.T!==null?ft():NL()}function f1(){if(oa===0)if(!(Dt&536870912)||Nt){var r=Id;Id<<=1,!(Id&3932160)&&(Id=262144),oa=r}else oa=536870912;return r=sa.current,r!==null&&(r.flags|=32),oa}function Oi(r,o,f){(r===nn&&(Yt===2||Yt===9)||r.cancelPendingCommit!==null)&&(jl(r,0),Tr(r,Dt,oa,!1)),R(r,f),(!(Et&2)||r!==nn)&&(r===nn&&(!(Et&2)&&(Go|=f),yn===4&&Tr(r,Dt,oa,!1)),Ce(r))}function h1(r,o,f){if(Et&6)throw Error(a(327));var d=!f&&(o&127)===0&&(o&r.expiredLanes)===0||S(r,o),x=d?cL(r,o):Sv(r,o,!0),M=d;do{if(x===0){mu&&!d&&Tr(r,o,0,!1);break}else{if(f=r.current.alternate,M&&!lL(f)){x=Sv(r,o,!1),M=!1;continue}if(x===2){if(M=o,r.errorRecoveryDisabledLanes&M)var U=0;else U=r.pendingLanes&-536870913,U=U!==0?U:U&536870912?536870912:0;if(U!==0){o=U;e:{var H=r;x=hf;var ie=gi&&H.current.memoizedState.isDehydrated;if(ie&&(jl(H,U).flags|=256),U=Sv(H,U,!1),U!==2){if(ny&&!ie){H.errorRecoveryDisabledLanes|=M,Go|=M,x=4;break e}M=Fi,Fi=x,M!==null&&(Fi===null?Fi=M:Fi.push.apply(Fi,M))}x=U}if(M=!1,x!==2)continue}}if(x===1){jl(r,0),Tr(r,o,0,!0);break}e:{switch(d=r,M=x,M){case 0:case 1:throw Error(a(345));case 4:if((o&4194048)!==o)break;case 6:Tr(d,o,oa,!Lr);break e;case 2:Fi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(x=Jd+300-Pi(),10<x)){if(Tr(d,o,oa,!Lr),y(d,0,!0)!==0)break e;Vs=o,d.timeoutHandle=RL(d1.bind(null,d,f,Fi,$d,ay,o,oa,Go,gu,Lr,M,"Throttled",-0,0),x);break e}d1(d,f,Fi,$d,ay,o,oa,Go,gu,Lr,M,null,-0,0)}}break}while(!0);Ce(r)}function d1(r,o,f,d,x,M,U,H,ie,pe,Ae,Se,Ve,gt){if(r.timeoutHandle=zo,Se=o.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se=BL(),r1(o,M,Se);var Nn=(M&62914560)===M?Jd-Pi():(M&4194048)===M?yE-Pi():0;if(Nn=FL(Se,Nn),Nn!==null){Vs=M,r.cancelPendingCommit=Nn(b1.bind(null,r,o,M,f,d,x,U,H,ie,Ae,Se,null,Ve,gt)),Tr(r,M,U,!pe);return}}b1(r,o,M,f,d,x,U,H,ie)}function lL(r){for(var o=r;;){var f=o.tag;if((f===0||f===11||f===15)&&o.flags&16384&&(f=o.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var d=0;d<f.length;d++){var x=f[d],M=x.getSnapshot;x=x.value;try{if(!aa(M(),x))return!1}catch{return!1}}if(f=o.child,o.subtreeFlags&16384&&f!==null)f.return=o,o=f;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Tr(r,o,f,d){o&=~iy,o&=~Go,r.suspendedLanes|=o,r.pingedLanes&=~o,d&&(r.warmLanes|=o),d=r.expirationTimes;for(var x=o;0<x;){var M=31-na(x),U=1<<M;d[M]=-1,x&=~U}f!==0&&z(r,f,o)}function p1(){return Et&6?!0:(mt(0),!1)}function xv(){if(Tt!==null){if(Yt===0)var r=Tt.return;else r=Tt,Ps=Po=null,ii(r),uu=null,lf=0,r=Tt;for(;r!==null;)qM(r.alternate,r),r=r.return;Tt=null}}function jl(r,o){var f=r.timeoutHandle;f!==zo&&(r.timeoutHandle=zo,DL(f)),f=r.cancelPendingCommit,f!==null&&(r.cancelPendingCommit=null,f()),Vs=0,xv(),nn=r,Tt=f=Is(r.current,null),Dt=o,Yt=0,ra=null,Lr=!1,mu=S(r,o),ny=!1,gu=oa=iy=Go=Nr=yn=0,Fi=hf=null,ay=!1,o&8&&(o|=o&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=o;0<d;){var x=31-na(d),M=1<<x;o|=r[x],d&=~M}return Hs=o,Mr(),f}function m1(r,o){yt=null,$e.H=cf,o===lu||o===kd?(o=Ft(),Yt=3):o===Zv?(o=Ft(),Yt=4):Yt=o===$v?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,ra=o,Tt===null&&(yn=1,yd(r,oe(o,r.current)))}function g1(){var r=sa.current;return r===null?!0:(Dt&4194048)===Dt?Ya===null:(Dt&62914560)===Dt||Dt&536870912?r===Ya:!1}function v1(){var r=$e.H;return $e.H=cf,r===null?cf:r}function y1(){var r=$e.A;return $e.A=lI,r}function wd(){yn=4,Lr||(Dt&4194048)!==Dt&&sa.current!==null||(mu=!0),!(Nr&134217727)&&!(Go&134217727)||nn===null||Tr(nn,Dt,oa,!1)}function Sv(r,o,f){var d=Et;Et|=2;var x=v1(),M=y1();(nn!==r||Dt!==o)&&($d=null,jl(r,o)),o=!1;var U=yn;e:do try{if(Yt!==0&&Tt!==null){var H=Tt,ie=ra;switch(Yt){case 8:xv(),U=6;break e;case 3:case 2:case 9:case 6:sa.current===null&&(o=!0);var pe=Yt;if(Yt=0,ra=null,Ql(r,H,ie,pe),f&&mu){U=0;break e}break;default:pe=Yt,Yt=0,ra=null,Ql(r,H,ie,pe)}}uL(),U=yn;break}catch(Ae){m1(r,Ae)}while(!0);return o&&r.shellSuspendCounter++,Ps=Po=null,Et=d,$e.H=x,$e.A=M,Tt===null&&(nn=null,Dt=0,Mr()),U}function uL(){for(;Tt!==null;)_1(Tt)}function cL(r,o){var f=Et;Et|=2;var d=v1(),x=y1();nn!==r||Dt!==o?($d=null,df=Pi()+500,jl(r,o)):mu=S(r,o);e:do try{if(Yt!==0&&Tt!==null){o=Tt;var M=ra;t:switch(Yt){case 1:Yt=0,ra=null,Ql(r,o,M,1);break;case 2:case 9:if(ht(M)){Yt=0,ra=null,x1(o);break}o=function(){Yt!==2&&Yt!==9||nn!==r||(Yt=7),Ce(r)},M.then(o,o);break e;case 3:Yt=7;break e;case 4:Yt=5;break e;case 7:ht(M)?(Yt=0,ra=null,x1(o)):(Yt=0,ra=null,Ql(r,o,M,7));break;case 5:var U=null;switch(Tt.tag){case 26:U=Tt.memoizedState;case 5:case 27:var H=Tt,ie=H.type,pe=H.pendingProps;if(U?sE(U):G1(H.stateNode,ie,pe)){Yt=0,ra=null;var Ae=H.sibling;if(Ae!==null)Tt=Ae;else{var Se=H.return;Se!==null?(Tt=Se,Cd(Se)):Tt=null}break t}}Yt=0,ra=null,Ql(r,o,M,5);break;case 6:Yt=0,ra=null,Ql(r,o,M,6);break;case 8:xv(),yn=6;break e;default:throw Error(a(462))}}fL();break}catch(Ve){m1(r,Ve)}while(!0);return Ps=Po=null,$e.H=d,$e.A=x,Et=f,Tt!==null?0:(nn=null,Dt=0,Mr(),yn)}function fL(){for(;Tt!==null&&!KN();)_1(Tt)}function _1(r){var o=VM(r.alternate,r,Hs);r.memoizedProps=r.pendingProps,o===null?Cd(r):Tt=o}function x1(r){var o=r,f=o.alternate;switch(o.tag){case 15:case 0:o=zM(f,o,o.pendingProps,o.type,void 0,Dt);break;case 11:o=zM(f,o,o.pendingProps,o.type.render,o.ref,Dt);break;case 5:ii(o);default:qM(f,o),o=Tt=D1(o,Hs),o=VM(f,o,Hs)}r.memoizedProps=r.pendingProps,o===null?Cd(r):Tt=o}function Ql(r,o,f,d){Ps=Po=null,ii(o),uu=null,lf=0;var x=o.return;try{if(tL(r,x,o,f,Dt)){yn=1,yd(r,oe(f,r.current)),Tt=null;return}}catch(M){if(x!==null)throw Tt=x,M;yn=1,yd(r,oe(f,r.current)),Tt=null;return}o.flags&32768?(Nt||d===1?r=!0:mu||Dt&536870912?r=!1:(Lr=r=!0,(d===2||d===9||d===3||d===6)&&(d=sa.current,d!==null&&d.tag===13&&(d.flags|=16384))),S1(o,r)):Cd(o)}function Cd(r){var o=r;do{if(o.flags&32768){S1(o,Lr);return}r=o.return;var f=aL(o.alternate,o,Hs);if(f!==null){Tt=f;return}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);yn===0&&(yn=5)}function S1(r,o){do{var f=sL(r.alternate,r);if(f!==null){f.flags&=32767,Tt=f;return}if(f=r.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!o&&(r=r.sibling,r!==null)){Tt=r;return}Tt=r=f}while(r!==null);yn=6,Tt=null}function b1(r,o,f,d,x,M,U,H,ie){r.cancelPendingCommit=null;do $c();while(Vn!==0);if(Et&6)throw Error(a(327));if(o!==null){if(o===r.current)throw Error(a(177));if(M=o.lanes|o.childLanes,M|=jv,L(r,f,M,U,H,ie),r===nn&&(Tt=nn=null,Dt=0),vu=o,zr=r,Vs=f,sy=M,ry=x,_E=d,o.subtreeFlags&10256||o.flags&10256?(r.callbackNode=null,r.callbackPriority=0,mL(Vv,function(){return w1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=$e.T,$e.T=null,x=Os(),jn(2),U=Et,Et|=4;try{rL(r,o,f)}finally{Et=U,jn(x),$e.T=d}}Vn=1,M1(),E1(),T1()}}function M1(){if(Vn===1){Vn=0;var r=zr,o=vu,f=(o.flags&13878)!==0;if(o.subtreeFlags&13878||f){f=$e.T,$e.T=null;var d=Os();jn(2);var x=Et;Et|=4;try{i1(o,r),wL(r.containerInfo)}finally{Et=x,jn(d),$e.T=f}}r.current=o,Vn=2}}function E1(){if(Vn===2){Vn=0;var r=zr,o=vu,f=(o.flags&8772)!==0;if(o.subtreeFlags&8772||f){f=$e.T,$e.T=null;var d=Os();jn(2);var x=Et;Et|=4;try{$M(r,o.alternate,o)}finally{Et=x,jn(d),$e.T=f}}Vn=3}}function T1(){if(Vn===4||Vn===3){Vn=0,JN();var r=zr,o=vu,f=Vs,d=_E;o.subtreeFlags&10256||o.flags&10256?Vn=5:(Vn=0,vu=zr=null,A1(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(Ir=null),Q(f),o=o.stateNode,ia&&typeof ia.onCommitFiberRoot=="function")try{ia.onCommitFiberRoot(af,o,void 0,(o.current.flags&128)===128)}catch{}if(d!==null){o=$e.T,x=Os(),jn(2),$e.T=null;try{for(var M=r.onRecoverableError,U=0;U<d.length;U++){var H=d[U];M(H.value,{componentStack:H.stack})}}finally{$e.T=o,jn(x)}}Vs&3&&$c(),Ce(r),x=r.pendingLanes,f&261930&&x&42?r===oy?pf++:(pf=0,oy=r):pf=0,gi&&ON(),mt(0)}}function A1(r,o){(r.pooledCacheLanes&=o)===0&&(o=r.pooledCache,o!=null&&(r.pooledCache=null,Xe(o)))}function $c(){return M1(),E1(),T1(),w1()}function w1(){if(Vn!==5)return!1;var r=zr,o=sy;sy=0;var f=Q(Vs),d=32>f?32:f;f=$e.T;var x=Os();try{jn(d),$e.T=null,d=ry,ry=null;var M=zr,U=Vs;if(Vn=0,vu=zr=null,Vs=0,(Et&6)!==0)throw Error(a(331));var H=Et;if(Et|=4,l1(M.current),s1(M,M.current,U,d),Et=H,mt(0,!1),ia&&typeof ia.onPostCommitFiberRoot=="function")try{ia.onPostCommitFiberRoot(af,M)}catch{}return!0}finally{jn(x),$e.T=f,A1(r,o)}}function C1(r,o,f){o=oe(f,o),o=$0(r.stateNode,o,2),r=cs(r,o,2),r!==null&&(R(r,2),Ce(r))}function Vt(r,o,f){if(r.tag===3)C1(r,r,f);else for(;o!==null;){if(o.tag===3){C1(o,r,f);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ir===null||!Ir.has(d))){r=oe(f,r),f=wM(2),d=cs(o,f,2),d!==null&&(CM(f,d,o,r),R(d,2),Ce(d));break}}o=o.return}}function bv(r,o,f){var d=r.pingCache;if(d===null){d=r.pingCache=new uI;var x=new Set;d.set(o,x)}else x=d.get(o),x===void 0&&(x=new Set,d.set(o,x));x.has(f)||(ny=!0,x.add(f),r=hL.bind(null,r,o,f),o.then(r,r))}function hL(r,o,f){var d=r.pingCache;d!==null&&d.delete(o),r.pingedLanes|=r.suspendedLanes&f,r.warmLanes&=~f,nn===r&&(Dt&f)===f&&(yn===4||yn===3&&(Dt&62914560)===Dt&&300>Pi()-Jd?!(Et&2)&&jl(r,0):iy|=f,gu===Dt&&(gu=0)),Ce(r)}function R1(r,o){o===0&&(o=A()),r=Ma(r,o),r!==null&&(R(r,o),Ce(r))}function dL(r){var o=r.memoizedState,f=0;o!==null&&(f=o.retryLane),R1(r,f)}function pL(r,o){var f=0;switch(r.tag){case 31:case 13:var d=r.stateNode,x=r.memoizedState;x!==null&&(f=x.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(o),R1(r,f)}function mL(r,o){return Od(r,o)}function gL(r,o,f,d){this.tag=r,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mv(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Is(r,o){var f=r.alternate;return f===null?(f=t(r.tag,o,r.key,r.mode),f.elementType=r.elementType,f.type=r.type,f.stateNode=r.stateNode,f.alternate=r,r.alternate=f):(f.pendingProps=o,f.type=r.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=r.flags&65011712,f.childLanes=r.childLanes,f.lanes=r.lanes,f.child=r.child,f.memoizedProps=r.memoizedProps,f.memoizedState=r.memoizedState,f.updateQueue=r.updateQueue,o=r.dependencies,f.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},f.sibling=r.sibling,f.index=r.index,f.ref=r.ref,f.refCleanup=r.refCleanup,f}function D1(r,o){r.flags&=65011714;var f=r.alternate;return f===null?(r.childLanes=0,r.lanes=o,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=f.childLanes,r.lanes=f.lanes,r.child=f.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=f.memoizedProps,r.memoizedState=f.memoizedState,r.updateQueue=f.updateQueue,r.type=f.type,o=f.dependencies,r.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),r}function Rd(r,o,f,d,x,M){var U=0;if(d=r,typeof r=="function")Mv(r)&&(U=1);else if(typeof r=="string")U=qa&&Hn?$1(r,f,ri.current)?26:lE(r)?27:5:qa?$1(r,f,ri.current)?26:5:Hn&&lE(r)?27:5;else e:switch(r){case Nv:return r=t(31,f,o,x),r.elementType=Nv,r.lanes=M,r;case Jl:return Io(f.children,x,M,o);case P1:U=8,x|=24;break;case Cv:return r=t(12,f,o,x|2),r.elementType=Cv,r.lanes=M,r;case Dv:return r=t(13,f,o,x),r.elementType=Dv,r.lanes=M,r;case Uv:return r=t(19,f,o,x),r.elementType=Uv,r.lanes=M,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Ar:U=10;break e;case B1:U=9;break e;case Rv:U=11;break e;case Lv:U=14;break e;case wr:U=16,d=null;break e}U=29,f=Error(a(130,r===null?"null":typeof r,"")),d=null}return o=t(U,f,o,x),o.elementType=r,o.type=d,o.lanes=M,o}function Io(r,o,f,d){return r=t(7,r,d,o),r.lanes=f,r}function Ev(r,o,f){return r=t(6,r,null,o),r.lanes=f,r}function U1(r){var o=t(18,null,null,0);return o.stateNode=r,o}function Tv(r,o,f){return o=t(4,r.children!==null?r.children:[],r.key,o),o.lanes=f,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function vL(r,o,f,d,x,M,U,H,ie){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=zo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=I(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=I(0),this.hiddenUpdates=I(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=M,this.onRecoverableError=U,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.incompleteTransitions=new Map}function L1(r,o,f,d,x,M,U,H,ie,pe,Ae,Se){return r=new vL(r,o,f,U,ie,pe,Ae,Se,H),o=1,M===!0&&(o|=24),M=t(3,null,null,o),r.current=M,M.stateNode=r,o=le(),o.refCount++,r.pooledCache=o,o.refCount++,M.memoizedState={element:d,isDehydrated:f,cache:o},Wl(M),r}function N1(r){return r?(r=nu,r):nu}function I1(r){var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=u(o),r=r!==null?c(r):null,r===null?null:ef(r.stateNode)}function z1(r,o,f,d,x,M){x=N1(x),d.context===null?d.context=x:d.pendingContext=x,d=us(o),d.payload={element:f},M=M===void 0?null:M,M!==null&&(d.callback=M),f=cs(r,d,o),f!==null&&(Oi(f,r,o),Ro(f,r,o))}function O1(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var f=r.retryLane;r.retryLane=f!==0&&f<o?f:o}}function Av(r,o){O1(r,o),(r=r.alternate)&&O1(r,o)}var Mt={},yL=Fw,ta=dI,wv=Object.assign,_L=Symbol.for("react.element"),Dd=Symbol.for("react.transitional.element"),Kl=Symbol.for("react.portal"),Jl=Symbol.for("react.fragment"),P1=Symbol.for("react.strict_mode"),Cv=Symbol.for("react.profiler"),B1=Symbol.for("react.consumer"),Ar=Symbol.for("react.context"),Rv=Symbol.for("react.forward_ref"),Dv=Symbol.for("react.suspense"),Uv=Symbol.for("react.suspense_list"),Lv=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),Nv=Symbol.for("react.activity"),xL=Symbol.for("react.memo_cache_sentinel"),F1=Symbol.iterator,SL=Symbol.for("react.client.reference"),Ud=Array.isArray,$e=yL.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,bL=e.rendererVersion,ML=e.rendererPackageName,H1=e.extraDevToolsConfig,ef=e.getPublicInstance,EL=e.getRootHostContext,TL=e.getChildHostContext,AL=e.prepareForCommit,wL=e.resetAfterCommit,CL=e.createInstance;e.cloneMutableInstance;var Iv=e.appendInitialChild,V1=e.finalizeInitialChildren,Ld=e.shouldSetTextContent,k1=e.createTextInstance;e.cloneMutableTextInstance;var RL=e.scheduleTimeout,DL=e.cancelTimeout,zo=e.noTimeout,zs=e.isPrimaryRenderer;e.warnsIfNotActing;var mi=e.supportsMutation,ds=e.supportsPersistence,gi=e.supportsHydration,UL=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var LL=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var jn=e.setCurrentUpdatePriority,Os=e.getCurrentUpdatePriority,NL=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var IL=e.shouldAttemptEagerTransition,zL=e.detachDeletedInstance;e.requestPostPaintCallback;var OL=e.maySuspendCommit,PL=e.maySuspendCommitOnUpdate,zv=e.maySuspendCommitInSyncRender,G1=e.preloadInstance,BL=e.startSuspendingCommit,X1=e.suspendInstance;e.suspendOnActiveViewTransition;var FL=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var $l=e.NotPendingTransition,Oo=e.HostTransitionContext,HL=e.resetFormInstance;e.bindToConsole;var VL=e.supportsMicrotasks,kL=e.scheduleMicrotask,tf=e.supportsTestSelectors,GL=e.findFiberRoot,XL=e.getBoundingRect,WL=e.getTextContent,nf=e.isHiddenSubtree,qL=e.matchAccessibilityRole,YL=e.setFocusIfFocusable,ZL=e.setupIntersectionObserver,jL=e.appendChild,QL=e.appendChildToContainer,KL=e.commitTextUpdate,JL=e.commitMount,$L=e.commitUpdate,eN=e.insertBefore,tN=e.insertInContainerBefore,nN=e.removeChild,iN=e.removeChildFromContainer,W1=e.resetTextContent,aN=e.hideInstance,sN=e.hideTextInstance,rN=e.unhideInstance,oN=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var lN=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var uN=e.cloneInstance,q1=e.createContainerChildSet,Y1=e.appendChildToContainerChildSet,cN=e.finalizeContainerChildren,Z1=e.replaceContainerChildren,j1=e.cloneHiddenInstance,Q1=e.cloneHiddenTextInstance,Ov=e.isSuspenseInstancePending,Pv=e.isSuspenseInstanceFallback,fN=e.getSuspenseInstanceFallbackErrorDetails,hN=e.registerSuspenseInstanceRetry,dN=e.canHydrateFormStateMarker,pN=e.isFormStateMarkerMatching,K1=e.getNextHydratableSibling,mN=e.getNextHydratableSiblingAfterSingleton,gN=e.getFirstHydratableChild,vN=e.getFirstHydratableChildWithinContainer,yN=e.getFirstHydratableChildWithinActivityInstance,_N=e.getFirstHydratableChildWithinSuspenseInstance,xN=e.getFirstHydratableChildWithinSingleton,SN=e.canHydrateInstance,bN=e.canHydrateTextInstance,MN=e.canHydrateActivityInstance,EN=e.canHydrateSuspenseInstance,TN=e.hydrateInstance,AN=e.hydrateTextInstance,wN=e.hydrateActivityInstance,CN=e.hydrateSuspenseInstance,RN=e.getNextHydratableInstanceAfterActivityInstance,DN=e.getNextHydratableInstanceAfterSuspenseInstance,UN=e.commitHydratedInstance,LN=e.commitHydratedContainer,NN=e.commitHydratedActivityInstance,IN=e.commitHydratedSuspenseInstance,zN=e.finalizeHydratedChildren,ON=e.flushHydrationEvents;e.clearActivityBoundary;var PN=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var BN=e.clearSuspenseBoundaryFromContainer,FN=e.hideDehydratedBoundary,HN=e.unhideDehydratedBoundary,J1=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var VN=e.validateHydratableInstance,kN=e.validateHydratableTextInstance,qa=e.supportsResources,$1=e.isHostHoistableType,Bv=e.getHoistableRoot,eE=e.getResource,tE=e.acquireResource,nE=e.releaseResource,GN=e.hydrateHoistable,iE=e.mountHoistable,aE=e.unmountHoistable,XN=e.createHoistableInstance,WN=e.prepareToCommitHoistables,qN=e.mayResourceSuspendCommit,sE=e.preloadResource,YN=e.suspendResource,Hn=e.supportsSingletons,rE=e.resolveSingletonInstance,ZN=e.acquireSingletonInstance,oE=e.releaseSingletonInstance,lE=e.isHostSingletonType,eu=e.isSingletonScope,Fv=[],tu=-1,nu={},na=Math.clz32?Math.clz32:T,jN=Math.log,QN=Math.LN2,Nd=256,Id=262144,zd=4194304,Od=ta.unstable_scheduleCallback,Hv=ta.unstable_cancelCallback,KN=ta.unstable_shouldYield,JN=ta.unstable_requestPaint,Pi=ta.unstable_now,uE=ta.unstable_ImmediatePriority,$N=ta.unstable_UserBlockingPriority,Vv=ta.unstable_NormalPriority,eI=ta.unstable_IdlePriority,tI=ta.log,nI=ta.unstable_setDisableYieldValue,af=null,ia=null,aa=typeof Object.is=="function"?Object.is:j,cE=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},iI=Object.prototype.hasOwnProperty,kv,fE,Gv=!1,hE=new WeakMap,iu=[],au=0,Pd=null,sf=0,Aa=[],wa=0,Cr=null,ps=1,ms="",ri=m(null),rf=m(null),Rr=m(null),Bd=m(null),oi=null,dn=null,Nt=!1,Dr=null,Ca=!1,Xv=Error(a(519)),Fd=m(null),Po=null,Ps=null,aI=typeof AbortController<"u"?AbortController:function(){var r=[],o=this.signal={aborted:!1,addEventListener:function(f,d){r.push(d)}};this.abort=function(){o.aborted=!0,r.forEach(function(f){return f()})}},sI=ta.unstable_scheduleCallback,rI=ta.unstable_NormalPriority,pn={$$typeof:Ar,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Hd=null,su=null,Wv=!1,Vd=!1,qv=!1,Bo=0,of=null,Yv=0,ru=0,ou=null,dE=$e.S;$e.S=function(r,o){yE=Pi(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&Kt(r,o),dE!==null&&dE(r,o)};var Fo=m(null),lu=Error(a(460)),Zv=Error(a(474)),kd=Error(a(542)),Gd={then:function(){}},Ho=null,uu=null,lf=0,Vo=ls(!0),pE=ls(!1),Ra=[],cu=0,jv=0,Ur=!1,Qv=!1,fu=m(null),Xd=m(0),sa=m(null),Ya=null,Tn=m(0),Bs=0,yt=null,Jt=null,Rn=null,Wd=!1,hu=!1,ko=!1,qd=0,uf=0,du=null,oI=0,cf={readContext:Z,use:ai,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st};cf.useEffectEvent=st;var mE={readContext:Z,use:ai,useCallback:function(r,o){return En().memoizedState=[r,o===void 0?null:o],r},useContext:Z,useEffect:lM,useImperativeHandle:function(r,o,f){f=f!=null?f.concat([r]):null,md(4194308,4,hM.bind(null,o,r),f)},useLayoutEffect:function(r,o){return md(4194308,4,r,o)},useInsertionEffect:function(r,o){md(4,2,r,o)},useMemo:function(r,o){var f=En();o=o===void 0?null:o;var d=r();if(ko){k(!0);try{r()}finally{k(!1)}}return f.memoizedState=[d,o],d},useReducer:function(r,o,f){var d=En();if(f!==void 0){var x=f(o);if(ko){k(!0);try{f(o)}finally{k(!1)}}}else x=o;return d.memoizedState=d.baseState=x,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:x},d.queue=r,r=r.dispatch=eL.bind(null,yt,r),[d.memoizedState,r]},useRef:function(r){var o=En();return r={current:r},o.memoizedState=r},useState:function(r){r=W0(r);var o=r.queue,f=SM.bind(null,yt,o);return o.dispatch=f,[r.memoizedState,f]},useDebugValue:Z0,useDeferredValue:function(r,o){var f=En();return j0(f,r,o)},useTransition:function(){var r=W0(!1);return r=vM.bind(null,yt,r.queue,!0,!1),En().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,o,f){var d=yt,x=En();if(Nt){if(f===void 0)throw Error(a(407));f=f()}else{if(f=o(),nn===null)throw Error(a(349));Dt&127||qb(d,o,f)}x.memoizedState=f;var M={value:f,getSnapshot:o};return x.queue=M,lM(Zb.bind(null,d,M,r),[r]),d.flags|=2048,Yl(9,{destroy:void 0},Yb.bind(null,d,M,f,o),null),f},useId:function(){var r=En(),o=nn.identifierPrefix;if(Nt){var f=ms,d=ps;f=(d&~(1<<32-na(d)-1)).toString(32)+f,o="_"+o+"R_"+f,f=qd++,0<f&&(o+="H"+f.toString(32)),o+="_"}else f=oI++,o="_"+o+"r_"+f.toString(32)+"_";return r.memoizedState=o},useHostTransitionStatus:Q0,useFormState:iM,useActionState:iM,useOptimistic:function(r){var o=En();o.memoizedState=o.baseState=r;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=f,o=K0.bind(null,yt,!0,f),f.dispatch=o,[r,o]},useMemoCache:Ta,useCacheRefresh:function(){return En().memoizedState=$U.bind(null,yt)},useEffectEvent:function(r){var o=En(),f={impl:r};return o.memoizedState=f,function(){if(Et&2)throw Error(a(440));return f.impl.apply(void 0,arguments)}}},Kv={readContext:Z,use:ai,useCallback:pM,useContext:Z,useEffect:Y0,useImperativeHandle:dM,useInsertionEffect:cM,useLayoutEffect:fM,useMemo:mM,useReducer:Do,useRef:oM,useState:function(){return Do(Zn)},useDebugValue:Z0,useDeferredValue:function(r,o){var f=ut();return gM(f,Jt.memoizedState,r,o)},useTransition:function(){var r=Do(Zn)[0],o=ut().memoizedState;return[typeof r=="boolean"?r:ka(r),o]},useSyncExternalStore:Wb,useId:_M,useHostTransitionStatus:Q0,useFormState:aM,useActionState:aM,useOptimistic:function(r,o){var f=ut();return Kb(f,Jt,r,o)},useMemoCache:Ta,useCacheRefresh:xM};Kv.useEffectEvent=uM;var gE={readContext:Z,use:ai,useCallback:pM,useContext:Z,useEffect:Y0,useImperativeHandle:dM,useInsertionEffect:cM,useLayoutEffect:fM,useMemo:mM,useReducer:X0,useRef:oM,useState:function(){return X0(Zn)},useDebugValue:Z0,useDeferredValue:function(r,o){var f=ut();return Jt===null?j0(f,r,o):gM(f,Jt.memoizedState,r,o)},useTransition:function(){var r=X0(Zn)[0],o=ut().memoizedState;return[typeof r=="boolean"?r:ka(r),o]},useSyncExternalStore:Wb,useId:_M,useHostTransitionStatus:Q0,useFormState:rM,useActionState:rM,useOptimistic:function(r,o){var f=ut();return Jt!==null?Kb(f,Jt,r,o):(f.baseState=r,[r,f.queue.dispatch])},useMemoCache:Ta,useCacheRefresh:xM};gE.useEffectEvent=uM;var Jv={enqueueSetState:function(r,o,f){r=r._reactInternals;var d=ea(),x=us(d);x.payload=o,f!=null&&(x.callback=f),o=cs(r,x,d),o!==null&&(Oi(o,r,d),Ro(o,r,d))},enqueueReplaceState:function(r,o,f){r=r._reactInternals;var d=ea(),x=us(d);x.tag=1,x.payload=o,f!=null&&(x.callback=f),o=cs(r,x,d),o!==null&&(Oi(o,r,d),Ro(o,r,d))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var f=ea(),d=us(f);d.tag=2,o!=null&&(d.callback=o),o=cs(r,d,f),o!==null&&(Oi(o,r,f),Ro(o,r,f))}},$v=Error(a(461)),Dn=!1,ey={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Fs=!1,Un=!1,ty=!1,vE=typeof WeakSet=="function"?WeakSet:Set,Qn=null,Ln=null,Bi=!1,Za=null,pu=8192,lI={getCacheForType:function(r){var o=Z(pn),f=o.data.get(r);return f===void 0&&(f=r(),o.data.set(r,f)),f},cacheSignal:function(){return Z(pn).controller.signal}},Yd=0,Zd=1,jd=2,Qd=3,Kd=4;if(typeof Symbol=="function"&&Symbol.for){var ff=Symbol.for;Yd=ff("selector.component"),Zd=ff("selector.has_pseudo_class"),jd=ff("selector.role"),Qd=ff("selector.test_id"),Kd=ff("selector.text")}var uI=typeof WeakMap=="function"?WeakMap:Map,Et=0,nn=null,Tt=null,Dt=0,Yt=0,ra=null,Lr=!1,mu=!1,ny=!1,Hs=0,yn=0,Nr=0,Go=0,iy=0,oa=0,gu=0,hf=null,Fi=null,ay=!1,Jd=0,yE=0,df=1/0,$d=null,Ir=null,Vn=0,zr=null,vu=null,Vs=0,sy=0,ry=null,_E=null,pf=0,oy=null;return Mt.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var o=Ma(r,67108864);o!==null&&Oi(o,r,67108864),Av(r,67108864)}},Mt.attemptHydrationAtCurrentPriority=function(r){if(r.tag===13||r.tag===31){var o=ea();o=B(o);var f=Ma(r,o);f!==null&&Oi(f,r,o),Av(r,o)}},Mt.attemptSynchronousHydration=function(r){switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var o=b(r.pendingLanes);if(o!==0){for(r.pendingLanes|=2,r.entangledLanes|=2;o;){var f=1<<31-na(o);r.entanglements[1]|=f,o&=~f}Ce(r),!(Et&6)&&(df=Pi()+500,mt(0))}}break;case 31:case 13:o=Ma(r,2),o!==null&&Oi(o,r,2),p1(),Av(r,2)}},Mt.batchedUpdates=function(r,o){return r(o)},Mt.createComponentSelector=function(r){return{$$typeof:Yd,value:r}},Mt.createContainer=function(r,o,f,d,x,M,U,H,ie,pe){return L1(r,o,!1,null,f,d,M,null,U,H,ie,pe)},Mt.createHasPseudoClassSelector=function(r){return{$$typeof:Zd,value:r}},Mt.createHydrationContainer=function(r,o,f,d,x,M,U,H,ie,pe,Ae,Se,Ve,gt){var Nn;return r=L1(f,d,!0,r,x,M,H,gt,ie,pe,Ae,Se),r.context=N1(null),f=r.current,d=ea(),d=B(d),x=us(d),x.callback=(Nn=o)!=null?Nn:null,cs(f,x,d),o=d,r.current.lanes=o,R(r,o),Ce(r),r},Mt.createPortal=function(r,o,f){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Kl,key:d==null?null:""+d,children:r,containerInfo:o,implementation:f}},Mt.createRoleSelector=function(r){return{$$typeof:jd,value:r}},Mt.createTestNameSelector=function(r){return{$$typeof:Qd,value:r}},Mt.createTextSelector=function(r){return{$$typeof:Kd,value:r}},Mt.defaultOnCaughtError=function(r){console.error(r)},Mt.defaultOnRecoverableError=function(r){cE(r)},Mt.defaultOnUncaughtError=function(r){cE(r)},Mt.deferredUpdates=function(r){var o=$e.T,f=Os();try{return jn(32),$e.T=null,r()}finally{jn(f),$e.T=o}},Mt.discreteUpdates=function(r,o,f,d,x){var M=$e.T,U=Os();try{return jn(2),$e.T=null,r(o,f,d,x)}finally{jn(U),$e.T=M,Et===0&&(df=Pi()+500)}},Mt.findAllNodes=_v,Mt.findBoundingRects=function(r,o){if(!tf)throw Error(a(363));o=_v(r,o),r=[];for(var f=0;f<o.length;f++)r.push(XL(o[f]));for(o=r.length-1;0<o;o--){f=r[o];for(var d=f.x,x=d+f.width,M=f.y,U=M+f.height,H=o-1;0<=H;H--)if(o!==H){var ie=r[H],pe=ie.x,Ae=pe+ie.width,Se=ie.y,Ve=Se+ie.height;if(d>=pe&&M>=Se&&x<=Ae&&U<=Ve){r.splice(o,1);break}else if(d!==pe||f.width!==ie.width||Ve<M||Se>U){if(!(M!==Se||f.height!==ie.height||Ae<d||pe>x)){pe>d&&(ie.width+=pe-d,ie.x=d),Ae<x&&(ie.width=x-pe),r.splice(o,1);break}}else{Se>M&&(ie.height+=Se-M,ie.y=M),Ve<U&&(ie.height=U-Se),r.splice(o,1);break}}}return r},Mt.findHostInstance=I1,Mt.findHostInstanceWithNoPortals=function(r){return r=u(r),r=r!==null?h(r):null,r===null?null:ef(r.stateNode)},Mt.findHostInstanceWithWarning=function(r){return I1(r)},Mt.flushPassiveEffects=$c,Mt.flushSyncFromReconciler=function(r){var o=Et;Et|=1;var f=$e.T,d=Os();try{if(jn(2),$e.T=null,r)return r()}finally{jn(d),$e.T=f,Et=o,!(Et&6)&&mt(0)}},Mt.flushSyncWork=p1,Mt.focusWithin=function(r,o){if(!tf)throw Error(a(363));for(r=gv(r),o=c1(r,o),o=Array.from(o),r=0;r<o.length;){var f=o[r++],d=f.tag;if(!nf(f)){if((d===5||d===26||d===27)&&YL(f.stateNode))return!0;for(f=f.child;f!==null;)o.push(f),f=f.sibling}}return!1},Mt.getFindAllNodesFailureDescription=function(r,o){if(!tf)throw Error(a(363));var f=0,d=[];r=[gv(r),0];for(var x=0;x<r.length;){var M=r[x++],U=M.tag,H=r[x++],ie=o[H];if((U!==5&&U!==26&&U!==27||!nf(M))&&(vv(M,ie)&&(d.push(yv(ie)),H++,H>f&&(f=H)),H<o.length))for(M=M.child;M!==null;)r.push(M,H),M=M.sibling}if(f<o.length){for(r=[];f<o.length;f++)r.push(yv(o[f]));return`findAllNodes was able to match part of the selector:
  `+(d.join(" > ")+`

No matching component was found for:
  `)+r.join(" > ")}return null},Mt.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return ef(r.child.stateNode);default:return r.child.stateNode}},Mt.injectIntoDevTools=function(){var r={bundleType:0,version:bL,rendererPackageName:ML,currentDispatcherRef:$e,reconcilerVersion:"19.2.0"};if(H1!==null&&(r.rendererConfig=H1),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)r=!0;else{try{af=o.inject(r),ia=o}catch{}r=!!o.checkDCE}}return r},Mt.isAlreadyRendering=function(){return(Et&6)!==0},Mt.observeVisibleRects=function(r,o,f,d){if(!tf)throw Error(a(363));r=_v(r,o);var x=ZL(r,f,d).disconnect;return{disconnect:function(){x()}}},Mt.shouldError=function(){return null},Mt.shouldSuspend=function(){return!1},Mt.startHostTransition=function(r,o,f,d){if(r.tag!==5)throw Error(a(476));var x=yM(r).queue;vM(r,x,o,$l,f===null?i:function(){var M=yM(r);return M.next===null&&(M=r.alternate.memoizedState),qc(r,M.next.queue,{},ea()),f(d)})},Mt.updateContainer=function(r,o,f,d){var x=o.current,M=ea();return z1(x,M,r,o,f,d),M},Mt.updateContainerSync=function(r,o,f,d){return z1(o.current,2,r,o,f,d),2},Mt},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})}(Uw)),Uw.exports}var Nw;function Vk(){return Nw||(Nw=1,Dw.exports=Hk()),Dw.exports}var kk=Vk();const Gk=Fk(kk);function Xk(n){const e=Gk(n);return e.injectIntoDevTools(),e}const GU=0,Dc={},Wk=/^three(?=[A-Z])/,k0=n=>`${n[0].toUpperCase()}${n.slice(1)}`;let qk=0;const Yk=n=>typeof n=="function";function Zk(n){if(Yk(n)){const e=`${qk++}`;return Dc[e]=n,e}else Object.assign(Dc,n)}function XU(n,e){const t=k0(n),i=Dc[t];if(n!=="primitive"&&!i)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(n==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function jk(n,e,t){var i;return n=k0(n)in Dc?n:n.replace(Wk,""),XU(n,e),n==="primitive"&&(i=e.object)!=null&&i.__r3f&&delete e.object.__r3f,Vg(e.object,t,n,e)}function Qk(n){if(!n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?Gg(n.parent,n):qi(n.object)&&(n.object.visible=!1),n.isHidden=!0,Xc(n)}}function WU(n){if(n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?kg(n.parent,n):qi(n.object)&&n.props.visible!==!1&&(n.object.visible=!0),n.isHidden=!1,Xc(n)}}function Xb(n,e,t){const i=e.root.getState();if(!(!n.parent&&n.object!==i.scene)){if(!e.object){var a,s;const l=Dc[k0(e.type)];e.object=(a=e.props.object)!=null?a:new l(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(Jr(e.object,e.props),e.props.attach)kg(n,e);else if(qi(e.object)&&qi(n.object)){const l=n.object.children.indexOf(t==null?void 0:t.object);if(t&&l!==-1){const u=n.object.children.indexOf(e.object);if(u!==-1){n.object.children.splice(u,1);const c=u<l?l-1:l;n.object.children.splice(c,0,e.object)}else e.object.parent=n.object,n.object.children.splice(l,0,e.object),e.object.dispatchEvent({type:"added"}),n.object.dispatchEvent({type:"childadded",child:e.object})}else n.object.add(e.object)}for(const l of e.children)Xb(e,l);Xc(e)}}function L_(n,e){e&&(e.parent=n,n.children.push(e),Xb(n,e))}function Iw(n,e,t){if(!e||!t)return;e.parent=n;const i=n.children.indexOf(t);i!==-1?n.children.splice(i,0,e):n.children.push(e),Xb(n,e,t)}function qU(n){if(typeof n.dispose=="function"){const e=()=>{try{n.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Am.unstable_scheduleCallback(Am.unstable_IdlePriority,e)}}function Kx(n,e,t){if(!e)return;e.parent=null;const i=n.children.indexOf(e);i!==-1&&n.children.splice(i,1),e.props.attach?Gg(n,e):qi(e.object)&&qi(n.object)&&(n.object.remove(e.object),Uk(zU(e),e.object));const a=e.props.dispose!==null&&t!==!1;for(let s=e.children.length-1;s>=0;s--){const l=e.children[s];Kx(e,l,a)}e.children.length=0,delete e.object.__r3f,a&&e.type!=="primitive"&&e.object.type!=="Scene"&&qU(e.object),t===void 0&&Xc(e)}function Kk(n,e){for(const t of[n,n.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const i=t.ref(e);typeof i=="function"&&(t.refCleanup=i)}else t.ref&&(t.ref.current=e)}const Tm=[];function Jk(){for(const[t]of Tm){const i=t.parent;if(i){t.props.attach?Gg(i,t):qi(t.object)&&qi(i.object)&&i.object.remove(t.object);for(const a of t.children)a.props.attach?Gg(t,a):qi(a.object)&&qi(t.object)&&t.object.remove(a.object)}t.isHidden&&WU(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&qU(t.object)}for(const[t,i,a]of Tm){t.props=i;const s=t.parent;if(s){var n,e;const l=Dc[k0(t.type)];t.object=(n=t.props.object)!=null?n:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,Kk(a,t.object),Jr(t.object,t.props),t.props.attach?kg(s,t):qi(t.object)&&qi(s.object)&&s.object.add(t.object);for(const u of t.children)u.props.attach?kg(t,u):qi(u.object)&&qi(t.object)&&t.object.add(u.object);Xc(t)}}Tm.length=0}const N_=()=>{},zw={};let om=GU;const $k=0,e8=4,Jx=Xk({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:jk,removeChild:Kx,appendChild:L_,appendInitialChild:L_,insertBefore:Iw,appendChildToContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||L_(t,e)},removeChildFromContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||Kx(t,e)},insertInContainerBefore(n,e,t){const i=n.getState().scene.__r3f;!e||!t||!i||Iw(i,e,t)},getRootHostContext:()=>zw,getChildHostContext:()=>zw,commitUpdate(n,e,t,i,a){var s,l,u;XU(e,i);let c=!1;if((n.type==="primitive"&&t.object!==i.object||((s=i.args)==null?void 0:s.length)!==((l=t.args)==null?void 0:l.length)||(u=i.args)!=null&&u.some((p,g)=>{var m;return p!==((m=t.args)==null?void 0:m[g])}))&&(c=!0),c)Tm.push([n,{...i},a]);else{const p=wk(n,i);Object.keys(p).length&&(Object.assign(n.props,p),Jr(n.object,p))}(a.sibling===null||(a.flags&e8)===$k)&&Jk()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:n=>n==null?void 0:n.object,prepareForCommit:()=>null,preparePortalMount:n=>Vg(n.getState().scene,n,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:Qk,unhideInstance:WU,createTextInstance:N_,hideTextInstance:N_,unhideTextInstance:N_,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:pt.createContext(null),setCurrentUpdatePriority(n){om=n},getCurrentUpdatePriority(){return om},resolveUpdatePriority(){var n;if(om!==GU)return om;switch(typeof window<"u"&&((n=window.event)==null?void 0:n.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Pk;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return zk;default:return Ok}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:Bk.version,applyViewTransitionName(n,e,t){},restoreViewTransitionName(n,e){},cancelViewTransitionName(n,e,t){},cancelRootViewTransitionName(n){},restoreRootViewTransitionName(n){},InstanceMeasurement:null,measureInstance:n=>null,wasInstanceInViewport:n=>!0,hasInstanceChanged:(n,e)=>!1,hasInstanceAffectedParent:(n,e)=>!1,suspendOnActiveViewTransition(n,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(n){},createViewTransitionInstance:n=>null,getCurrentGestureOffset(n){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(n,e){return n},cloneMutableTextInstance(n){return n},cloneRootViewTransitionContainer(n){throw new Error("Not implemented.")},removeRootViewTransitionClone(n,e){throw new Error("Not implemented.")},createFragmentInstance:n=>null,updateFragmentInstanceFiber(n,e){},commitNewChildToFragmentInstance(n,e){},deleteChildFromFragmentInstance(n,e){},measureClonedInstance:n=>null,maySuspendCommitOnUpdate:(n,e,t)=>!1,maySuspendCommitInSyncRender:(n,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(n,e)=>null}),zl=new Map,Fu={objects:"shallow",strict:!1};function t8(n,e){if(!e&&typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:a,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:a,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function n8(n){const e=zl.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const a=typeof reportError=="function"?reportError:console.error,s=i||Nk(tS,Pw),l=t||Jx.createContainer(s,Ik,null,!1,null,"",a,a,a,null);e||zl.set(n,{fiber:l,store:s});let u,c,h=!1,p=null;return{async configure(g={}){let m;p=new Promise(ye=>m=ye);let{gl:v,size:_,scene:T,events:b,onCreated:y,shadows:S=!1,linear:E=!1,flat:A=!1,legacy:I=!1,orthographic:R=!1,frameloop:L="always",dpr:z=[1,2],performance:C,raycaster:w,camera:B,onPointerMissed:Q}=g,k=s.getState(),j=k.gl;if(!k.gl){const ye={canvas:n,powerPreference:"high-performance",antialias:!0,alpha:!0},Ie=typeof v=="function"?await v(ye):v;Rw(Ie)?j=Ie:j=new zD({...ye,...v}),k.set({gl:j})}let ae=k.raycaster;ae||k.set({raycaster:ae=new CU});const{params:V,...ne}=w||{};if(gn.equ(ne,ae,Fu)||Jr(ae,{...ne}),gn.equ(V,ae.params,Fu)||Jr(ae,{params:{...ae.params,...V}}),!k.camera||k.camera===c&&!gn.equ(c,B,Fu)){c=B;const ye=B==null?void 0:B.isCamera,Ie=ye?B:R?new ld(0,0,0,0,.1,1e3):new ti(75,0,.1,1e3);ye||(Ie.position.z=5,B&&(Jr(Ie,B),Ie.manual||("aspect"in B||"left"in B||"right"in B||"bottom"in B||"top"in B)&&(Ie.manual=!0,Ie.updateProjectionMatrix())),!k.camera&&!(B!=null&&B.rotation)&&Ie.lookAt(0,0,0)),k.set({camera:Ie}),ae.camera=Ie}if(!k.scene){let ye;T!=null&&T.isScene?(ye=T,Vg(ye,s,"",{})):(ye=new xb,Vg(ye,s,"",{}),T&&Jr(ye,T)),k.set({scene:ye})}b&&!k.events.handlers&&k.set({events:b(s)});const q=t8(n,_);if(gn.equ(q,k.size,Fu)||k.setSize(q.width,q.height,q.top,q.left),z&&k.viewport.dpr!==BU(z)&&k.setDpr(z),k.frameloop!==L&&k.setFrameloop(L),k.onPointerMissed||k.set({onPointerMissed:Q}),C&&!gn.equ(C,k.performance,Fu)&&k.set(ye=>({performance:{...ye.performance,...C}})),!k.xr){var oe;const ye=(ee,ve)=>{const Pe=s.getState();Pe.frameloop!=="never"&&Pw(ee,!0,Pe,ve)},Ie=()=>{const ee=s.getState();ee.gl.xr.enabled=ee.gl.xr.isPresenting,ee.gl.xr.setAnimationLoop(ee.gl.xr.isPresenting?ye:null),ee.gl.xr.isPresenting||tS(ee)},tt={connect(){const ee=s.getState().gl;ee.xr.addEventListener("sessionstart",Ie),ee.xr.addEventListener("sessionend",Ie)},disconnect(){const ee=s.getState().gl;ee.xr.removeEventListener("sessionstart",Ie),ee.xr.removeEventListener("sessionend",Ie)}};typeof((oe=j.xr)==null?void 0:oe.addEventListener)=="function"&&tt.connect(),k.set({xr:tt})}if(j.shadowMap){const ye=j.shadowMap.enabled,Ie=j.shadowMap.type;if(j.shadowMap.enabled=!!S,gn.boo(S))j.shadowMap.type=nh;else if(gn.str(S)){var me;const tt={basic:L3,percentage:u0,soft:nh,variance:$a};j.shadowMap.type=(me=tt[S])!=null?me:nh}else gn.obj(S)&&Object.assign(j.shadowMap,S);(ye!==j.shadowMap.enabled||Ie!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Ut.enabled=!I,h||(j.outputColorSpace=E?Mo:xi,j.toneMapping=A?Ms:$S),k.legacy!==I&&k.set(()=>({legacy:I})),k.linear!==E&&k.set(()=>({linear:E})),k.flat!==A&&k.set(()=>({flat:A})),v&&!gn.fun(v)&&!Rw(v)&&!gn.equ(v,j,Fu)&&Jr(j,v),u=y,h=!0,m(),this},render(g){return!h&&!p&&this.configure(),p.then(()=>{Jx.updateContainer(fa.jsx(i8,{store:s,children:g,onCreated:u,rootElement:n}),l,null,()=>{})}),s},unmount(){YU(n)}}}function i8({store:n,children:e,onCreated:t,rootElement:i}){return pd(()=>{const a=n.getState();a.set(s=>({internal:{...s.internal,active:!0}})),t&&t(a),n.getState().events.connected||a.events.connect==null||a.events.connect(i)},[]),fa.jsx(VU.Provider,{value:n,children:e})}function YU(n,e){const t=zl.get(n),i=t==null?void 0:t.fiber;if(i){const a=t==null?void 0:t.store.getState();a&&(a.internal.active=!1),Jx.updateContainer(null,i,null,()=>{a&&setTimeout(()=>{try{var s,l,u,c;a.events.disconnect==null||a.events.disconnect(),(s=a.gl)==null||(l=s.renderLists)==null||l.dispose==null||l.dispose(),(u=a.gl)==null||u.forceContextLoss==null||u.forceContextLoss(),(c=a.gl)!=null&&c.xr&&a.xr.disconnect(),Ek(a.scene),zl.delete(n)}catch{}},500)})}}const a8=new Set,s8=new Set,r8=new Set;function I_(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function hh(n,e){switch(n){case"before":return I_(a8,e);case"after":return I_(s8,e);case"tail":return I_(r8,e)}}let z_,O_;function $x(n,e,t){let i=e.clock.getDelta();e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),z_=e.internal.subscribers;for(let a=0;a<z_.length;a++)O_=z_[a],O_.ref.current(O_.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let Xg=!1,eS=!1,P_,Ow,Hu;function ZU(n){Ow=requestAnimationFrame(ZU),Xg=!0,P_=0,hh("before",n),eS=!0;for(const t of zl.values()){var e;Hu=t.store.getState(),Hu.internal.active&&(Hu.frameloop==="always"||Hu.internal.frames>0)&&!((e=Hu.gl.xr)!=null&&e.isPresenting)&&(P_+=$x(n,Hu))}if(eS=!1,hh("after",n),P_===0)return hh("tail",n),Xg=!1,cancelAnimationFrame(Ow)}function tS(n,e=1){var t;if(!n)return zl.forEach(i=>tS(i.store.getState(),e));(t=n.gl.xr)!=null&&t.isPresenting||!n.internal.active||n.frameloop==="never"||(e>1?n.internal.frames=Math.min(60,n.internal.frames+e):eS?n.internal.frames=2:n.internal.frames=1,Xg||(Xg=!0,requestAnimationFrame(ZU)))}function Pw(n,e=!0,t,i){if(e&&hh("before",n),t)$x(n,t,i);else for(const a of zl.values())$x(n,a.store.getState());e&&hh("after",n)}const B_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function o8(n){const{handlePointer:e}=Lk(n);return{priority:1,enabled:!0,compute(t,i,a){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(B_).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:a}=n.getState();(t=a.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(a.lastEvent.current)},connect:t=>{const{set:i,events:a}=n.getState();if(a.disconnect==null||a.disconnect(),i(s=>({events:{...s.events,connected:t}})),a.handlers)for(const s in a.handlers){const l=a.handlers[s],[u,c]=B_[s];t.addEventListener(u,l,{passive:c})}},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){if(i.handlers)for(const a in i.handlers){const s=i.handlers[a],[l]=B_[a];i.connected.removeEventListener(l,s)}t(a=>({events:{...a.events,connected:void 0}}))}}}}function Bw(n,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...i),e)}}function l8({debounce:n,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const a=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!a)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,l]=pt.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=pt.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),c=n?typeof n=="number"?n:n.scroll:null,h=n?typeof n=="number"?n:n.resize:null,p=pt.useRef(!1);pt.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[g,m,v]=pt.useMemo(()=>{const y=()=>{if(!u.current.element)return;const{left:S,top:E,width:A,height:I,bottom:R,right:L,x:z,y:C}=u.current.element.getBoundingClientRect(),w={left:S,top:E,width:A,height:I,bottom:R,right:L,x:z,y:C};u.current.element instanceof HTMLElement&&i&&(w.height=u.current.element.offsetHeight,w.width=u.current.element.offsetWidth),Object.freeze(w),p.current&&!h8(u.current.lastBounds,w)&&l(u.current.lastBounds=w)};return[y,h?Bw(y,h):y,c?Bw(y,c):y]},[l,i,c,h]);function _(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null),u.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",u.current.orientationHandler))}function T(){u.current.element&&(u.current.resizeObserver=new a(v),u.current.resizeObserver.observe(u.current.element),e&&u.current.scrollContainers&&u.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})),u.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",u.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",u.current.orientationHandler))}const b=y=>{!y||y===u.current.element||(_(),u.current.element=y,u.current.scrollContainers=jU(y),T())};return c8(v,!!e),u8(m),pt.useEffect(()=>{_(),T()},[e,v,m]),pt.useEffect(()=>_,[]),[b,s,g]}function u8(n){pt.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function c8(n,e){pt.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function jU(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:a}=window.getComputedStyle(n);return[t,i,a].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...jU(n.parentElement)]}const f8=["x","y","top","bottom","left","right","width","height"],h8=(n,e)=>f8.every(t=>n[t]===e[t]);function d8({ref:n,children:e,fallback:t,resize:i,style:a,gl:s,events:l=o8,eventSource:u,eventPrefix:c,shadows:h,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:T,performance:b,raycaster:y,camera:S,scene:E,onPointerMissed:A,onCreated:I,...R}){pt.useMemo(()=>Zk($V),[]);const L=Sk(),[z,C]=l8({scroll:!0,debounce:{scroll:50,resize:0},...i}),w=pt.useRef(null),B=pt.useRef(null);pt.useImperativeHandle(n,()=>w.current);const Q=PU(A),[k,j]=pt.useState(!1),[ae,V]=pt.useState(!1);if(k)throw k;if(ae)throw ae;const ne=pt.useRef(null);pd(()=>{const oe=w.current;if(C.width>0&&C.height>0&&oe){ne.current||(ne.current=n8(oe));async function me(){await ne.current.configure({gl:s,scene:E,events:l,shadows:h,linear:p,flat:g,legacy:m,orthographic:v,frameloop:_,dpr:T,performance:b,raycaster:y,camera:S,size:C,onPointerMissed:(...ye)=>Q.current==null?void 0:Q.current(...ye),onCreated:ye=>{ye.events.connect==null||ye.events.connect(u?_k(u)?u.current:u:B.current),c&&ye.setEvents({compute:(Ie,tt)=>{const ee=Ie[c+"X"],ve=Ie[c+"Y"];tt.pointer.set(ee/tt.size.width*2-1,-(ve/tt.size.height)*2+1),tt.raycaster.setFromCamera(tt.pointer,tt.camera)}}),I==null||I(ye)}}),ne.current.render(fa.jsx(L,{children:fa.jsx(Mk,{set:V,children:fa.jsx(pt.Suspense,{fallback:fa.jsx(bk,{set:j}),children:e??null})})}))}me()}}),pt.useEffect(()=>{const oe=w.current;if(oe)return()=>YU(oe)},[]);const q=u?"none":"auto";return fa.jsx("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:q,...a},...R,children:fa.jsx("div",{ref:z,style:{width:"100%",height:"100%"},children:fa.jsx("canvas",{ref:w,style:{display:"block"},children:t})})})}function S8(n){return fa.jsx(NU,{children:fa.jsx(d8,{...n})})}export{zx as A,bt as B,Be as C,ld as O,g8 as R,as as S,v8 as _,tn as a,x8 as b,S8 as c,_8 as u};