import{g as sS,r as Fe,a as yI,R as Ww}from"./vendor-react-C0ZmnAiH.js";import{s as _I,j as fa}from"./vendor-ui-BljgDEJN.js";var Xw={exports:{}},qg={},qw={exports:{}},Yw={};/**
* @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,J){var X=V.length;V.push(J);e:for(;0<X;){var re=X-1>>>1,he=V[re];if(0<a(he,J))V[re]=J,V[X]=he,X=re;else break e}}function t(V){return V.length===0?null:V[0]}function i(V){if(V.length===0)return null;var J=V[0],X=V.pop();if(X!==J){V[0]=X;e:for(var re=0,he=V.length,_e=he>>>1;re<_e;){var we=2*(re+1)-1,Je=V[we],ee=we+1,me=V[ee];if(0>a(Je,X))ee<he&&0>a(me,Je)?(V[re]=me,V[ee]=X,re=ee):(V[re]=Je,V[we]=X,re=we);else if(ee<he&&0>a(me,X))V[re]=me,V[ee]=X,re=ee;else break e}}return J}function a(V,J){var X=V.sortIndex-J.sortIndex;return X!==0?X:V.id-J.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,m=null,g=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 J=t(h);J!==null;){if(J.callback===null)i(h);else if(J.startTime<=V)i(h),J.sortIndex=J.expirationTime,e(c,J);else break;J=t(h)}}function I(V){if(T=!1,A(V),!_)if(t(c)!==null)_=!0,R||(R=!0,Q());else{var J=t(h);J!==null&&te(I,J.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 J=!0;try{e:{_=!1,T&&(T=!1,S(L),L=-1),v=!0;var X=g;try{t:{for(A(V),m=t(c);m!==null&&!(m.expirationTime>V&&w());){var re=m.callback;if(typeof re=="function"){m.callback=null,g=m.priorityLevel;var he=re(m.expirationTime<=V);if(V=n.unstable_now(),typeof he=="function"){m.callback=he,A(V),J=!0;break t}m===t(c)&&i(c),A(V)}else i(c);m=t(c)}if(m!==null)J=!0;else{var _e=t(h);_e!==null&&te(I,_e.startTime-V),J=!1}}break e}finally{m=null,g=X,v=!1}J=void 0}}finally{J?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 te(V,J){L=y(function(){V(n.unstable_now())},J)}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 g},n.unstable_next=function(V){switch(g){case 1:case 2:case 3:var J=3;break;default:J=g}var X=g;g=J;try{return V()}finally{g=X}},n.unstable_requestPaint=function(){b=!0},n.unstable_runWithPriority=function(V,J){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var X=g;g=V;try{return J()}finally{g=X}},n.unstable_scheduleCallback=function(V,J,X){var re=n.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?re+X:re):X=re,V){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=X+he,V={id:p++,callback:J,priorityLevel:V,startTime:X,expirationTime:he,sortIndex:-1},X>re?(V.sortIndex=X,e(h,V),t(c)===null&&V===t(h)&&(T?(S(L),L=-1):T=!0,te(I,X-re))):(V.sortIndex=he,e(c,V),_||v||(_=!0,R||(R=!0,Q()))),V},n.unstable_shouldYield=w,n.unstable_wrapCallback=function(V){var J=g;return function(){var X=g;g=J;try{return V.apply(this,arguments)}finally{g=X}}}})(Yw);qw.exports=Yw;var wm=qw.exports;const xI=sS(wm);/**
* @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=wm,Zw=Fe,SI=yI;function ce(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 jw(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function qh(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 Qw(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 Kw(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 EE(n){if(qh(n)!==n)throw Error(ce(188))}function bI(n){var e=n.alternate;if(!e){if(e=qh(n),e===null)throw Error(ce(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 EE(a),n;if(s===i)return EE(a),e;s=s.sibling}throw Error(ce(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(ce(189))}}if(t.alternate!==i)throw Error(ce(190))}if(t.tag!==3)throw Error(ce(188));return t.stateNode.current===t?n:e}function Jw(n){var e=n.tag;if(e===5||e===26||e===27||e===6)return n;for(n=n.child;n!==null;){if(e=Jw(n),e!==null)return e;n=n.sibling}return null}var cn=Object.assign,MI=Symbol.for("react.element"),tp=Symbol.for("react.transitional.element"),Of=Symbol.for("react.portal"),Wu=Symbol.for("react.fragment"),$w=Symbol.for("react.strict_mode"),H_=Symbol.for("react.profiler"),eC=Symbol.for("react.consumer"),ir=Symbol.for("react.context"),rS=Symbol.for("react.forward_ref"),V_=Symbol.for("react.suspense"),k_=Symbol.for("react.suspense_list"),oS=Symbol.for("react.memo"),Wr=Symbol.for("react.lazy"),G_=Symbol.for("react.activity"),EI=Symbol.for("react.memo_cache_sentinel"),TE=Symbol.iterator;function vf(n){return n===null||typeof n!="object"?null:(n=TE&&n[TE]||n["@@iterator"],typeof n=="function"?n:null)}var TI=Symbol.for("react.client.reference");function W_(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===TI?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Wu:return"Fragment";case H_:return"Profiler";case $w:return"StrictMode";case V_:return"Suspense";case k_:return"SuspenseList";case G_:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case Of:return"Portal";case ir:return n.displayName||"Context";case eC:return(n._context.displayName||"Context")+".Consumer";case rS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case oS:return e=n.displayName||null,e!==null?e:W_(n.type)||"Memo";case Wr:e=n._payload,n=n._init;try{return W_(n(e))}catch{}}return null}var Pf=Array.isArray,ut=Zw.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qt=SI.__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),ph=As(null),ao=As(null),Cm=As(null);function Rm(n,e){switch(sn(ao,e),sn(ph,n),sn(bs,null),e.nodeType){case 9:case 11:n=(n=e.documentElement)&&(n=n.namespaceURI)?UT(n):0;break;default:if(n=e.tagName,e=e.namespaceURI)e=UT(e),n=x3(e,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ni(bs),sn(bs,n)}function mc(){ni(bs),ni(ph),ni(ao)}function q_(n){n.memoizedState!==null&&sn(Cm,n);var e=bs.current,t=x3(e,n.type);e!==t&&(sn(ph,n),sn(bs,t))}function Dm(n){ph.current===n&&(ni(bs),ni(ph)),Cm.current===n&&(ni(Cm),Th._currentValue=gl)}var uy,AE;function sl(n){if(uy===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);uy=e&&e[1]||"",AE=-1<t.stack.indexOf(`
at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
`+uy+n+AE}var cy=!1;function fy(n,e){if(!n||cy)return"";cy=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(e){var m=function(){throw Error()};if(Object.defineProperty(m.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(m,[])}catch(v){var g=v}Reflect.construct(n,[],m)}else{try{m.call()}catch(v){g=v}n.call(m.prototype)}}else{try{throw Error()}catch(v){g=v}(m=n())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(v){if(v&&g&&typeof v.stack=="string")return[v.stack,g.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{cy=!1,Error.prepareStackTrace=t}return(t=n?n.displayName||n.name:"")?sl(t):""}function AI(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 fy(n.type,!1);case 11:return fy(n.type.render,!1);case 1:return fy(n.type,!0);case 31:return sl("Activity");default:return""}}function wE(n){try{var e="",t=null;do e+=AI(n,t),t=n,n=n.return;while(n);return e}catch(i){return`
Error generating stack: `+i.message+`
`+i.stack}}var Y_=Object.prototype.hasOwnProperty,lS=Xn.unstable_scheduleCallback,hy=Xn.unstable_cancelCallback,wI=Xn.unstable_shouldYield,CI=Xn.unstable_requestPaint,ma=Xn.unstable_now,RI=Xn.unstable_getCurrentPriorityLevel,tC=Xn.unstable_ImmediatePriority,nC=Xn.unstable_UserBlockingPriority,Um=Xn.unstable_NormalPriority,DI=Xn.unstable_LowPriority,iC=Xn.unstable_IdlePriority,UI=Xn.log,LI=Xn.unstable_setDisableYieldValue,Yh=null,ga=null;function $r(n){if(typeof UI=="function"&&LI(n),ga&&typeof ga.setStrictMode=="function")try{ga.setStrictMode(Yh,n)}catch{}}var va=Math.clz32?Math.clz32:zI,NI=Math.log,II=Math.LN2;function zI(n){return n>>>=0,n===0?32:31-(NI(n)/II|0)|0}var np=256,ip=262144,ap=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 Yg(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 Zh(n,e){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&e)===0}function OI(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 aC(){var n=ap;return ap<<=1,!(ap&62914560)&&(ap=4194304),n}function dy(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function jh(n,e){n.pendingLanes|=e,e!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function PI(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),m=1<<p;u[p]=0,c[p]=-1;var g=h[p];if(g!==null)for(h[p]=null,p=0;p<g.length;p++){var v=g[p];v!==null&&(v.lane&=-536870913)}t&=~m}i!==0&&sC(n,i,0),s!==0&&a===0&&n.tag!==0&&(n.suspendedLanes|=s&~(l&~e))}function sC(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 rC(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 oC(n,e){var t=e&-e;return t=t&42?1:uS(t),t&(n.suspendedLanes|e)?0:t}function uS(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 cS(n){return n&=-n,2<n?8<n?n&134217727?32:268435456:8:2}function lC(){var n=qt.p;return n!==0?n:(n=window.event,n===void 0?32:U3(n.type))}function CE(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,Lc="__reactContainer$"+xo,Z_="__reactEvents$"+xo,BI="__reactListeners$"+xo,FI="__reactHandles$"+xo,RE="__reactResources$"+xo,Qh="__reactMarker$"+xo;function fS(n){delete n[ui],delete n[Ki],delete n[Z_],delete n[BI],delete n[FI]}function qu(n){var e=n[ui];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Lc]||t[ui]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=OT(n);n!==null;){if(t=n[ui])return t;n=OT(n)}return e}n=t,t=n.parentNode}return null}function Nc(n){if(n=n[ui]||n[Lc]){var e=n.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return n}return null}function Bf(n){var e=n.tag;if(e===5||e===26||e===27||e===6)return n.stateNode;throw Error(ce(33))}function oc(n){var e=n[RE];return e||(e=n[RE]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function ti(n){n[Qh]=!0}var uC=new Set,cC={};function Ol(n,e){gc(n,e),gc(n+"Capture",e)}function gc(n,e){for(cC[n]=e,n=0;n<e.length;n++)uC.add(e[n])}var HI=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]*$"),DE={},UE={};function VI(n){return Y_.call(UE,n)?!0:Y_.call(DE,n)?!1:HI.test(n)?UE[n]=!0:(DE[n]=!0,!1)}function um(n,e,t){if(VI(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 sp(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 fC(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function kI(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 j_(n){if(!n._valueTracker){var e=fC(n)?"checked":"value";n._valueTracker=kI(n,e,""+n[e])}}function hC(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=fC(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Lm(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 GI=/[\n"\\]/g;function za(n){return n.replace(GI,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Q_(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?K_(n,l,La(e)):t!=null?K_(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 dC(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)){j_(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),j_(n)}function K_(n,e,t){e==="number"&&Lm(n.ownerDocument)===n||n.defaultValue===""+t||(n.defaultValue=""+t)}function lc(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 pC(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 mC(n,e,t,i){if(e==null){if(i!=null){if(t!=null)throw Error(ce(92));if(Pf(i)){if(1<i.length)throw Error(ce(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),j_(n)}function vc(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var WI=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 LE(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||WI.has(e)?e==="float"?n.cssFloat=t:n[e]=(""+t).trim():n[e]=t+"px"}function gC(n,e,t){if(e!=null&&typeof e!="object")throw Error(ce(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&&LE(n,a,i)}else for(var s in e)e.hasOwnProperty(s)&&LE(n,s,e[s])}function hS(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 XI=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"]]),qI=/^[\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 cm(n){return qI.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function ar(){}var J_=null;function dS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Yu=null,uc=null;function NE(n){var e=Nc(n);if(e&&(n=e.stateNode)){var t=n[Ki]||null;e:switch(n=e.stateNode,e.type){case"input":if(Q_(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(ce(90));Q_(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&&hC(i)}break e;case"textarea":pC(n,t.value,t.defaultValue);break e;case"select":e=t.value,e!=null&&lc(n,!!t.multiple,e,!1)}}}var py=!1;function vC(n,e,t){if(py)return n(e,t);py=!0;try{var i=n(e);return i}finally{if(py=!1,(Yu!==null||uc!==null)&&(s0(),Yu&&(e=Yu,n=uc,uc=Yu=null,NE(e),n)))for(e=0;e<n.length;e++)NE(n[e])}}function mh(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(ce(231,e,typeof t));return t}var hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$_=!1;if(hr)try{var yf={};Object.defineProperty(yf,"passive",{get:function(){$_=!0}}),window.addEventListener("test",yf,yf),window.removeEventListener("test",yf,yf)}catch{$_=!1}var eo=null,pS=null,fm=null;function yC(){if(fm)return fm;var n,e=pS,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 fm=a.slice(n,1<i?1-i:void 0)}function hm(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 rp(){return!0}function IE(){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)?rp:IE,this.isPropagationStopped=IE,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=rp)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=rp)},persist:function(){},isPersistent:rp}),e}var Pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zg=Ji(Pl),Kh=cn({},Pl,{view:0,detail:0}),YI=Ji(Kh),my,gy,_f,jg=cn({},Kh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mS,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!==_f&&(_f&&n.type==="mousemove"?(my=n.screenX-_f.screenX,gy=n.screenY-_f.screenY):gy=my=0,_f=n),my)},movementY:function(n){return"movementY"in n?n.movementY:gy}}),zE=Ji(jg),ZI=cn({},jg,{dataTransfer:0}),jI=Ji(ZI),QI=cn({},Kh,{relatedTarget:0}),vy=Ji(QI),KI=cn({},Pl,{animationName:0,elapsedTime:0,pseudoElement:0}),JI=Ji(KI),$I=cn({},Pl,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),ez=Ji($I),tz=cn({},Pl,{data:0}),OE=Ji(tz),nz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iz={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"},az={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sz(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=az[n])?!!e[n]:!1}function mS(){return sz}var rz=cn({},Kh,{key:function(n){if(n.key){var e=nz[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=hm(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?iz[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mS,charCode:function(n){return n.type==="keypress"?hm(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?hm(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),oz=Ji(rz),lz=cn({},jg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),PE=Ji(lz),uz=cn({},Kh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mS}),cz=Ji(uz),fz=cn({},Pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),hz=Ji(fz),dz=cn({},jg,{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}),pz=Ji(dz),mz=cn({},Pl,{newState:0,oldState:0}),gz=Ji(mz),vz=[9,13,27,32],gS=hr&&"CompositionEvent"in window,Wf=null;hr&&"documentMode"in document&&(Wf=document.documentMode);var yz=hr&&"TextEvent"in window&&!Wf,_C=hr&&(!gS||Wf&&8<Wf&&11>=Wf),BE=" ",FE=!1;function xC(n,e){switch(n){case"keyup":return vz.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function SC(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Zu=!1;function _z(n,e){switch(n){case"compositionend":return SC(e);case"keypress":return e.which!==32?null:(FE=!0,BE);case"textInput":return n=e.data,n===BE&&FE?null:n;default:return null}}function xz(n,e){if(Zu)return n==="compositionend"||!gS&&xC(n,e)?(n=yC(),fm=pS=eo=null,Zu=!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 _C&&e.locale!=="ko"?null:e.data;default:return null}}var Sz={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 HE(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!Sz[n.type]:e==="textarea"}function bC(n,e,t,i){Yu?uc?uc.push(i):uc=[i]:Yu=i,e=Qm(e,"onChange"),0<e.length&&(t=new Zg("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var Xf=null,gh=null;function bz(n){v3(n,0)}function Qg(n){var e=Bf(n);if(hC(e))return n}function VE(n,e){if(n==="change")return e}var MC=!1;if(hr){var yy;if(hr){var _y="oninput"in document;if(!_y){var kE=document.createElement("div");kE.setAttribute("oninput","return;"),_y=typeof kE.oninput=="function"}yy=_y}else yy=!1;MC=yy&&(!document.documentMode||9<document.documentMode)}function GE(){Xf&&(Xf.detachEvent("onpropertychange",EC),gh=Xf=null)}function EC(n){if(n.propertyName==="value"&&Qg(gh)){var e=[];bC(e,gh,n,dS(n)),vC(bz,e)}}function Mz(n,e,t){n==="focusin"?(GE(),Xf=e,gh=t,Xf.attachEvent("onpropertychange",EC)):n==="focusout"&&GE()}function Ez(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Qg(gh)}function Tz(n,e){if(n==="click")return Qg(e)}function Az(n,e){if(n==="input"||n==="change")return Qg(e)}function wz(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var xa=typeof Object.is=="function"?Object.is:wz;function vh(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(!Y_.call(e,a)||!xa(n[a],e[a]))return!1}return!0}function WE(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function XE(n,e){var t=WE(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=WE(t)}}function TC(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?TC(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function AC(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var e=Lm(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=Lm(n.document)}return e}function vS(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 Cz=hr&&"documentMode"in document&&11>=document.documentMode,ju=null,ex=null,qf=null,tx=!1;function qE(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;tx||ju==null||ju!==Lm(i)||(i=ju,"selectionStart"in i&&vS(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}),qf&&vh(qf,i)||(qf=i,i=Qm(ex,"onSelect"),0<i.length&&(e=new Zg("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=ju)))}function Xo(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Qu={animationend:Xo("Animation","AnimationEnd"),animationiteration:Xo("Animation","AnimationIteration"),animationstart:Xo("Animation","AnimationStart"),transitionrun:Xo("Transition","TransitionRun"),transitionstart:Xo("Transition","TransitionStart"),transitioncancel:Xo("Transition","TransitionCancel"),transitionend:Xo("Transition","TransitionEnd")},xy={},wC={};hr&&(wC=document.createElement("div").style,"AnimationEvent"in window||(delete Qu.animationend.animation,delete Qu.animationiteration.animation,delete Qu.animationstart.animation),"TransitionEvent"in window||delete Qu.transitionend.transition);function Bl(n){if(xy[n])return xy[n];if(!Qu[n])return n;var e=Qu[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in wC)return xy[n]=e[t];return n}var CC=Bl("animationend"),RC=Bl("animationiteration"),DC=Bl("animationstart"),Rz=Bl("transitionrun"),Dz=Bl("transitionstart"),Uz=Bl("transitioncancel"),UC=Bl("transitionend"),LC=new Map,nx="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(" ");nx.push("scrollEnd");function rs(n,e){LC.set(n,e),Ol(e,[n])}var Nm=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=[],Ku=0,yS=0;function Kg(){for(var n=Ku,e=yS=Ku=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&&NC(t,a,s)}}function Jg(n,e,t,i){Ua[Ku++]=n,Ua[Ku++]=e,Ua[Ku++]=t,Ua[Ku++]=i,yS|=i,n.lanes|=i,n=n.alternate,n!==null&&(n.lanes|=i)}function _S(n,e,t,i){return Jg(n,e,t,i),Im(n)}function Fl(n,e){return Jg(n,null,null,e),Im(n)}function NC(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 Im(n){if(50<th)throw th=0,Mx=null,Error(ce(185));for(var e=n.return;e!==null;)n=e,e=n.return;return n.tag===3?n.stateNode:null}var Ju={};function Lz(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 Lz(n,e,t,i)}function xS(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 IC(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 dm(n,e,t,i,a,s){var l=0;if(i=n,typeof n=="function")xS(n)&&(l=1);else if(typeof n=="string")l=PO(n,t,bs.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case G_:return n=da(31,t,e,a),n.elementType=G_,n.lanes=s,n;case Wu:return vl(t.children,a,s,e);case $w:l=8,a|=24;break;case H_:return n=da(12,t,e,a|2),n.elementType=H_,n.lanes=s,n;case V_:return n=da(13,t,e,a),n.elementType=V_,n.lanes=s,n;case k_:return n=da(19,t,e,a),n.elementType=k_,n.lanes=s,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ir:l=10;break e;case eC:l=9;break e;case rS:l=11;break e;case oS:l=14;break e;case Wr:l=16,i=null;break e}l=29,t=Error(ce(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 Sy(n,e,t){return n=da(6,n,null,e),n.lanes=t,n}function zC(n){var e=da(18,null,null,0);return e.stateNode=n,e}function by(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 YE=new WeakMap;function Oa(n,e){if(typeof n=="object"&&n!==null){var t=YE.get(n);return t!==void 0?t:(e={value:n,source:e,stack:wE(e)},YE.set(n,e),e)}return{value:n,source:e,stack:wE(e)}}var $u=[],ec=0,zm=null,yh=0,Na=[],Ia=0,po=null,vs=1,ys="";function $s(n,e){$u[ec++]=yh,$u[ec++]=zm,zm=n,yh=e}function OC(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 SS(n){n.return!==null&&($s(n,1),OC(n,1,0))}function bS(n){for(;n===zm;)zm=$u[--ec],$u[ec]=null,yh=$u[--ec],$u[ec]=null;for(;n===po;)po=Na[--Ia],Na[Ia]=null,ys=Na[--Ia],Na[Ia]=null,vs=Na[--Ia],Na[Ia]=null}function PC(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,ix=Error(ce(519));function mo(n){var e=Error(ce(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _h(Oa(e,n)),ix}function ZE(n){var e=n.stateNode,t=n.type,i=n.memoizedProps;switch(e[ui]=n,e[Ki]=i,t){case"dialog":wt("cancel",e),wt("close",e);break;case"iframe":case"object":case"embed":wt("load",e);break;case"video":case"audio":for(t=0;t<Mh.length;t++)wt(Mh[t],e);break;case"source":wt("error",e);break;case"img":case"image":case"link":wt("error",e),wt("load",e);break;case"details":wt("toggle",e);break;case"input":wt("invalid",e),dC(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":wt("invalid",e);break;case"textarea":wt("invalid",e),mC(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||_3(e.textContent,t)?(i.popover!=null&&(wt("beforetoggle",e),wt("toggle",e)),i.onScroll!=null&&wt("scroll",e),i.onScrollEnd!=null&&wt("scrollend",e),i.onClick!=null&&(e.onclick=ar),e=!0):e=!1,e||mo(n,!0)}function jE(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 _u(n){if(n!==ci)return!1;if(!It)return jE(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")||Cx(n.type,n.memoizedProps)),t=!t),t&&un&&mo(n),jE(n),e===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ce(317));un=zT(n)}else if(e===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ce(317));un=zT(n)}else e===27?(e=un,So(n.type)?(n=Lx,Lx=null,un=n):un=e):un=ci?Ha(n.stateNode.nextSibling):null;return!0}function Tl(){un=ci=null,It=!1}function My(){var n=so;return n!==null&&(Xi===null?Xi=n:Xi.push.apply(Xi,n),so=null),n}function _h(n){so===null?so=[n]:so.push(n)}var ax=As(null),Hl=null,sr=null;function Yr(n,e,t){sn(ax,e._currentValue),e._currentValue=t}function lr(n){n._currentValue=ax.current,ni(ax)}function sx(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 rx(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),sx(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(ce(341));l.lanes|=t,s=l.alternate,s!==null&&(s.lanes|=t),sx(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 Ic(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(ce(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===Cm.current){if(l=a.alternate,l===null)throw Error(ce(387));l.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(n!==null?n.push(Th):n=[Th])}a=a.return}n!==null&&rx(e,n,t,i),e.flags|=262144}function Om(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 BC(Hl,n)}function op(n,e){return Hl===null&&Al(n),BC(n,e)}function BC(n,e){var t=e._currentValue;if(e={context:e,memoizedValue:t,next:null},sr===null){if(n===null)throw Error(ce(308));sr=e,n.dependencies={lanes:0,firstContext:e},n.flags|=524288}else sr=sr.next=e;return t}var Nz=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()})}},Iz=Xn.unstable_scheduleCallback,zz=Xn.unstable_NormalPriority,Pn={$$typeof:ir,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function MS(){return{controller:new Nz,data:new Map,refCount:0}}function Jh(n){n.refCount--,n.refCount===0&&Iz(zz,function(){n.controller.abort()})}var Yf=null,ox=0,yc=0,cc=null;function Oz(n,e){if(Yf===null){var t=Yf=[];ox=0,yc=ZS(),cc={status:"pending",value:void 0,then:function(i){t.push(i)}}}return ox++,e.then(QE,QE),e}function QE(){if(--ox===0&&Yf!==null){cc!==null&&(cc.status="fulfilled");var n=Yf;Yf=null,yc=0,cc=null;for(var e=0;e<n.length;e++)(0,n[e])()}}function Pz(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 KE=ut.S;ut.S=function(n,e){JR=ma(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&Oz(n,e),KE!==null&&KE(n,e)};var yl=As(null);function ES(){var n=yl.current;return n!==null?n:an.pooledCache}function pm(n,e){e===null?sn(yl,yl.current):sn(yl,e.pool)}function FC(){var n=ES();return n===null?null:{parent:Pn._currentValue,pool:n}}var zc=Error(ce(460)),TS=Error(ce(474)),$g=Error(ce(542)),Pm={then:function(){}};function JE(n){return n=n.status,n==="fulfilled"||n==="rejected"}function HC(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,eT(n),n;default:if(typeof e.status=="string")e.then(ar,ar);else{if(n=an,n!==null&&100<n.shellSuspendCounter)throw Error(ce(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,eT(n),n}throw _l=e,zc}}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,zc):t}}var _l=null;function $E(){if(_l===null)throw Error(ce(459));var n=_l;return _l=null,n}function eT(n){if(n===zc||n===$g)throw Error(ce(483))}var fc=null,xh=0;function lp(n){var e=xh;return xh+=1,fc===null&&(fc=[]),HC(fc,n,e)}function xf(n,e){e=e.props.ref,n.ref=e!==void 0?e:null}function up(n,e){throw e.$$typeof===MI?Error(ce(525)):(n=Object.prototype.toString.call(e),Error(ce(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)))}function VC(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=Sy(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===Wu?p(y,S,E.props.children,A,E.key):S!==null&&(S.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Wr&&ol(I)===S.type)?(S=a(S,E.props),xf(S,E),S.return=y,S):(S=dm(E.type,E.key,E.props,null,y.mode,A),xf(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=by(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 m(y,S,E){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return S=Sy(""+S,y.mode,E),S.return=y,S;if(typeof S=="object"&&S!==null){switch(S.$$typeof){case tp:return E=dm(S.type,S.key,S.props,null,y.mode,E),xf(E,S),E.return=y,E;case Of:return S=by(S,y.mode,E),S.return=y,S;case Wr:return S=ol(S),m(y,S,E)}if(Pf(S)||vf(S))return S=vl(S,y.mode,E,null),S.return=y,S;if(typeof S.then=="function")return m(y,lp(S),E);if(S.$$typeof===ir)return m(y,op(y,S),E);up(y,S)}return null}function g(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 tp:return E.key===I?c(y,S,E,A):null;case Of:return E.key===I?h(y,S,E,A):null;case Wr:return E=ol(E),g(y,S,E,A)}if(Pf(E)||vf(E))return I!==null?null:p(y,S,E,A,null);if(typeof E.then=="function")return g(y,S,lp(E),A);if(E.$$typeof===ir)return g(y,S,op(y,E),A);up(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 tp:return y=y.get(A.key===null?E:A.key)||null,c(S,y,A,I);case Of:return y=y.get(A.key===null?E:A.key)||null,h(S,y,A,I);case Wr:return A=ol(A),v(y,S,E,A,I)}if(Pf(A)||vf(A))return y=y.get(E)||null,p(S,y,A,I,null);if(typeof A.then=="function")return v(y,S,E,lp(A),I);if(A.$$typeof===ir)return v(y,S,E,op(S,A),I);up(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=g(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=m(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(ce(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=g(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=m(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===Wu&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case tp:e:{for(var I=E.key;S!==null;){if(S.key===I){if(I=E.type,I===Wu){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===Wr&&ol(I)===S.type){t(y,S.sibling),A=a(S,E.props),xf(A,E),A.return=y,y=A;break e}t(y,S);break}else e(y,S);S=S.sibling}E.type===Wu?(A=vl(E.props.children,y.mode,A,E.key),A.return=y,y=A):(A=dm(E.type,E.key,E.props,null,y.mode,A),xf(A,E),A.return=y,y=A)}return l(y);case Of: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=by(E,y.mode,A),A.return=y,y=A}return l(y);case Wr:return E=ol(E),b(y,S,E,A)}if(Pf(E))return _(y,S,E,A);if(vf(E)){if(I=vf(E),typeof I!="function")throw Error(ce(150));return E=I.call(E),T(y,S,E,A)}if(typeof E.then=="function")return b(y,S,lp(E),A);if(E.$$typeof===ir)return b(y,S,op(y,E),A);up(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=Sy(E,y.mode,A),A.return=y,y=A),l(y)):t(y,S)}return function(y,S,E,A){try{xh=0;var I=b(y,S,E,A);return fc=null,I}catch(L){if(L===zc||L===$g)throw L;var R=da(29,L,null,y.mode);return R.lanes=A,R.return=y,R}finally{}}}var wl=VC(!0),kC=VC(!1),Xr=!1;function AS(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lx(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,Xt&2){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=Im(n),NC(n,null,t),e}return Jg(n,i,e,t),Im(n)}function Zf(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,rC(n,t)}}function Ey(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 ux=!1;function jf(){if(ux){var n=cc;if(n!==null)throw n}}function Qf(n,e,t,i){ux=!1;var a=n.updateQueue;Xr=!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 m=a.baseState;l=0,p=h=c=null,u=s;do{var g=u.lane&-536870913,v=g!==u.lane;if(v?(Lt&g)===g:(i&g)===g){g!==0&&g===yc&&(ux=!0),p!==null&&(p=p.next={lane:0,tag:u.tag,payload:u.payload,callback:null,next:null});e:{var _=n,T=u;g=e;var b=t;switch(T.tag){case 1:if(_=T.payload,typeof _=="function"){m=_.call(b,m,g);break e}m=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=T.payload,g=typeof _=="function"?_.call(b,m,g):_,g==null)break e;m=cn({},m,g);break e;case 2:Xr=!0}}g=u.callback,g!==null&&(n.flags|=64,v&&(n.flags|=8192),v=a.callbacks,v===null?a.callbacks=[g]:v.push(g))}else v={lane:g,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(h=p=v,c=m):p=p.next=v,l|=g;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=m),a.baseState=c,a.firstBaseUpdate=h,a.lastBaseUpdate=p,s===null&&(a.shared.lanes=0),vo|=l,n.lanes=l,n.memoizedState=m}}function GC(n,e){if(typeof n!="function")throw Error(ce(191,n));n.call(e)}function WC(n,e){var t=n.callbacks;if(t!==null)for(n.callbacks=null,n=0;n<t.length;n++)GC(t[n],e)}var _c=As(null),Bm=As(0);function tT(n,e){n=gr,sn(Bm,n),sn(_c,e),gr=n|e.baseLanes}function cx(){sn(Bm,gr),sn(_c,_c.current)}function wS(){gr=Bm.current,ni(_c),ni(Bm)}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||_c.current!==null||e.memoizedState!==null)&&(Fa=n)}function fx(n){sn(wn,wn.current),sn(Sa,n),Fa===null&&(Fa=n)}function XC(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 Fm(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||Dx(t)||Ux(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,St=null,en=null,zn=null,Hm=!1,hc=!1,Cl=!1,Vm=0,Sh=0,dc=null,Bz=0;function xn(){throw Error(ce(321))}function CS(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 RS(n,e,t,i,a,s){return dr=s,St=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ut.H=n===null||n.memoizedState===null?bR:HS,Cl=!1,s=t(i,a),Cl=!1,hc&&(s=YC(e,t,i,a)),qC(n),s}function qC(n){ut.H=bh;var e=en!==null&&en.next!==null;if(dr=0,zn=en=St=null,Hm=!1,Sh=0,dc=null,e)throw Error(ce(300));n===null||Fn||(n=n.dependencies,n!==null&&Om(n)&&(Fn=!0))}function YC(n,e,t,i){St=n;var a=0;do{if(hc&&(dc=null),Sh=0,hc=!1,25<=a)throw Error(ce(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)}ut.H=MR,s=e(t,i)}while(hc);return s}function Fz(){var n=ut.H,e=n.useState()[0];return e=typeof e.then=="function"?$h(e):e,n=n.useState()[0],(en!==null?en.memoizedState:null)!==n&&(St.flags|=1024),e}function DS(){var n=Vm!==0;return Vm=0,n}function US(n,e,t){e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~t}function LS(n){if(Hm){for(n=n.memoizedState;n!==null;){var e=n.queue;e!==null&&(e.pending=null),n=n.next}Hm=!1}dr=0,zn=en=St=null,hc=!1,Sh=Vm=0,dc=null}function Ri(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?St.memoizedState=zn=n:zn=zn.next=n,zn}function Cn(){if(en===null){var n=St.alternate;n=n!==null?n.memoizedState:null}else n=en.next;var e=zn===null?St.memoizedState:zn.next;if(e!==null)zn=e,en=n;else{if(n===null)throw St.alternate===null?Error(ce(467)):Error(ce(310));en=n,n={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},zn===null?St.memoizedState=zn=n:zn=zn.next=n}return zn}function e0(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $h(n){var e=Sh;return Sh+=1,dc===null&&(dc=[]),n=HC(dc,n,e),e=St,(zn===null?e.memoizedState:zn.next)===null&&(e=e.alternate,ut.H=e===null||e.memoizedState===null?bR:HS),n}function t0(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return $h(n);if(n.$$typeof===ir)return fi(n)}throw Error(ce(438,String(n)))}function NS(n){var e=null,t=St.updateQueue;if(t!==null&&(e=t.memoCache),e==null){var i=St.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=e0(),St.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]=EI;return e.index++,t}function pr(n,e){return typeof e=="function"?e(n):e}function mm(n){var e=Cn();return IS(e,en,n)}function IS(n,e,t){var i=n.queue;if(i===null)throw Error(ce(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 m=h.lane&-536870913;if(m!==h.lane?(Lt&m)===m:(dr&m)===m){var g=h.revertLane;if(g===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),m===yc&&(p=!0);else if((dr&g)===g){h=h.next,g===yc&&(p=!0);continue}else m={lane:0,revertLane:h.revertLane,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},c===null?(u=c=m,l=s):c=c.next=m,St.lanes|=g,vo|=g;m=h.action,Cl&&t(s,m),s=h.hasEagerState?h.eagerState:t(s,m)}else g={lane:m,revertLane:h.revertLane,gesture:h.gesture,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},c===null?(u=c=g,l=s):c=c.next=g,St.lanes|=m,vo|=m;h=h.next}while(h!==null&&h!==e);if(c===null?l=s:c.next=u,!xa(s,n.memoizedState)&&(Fn=!0,p&&(t=cc,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 Ty(n){var e=Cn(),t=e.queue;if(t===null)throw Error(ce(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)||(Fn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function ZC(n,e,t){var i=St,a=Cn(),s=It;if(s){if(t===void 0)throw Error(ce(407));t=t()}else t=e();var l=!xa((en||a).memoizedState,t);if(l&&(a.memoizedState=t,Fn=!0),a=a.queue,zS(KC.bind(null,i,a,n),[n]),a.getSnapshot!==e||l||zn!==null&&zn.memoizedState.tag&1){if(i.flags|=2048,xc(9,{destroy:void 0},QC.bind(null,i,a,t,e),null),an===null)throw Error(ce(349));s||dr&127||jC(i,e,t)}return t}function jC(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=St.updateQueue,e===null?(e=e0(),St.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function QC(n,e,t,i){e.value=t,e.getSnapshot=i,JC(e)&&$C(n)}function KC(n,e,t){return t(function(){JC(e)&&$C(n)})}function JC(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!xa(n,t)}catch{return!0}}function $C(n){var e=Fl(n,2);e!==null&&ji(e,n,2)}function hx(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 eR(n,e,t,i){return n.baseState=t,IS(n,en,typeof i=="function"?i:pr)}function Hz(n,e,t,i,a){if(i0(n))throw Error(ce(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)}};ut.T!==null?t(!0):s.isTransition=!1,i(s),t=e.pending,t===null?(s.next=e.pending=s,tR(e,s)):(s.next=t.next,e.pending=t.next=s)}}function tR(n,e){var t=e.action,i=e.payload,a=n.state;if(e.isTransition){var s=ut.T,l={};ut.T=l;try{var u=t(a,i),c=ut.S;c!==null&&c(l,u),nT(n,e,u)}catch(h){dx(n,e,h)}finally{s!==null&&l.types!==null&&(s.types=l.types),ut.T=s}}else try{s=t(a,i),nT(n,e,s)}catch(h){dx(n,e,h)}}function nT(n,e,t){t!==null&&typeof t=="object"&&typeof t.then=="function"?t.then(function(i){iT(n,e,i)},function(i){return dx(n,e,i)}):iT(n,e,t)}function iT(n,e,t){e.status="fulfilled",e.value=t,nR(e),n.state=t,e=n.pending,e!==null&&(t=e.next,t===e?n.pending=null:(t=t.next,e.next=t,tR(n,t)))}function dx(n,e,t){var i=n.pending;if(n.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=t,nR(e),e=e.next;while(e!==i)}n.action=null}function nR(n){n=n.listeners;for(var e=0;e<n.length;e++)(0,n[e])()}function iR(n,e){return e}function aT(n,e){if(It){var t=an.formState;if(t!==null){e:{var i=St;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:iR,lastRenderedState:e},t.queue=i,t=_R.bind(null,St,i),i.dispatch=t,i=hx(!1),s=FS.bind(null,St,!1,i.queue),i=Ri(),a={state:e,dispatch:null,action:n,pending:null},i.queue=a,t=Hz.bind(null,St,a,s,t),a.dispatch=t,i.memoizedState=n,[e,t,!1]}function sT(n){var e=Cn();return aR(e,en,n)}function aR(n,e,t){if(e=IS(n,e,iR)[0],n=mm(pr)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=$h(e)}catch(l){throw l===zc?$g:l}else i=e;e=Cn();var a=e.queue,s=a.dispatch;return t!==e.memoizedState&&(St.flags|=2048,xc(9,{destroy:void 0},Vz.bind(null,a,t),null)),[i,s,n]}function Vz(n,e){n.action=e}function rT(n){var e=Cn(),t=en;if(t!==null)return aR(e,t,n);Cn(),e=e.memoizedState,t=Cn();var i=t.queue.dispatch;return t.memoizedState=n,[e,i,!1]}function xc(n,e,t,i){return n={tag:n,create:t,deps:i,inst:e,next:null},e=St.updateQueue,e===null&&(e=e0(),St.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 sR(){return Cn().memoizedState}function gm(n,e,t,i){var a=Ri();St.flags|=n,a.memoizedState=xc(1|e,{destroy:void 0},t,i===void 0?null:i)}function n0(n,e,t,i){var a=Cn();i=i===void 0?null:i;var s=a.memoizedState.inst;en!==null&&i!==null&&CS(i,en.memoizedState.deps)?a.memoizedState=xc(e,s,t,i):(St.flags|=n,a.memoizedState=xc(1|e,s,t,i))}function oT(n,e){gm(8390656,8,n,e)}function zS(n,e){n0(2048,8,n,e)}function kz(n){St.flags|=4;var e=St.updateQueue;if(e===null)e=e0(),St.updateQueue=e,e.events=[n];else{var t=e.events;t===null?e.events=[n]:t.push(n)}}function rR(n){var e=Cn().memoizedState;return kz({ref:e,nextImpl:n}),function(){if(Xt&2)throw Error(ce(440));return e.impl.apply(void 0,arguments)}}function oR(n,e){return n0(4,2,n,e)}function lR(n,e){return n0(4,4,n,e)}function uR(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 cR(n,e,t){t=t!=null?t.concat([n]):null,n0(4,4,uR.bind(null,e,n),t)}function OS(){}function fR(n,e){var t=Cn();e=e===void 0?null:e;var i=t.memoizedState;return e!==null&&CS(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function hR(n,e){var t=Cn();e=e===void 0?null:e;var i=t.memoizedState;if(e!==null&&CS(e,i[1]))return i[0];if(i=n(),Cl){$r(!0);try{n()}finally{$r(!1)}}return t.memoizedState=[i,e],i}function PS(n,e,t){return t===void 0||dr&1073741824&&!(Lt&261930)?n.memoizedState=e:(n.memoizedState=t,n=e3(),St.lanes|=n,vo|=n,t)}function dR(n,e,t,i){return xa(t,e)?t:_c.current!==null?(n=PS(n,t,i),xa(n,e)||(Fn=!0),n):!(dr&42)||dr&1073741824&&!(Lt&261930)?(Fn=!0,n.memoizedState=t):(n=e3(),St.lanes|=n,vo|=n,e)}function pR(n,e,t,i,a){var s=qt.p;qt.p=s!==0&&8>s?s:8;var l=ut.T,u={};ut.T=u,FS(n,!1,e,t);try{var c=a(),h=ut.S;if(h!==null&&h(u,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var p=Pz(c,i);Kf(n,e,p,ya(n))}else Kf(n,e,i,ya(n))}catch(m){Kf(n,e,{then:function(){},status:"rejected",reason:m},ya())}finally{qt.p=s,l!==null&&u.types!==null&&(l.types=u.types),ut.T=l}}function Gz(){}function px(n,e,t,i){if(n.tag!==5)throw Error(ce(476));var a=mR(n).queue;pR(n,a,e,gl,t===null?Gz:function(){return gR(n),t(i)})}function mR(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 gR(n){var e=mR(n);e.next===null&&(e=n.alternate.memoizedState),Kf(n,e.next.queue,{},ya())}function BS(){return fi(Th)}function vR(){return Cn().memoizedState}function yR(){return Cn().memoizedState}function Wz(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),Zf(i,e,t)),e={cache:MS()},n.payload=e;return}e=e.return}}function Xz(n,e,t){var i=ya();t={lane:i,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null},i0(n)?xR(e,t):(t=_S(n,e,t,i),t!==null&&(ji(t,n,i),SR(t,e,i)))}function _R(n,e,t){var i=ya();Kf(n,e,t,i)}function Kf(n,e,t,i){var a={lane:i,revertLane:0,gesture:null,action:t,hasEagerState:!1,eagerState:null,next:null};if(i0(n))xR(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 Jg(n,e,a,0),an===null&&Kg(),!1}catch{}finally{}if(t=_S(n,e,a,i),t!==null)return ji(t,n,i),SR(t,e,i),!0}return!1}function FS(n,e,t,i){if(i={lane:2,revertLane:ZS(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},i0(n)){if(e)throw Error(ce(479))}else e=_S(n,t,i,2),e!==null&&ji(e,n,2)}function i0(n){var e=n.alternate;return n===St||e!==null&&e===St}function xR(n,e){hc=Hm=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function SR(n,e,t){if(t&4194048){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,rC(n,t)}}var bh={readContext:fi,use:t0,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};bh.useEffectEvent=xn;var bR={readContext:fi,use:t0,useCallback:function(n,e){return Ri().memoizedState=[n,e===void 0?null:e],n},useContext:fi,useEffect:oT,useImperativeHandle:function(n,e,t){t=t!=null?t.concat([n]):null,gm(4194308,4,uR.bind(null,e,n),t)},useLayoutEffect:function(n,e){return gm(4194308,4,n,e)},useInsertionEffect:function(n,e){gm(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=Xz.bind(null,St,n),[i.memoizedState,n]},useRef:function(n){var e=Ri();return n={current:n},e.memoizedState=n},useState:function(n){n=hx(n);var e=n.queue,t=_R.bind(null,St,e);return e.dispatch=t,[n.memoizedState,t]},useDebugValue:OS,useDeferredValue:function(n,e){var t=Ri();return PS(t,n,e)},useTransition:function(){var n=hx(!1);return n=pR.bind(null,St,n.queue,!0,!1),Ri().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,e,t){var i=St,a=Ri();if(It){if(t===void 0)throw Error(ce(407));t=t()}else{if(t=e(),an===null)throw Error(ce(349));Lt&127||jC(i,e,t)}a.memoizedState=t;var s={value:t,getSnapshot:e};return a.queue=s,oT(KC.bind(null,i,s,n),[n]),i.flags|=2048,xc(9,{destroy:void 0},QC.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=Vm++,0<t&&(e+="H"+t.toString(32)),e+="_"}else t=Bz++,e="_"+e+"r_"+t.toString(32)+"_";return n.memoizedState=e},useHostTransitionStatus:BS,useFormState:aT,useActionState:aT,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=FS.bind(null,St,!0,t),t.dispatch=e,[n,e]},useMemoCache:NS,useCacheRefresh:function(){return Ri().memoizedState=Wz.bind(null,St)},useEffectEvent:function(n){var e=Ri(),t={impl:n};return e.memoizedState=t,function(){if(Xt&2)throw Error(ce(440));return t.impl.apply(void 0,arguments)}}},HS={readContext:fi,use:t0,useCallback:fR,useContext:fi,useEffect:zS,useImperativeHandle:cR,useInsertionEffect:oR,useLayoutEffect:lR,useMemo:hR,useReducer:mm,useRef:sR,useState:function(){return mm(pr)},useDebugValue:OS,useDeferredValue:function(n,e){var t=Cn();return dR(t,en.memoizedState,n,e)},useTransition:function(){var n=mm(pr)[0],e=Cn().memoizedState;return[typeof n=="boolean"?n:$h(n),e]},useSyncExternalStore:ZC,useId:vR,useHostTransitionStatus:BS,useFormState:sT,useActionState:sT,useOptimistic:function(n,e){var t=Cn();return eR(t,en,n,e)},useMemoCache:NS,useCacheRefresh:yR};HS.useEffectEvent=rR;var MR={readContext:fi,use:t0,useCallback:fR,useContext:fi,useEffect:zS,useImperativeHandle:cR,useInsertionEffect:oR,useLayoutEffect:lR,useMemo:hR,useReducer:Ty,useRef:sR,useState:function(){return Ty(pr)},useDebugValue:OS,useDeferredValue:function(n,e){var t=Cn();return en===null?PS(t,n,e):dR(t,en.memoizedState,n,e)},useTransition:function(){var n=Ty(pr)[0],e=Cn().memoizedState;return[typeof n=="boolean"?n:$h(n),e]},useSyncExternalStore:ZC,useId:vR,useHostTransitionStatus:BS,useFormState:rT,useActionState:rT,useOptimistic:function(n,e){var t=Cn();return en!==null?eR(t,en,n,e):(t.baseState=n,[n,t.queue.dispatch])},useMemoCache:NS,useCacheRefresh:yR};MR.useEffectEvent=rR;function Ay(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 mx={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),Zf(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),Zf(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),Zf(e,n,t))}};function lT(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?!vh(t,i)||!vh(a,s):!0}function uT(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&&mx.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 ER(n){Nm(n)}function TR(n){console.error(n)}function AR(n){Nm(n)}function km(n,e){try{var t=n.onUncaughtError;t(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function cT(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 gx(n,e,t){return t=ro(t),t.tag=3,t.payload={element:null},t.callback=function(){km(n,e)},t}function wR(n){return n=ro(n),n.tag=3,n}function CR(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(){cT(e,t,i)}}var l=t.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){cT(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 qz(n,e,t,i,a){if(t.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=t.alternate,e!==null&&Ic(e,t,a,!0),t=Sa.current,t!==null){switch(t.tag){case 31:case 13:return Fa===null?Ym():t.alternate===null&&Sn===0&&(Sn=3),t.flags&=-257,t.flags|=65536,t.lanes=a,i===Pm?t.flags|=16384:(e=t.updateQueue,e===null?t.updateQueue=new Set([i]):e.add(i),Py(n,i,a)),!1;case 22:return t.flags|=65536,i===Pm?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)),Py(n,i,a)),!1}throw Error(ce(435,t.tag))}return Py(n,i,a),Ym(),!1}if(It)return e=Sa.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==ix&&(n=Error(ce(422),{cause:i}),_h(Oa(n,t)))):(i!==ix&&(e=Error(ce(423),{cause:i}),_h(Oa(e,t))),n=n.current.alternate,n.flags|=65536,a&=-a,n.lanes|=a,i=Oa(i,t),a=gx(n.stateNode,i,a),Ey(n,a),Sn!==4&&(Sn=2)),!1;var s=Error(ce(520),{cause:i});if(s=Oa(s,t),eh===null?eh=[s]:eh.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=gx(t.stateNode,i,n),Ey(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=wR(a),CR(a,n,t,i),Ey(t,a),!1}t=t.return}while(t!==null);return!1}var VS=Error(ce(461)),Fn=!1;function li(n,e,t,i){e.child=n===null?kC(e,null,t,i):wl(e,n.child,t,i)}function fT(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=RS(n,e,t,l,s,a),u=DS(),n!==null&&!Fn?(US(n,e,a),mr(n,e,a)):(It&&u&&SS(e),e.flags|=1,li(n,e,i,a),e.child)}function hT(n,e,t,i,a){if(n===null){var s=t.type;return typeof s=="function"&&!xS(s)&&s.defaultProps===void 0&&t.compare===null?(e.tag=15,e.type=s,RR(n,e,s,i,a)):(n=dm(t.type,null,i,e,e.mode,a),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!kS(n,a)){var l=s.memoizedProps;if(t=t.compare,t=t!==null?t:vh,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 RR(n,e,t,i,a){if(n!==null){var s=n.memoizedProps;if(vh(s,i)&&n.ref===e.ref)if(Fn=!1,e.pendingProps=i=s,kS(n,a))n.flags&131072&&(Fn=!0);else return e.lanes=n.lanes,mr(n,e,a)}return vx(n,e,t,i,a)}function DR(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 dT(n,e,s,t,i)}if(t&536870912)e.memoizedState={baseLanes:0,cachePool:null},n!==null&&pm(e,s!==null?s.cachePool:null),s!==null?tT(e,s):cx(),XC(e);else return i=e.lanes=536870912,dT(n,e,s!==null?s.baseLanes|t:t,t,i)}else s!==null?(pm(e,s.cachePool),tT(e,s),jr(),e.memoizedState=null):(n!==null&&pm(e,null),cx(),jr());return li(n,e,a,t),e.child}function Ff(n,e){return n!==null&&n.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function dT(n,e,t,i,a){var s=ES();return s=s===null?null:{parent:Pn._currentValue,pool:s},e.memoizedState={baseLanes:t,cachePool:s},n!==null&&pm(e,null),cx(),XC(e),n!==null&&Ic(n,e,i,!0),e.childLanes=a,null}function vm(n,e){return e=Gm({mode:e.mode,children:e.children},n.mode),e.ref=n.ref,n.child=e,e.return=n,e}function pT(n,e,t){return wl(e,n.child,null,t),n=vm(e,e.pendingProps),n.flags|=2,ha(e),e.memoizedState=null,n}function Yz(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=vm(e,i),e.lanes=536870912,Ff(null,n);if(fx(e),(n=un)?(n=b3(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=zC(n),t.return=e,e.child=t,ci=e,un=null)):n=null,n===null)throw mo(e);return e.lanes=536870912,null}return vm(e,i)}var s=n.memoizedState;if(s!==null){var l=s.dehydrated;if(fx(e),a)if(e.flags&256)e.flags&=-257,e=pT(n,e,t);else if(e.memoizedState!==null)e.child=n.child,e.flags|=128,e=null;else throw Error(ce(558));else if(Fn||Ic(n,e,t,!1),a=(t&n.childLanes)!==0,Fn||a){if(i=an,i!==null&&(l=oC(i,t),l!==0&&l!==s.retryLane))throw s.retryLane=l,Fl(n,l),ji(i,n,l),VS;Ym(),e=pT(n,e,t)}else n=s.treeContext,un=Ha(l.nextSibling),ci=e,It=!0,so=null,Pa=!1,n!==null&&PC(e,n),e=vm(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 ym(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(ce(284));(n===null||n.ref!==t)&&(e.flags|=4194816)}}function vx(n,e,t,i,a){return Al(e),t=RS(n,e,t,i,void 0,a),i=DS(),n!==null&&!Fn?(US(n,e,a),mr(n,e,a)):(It&&i&&SS(e),e.flags|=1,li(n,e,t,a),e.child)}function mT(n,e,t,i,a,s){return Al(e),e.updateQueue=null,t=YC(e,i,t,a),qC(n),i=DS(),n!==null&&!Fn?(US(n,e,s),mr(n,e,s)):(It&&i&&SS(e),e.flags|=1,li(n,e,t,s),e.child)}function gT(n,e,t,i,a){if(Al(e),e.stateNode===null){var s=Ju,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=mx,e.stateNode=s,s._reactInternals=e,s=e.stateNode,s.props=i,s.state=e.memoizedState,s.refs={},AS(e),l=t.contextType,s.context=typeof l=="object"&&l!==null?fi(l):Ju,s.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(Ay(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&&mx.enqueueReplaceState(s,s.state,null),Qf(e,i,s,a),jf(),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=Ju,typeof p=="object"&&p!==null&&(l=fi(p));var m=t.getDerivedStateFromProps;p=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function",u=e.pendingProps!==u,p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u||h!==l)&&uT(e,s,i,l),Xr=!1;var g=e.memoizedState;s.state=g,Qf(e,i,s,a),jf(),h=e.memoizedState,u||g!==h||Xr?(typeof m=="function"&&(Ay(e,t,m,i),h=e.memoizedState),(c=Xr||lT(e,t,c,i,g,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,lx(n,e),l=e.memoizedProps,p=Rl(t,l),s.props=p,m=e.pendingProps,g=s.context,h=t.contextType,c=Ju,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!==m||g!==c)&&uT(e,s,i,c),Xr=!1,g=e.memoizedState,s.state=g,Qf(e,i,s,a),jf();var v=e.memoizedState;l!==m||g!==v||Xr||n!==null&&n.dependencies!==null&&Om(n.dependencies)?(typeof u=="function"&&(Ay(e,t,u,i),v=e.memoizedState),(p=Xr||lT(e,t,p,i,g,v,c)||n!==null&&n.dependencies!==null&&Om(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&&g===n.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&g===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&&g===n.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&g===n.memoizedState||(e.flags|=1024),i=!1)}return s=i,ym(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 vT(n,e,t,i){return Tl(),e.flags|=256,li(n,e,t,i),e.child}var wy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cy(n){return{baseLanes:n,cachePool:FC()}}function Ry(n,e,t){return n=n!==null?n.childLanes&~t:0,e&&(n|=pa),n}function UR(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=b3(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=zC(n),t.return=e,e.child=t,ci=e,un=null)):n=null,n===null)throw mo(e);return Ux(n)?e.lanes=32:e.lanes=536870912,null}var u=i.children;return i=i.fallback,a?(jr(),a=e.mode,u=Gm({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=Cy(t),i.childLanes=Ry(n,l,t),e.memoizedState=wy,Ff(null,i)):(Zr(e),yx(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=Dy(n,e,t)):e.memoizedState!==null?(jr(),e.child=n.child,e.flags|=128,e=null):(jr(),u=i.fallback,a=e.mode,i=Gm({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=Cy(t),i.childLanes=Ry(n,l,t),e.memoizedState=wy,e=Ff(null,i));else if(Zr(e),Ux(u)){if(l=u.nextSibling&&u.nextSibling.dataset,l)var h=l.dgst;l=h,i=Error(ce(419)),i.stack="",i.digest=l,_h({value:i,source:null,stack:null}),e=Dy(n,e,t)}else if(Fn||Ic(n,e,t,!1),l=(t&n.childLanes)!==0,Fn||l){if(l=an,l!==null&&(i=oC(l,t),i!==0&&i!==c.retryLane))throw c.retryLane=i,Fl(n,i),ji(l,n,i),VS;Dx(u)||Ym(),e=Dy(n,e,t)}else Dx(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&&PC(e,n),e=yx(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,Ff(null,i),i=e.child,u=n.child.memoizedState,u===null?u=Cy(t):(a=u.cachePool,a!==null?(c=Pn._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=FC(),u={baseLanes:u.baseLanes|t,cachePool:a}),i.memoizedState=u,i.childLanes=Ry(n,l,t),e.memoizedState=wy,Ff(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 yx(n,e){return e=Gm({mode:"visible",children:e},n.mode),e.return=n,n.child=e}function Gm(n,e){return n=da(22,n,null,e),n.lanes=0,n}function Dy(n,e,t){return wl(e,n.child,null,t),n=yx(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function yT(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),sx(n.return,e,t)}function Uy(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 LR(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?yh:0,!u&&n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&yT(n,t,e);else if(n.tag===19)yT(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&&Fm(n)===null&&(a=t),t=t.sibling;t=a,t===null?(a=e.child,e.child=null):(a=t.sibling,t.sibling=null),Uy(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&&Fm(n)===null){e.child=a;break}n=a.sibling,a.sibling=t,t=a,a=n}Uy(e,!0,t,null,s,i);break;case"together":Uy(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(Ic(n,e,t,!1),(t&e.childLanes)===0)return null}else return null;if(n!==null&&e.child!==n.child)throw Error(ce(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 kS(n,e){return n.lanes&e?!0:(n=n.dependencies,!!(n!==null&&Om(n)))}function Zz(n,e,t){switch(e.tag){case 3:Rm(e,e.stateNode.containerInfo),Yr(e,Pn,n.memoizedState.cache),Tl();break;case 27:case 5:q_(e);break;case 4:Rm(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,fx(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?UR(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||(Ic(n,e,t,!1),i=(t&e.childLanes)!==0),a){if(i)return LR(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,DR(n,e,t,e.pendingProps);case 24:Yr(e,Pn,n.memoizedState.cache)}return mr(n,e,t)}function NR(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps)Fn=!0;else{if(!kS(n,t)&&!(e.flags&128))return Fn=!1,Zz(n,e,t);Fn=!!(n.flags&131072)}else Fn=!1,It&&e.flags&1048576&&OC(e,yh,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")xS(n)?(i=Rl(n,i),e.tag=1,e=gT(null,e,n,i,t)):(e.tag=0,e=vx(null,e,n,i,t));else{if(n!=null){var a=n.$$typeof;if(a===rS){e.tag=11,e=fT(null,e,n,i,t);break e}else if(a===oS){e.tag=14,e=hT(null,e,n,i,t);break e}}throw e=W_(n)||n,Error(ce(306,e,""))}}return e;case 0:return vx(n,e,e.type,e.pendingProps,t);case 1:return i=e.type,a=Rl(i,e.pendingProps),gT(n,e,i,a,t);case 3:e:{if(Rm(e,e.stateNode.containerInfo),n===null)throw Error(ce(387));i=e.pendingProps;var s=e.memoizedState;a=s.element,lx(n,e),Qf(e,i,null,t);var l=e.memoizedState;if(i=l.cache,Yr(e,Pn,i),i!==s.cache&&rx(e,[Pn],t,!0),jf(),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=vT(n,e,i,t);break e}else if(i!==a){a=Oa(Error(ce(424)),e),_h(a),e=vT(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=kC(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 ym(n,e),n===null?(t=BT(e.type,null,e.pendingProps,null))?e.memoizedState=t:It||(t=e.type,n=e.pendingProps,i=Km(ao.current).createElement(t),i[ui]=e,i[Ki]=n,hi(i,t,n),ti(i),e.stateNode=i):e.memoizedState=BT(e.type,n.memoizedProps,e.pendingProps,n.memoizedState),null;case 27:return q_(e),n===null&&It&&(i=e.stateNode=M3(e.type,e.pendingProps,ao.current),ci=e,Pa=!0,a=un,So(e.type)?(Lx=a,un=Ha(i.firstChild)):un=a),li(n,e,e.pendingProps.children,t),ym(n,e),n===null&&(e.flags|=4194304),e.child;case 5:return n===null&&It&&((a=i=un)&&(i=EO(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)),q_(e),a=e.type,s=e.pendingProps,l=n!==null?n.memoizedProps:null,i=s.children,Cx(a,s)?i=null:l!==null&&Cx(a,l)&&(e.flags|=32),e.memoizedState!==null&&(a=RS(n,e,Fz,null,null,t),Th._currentValue=a),ym(n,e),li(n,e,i,t),e.child;case 6:return n===null&&It&&((n=t=un)&&(t=TO(t,e.pendingProps,Pa),t!==null?(e.stateNode=t,ci=e,un=null,n=!0):n=!1),n||mo(e)),null;case 13:return UR(n,e,t);case 4:return Rm(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 fT(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 hT(n,e,e.type,e.pendingProps,t);case 15:return RR(n,e,e.type,e.pendingProps,t);case 19:return LR(n,e,t);case 31:return Yz(n,e,t);case 22:return DR(n,e,t,e.pendingProps);case 24:return Al(e),i=fi(Pn),n===null?(a=ES(),a===null&&(a=an,s=MS(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=t),a=s),e.memoizedState={parent:i,cache:a},AS(e),Yr(e,Pn,a)):(n.lanes&t&&(lx(n,e),Qf(e,null,null,t),jf()),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&&rx(e,[Pn],t,!0))),li(n,e,e.pendingProps.children,t),e.child;case 29:throw e.pendingProps}throw Error(ce(156,e.tag))}function Gs(n){n.flags|=4}function Ly(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(i3())n.flags|=8192;else throw _l=Pm,TS}else n.flags&=-16777217}function _T(n,e){if(e.type!=="stylesheet"||e.state.loading&4)n.flags&=-16777217;else if(n.flags|=16777216,!A3(e))if(i3())n.flags|=8192;else throw _l=Pm,TS}function cp(n,e){e!==null&&(n.flags|=4),n.flags&16384&&(e=n.tag!==22?aC():536870912,n.lanes|=e,Sc|=e)}function Sf(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 jz(n,e,t){var i=e.pendingProps;switch(bS(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),mc(),t.pendingContext&&(t.context=t.pendingContext,t.pendingContext=null),(n===null||n.child===null)&&(_u(e)?Gs(e):n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,My())),ln(e),null;case 26:var a=e.type,s=e.memoizedState;return n===null?(Gs(e),s!==null?(ln(e),_T(e,s)):(ln(e),Ly(e,a,null,i,t))):s?s!==n.memoizedState?(Gs(e),ln(e),_T(e,s)):(ln(e),e.flags&=-16777217):(n=n.memoizedProps,n!==i&&Gs(e),ln(e),Ly(e,a,n,i,t)),null;case 27:if(Dm(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(ce(166));return ln(e),null}n=bs.current,_u(e)?ZE(e):(n=M3(a,i,t),e.stateNode=n,Gs(e))}return ln(e),null;case 5:if(Dm(e),a=e.type,n!==null&&e.stateNode!=null)n.memoizedProps!==i&&Gs(e);else{if(!i){if(e.stateNode===null)throw Error(ce(166));return ln(e),null}if(s=bs.current,_u(e))ZE(e);else{var l=Km(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),Ly(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(ce(166));if(n=ao.current,_u(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||_3(n.nodeValue,t)),n||mo(e,!0)}else n=Km(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=_u(e),t!==null){if(n===null){if(!i)throw Error(ce(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ce(557));n[ui]=e}else Tl(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ln(e),n=!1}else t=My(),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(ce(558))}return ln(e),null;case 13:if(i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(a=_u(e),i!==null&&i.dehydrated!==null){if(n===null){if(!a)throw Error(ce(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(ce(317));a[ui]=e}else Tl(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;ln(e),a=!1}else a=My(),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),cp(e,e.updateQueue),ln(e),null);case 4:return mc(),n===null&&jS(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)Sf(i,!1);else{if(Sn!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(s=Fm(n),s!==null){for(e.flags|=128,Sf(i,!1),n=s.updateQueue,e.updateQueue=n,cp(e,n),e.subtreeFlags=0,n=t,t=e.child;t!==null;)IC(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,Sf(i,!1),e.lanes=4194304)}else{if(!a)if(n=Fm(s),n!==null){if(e.flags|=128,a=!0,n=n.updateQueue,e.updateQueue=n,cp(e,n),Sf(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,Sf(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),wS(),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&&cp(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(ce(156,e.tag))}function Qz(n,e){switch(bS(e),e.tag){case 1:return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return lr(Pn),mc(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 26:case 27:case 5:return Dm(e),null;case 31:if(e.memoizedState!==null){if(ha(e),e.alternate===null)throw Error(ce(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(ce(340));Tl()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ni(wn),null;case 4:return mc(),null;case 10:return lr(e.type),null;case 22:case 23:return ha(e),wS(),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 IR(n,e){switch(bS(e),e.tag){case 3:lr(Pn),mc();break;case 26:case 27:case 5:Dm(e);break;case 4:mc();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),wS(),n!==null&&ni(yl);break;case 24:lr(Pn)}}function ed(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 zR(n){var e=n.updateQueue;if(e!==null){var t=n.stateNode;try{WC(e,t)}catch(i){Qt(n,n.return,i)}}}function OR(n,e,t){t.props=Rl(n.type,n.memoizedProps),t.state=n.memoizedState;try{t.componentWillUnmount()}catch(i){Qt(n,e,i)}}function Jf(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 PR(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 Ny(n,e,t){try{var i=n.stateNode;yO(i,n.type,t,e),i[Ki]=e}catch(a){Qt(n,n.return,a)}}function BR(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&So(n.type)||n.tag===4}function Iy(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||BR(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 _x(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(_x(n,e,t),n=n.sibling;n!==null;)_x(n,e,t),n=n.sibling}function Wm(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(Wm(n,e,t),n=n.sibling;n!==null;)Wm(n,e,t),n=n.sibling}function FR(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,zy=!1,xT=typeof WeakSet=="function"?WeakSet:Set,ei=null;function Kz(n,e){if(n=n.containerInfo,Ax=tg,n=AC(n),vS(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,m=n,g=null;t:for(;;){for(var v;m!==t||a!==0&&m.nodeType!==3||(u=l+a),m!==s||i!==0&&m.nodeType!==3||(c=l+i),m.nodeType===3&&(l+=m.nodeValue.length),(v=m.firstChild)!==null;)g=m,m=v;for(;;){if(m===n)break t;if(g===t&&++h===a&&(u=l),g===s&&++p===i&&(c=l),(v=m.nextSibling)!==null)break;m=g,g=m.parentNode}m=v}t=u===-1||c===-1?null:{start:u,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(wx={focusedElem:n,selectionRange:t},tg=!1,ei=e;ei!==null;)if(e=ei,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ei=n;else for(;ei!==null;){switch(e=ei,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)Rx(n);else if(t===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Rx(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(ce(163))}if(n=e.sibling,n!==null){n.return=e.return,ei=n;break}ei=e.return}}function HR(n,e,t){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Xs(n,t),i&4&&ed(5,t);break;case 1:if(Xs(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&&zR(t),i&512&&Jf(t,t.return);break;case 3:if(Xs(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{WC(n,e)}catch(l){Qt(t,t.return,l)}}break;case 27:e===null&&i&4&&FR(t);case 26:case 5:Xs(n,t),e===null&&i&4&&PR(t),i&512&&Jf(t,t.return);break;case 12:Xs(n,t);break;case 31:Xs(n,t),i&4&&GR(n,t);break;case 13:Xs(n,t),i&4&&WR(n,t),i&64&&(n=t.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(t=rO.bind(null,t),AO(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):Xs(n,t),er=a,On=s}break;case 30:break;default:Xs(n,t)}}function VR(n){var e=n.alternate;e!==null&&(n.alternate=null,VR(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&fS(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,Wi=!1;function Ws(n,e,t){for(t=t.child;t!==null;)kR(n,e,t),t=t.sibling}function kR(n,e,t){if(ga&&typeof ga.onCommitFiberUnmount=="function")try{ga.onCommitFiberUnmount(Yh,t)}catch{}switch(t.tag){case 26:On||_s(t,e),Ws(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=Wi;So(t.type)&&(hn=t.stateNode,Wi=!1),Ws(n,e,t),nh(t.stateNode),hn=i,Wi=a;break;case 5:On||_s(t,e);case 6:if(i=hn,a=Wi,hn=null,Ws(n,e,t),hn=i,Wi=a,hn!==null)if(Wi)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&&(Wi?(n=hn,NT(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.stateNode),Tc(n)):NT(hn,t.stateNode));break;case 4:i=hn,a=Wi,hn=t.stateNode.containerInfo,Wi=!0,Ws(n,e,t),hn=i,Wi=a;break;case 0:case 11:case 14:case 15:go(2,t,e),On||go(4,t,e),Ws(n,e,t);break;case 1:On||(_s(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"&&OR(t,e,i)),Ws(n,e,t);break;case 21:Ws(n,e,t);break;case 22:On=(i=On)||t.memoizedState!==null,Ws(n,e,t),On=i;break;default:Ws(n,e,t)}}function GR(n,e){if(e.memoizedState===null&&(n=e.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Tc(n)}catch(t){Qt(e,e.return,t)}}}function WR(n,e){if(e.memoizedState===null&&(n=e.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Tc(n)}catch(t){Qt(e,e.return,t)}}function Jz(n){switch(n.tag){case 31:case 13:case 19:var e=n.stateNode;return e===null&&(e=n.stateNode=new xT),e;case 22:return n=n.stateNode,e=n._retryCache,e===null&&(e=n._retryCache=new xT),e;default:throw Error(ce(435,n.tag))}}function fp(n,e){var t=Jz(n);e.forEach(function(i){if(!t.has(i)){t.add(i);var a=oO.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,Wi=!1;break e}break;case 5:hn=u.stateNode,Wi=!1;break e;case 3:case 4:hn=u.stateNode.containerInfo,Wi=!0;break e}u=u.return}if(hn===null)throw Error(ce(160));kR(s,l,a),hn=null,Wi=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)XR(e,n),e=e.sibling}var es=null;function XR(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),ed(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[Qh]||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,ti(s),i=s;break e;case"link":var l=HT("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=HT("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(ce(468,i))}s[ui]=n,ti(s),i=s}n.stateNode=i}else VT(a,n.type,n.stateNode);else n.stateNode=FT(a,i,n.memoizedProps);else s!==i?(s===null?t.stateNode!==null&&(t=t.stateNode,t.parentNode.removeChild(t)):s.count--,i===null?VT(a,n.type,n.stateNode):FT(a,i,n.memoizedProps)):i===null&&n.stateNode!==null&&Ny(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&&Ny(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{vc(a,"")}catch(_){Qt(n,n.return,_)}}i&4&&n.stateNode!=null&&(a=n.memoizedProps,Ny(n,a,t!==null?t.memoizedProps:a)),i&1024&&(zy=!0);break;case 6:if(Hi(e,n),Vi(n),i&4){if(n.stateNode===null)throw Error(ce(162));i=n.memoizedProps,t=n.stateNode;try{t.nodeValue=i}catch(_){Qt(n,n.return,_)}}break;case 3:if(Sm=null,a=es,es=Jm(e.containerInfo),Hi(e,n),es=a,Vi(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{Tc(e.containerInfo)}catch(_){Qt(n,n.return,_)}zy&&(zy=!1,qR(n));break;case 4:i=es,es=Jm(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,fp(n,i)));break;case 13:Hi(e,n),Vi(n),n.child.flags&8192&&n.memoizedState!==null!=(t!==null&&t.memoizedState!==null)&&(a0=ma()),i&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,fp(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 m=c.memoizedProps.style,g=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=g==null||typeof g=="boolean"?"":(""+g).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?IT(v,!0):IT(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,fp(n,t))));break;case 19:Hi(e,n),Vi(n),i&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,fp(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(BR(i)){t=i;break}i=i.return}if(t==null)throw Error(ce(160));switch(t.tag){case 27:var a=t.stateNode,s=Iy(n);Wm(n,s,a);break;case 5:var l=t.stateNode;t.flags&32&&(vc(l,""),t.flags&=-33);var u=Iy(n);Wm(n,u,l);break;case 3:case 4:var c=t.stateNode.containerInfo,h=Iy(n);_x(n,h,c);break;default:throw Error(ce(161))}}catch(p){Qt(n,n.return,p)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function qR(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var e=n;qR(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),n=n.sibling}}function Xs(n,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)HR(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"&&OR(e,e.return,t),ll(e);break;case 27:nh(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),ed(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++)GC(c[a],u)}catch(h){Qt(i,i.return,h)}}t&&l&64&&zR(s),Jf(s,s.return);break;case 27:FR(s);case 26:case 5:Js(a,s,t),t&&i===null&&l&4&&PR(s),Jf(s,s.return);break;case 12:Js(a,s,t);break;case 31:Js(a,s,t),t&&l&4&&GR(a,s);break;case 13:Js(a,s,t),t&&l&4&&WR(a,s);break;case 22:s.memoizedState===null&&Js(a,s,t),Jf(s,s.return);break;case 30:break;default:Js(a,s,t)}e=e.sibling}}function GS(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&&Jh(t))}function WS(n,e){n=null,e.alternate!==null&&(n=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==n&&(e.refCount++,n!=null&&Jh(n))}function ja(n,e,t,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)YR(n,e,t,i),e=e.sibling}function YR(n,e,t,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:ja(n,e,t,i),a&2048&&ed(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&&Jh(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):$f(n,e):s._visibility&2?ja(n,e,t,i):(s._visibility|=2,ku(n,e,t,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&GS(l,e);break;case 24:ja(n,e,t,i),a&2048&&WS(e.alternate,e);break;default:ja(n,e,t,i)}}function ku(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:ku(s,l,u,c,a),ed(8,l);break;case 23:break;case 22:var p=l.stateNode;l.memoizedState!==null?p._visibility&2?ku(s,l,u,c,a):$f(s,l):(p._visibility|=2,ku(s,l,u,c,a)),a&&h&2048&&GS(l.alternate,l);break;case 24:ku(s,l,u,c,a),a&&h&2048&&WS(l.alternate,l);break;default:ku(s,l,u,c,a)}e=e.sibling}}function $f(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:$f(t,i),a&2048&&GS(i.alternate,i);break;case 24:$f(t,i),a&2048&&WS(i.alternate,i);break;default:$f(t,i)}e=e.sibling}}var Hf=8192;function xu(n,e,t){if(n.subtreeFlags&Hf)for(n=n.child;n!==null;)ZR(n,e,t),n=n.sibling}function ZR(n,e,t){switch(n.tag){case 26:xu(n,e,t),n.flags&Hf&&n.memoizedState!==null&&BO(t,es,n.memoizedState,n.memoizedProps);break;case 5:xu(n,e,t);break;case 3:case 4:var i=es;es=Jm(n.stateNode.containerInfo),xu(n,e,t),es=i;break;case 22:n.memoizedState===null&&(i=n.alternate,i!==null&&i.memoizedState!==null?(i=Hf,Hf=16777216,xu(n,e,t),Hf=i):xu(n,e,t));break;default:xu(n,e,t)}}function jR(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 bf(n){var e=n.deletions;if(n.flags&16){if(e!==null)for(var t=0;t<e.length;t++){var i=e[t];ei=i,KR(i,n)}jR(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)QR(n),n=n.sibling}function QR(n){switch(n.tag){case 0:case 11:case 15:bf(n),n.flags&2048&&go(9,n,n.return);break;case 3:bf(n);break;case 12:bf(n);break;case 22:var e=n.stateNode;n.memoizedState!==null&&e._visibility&2&&(n.return===null||n.return.tag!==13)?(e._visibility&=-3,_m(n)):bf(n);break;default:bf(n)}}function _m(n){var e=n.deletions;if(n.flags&16){if(e!==null)for(var t=0;t<e.length;t++){var i=e[t];ei=i,KR(i,n)}jR(n)}for(n=n.child;n!==null;){switch(e=n,e.tag){case 0:case 11:case 15:go(8,e,e.return),_m(e);break;case 22:t=e.stateNode,t._visibility&2&&(t._visibility&=-3,_m(e));break;default:_m(e)}n=n.sibling}}function KR(n,e){for(;ei!==null;){var t=ei;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:Jh(t.memoizedState.cache)}if(i=t.child,i!==null)i.return=t,ei=i;else e:for(t=n;ei!==null;){i=ei;var a=i.sibling,s=i.return;if(VR(i),i===t){ei=null;break e}if(a!==null){a.return=s,ei=a;break e}ei=s}}}var $z={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}},eO=typeof WeakMap=="function"?WeakMap:Map,Xt=0,an=null,Ct=null,Lt=0,jt=0,ca=null,to=!1,Oc=!1,XS=!1,gr=0,Sn=0,vo=0,xl=0,qS=0,pa=0,Sc=0,eh=null,Xi=null,xx=!1,a0=0,JR=0,Xm=1/0,qm=null,lo=null,Gn=0,uo=null,bc=null,ur=0,Sx=0,bx=null,$R=null,th=0,Mx=null;function ya(){return Xt&2&&Lt!==0?Lt&-Lt:ut.T!==null?ZS():lC()}function e3(){if(pa===0)if(!(Lt&536870912)||It){var n=ip;ip<<=1,!(ip&3932160)&&(ip=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)&&(Mc(n,0),no(n,Lt,pa,!1)),jh(n,t),(!(Xt&2)||n!==an)&&(n===an&&(!(Xt&2)&&(xl|=t),Sn===4&&no(n,Lt,pa,!1)),ws(n))}function t3(n,e,t){if(Xt&6)throw Error(ce(327));var i=!t&&(e&127)===0&&(e&n.expiredLanes)===0||Zh(n,e),a=i?iO(n,e):Oy(n,e,!0),s=i;do{if(a===0){Oc&&!i&&no(n,e,0,!1);break}else{if(t=n.current.alternate,s&&!tO(t)){a=Oy(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=eh;var c=u.current.memoizedState.isDehydrated;if(c&&(Mc(u,l).flags|=256),l=Oy(u,l,!1),l!==2){if(XS&&!c){u.errorRecoveryDisabledLanes|=s,xl|=s,a=4;break e}s=Xi,Xi=a,s!==null&&(Xi===null?Xi=s:Xi.push.apply(Xi,s))}a=l}if(s=!1,a!==2)continue}}if(a===1){Mc(n,0),no(n,e,0,!0);break}e:{switch(i=n,s=a,s){case 0:case 1:throw Error(ce(345));case 4:if((e&4194048)!==e)break;case 6:no(i,e,pa,!to);break e;case 2:Xi=null;break;case 3:case 5:break;default:throw Error(ce(329))}if((e&62914560)===e&&(a=a0+300-ma(),10<a)){if(no(i,e,pa,!to),Yg(i,0,!0)!==0)break e;ur=e,i.timeoutHandle=S3(ST.bind(null,i,t,Xi,qm,xx,e,pa,xl,Sc,to,s,"Throttled",-0,0),a);break e}ST(i,t,Xi,qm,xx,e,pa,xl,Sc,to,s,null,-0,0)}}break}while(!0);ws(n)}function ST(n,e,t,i,a,s,l,u,c,h,p,m,g,v){if(n.timeoutHandle=-1,m=e.subtreeFlags,m&8192||(m&16785408)===16785408){m={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ar},ZR(e,s,m);var _=(s&62914560)===s?a0-ma():(s&4194048)===s?JR-ma():0;if(_=FO(m,_),_!==null){ur=s,n.cancelPendingCommit=_(MT.bind(null,n,e,s,t,i,a,l,u,c,p,m,null,g,v)),no(n,s,l,!h);return}}MT(n,e,s,t,i,a,l,u,c)}function tO(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&=~qS,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&&sC(n,t,e)}function s0(){return Xt&6?!0:(td(0),!1)}function YS(){if(Ct!==null){if(jt===0)var n=Ct.return;else n=Ct,sr=Hl=null,LS(n),fc=null,xh=0,n=Ct;for(;n!==null;)IR(n.alternate,n),n=n.return;Ct=null}}function Mc(n,e){var t=n.timeoutHandle;t!==-1&&(n.timeoutHandle=-1,SO(t)),t=n.cancelPendingCommit,t!==null&&(n.cancelPendingCommit=null,t()),ur=0,YS(),an=n,Ct=t=or(n.current,null),Lt=e,jt=0,ca=null,to=!1,Oc=Zh(n,e),XS=!1,Sc=pa=qS=xl=vo=Sn=0,Xi=eh=null,xx=!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,Kg(),t}function n3(n,e){St=null,ut.H=bh,e===zc||e===$g?(e=$E(),jt=3):e===TS?(e=$E(),jt=4):jt=e===VS?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,ca=e,Ct===null&&(Sn=1,km(n,Oa(e,n.current)))}function i3(){var n=Sa.current;return n===null?!0:(Lt&4194048)===Lt?Fa===null:(Lt&62914560)===Lt||Lt&536870912?n===Fa:!1}function a3(){var n=ut.H;return ut.H=bh,n===null?bh:n}function s3(){var n=ut.A;return ut.A=$z,n}function Ym(){Sn=4,to||(Lt&4194048)!==Lt&&Sa.current!==null||(Oc=!0),!(vo&134217727)&&!(xl&134217727)||an===null||no(an,Lt,pa,!1)}function Oy(n,e,t){var i=Xt;Xt|=2;var a=a3(),s=s3();(an!==n||Lt!==e)&&(qm=null,Mc(n,e)),e=!1;var l=Sn;e:do try{if(jt!==0&&Ct!==null){var u=Ct,c=ca;switch(jt){case 8:YS(),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,tc(n,u,c,h),t&&Oc){l=0;break e}break;default:h=jt,jt=0,ca=null,tc(n,u,c,h)}}nO(),l=Sn;break}catch(p){n3(n,p)}while(!0);return e&&n.shellSuspendCounter++,sr=Hl=null,Xt=i,ut.H=a,ut.A=s,Ct===null&&(an=null,Lt=0,Kg()),l}function nO(){for(;Ct!==null;)r3(Ct)}function iO(n,e){var t=Xt;Xt|=2;var i=a3(),a=s3();an!==n||Lt!==e?(qm=null,Xm=ma()+500,Mc(n,e)):Oc=Zh(n,e);e:do try{if(jt!==0&&Ct!==null){e=Ct;var s=ca;t:switch(jt){case 1:jt=0,ca=null,tc(n,e,s,1);break;case 2:case 9:if(JE(s)){jt=0,ca=null,bT(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:JE(s)?(jt=0,ca=null,bT(e)):(jt=0,ca=null,tc(n,e,s,7));break;case 5:var l=null;switch(Ct.tag){case 26:l=Ct.memoizedState;case 5:case 27:var u=Ct;if(l?A3(l):u.stateNode.complete){jt=0,ca=null;var c=u.sibling;if(c!==null)Ct=c;else{var h=u.return;h!==null?(Ct=h,r0(h)):Ct=null}break t}}jt=0,ca=null,tc(n,e,s,5);break;case 6:jt=0,ca=null,tc(n,e,s,6);break;case 8:YS(),Sn=6;break e;default:throw Error(ce(462))}}aO();break}catch(p){n3(n,p)}while(!0);return sr=Hl=null,ut.H=i,ut.A=a,Xt=t,Ct!==null?0:(an=null,Lt=0,Kg(),Sn)}function aO(){for(;Ct!==null&&!wI();)r3(Ct)}function r3(n){var e=NR(n.alternate,n,gr);n.memoizedProps=n.pendingProps,e===null?r0(n):Ct=e}function bT(n){var e=n,t=e.alternate;switch(e.tag){case 15:case 0:e=mT(t,e,e.pendingProps,e.type,void 0,Lt);break;case 11:e=mT(t,e,e.pendingProps,e.type.render,e.ref,Lt);break;case 5:LS(e);default:IR(t,e),e=Ct=IC(e,gr),e=NR(t,e,gr)}n.memoizedProps=n.pendingProps,e===null?r0(n):Ct=e}function tc(n,e,t,i){sr=Hl=null,LS(e),fc=null,xh=0;var a=e.return;try{if(qz(n,a,e,t,Lt)){Sn=1,km(n,Oa(t,n.current)),Ct=null;return}}catch(s){if(a!==null)throw Ct=a,s;Sn=1,km(n,Oa(t,n.current)),Ct=null;return}e.flags&32768?(It||i===1?n=!0:Oc||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))),o3(e,n)):r0(e)}function r0(n){var e=n;do{if(e.flags&32768){o3(e,to);return}n=e.return;var t=jz(e.alternate,e,gr);if(t!==null){Ct=t;return}if(e=e.sibling,e!==null){Ct=e;return}Ct=e=n}while(e!==null);Sn===0&&(Sn=5)}function o3(n,e){do{var t=Qz(n.alternate,n);if(t!==null){t.flags&=32767,Ct=t;return}if(t=n.return,t!==null&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!e&&(n=n.sibling,n!==null)){Ct=n;return}Ct=n=t}while(n!==null);Sn=6,Ct=null}function MT(n,e,t,i,a,s,l,u,c){n.cancelPendingCommit=null;do o0();while(Gn!==0);if(Xt&6)throw Error(ce(327));if(e!==null){if(e===n.current)throw Error(ce(177));if(s=e.lanes|e.childLanes,s|=yS,PI(n,t,s,l,u,c),n===an&&(Ct=an=null,Lt=0),bc=e,uo=n,ur=t,Sx=s,bx=a,$R=i,e.subtreeFlags&10256||e.flags&10256?(n.callbackNode=null,n.callbackPriority=0,lO(Um,function(){return h3(),null})):(n.callbackNode=null,n.callbackPriority=0),i=(e.flags&13878)!==0,e.subtreeFlags&13878||i){i=ut.T,ut.T=null,a=qt.p,qt.p=2,l=Xt,Xt|=4;try{Kz(n,e,t)}finally{Xt=l,qt.p=a,ut.T=i}}Gn=1,l3(),u3(),c3()}}function l3(){if(Gn===1){Gn=0;var n=uo,e=bc,t=(e.flags&13878)!==0;if(e.subtreeFlags&13878||t){t=ut.T,ut.T=null;var i=qt.p;qt.p=2;var a=Xt;Xt|=4;try{XR(e,n);var s=wx,l=AC(n.containerInfo),u=s.focusedElem,c=s.selectionRange;if(l!==u&&u&&u.ownerDocument&&TC(u.ownerDocument.documentElement,u)){if(c!==null&&vS(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 m=u.ownerDocument||document,g=m&&m.defaultView||window;if(g.getSelection){var v=g.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=XE(u,T),S=XE(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=m.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(m=[],v=u;v=v.parentNode;)v.nodeType===1&&m.push({element:v,left:v.scrollLeft,top:v.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<m.length;u++){var A=m[u];A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}tg=!!Ax,wx=Ax=null}finally{Xt=a,qt.p=i,ut.T=t}}n.current=e,Gn=2}}function u3(){if(Gn===2){Gn=0;var n=uo,e=bc,t=(e.flags&8772)!==0;if(e.subtreeFlags&8772||t){t=ut.T,ut.T=null;var i=qt.p;qt.p=2;var a=Xt;Xt|=4;try{HR(n,e.alternate,e)}finally{Xt=a,qt.p=i,ut.T=t}}Gn=3}}function c3(){if(Gn===4||Gn===3){Gn=0,CI();var n=uo,e=bc,t=ur,i=$R;e.subtreeFlags&10256||e.flags&10256?Gn=5:(Gn=0,bc=uo=null,f3(n,n.pendingLanes));var a=n.pendingLanes;if(a===0&&(lo=null),cS(t),e=e.stateNode,ga&&typeof ga.onCommitFiberRoot=="function")try{ga.onCommitFiberRoot(Yh,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=ut.T,a=qt.p,qt.p=2,ut.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{ut.T=e,qt.p=a}}ur&3&&o0(),ws(n),a=n.pendingLanes,t&261930&&a&42?n===Mx?th++:(th=0,Mx=n):th=0,td(0)}}function f3(n,e){(n.pooledCacheLanes&=e)===0&&(e=n.pooledCache,e!=null&&(n.pooledCache=null,Jh(e)))}function o0(){return l3(),u3(),c3(),h3()}function h3(){if(Gn!==5)return!1;var n=uo,e=Sx;Sx=0;var t=cS(ur),i=ut.T,a=qt.p;try{qt.p=32>t?32:t,ut.T=null,t=bx,bx=null;var s=uo,l=ur;if(Gn=0,bc=uo=null,ur=0,Xt&6)throw Error(ce(331));var u=Xt;if(Xt|=4,QR(s.current),YR(s,s.current,l,t),Xt=u,td(0,!1),ga&&typeof ga.onPostCommitFiberRoot=="function")try{ga.onPostCommitFiberRoot(Yh,s)}catch{}return!0}finally{qt.p=a,ut.T=i,f3(n,e)}}function ET(n,e,t){e=Oa(t,e),e=gx(n.stateNode,e,2),n=oo(n,e,2),n!==null&&(jh(n,2),ws(n))}function Qt(n,e,t){if(n.tag===3)ET(n,n,t);else for(;e!==null;){if(e.tag===3){ET(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=wR(2),i=oo(e,t,2),i!==null&&(CR(t,i,e,n),jh(i,2),ws(i));break}}e=e.return}}function Py(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new eO;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)||(XS=!0,a.add(t),n=sO.bind(null,n,e,t),e.then(n,n))}function sO(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()-a0?!(Xt&2)&&Mc(n,0):qS|=t,Sc===Lt&&(Sc=0)),ws(n)}function d3(n,e){e===0&&(e=aC()),n=Fl(n,e),n!==null&&(jh(n,e),ws(n))}function rO(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),d3(n,t)}function oO(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(ce(314))}i!==null&&i.delete(e),d3(n,t)}function lO(n,e){return lS(n,e)}var Zm=null,Gu=null,Ex=!1,jm=!1,By=!1,io=0;function ws(n){n!==Gu&&n.next===null&&(Gu===null?Zm=Gu=n:Gu=Gu.next=n),jm=!0,Ex||(Ex=!0,cO())}function td(n,e){if(!By&&jm){By=!0;do for(var t=!1,i=Zm;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,TT(i,s))}else s=Lt,s=Yg(i,i===an?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(s&3)||Zh(i,s)||(t=!0,TT(i,s));i=i.next}while(t);By=!1}}function uO(){p3()}function p3(){jm=Ex=!1;var n=0;io!==0&&xO()&&(n=io);for(var e=ma(),t=null,i=Zm;i!==null;){var a=i.next,s=m3(i,e);s===0?(i.next=null,t===null?Zm=a:t.next=a,a===null&&(Gu=t)):(t=i,(n!==0||s&3)&&(jm=!0)),i=a}Gn!==0&&Gn!==5||td(n),io!==0&&(io=0)}function m3(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]=OI(u,e)):c<=e&&(n.expiredLanes|=u),s&=~u}if(e=an,t=Lt,t=Yg(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&&hy(i),n.callbackNode=null,n.callbackPriority=0;if(!(t&3)||Zh(n,t)){if(e=t&-t,e===n.callbackPriority)return e;switch(i!==null&&hy(i),cS(t)){case 2:case 8:t=nC;break;case 32:t=Um;break;case 268435456:t=iC;break;default:t=Um}return i=g3.bind(null,n),t=lS(t,i),n.callbackPriority=e,n.callbackNode=t,e}return i!==null&&i!==null&&hy(i),n.callbackPriority=2,n.callbackNode=null,2}function g3(n,e){if(Gn!==0&&Gn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var t=n.callbackNode;if(o0()&&n.callbackNode!==t)return null;var i=Lt;return i=Yg(n,n===an?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),i===0?null:(t3(n,i,e),m3(n,ma()),n.callbackNode!=null&&n.callbackNode===t?g3.bind(null,n):null)}function TT(n,e){if(o0())return null;t3(n,e,!0)}function cO(){bO(function(){Xt&6?lS(tC,uO):p3()})}function ZS(){if(io===0){var n=yc;n===0&&(n=np,np<<=1,!(np&261888)&&(np=256)),io=n}return io}function AT(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:cm(""+n)}function wT(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 fO(n,e,t,i,a){if(e==="submit"&&t&&t.stateNode===a){var s=AT((a[Ki]||null).action),l=i.submitter;l&&(e=(e=l[Ki]||null)?AT(e.formAction):l.getAttribute("formAction"),e!==null&&(s=e,l=null));var u=new Zg("action","action",null,i,a);n.push({event:u,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(io!==0){var c=l?wT(a,l):new FormData(a);px(t,{pending:!0,data:c,method:a.method,action:s},null,c)}}else typeof s=="function"&&(u.preventDefault(),c=l?wT(a,l):new FormData(a),px(t,{pending:!0,data:c,method:a.method,action:s},s,c))},currentTarget:a}]})}}for(var Fy=0;Fy<nx.length;Fy++){var Hy=nx[Fy],hO=Hy.toLowerCase(),dO=Hy[0].toUpperCase()+Hy.slice(1);rs(hO,"on"+dO)}rs(CC,"onAnimationEnd");rs(RC,"onAnimationIteration");rs(DC,"onAnimationStart");rs("dblclick","onDoubleClick");rs("focusin","onFocus");rs("focusout","onBlur");rs(Rz,"onTransitionRun");rs(Dz,"onTransitionStart");rs(Uz,"onTransitionCancel");rs(UC,"onTransitionEnd");gc("onMouseEnter",["mouseout","mouseover"]);gc("onMouseLeave",["mouseout","mouseover"]);gc("onPointerEnter",["pointerout","pointerover"]);gc("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 Mh="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(" "),pO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mh));function v3(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){Nm(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){Nm(p)}a.currentTarget=null,s=c}}}}function wt(n,e){var t=e[Z_];t===void 0&&(t=e[Z_]=new Set);var i=n+"__bubble";t.has(i)||(y3(e,n,2,!1),t.add(i))}function Vy(n,e,t){var i=0;e&&(i|=4),y3(t,n,i,e)}var hp="_reactListening"+Math.random().toString(36).slice(2);function jS(n){if(!n[hp]){n[hp]=!0,uC.forEach(function(t){t!=="selectionchange"&&(pO.has(t)||Vy(t,!1,n),Vy(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[hp]||(e[hp]=!0,Vy("selectionchange",!1,e))}}function y3(n,e,t,i){switch(U3(e)){case 2:var a=kO;break;case 8:a=GO;break;default:a=$S}t=a.bind(null,e,t,n),a=void 0,!$_||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 ky(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=qu(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}vC(function(){var h=s,p=dS(t),m=[];e:{var g=LC.get(n);if(g!==void 0){var v=Zg,_=n;switch(n){case"keypress":if(hm(t)===0)break e;case"keydown":case"keyup":v=oz;break;case"focusin":_="focus",v=vy;break;case"focusout":_="blur",v=vy;break;case"beforeblur":case"afterblur":v=vy;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=zE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=jI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=cz;break;case CC:case RC:case DC:v=JI;break;case UC:v=hz;break;case"scroll":case"scrollend":v=YI;break;case"wheel":v=pz;break;case"copy":case"cut":case"paste":v=ez;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=PE;break;case"toggle":case"beforetoggle":v=gz}var T=(e&4)!==0,b=!T&&(n==="scroll"||n==="scrollend"),y=T?g!==null?g+"Capture":null:g;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=mh(S,y),A!=null&&T.push(Eh(S,A,E))),b)break;S=S.return}0<T.length&&(g=new v(g,_,null,t,p),m.push({event:g,listeners:T}))}}if(!(e&7)){e:{if(g=n==="mouseover"||n==="pointerover",v=n==="mouseout"||n==="pointerout",g&&t!==J_&&(_=t.relatedTarget||t.fromElement)&&(qu(_)||_[Lc]))break e;if((v||g)&&(g=p.window===p?p:(g=p.ownerDocument)?g.defaultView||g.parentWindow:window,v?(_=t.relatedTarget||t.toElement,v=h,_=_?qu(_):null,_!==null&&(b=qh(_),T=_.tag,_!==b||T!==5&&T!==27&&T!==6)&&(_=null)):(v=null,_=h),v!==_)){if(T=zE,A="onMouseLeave",y="onMouseEnter",S="mouse",(n==="pointerout"||n==="pointerover")&&(T=PE,A="onPointerLeave",y="onPointerEnter",S="pointer"),b=v==null?g:Bf(v),E=_==null?g:Bf(_),g=new T(A,S+"leave",v,t,p),g.target=b,g.relatedTarget=E,A=null,qu(p)===h&&(T=new T(y,S+"enter",_,t,p),T.target=E,T.relatedTarget=b,A=T),b=A,v&&_)t:{for(T=mO,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&&CT(m,g,v,T,!1),_!==null&&b!==null&&CT(m,b,_,T,!0)}}e:{if(g=h?Bf(h):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var R=VE;else if(HE(g))if(MC)R=Az;else{R=Ez;var L=Mz}else v=g.nodeName,!v||v.toLowerCase()!=="input"||g.type!=="checkbox"&&g.type!=="radio"?h&&hS(h.elementType)&&(R=VE):R=Tz;if(R&&(R=R(n,h))){bC(m,R,t,p);break e}L&&L(n,g,h),n==="focusout"&&h&&g.type==="number"&&h.memoizedProps.value!=null&&K_(g,"number",g.value)}switch(L=h?Bf(h):window,n){case"focusin":(HE(L)||L.contentEditable==="true")&&(ju=L,ex=h,qf=null);break;case"focusout":qf=ex=ju=null;break;case"mousedown":tx=!0;break;case"contextmenu":case"mouseup":case"dragend":tx=!1,qE(m,t,p);break;case"selectionchange":if(Cz)break;case"keydown":case"keyup":qE(m,t,p)}var z;if(gS)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 Zu?xC(n,t)&&(C="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(C="onCompositionStart");C&&(_C&&t.locale!=="ko"&&(Zu||C!=="onCompositionStart"?C==="onCompositionEnd"&&Zu&&(z=yC()):(eo=p,pS="value"in eo?eo.value:eo.textContent,Zu=!0)),L=Qm(h,C),0<L.length&&(C=new OE(C,n,null,t,p),m.push({event:C,listeners:L}),z?C.data=z:(z=SC(t),z!==null&&(C.data=z)))),(z=yz?_z(n,t):xz(n,t))&&(C=Qm(h,"onBeforeInput"),0<C.length&&(L=new OE("onBeforeInput","beforeinput",null,t,p),m.push({event:L,listeners:C}),L.data=z)),fO(m,n,h,t,p)}v3(m,e)})}function Eh(n,e,t){return{instance:n,listener:e,currentTarget:t}}function Qm(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=mh(n,t),a!=null&&i.unshift(Eh(n,a,s)),a=mh(n,e),a!=null&&i.push(Eh(n,a,s))),n.tag===3)return i;n=n.return}return[]}function mO(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function CT(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=mh(t,s),h!=null&&l.unshift(Eh(t,h,c))):a||(h=mh(t,s),h!=null&&l.push(Eh(t,h,c)))),t=t.return}l.length!==0&&n.push({event:e,listeners:l})}var gO=/\r\n?/g,vO=/\u0000|\uFFFD/g;function RT(n){return(typeof n=="string"?n:""+n).replace(gO,`
`).replace(vO,"")}function _3(n,e){return e=RT(e),RT(n)===e}function $t(n,e,t,i,a,s){switch(t){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||vc(n,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&vc(n,""+i);break;case"className":sp(n,"class",i);break;case"tabIndex":sp(n,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":sp(n,t,i);break;case"style":gC(n,i,s);break;case"data":if(e!=="object"){sp(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=cm(""+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=cm(""+i),n.setAttribute(t,i);break;case"onClick":i!=null&&(n.onclick=ar);break;case"onScroll":i!=null&&wt("scroll",n);break;case"onScrollEnd":i!=null&&wt("scrollend",n);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ce(61));if(t=i.__html,t!=null){if(a.children!=null)throw Error(ce(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=cm(""+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":wt("beforetoggle",n),wt("toggle",n),um(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":um(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=XI.get(t)||t,um(n,t,i))}}function Tx(n,e,t,i,a,s){switch(t){case"style":gC(n,i,s);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ce(61));if(t=i.__html,t!=null){if(a.children!=null)throw Error(ce(60));n.innerHTML=t}}break;case"children":typeof i=="string"?vc(n,i):(typeof i=="number"||typeof i=="bigint")&&vc(n,""+i);break;case"onScroll":i!=null&&wt("scroll",n);break;case"onScrollEnd":i!=null&&wt("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(!cC.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,""):um(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":wt("error",n),wt("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(ce(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":wt("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(ce(137,e));break;default:$t(n,e,i,p,t,null)}}dC(n,s,u,c,h,l,a,!1);return;case"select":wt("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?lc(n,!!i,e,!1):t!=null&&lc(n,!!i,t,!0);return;case"textarea":wt("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(ce(91));break;default:$t(n,e,l,u,t,null)}mC(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":wt("beforetoggle",n),wt("toggle",n),wt("cancel",n),wt("close",n);break;case"iframe":case"object":wt("load",n);break;case"video":case"audio":for(i=0;i<Mh.length;i++)wt(Mh[i],n);break;case"image":wt("error",n),wt("load",n);break;case"details":wt("toggle",n);break;case"embed":case"source":case"link":wt("error",n),wt("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(ce(137,e));default:$t(n,e,h,i,t,null)}return;default:if(hS(e)){for(p in t)t.hasOwnProperty(p)&&(i=t[p],i!==void 0&&Tx(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 yO(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 m=t[v];if(t.hasOwnProperty(v)&&m!=null)switch(v){case"checked":break;case"value":break;case"defaultValue":c=m;default:i.hasOwnProperty(v)||$t(n,e,v,null,i,m)}}for(var g in i){var v=i[g];if(m=t[g],i.hasOwnProperty(g)&&(v!=null||m!=null))switch(g){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(ce(137,e));break;default:v!==m&&$t(n,e,g,v,i,m)}}Q_(n,l,u,c,h,p,s,a);return;case"select":v=l=u=g=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":g=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,g!=null?lc(n,!!t,g,!1):!!i!=!!t&&(e!=null?lc(n,!!t,e,!0):lc(n,!!t,t?[]:"",!1));return;case"textarea":v=g=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":g=a;break;case"defaultValue":v=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(ce(91));break;default:a!==s&&$t(n,e,l,a,i,s)}pC(n,g,v);return;case"option":for(var _ in t)if(g=t[_],t.hasOwnProperty(_)&&g!=null&&!i.hasOwnProperty(_))switch(_){case"selected":n.selected=!1;break;default:$t(n,e,_,null,i,g)}for(c in i)if(g=i[c],v=t[c],i.hasOwnProperty(c)&&g!==v&&(g!=null||v!=null))switch(c){case"selected":n.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:$t(n,e,c,g,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)g=t[T],t.hasOwnProperty(T)&&g!=null&&!i.hasOwnProperty(T)&&$t(n,e,T,null,i,g);for(h in i)if(g=i[h],v=t[h],i.hasOwnProperty(h)&&g!==v&&(g!=null||v!=null))switch(h){case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(ce(137,e));break;default:$t(n,e,h,g,i,v)}return;default:if(hS(e)){for(var b in t)g=t[b],t.hasOwnProperty(b)&&g!==void 0&&!i.hasOwnProperty(b)&&Tx(n,e,b,void 0,i,g);for(p in i)g=i[p],v=t[p],!i.hasOwnProperty(p)||g===v||g===void 0&&v===void 0||Tx(n,e,p,g,i,v);return}}for(var y in t)g=t[y],t.hasOwnProperty(y)&&g!=null&&!i.hasOwnProperty(y)&&$t(n,e,y,null,i,g);for(m in i)g=i[m],v=t[m],!i.hasOwnProperty(m)||g===v||g==null&&v==null||$t(n,e,m,g,i,v)}function DT(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _O(){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&&DT(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,m=c.initiatorType;p&&DT(m)&&(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 Ax=null,wx=null;function Km(n){return n.nodeType===9?n:n.ownerDocument}function UT(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 x3(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 Cx(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 Gy=null;function xO(){var n=window.event;return n&&n.type==="popstate"?n===Gy?!1:(Gy=n,!0):(Gy=null,!1)}var S3=typeof setTimeout=="function"?setTimeout:void 0,SO=typeof clearTimeout=="function"?clearTimeout:void 0,LT=typeof Promise=="function"?Promise:void 0,bO=typeof queueMicrotask=="function"?queueMicrotask:typeof LT<"u"?function(n){return LT.resolve(null).then(n).catch(MO)}:S3;function MO(n){setTimeout(function(){throw n})}function So(n){return n==="head"}function NT(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),Tc(e);return}i--}else if(t==="$"||t==="$?"||t==="$~"||t==="$!"||t==="&")i++;else if(t==="html")nh(n.ownerDocument.documentElement);else if(t==="head"){t=n.ownerDocument.head,nh(t);for(var s=t.firstChild;s;){var l=s.nextSibling,u=s.nodeName;s[Qh]||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&s.rel.toLowerCase()==="stylesheet"||t.removeChild(s),s=l}}else t==="body"&&nh(n.ownerDocument.body);t=a}while(t);Tc(e)}function IT(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 Rx(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":Rx(t),fS(t);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(t.rel.toLowerCase()==="stylesheet")continue}n.removeChild(t)}}function EO(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[Qh])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 TO(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 b3(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 Dx(n){return n.data==="$?"||n.data==="$~"}function Ux(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function AO(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 Lx=null;function zT(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 OT(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 M3(n,e,t){switch(e=Km(t),n){case"html":if(n=e.documentElement,!n)throw Error(ce(452));return n;case"head":if(n=e.head,!n)throw Error(ce(453));return n;case"body":if(n=e.body,!n)throw Error(ce(454));return n;default:throw Error(ce(451))}}function nh(n){for(var e=n.attributes;e.length;)n.removeAttributeNode(e[0]);fS(n)}var Va=new Map,PT=new Set;function Jm(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Sr=qt.d;qt.d={f:wO,r:CO,D:RO,C:DO,L:UO,m:LO,X:IO,S:NO,M:zO};function wO(){var n=Sr.f(),e=s0();return n||e}function CO(n){var e=Nc(n);e!==null&&e.tag===5&&e.type==="form"?gR(e):Sr.r(n)}var Pc=typeof document>"u"?null:document;function E3(n,e,t){var i=Pc;if(i&&typeof e=="string"&&e){var a=za(e);a='link[rel="'+n+'"][href="'+a+'"]',typeof t=="string"&&(a+='[crossorigin="'+t+'"]'),PT.has(a)||(PT.add(a),n={rel:n,crossOrigin:t,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),hi(e,"link",n),ti(e),i.head.appendChild(e)))}}function RO(n){Sr.D(n),E3("dns-prefetch",n,null)}function DO(n,e){Sr.C(n,e),E3("preconnect",n,e)}function UO(n,e,t){Sr.L(n,e,t);var i=Pc;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=Ec(n);break;case"script":s=Bc(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(nd(s))||e==="script"&&i.querySelector(id(s))||(e=i.createElement("link"),hi(e,"link",n),ti(e),i.head.appendChild(e)))}}function LO(n,e){Sr.m(n,e);var t=Pc;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=Bc(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(id(s)))return}i=t.createElement("link"),hi(i,"link",n),ti(i),t.head.appendChild(i)}}}function NO(n,e,t){Sr.S(n,e,t);var i=Pc;if(i&&n){var a=oc(i).hoistableStyles,s=Ec(n);e=e||"default";var l=a.get(s);if(!l){var u={loading:0,preload:null};if(l=i.querySelector(nd(s)))u.loading=5;else{n=cn({rel:"stylesheet",href:n,"data-precedence":e},t),(t=Va.get(s))&&QS(n,t);var c=l=i.createElement("link");ti(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,xm(l,e,i)}l={type:"stylesheet",instance:l,count:1,state:u},a.set(s,l)}}}function IO(n,e){Sr.X(n,e);var t=Pc;if(t&&n){var i=oc(t).hoistableScripts,a=Bc(n),s=i.get(a);s||(s=t.querySelector(id(a)),s||(n=cn({src:n,async:!0},e),(e=Va.get(a))&&KS(n,e),s=t.createElement("script"),ti(s),hi(s,"link",n),t.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(a,s))}}function zO(n,e){Sr.M(n,e);var t=Pc;if(t&&n){var i=oc(t).hoistableScripts,a=Bc(n),s=i.get(a);s||(s=t.querySelector(id(a)),s||(n=cn({src:n,async:!0,type:"module"},e),(e=Va.get(a))&&KS(n,e),s=t.createElement("script"),ti(s),hi(s,"link",n),t.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(a,s))}}function BT(n,e,t,i){var a=(a=ao.current)?Jm(a):null;if(!a)throw Error(ce(446));switch(n){case"meta":case"title":return null;case"style":return typeof t.precedence=="string"&&typeof t.href=="string"?(e=Ec(t.href),t=oc(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=Ec(t.href);var s=oc(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(nd(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||OO(a,n,t,l.state))),e&&i===null)throw Error(ce(528,""));return l}if(e&&i!==null)throw Error(ce(529,""));return null;case"script":return e=t.async,t=t.src,typeof t=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Bc(t),t=oc(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(ce(444,n))}}function Ec(n){return'href="'+za(n)+'"'}function nd(n){return'link[rel="stylesheet"]['+n+"]"}function T3(n){return cn({},n,{"data-precedence":n.precedence,precedence:null})}function OO(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),ti(e),n.head.appendChild(e))}function Bc(n){return'[src="'+za(n)+'"]'}function id(n){return"script[async]"+n}function FT(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,ti(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"),ti(i),hi(i,"style",a),xm(i,t.precedence,n),e.instance=i;case"stylesheet":a=Ec(t.href);var s=n.querySelector(nd(a));if(s)return e.state.loading|=4,e.instance=s,ti(s),s;i=T3(t),(a=Va.get(a))&&QS(i,a),s=(n.ownerDocument||n).createElement("link"),ti(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,xm(s,t.precedence,n),e.instance=s;case"script":return s=Bc(t.src),(a=n.querySelector(id(s)))?(e.instance=a,ti(a),a):(i=t,(a=Va.get(s))&&(i=cn({},t),KS(i,a)),n=n.ownerDocument||n,a=n.createElement("script"),ti(a),hi(a,"link",i),n.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(ce(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(i=e.instance,e.state.loading|=4,xm(i,t.precedence,n));return e.instance}function xm(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 QS(n,e){n.crossOrigin==null&&(n.crossOrigin=e.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=e.referrerPolicy),n.title==null&&(n.title=e.title)}function KS(n,e){n.crossOrigin==null&&(n.crossOrigin=e.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=e.referrerPolicy),n.integrity==null&&(n.integrity=e.integrity)}var Sm=null;function HT(n,e,t){if(Sm===null){var i=new Map,a=Sm=new Map;a.set(t,i)}else a=Sm,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[Qh]||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 VT(n,e,t){n=n.ownerDocument||n,n.head.insertBefore(t,e==="title"?n.querySelector("head > title"):null)}function PO(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 A3(n){return!(n.type==="stylesheet"&&!(n.state.loading&3))}function BO(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=Ec(i.href),s=e.querySelector(nd(a));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(n.count++,n=$m.bind(n),e.then(n,n)),t.state.loading|=4,t.instance=s,ti(s);return}s=e.ownerDocument||e,i=T3(i),(a=Va.get(a))&&QS(i,a),s=s.createElement("link"),ti(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=$m.bind(n),e.addEventListener("load",t),e.addEventListener("error",t))}}var Wy=0;function FO(n,e){return n.stylesheets&&n.count===0&&bm(n,n.stylesheets),0<n.count||0<n.imgCount?function(t){var i=setTimeout(function(){if(n.stylesheets&&bm(n,n.stylesheets),n.unsuspend){var s=n.unsuspend;n.unsuspend=null,s()}},6e4+e);0<n.imgBytes&&Wy===0&&(Wy=62500*_O());var a=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&bm(n,n.stylesheets),n.unsuspend)){var s=n.unsuspend;n.unsuspend=null,s()}},(n.imgBytes>Wy?50:800)+e);return n.unsuspend=t,function(){n.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function $m(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bm(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var eg=null;function bm(n,e){n.stylesheets=null,n.unsuspend!==null&&(n.count++,eg=new Map,e.forEach(HO,n),eg=null,$m.call(n))}function HO(n,e){if(!(e.state.loading&4)){var t=eg.get(n);if(t)var i=t.get(null);else{t=new Map,eg.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=$m.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 Th={$$typeof:ir,Provider:null,Consumer:null,_currentValue:gl,_currentValue2:gl,_threadCount:0};function VO(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=dy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dy(0),this.hiddenUpdates=dy(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 w3(n,e,t,i,a,s,l,u,c,h,p,m){return n=new VO(n,e,t,l,c,h,p,m,u),e=1,s===!0&&(e|=24),s=da(3,null,null,e),n.current=s,s.stateNode=n,e=MS(),e.refCount++,n.pooledCache=e,e.refCount++,s.memoizedState={element:i,isDehydrated:t,cache:e},AS(s),n}function C3(n){return n?(n=Ju,n):Ju}function R3(n,e,t,i,a,s){a=C3(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),Zf(t,n,e))}function kT(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){kT(n,e),(n=n.alternate)&&kT(n,e)}function D3(n){if(n.tag===13||n.tag===31){var e=Fl(n,67108864);e!==null&&ji(e,n,67108864),JS(n,67108864)}}function GT(n){if(n.tag===13||n.tag===31){var e=ya();e=uS(e);var t=Fl(n,e);t!==null&&ji(t,n,e),JS(n,e)}}var tg=!0;function kO(n,e,t,i){var a=ut.T;ut.T=null;var s=qt.p;try{qt.p=2,$S(n,e,t,i)}finally{qt.p=s,ut.T=a}}function GO(n,e,t,i){var a=ut.T;ut.T=null;var s=qt.p;try{qt.p=8,$S(n,e,t,i)}finally{qt.p=s,ut.T=a}}function $S(n,e,t,i){if(tg){var a=Nx(i);if(a===null)ky(n,e,i,ng,t),WT(n,i);else if(XO(a,n,e,t,i))i.stopPropagation();else if(WT(n,i),e&4&&-1<WO.indexOf(n)){for(;a!==null;){var s=Nc(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),!(Xt&6)&&(Xm=ma()+500,td(0))}}break;case 31:case 13:u=Fl(s,2),u!==null&&ji(u,s,2),s0(),JS(s,2)}if(s=Nx(i),s===null&&ky(n,e,i,ng,t),s===a)break;a=s}a!==null&&i.stopPropagation()}else ky(n,e,i,null,t)}}function Nx(n){return n=dS(n),eb(n)}var ng=null;function eb(n){if(ng=null,n=qu(n),n!==null){var e=qh(n);if(e===null)n=null;else{var t=e.tag;if(t===13){if(n=Qw(e),n!==null)return n;n=null}else if(t===31){if(n=Kw(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 ng=n,null}function U3(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(RI()){case tC:return 2;case nC:return 8;case Um:case DI:return 32;case iC:return 268435456;default:return 32}default:return 32}}var Ix=!1,co=null,fo=null,ho=null,Ah=new Map,wh=new Map,Qr=[],WO="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 WT(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":Ah.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":wh.delete(e.pointerId)}}function Mf(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=Nc(e),e!==null&&D3(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),n)}function XO(n,e,t,i,a){switch(e){case"focusin":return co=Mf(co,n,e,t,i,a),!0;case"dragenter":return fo=Mf(fo,n,e,t,i,a),!0;case"mouseover":return ho=Mf(ho,n,e,t,i,a),!0;case"pointerover":var s=a.pointerId;return Ah.set(s,Mf(Ah.get(s)||null,n,e,t,i,a)),!0;case"gotpointercapture":return s=a.pointerId,wh.set(s,Mf(wh.get(s)||null,n,e,t,i,a)),!0}return!1}function L3(n){var e=qu(n.target);if(e!==null){var t=qh(e);if(t!==null){if(e=t.tag,e===13){if(e=Qw(t),e!==null){n.blockedOn=e,CE(n.priority,function(){GT(t)});return}}else if(e===31){if(e=Kw(t),e!==null){n.blockedOn=e,CE(n.priority,function(){GT(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 Mm(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Nx(n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);J_=i,t.target.dispatchEvent(i),J_=null}else return e=Nc(t),e!==null&&D3(e),n.blockedOn=t,!1;e.shift()}return!0}function XT(n,e,t){Mm(n)&&t.delete(e)}function qO(){Ix=!1,co!==null&&Mm(co)&&(co=null),fo!==null&&Mm(fo)&&(fo=null),ho!==null&&Mm(ho)&&(ho=null),Ah.forEach(XT),wh.forEach(XT)}function dp(n,e){n.blockedOn===e&&(n.blockedOn=null,Ix||(Ix=!0,Xn.unstable_scheduleCallback(Xn.unstable_NormalPriority,qO)))}var pp=null;function qT(n){pp!==n&&(pp=n,Xn.unstable_scheduleCallback(Xn.unstable_NormalPriority,function(){pp===n&&(pp=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(eb(i||t)===null)continue;break}var s=Nc(t);s!==null&&(n.splice(e,3),e-=3,px(s,{pending:!0,data:a,method:t.method,action:i},i,a))}}))}function Tc(n){function e(c){return dp(c,n)}co!==null&&dp(co,n),fo!==null&&dp(fo,n),ho!==null&&dp(ho,n),Ah.forEach(e),wh.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);)L3(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||qT(t);else if(l){var u=null;if(s&&s.hasAttribute("formAction")){if(a=s,l=s[Ki]||null)u=l.formAction;else if(eb(a)!==null)continue}else u=l.action;typeof u=="function"?t[i+1]=u:(t.splice(i,3),i-=3),qT(t)}}}function N3(){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 tb(n){this._internalRoot=n}l0.prototype.render=tb.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(ce(409));var t=e.current,i=ya();R3(t,i,n,e,null,null)};l0.prototype.unmount=tb.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;R3(n.current,2,null,n,null,null),s0(),e[Lc]=null}};function l0(n){this._internalRoot=n}l0.prototype.unstable_scheduleHydration=function(n){if(n){var e=lC();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&&L3(n)}};var YT=Zw.version;if(YT!=="19.2.3")throw Error(ce(527,YT,"19.2.3"));qt.findDOMNode=function(n){var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(ce(188)):(n=Object.keys(n).join(","),Error(ce(268,n)));return n=bI(e),n=n!==null?Jw(n):null,n=n===null?null:n.stateNode,n};var YO={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:ut,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mp.isDisabled&&mp.supportsFiber)try{Yh=mp.inject(YO),ga=mp}catch{}}qg.createRoot=function(n,e){if(!jw(n))throw Error(ce(299));var t=!1,i="",a=ER,s=TR,l=AR;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=w3(n,1,!1,null,null,t,i,null,a,s,l,N3),n[Lc]=e.current,jS(n),new tb(e)};qg.hydrateRoot=function(n,e,t){if(!jw(n))throw Error(ce(299));var i=!1,a="",s=ER,l=TR,u=AR,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=w3(n,1,!0,e,t??null,i,a,c,s,l,u,N3),e.context=C3(null),t=e.current,i=ya(),i=uS(i),a=ro(i),a.callback=null,oo(t,a,i),t=i,e.current.lanes=t,jh(e,t),ws(e),n[Lc]=e.current,jS(n),new l0(e)};qg.version="19.2.3";function I3(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(I3)}catch(n){console.error(n)}}I3(),Xw.exports=qg;var z3=Xw.exports;const N8=sS(z3),ZO="modulepreload",jO=function(n){return"/"+n},ZT={},I8=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=jO(c),c in ZT)return;ZT[c]=!0;const h=c.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":ZO,h||(m.as="script"),m.crossOrigin="",m.href=c,u&&m.setAttribute("nonce",u),document.head.appendChild(m),h)return new Promise((g,v)=>{m.addEventListener("load",g),m.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 u0="170",QO={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},KO={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},O3=0,zx=1,P3=2,JO=3,B3=0,c0=1,ih=2,$a=3,vr=0,Ui=1,ns=2,cr=0,Sl=1,Ox=2,Px=3,Bx=4,F3=5,Kr=100,H3=101,V3=102,k3=103,G3=104,W3=200,X3=201,q3=202,Y3=203,ig=204,ag=205,Z3=206,j3=207,Q3=208,K3=209,J3=210,$3=211,eD=212,tD=213,nD=214,sg=0,rg=1,og=2,Dl=3,lg=4,ug=5,cg=6,fg=7,ad=0,iD=1,aD=2,Ms=0,sD=1,rD=2,oD=3,nb=4,lD=5,uD=6,cD=7,Fx="attached",fD="detached",f0=300,yr=301,yo=302,Ch=303,Rh=304,Fc=306,Dh=1e3,Ba=1001,Uh=1002,di=1003,ib=1004,$O=1004,nc=1005,eP=1005,Wn=1006,ah=1007,tP=1007,xs=1008,nP=1008,is=1009,ab=1010,sb=1011,Ac=1012,h0=1013,_r=1014,Zi=1015,Hc=1016,d0=1017,p0=1018,Ul=1020,rb=35902,ob=1021,lb=1022,Si=1023,ub=1024,cb=1025,bl=1026,Ll=1027,m0=1028,sd=1029,fb=1030,g0=1031,iP=1032,v0=1033,sh=33776,rh=33777,oh=33778,lh=33779,hg=35840,dg=35841,pg=35842,mg=35843,gg=36196,vg=37492,yg=37496,_g=37808,xg=37809,Sg=37810,bg=37811,Mg=37812,Eg=37813,Tg=37814,Ag=37815,wg=37816,Cg=37817,Rg=37818,Dg=37819,Ug=37820,Lg=37821,uh=36492,Ng=36494,Ig=36495,hb=36283,zg=36284,Og=36285,Pg=36286,hD=2200,dD=2201,pD=2202,Lh=2300,Bg=2301,Em=2302,hl=2400,dl=2401,Nh=2402,y0=2500,db=2501,aP=0,sP=1,rP=2,mD=3200,gD=3201,oP=3202,lP=3203,bo=0,vD=1,tr="",xi="srgb",Mo="srgb-linear",rd="linear",Zt="srgb",uP=0,ul=7680,cP=7681,fP=7682,hP=7683,dP=34055,pP=34056,mP=5386,gP=512,vP=513,yP=514,_P=515,xP=516,SP=517,bP=518,Hx=519,yD=512,_D=513,xD=514,pb=515,SD=516,bD=517,MD=518,ED=519,Ih=35044,MP=35048,EP=35040,TP=35045,AP=35049,wP=35041,CP=35046,RP=35050,DP=35042,UP="100",Vx="300 es",Ss=2e3,zh=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 jT=1234567;const Ml=Math.PI/180,wc=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 mb(n,e){return(n%e+e)%e}function LP(n,e,t,i,a){return i+(n-e)*(a-i)/(t-e)}function NP(n,e,t){return n!==e?(t-n)/(e-n):0}function ch(n,e,t){return(1-t)*n+t*e}function IP(n,e,t,i){return ch(n,e,1-Math.exp(-t*i))}function zP(n,e=1){return e-Math.abs(mb(n,e*2)-e)}function OP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function PP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function BP(n,e){return n+Math.floor(Math.random()*(e-n+1))}function FP(n,e){return n+Math.random()*(e-n)}function HP(n){return n*(.5-Math.random())}function VP(n){n!==void 0&&(jT=n);let e=jT+=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 kP(n){return n*Ml}function GP(n){return n*wc}function WP(n){return(n&n-1)===0&&n!==0}function XP(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function qP(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function YP(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),m=s((e-i)/2),g=l((e-i)/2),v=s((i-e)/2),_=l((i-e)/2);switch(a){case"XYX":n.set(u*p,c*m,c*g,u*h);break;case"YZY":n.set(c*g,u*p,c*m,u*h);break;case"ZXZ":n.set(c*m,c*g,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 xt(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 ZP={DEG2RAD:Ml,RAD2DEG:wc,generateUUID:_a,clamp:bn,euclideanModulo:mb,mapLinear:LP,inverseLerp:NP,lerp:ch,damp:IP,pingpong:zP,smoothstep:OP,smootherstep:PP,randInt:BP,randFloat:FP,randFloatSpread:HP,seededRandom:VP,degToRad:kP,radToDeg:GP,isPowerOfTwo:WP,ceilPowerOfTwo:XP,floorPowerOfTwo:qP,setQuaternionFromProperEuler:YP,normalize:xt,denormalize:Di};class de{constructor(e=0,t=0){de.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 yt{constructor(e,t,i,a,s,l,u,c,h){yt.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],m=i[7],g=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+m*I,s[4]=h*b+p*E+m*R,s[7]=h*y+p*A+m*L,s[2]=g*T+v*S+_*I,s[5]=g*b+v*E+_*R,s[8]=g*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],m=p*l-u*h,g=u*c-p*s,v=h*s-l*c,_=t*m+i*g+a*v;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const T=1/_;return e[0]=m*T,e[1]=(a*h-p*i)*T,e[2]=(u*i-a*l)*T,e[3]=g*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 yt;function TD(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const jP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ic(n,e){return new jP[n](e)}function Oh(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function AD(){const n=Oh("canvas");return n.style.display="block",n}const QT={};function Vf(n){n in QT||(QT[n]=!0,console.warn(n))}function QP(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 KP(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 JP(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=pc(n.r),n.g=pc(n.g),n.b=pc(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?rd: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 pc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const KT=[.64,.33,.3,.6,.15,.06],JT=[.2126,.7152,.0722],$T=[.3127,.329],eA=new yt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tA=new yt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ut.define({[Mo]:{primaries:KT,whitePoint:$T,transfer:rd,toXYZ:eA,fromXYZ:tA,luminanceCoefficients:JT,workingColorSpaceConfig:{unpackColorSpace:xi},outputColorSpaceConfig:{drawingBufferColorSpace:xi}},[xi]:{primaries:KT,whitePoint:$T,transfer:Zt,toXYZ:eA,fromXYZ:tA,luminanceCoefficients:JT,outputColorSpaceConfig:{drawingBufferColorSpace:xi}}});let Su;class wD{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Su===void 0&&(Su=Oh("canvas")),Su.width=e.width,Su.height=e.height;const i=Su.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Su}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=Oh("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 $P=0;class pl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$P++}),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(qy(a[l].image)):s.push(qy(a[l]))}else s=qy(a);i.url=s}return t||(e.images[this.uuid]=i),i}}function qy(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?wD.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 eB=0;class Mn extends Cs{constructor(e=Mn.DEFAULT_IMAGE,t=Mn.DEFAULT_MAPPING,i=Ba,a=Ba,s=Wn,l=xs,u=Si,c=is,h=Mn.DEFAULT_ANISOTROPY,p=tr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eB++}),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 de(0,0),this.repeat=new de(1,1),this.center=new de(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yt,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!==f0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Dh:e.x=e.x-Math.floor(e.x);break;case Ba:e.x=e.x<0?0:1;break;case Uh: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 Dh:e.y=e.y-Math.floor(e.y);break;case Ba:e.y=e.y<0?0:1;break;case Uh: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=f0;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],m=c[8],g=c[1],v=c[5],_=c[9],T=c[2],b=c[6],y=c[10];if(Math.abs(p-g)<.01&&Math.abs(m-T)<.01&&Math.abs(_-b)<.01){if(Math.abs(p+g)<.1&&Math.abs(m+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+g)/4,L=(m+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-_)+(m-T)*(m-T)+(g-p)*(g-p));return Math.abs(S)<.001&&(S=1),this.x=(b-_)/S,this.y=(m-T)/S,this.z=(g-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 CD 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:Wn,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 as extends CD{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class _0 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 tB extends as{constructor(e=1,t=1,i=1,a={}){super(e,t,a),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new _0(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class gb 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 nB extends as{constructor(e=1,t=1,i=1,a={}){super(e,t,a),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new gb(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],m=i[a+3];const g=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]=m;return}if(u===1){e[t+0]=g,e[t+1]=v,e[t+2]=_,e[t+3]=T;return}if(m!==T||c!==g||h!==v||p!==_){let b=1-u;const y=c*g+h*v+p*_+m*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+g*A,h=h*b+v*A,p=p*b+_*A,m=m*b+T*A,b===1-u){const I=1/Math.sqrt(c*c+h*h+p*p+m*m);c*=I,h*=I,p*=I,m*=I}}e[t]=c,e[t+1]=h,e[t+2]=p,e[t+3]=m}static multiplyQuaternionsFlat(e,t,i,a,s,l){const u=i[a],c=i[a+1],h=i[a+2],p=i[a+3],m=s[l],g=s[l+1],v=s[l+2],_=s[l+3];return e[t]=u*_+p*m+c*v-h*g,e[t+1]=c*_+p*g+h*m-u*v,e[t+2]=h*_+p*v+u*g-c*m,e[t+3]=p*_-u*m-c*g-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),m=u(s/2),g=c(i/2),v=c(a/2),_=c(s/2);switch(l){case"XYZ":this._x=g*p*m+h*v*_,this._y=h*v*m-g*p*_,this._z=h*p*_+g*v*m,this._w=h*p*m-g*v*_;break;case"YXZ":this._x=g*p*m+h*v*_,this._y=h*v*m-g*p*_,this._z=h*p*_-g*v*m,this._w=h*p*m+g*v*_;break;case"ZXY":this._x=g*p*m-h*v*_,this._y=h*v*m+g*p*_,this._z=h*p*_+g*v*m,this._w=h*p*m-g*v*_;break;case"ZYX":this._x=g*p*m-h*v*_,this._y=h*v*m+g*p*_,this._z=h*p*_-g*v*m,this._w=h*p*m+g*v*_;break;case"YZX":this._x=g*p*m+h*v*_,this._y=h*v*m+g*p*_,this._z=h*p*_-g*v*m,this._w=h*p*m-g*v*_;break;case"XZY":this._x=g*p*m-h*v*_,this._y=h*v*m-g*p*_,this._z=h*p*_+g*v*m,this._w=h*p*m+g*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],m=t[10],g=i+u+m;if(g>0){const v=.5/Math.sqrt(g+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>m){const v=2*Math.sqrt(1+i-u-m);this._w=(p-c)/v,this._x=.25*v,this._y=(a+l)/v,this._z=(s+h)/v}else if(u>m){const v=2*Math.sqrt(1+u-i-m);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+m-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),m=Math.sin((1-t)*p)/h,g=Math.sin(t*p)/h;return this._w=l*m+this._w*g,this._x=i*m+this._x*g,this._y=a*m+this._y*g,this._z=s*m+this._z*g,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(nA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nA.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),m=2*(s*i-l*t);return this.x=t+c*h+l*m-u*p,this.y=i+c*p+u*h-s*m,this.z=a+c*m+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 Yy.copy(this).projectOnVector(e),this.sub(Yy)}reflect(e){return this.sub(Yy.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 Yy=new P,nA=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(),gp.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),gp.copy(i.boundingBox)),gp.applyMatrix4(e.matrixWorld),this.union(gp)}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(Ef),vp.subVectors(this.max,Ef),bu.subVectors(e.a,Ef),Mu.subVectors(e.b,Ef),Eu.subVectors(e.c,Ef),Pr.subVectors(Mu,bu),Br.subVectors(Eu,Mu),qo.subVectors(bu,Eu);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!Zy(t,bu,Mu,Eu,vp)||(t=[1,0,0,0,1,0,0,0,1],!Zy(t,bu,Mu,Eu,vp))?!1:(yp.crossVectors(Pr,Br),t=[yp.x,yp.y,yp.z],Zy(t,bu,Mu,Eu,vp))}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,gp=new Li,bu=new P,Mu=new P,Eu=new P,Pr=new P,Br=new P,qo=new P,Ef=new P,vp=new P,yp=new P,Yo=new P;function Zy(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 iB=new Li,Tf=new P,jy=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):iB.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;Tf.subVectors(e,this.center);const t=Tf.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),a=(i-this.radius)*.5;this.center.addScaledVector(Tf,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):(jy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tf.copy(e.center).add(jy)),this.expandByPoint(Tf.copy(e.center).sub(jy))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ys=new P,Qy=new P,_p=new P,Fr=new P,Ky=new P,xp=new P,Jy=new P;class Vc{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){Qy.copy(e).add(t).multiplyScalar(.5),_p.copy(t).sub(e).normalize(),Fr.copy(this.origin).sub(Qy);const s=e.distanceTo(t)*.5,l=-this.direction.dot(_p),u=Fr.dot(this.direction),c=-Fr.dot(_p),h=Fr.lengthSq(),p=Math.abs(1-l*l);let m,g,v,_;if(p>0)if(m=l*c-u,g=l*u-c,_=s*p,m>=0)if(g>=-_)if(g<=_){const T=1/p;m*=T,g*=T,v=m*(m+l*g+2*u)+g*(l*m+g+2*c)+h}else g=s,m=Math.max(0,-(l*g+u)),v=-m*m+g*(g+2*c)+h;else g=-s,m=Math.max(0,-(l*g+u)),v=-m*m+g*(g+2*c)+h;else g<=-_?(m=Math.max(0,-(-l*s+u)),g=m>0?-s:Math.min(Math.max(-s,-c),s),v=-m*m+g*(g+2*c)+h):g<=_?(m=0,g=Math.min(Math.max(-s,-c),s),v=g*(g+2*c)+h):(m=Math.max(0,-(l*s+u)),g=m>0?s:Math.min(Math.max(-s,-c),s),v=-m*m+g*(g+2*c)+h);else g=l>0?-s:s,m=Math.max(0,-(l*g+u)),v=-m*m+g*(g+2*c)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,m),a&&a.copy(Qy).addScaledVector(_p,g),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,m=1/this.direction.z,g=this.origin;return h>=0?(i=(e.min.x-g.x)*h,a=(e.max.x-g.x)*h):(i=(e.max.x-g.x)*h,a=(e.min.x-g.x)*h),p>=0?(s=(e.min.y-g.y)*p,l=(e.max.y-g.y)*p):(s=(e.max.y-g.y)*p,l=(e.min.y-g.y)*p),i>l||s>a||((s>i||isNaN(i))&&(i=s),(l<a||isNaN(a))&&(a=l),m>=0?(u=(e.min.z-g.z)*m,c=(e.max.z-g.z)*m):(u=(e.max.z-g.z)*m,c=(e.min.z-g.z)*m),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){Ky.subVectors(t,e),xp.subVectors(i,e),Jy.crossVectors(Ky,xp);let l=this.direction.dot(Jy),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(xp.crossVectors(Fr,xp));if(c<0)return null;const h=u*this.direction.dot(Ky.cross(Fr));if(h<0||c+h>l)return null;const p=-u*Fr.dot(Jy);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 ct{constructor(e,t,i,a,s,l,u,c,h,p,m,g,v,_,T,b){ct.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,m,g,v,_,T,b)}set(e,t,i,a,s,l,u,c,h,p,m,g,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]=m,y[14]=g,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 ct().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/Tu.setFromMatrixColumn(e,0).length(),s=1/Tu.setFromMatrixColumn(e,1).length(),l=1/Tu.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),m=Math.sin(s);if(e.order==="XYZ"){const g=l*p,v=l*m,_=u*p,T=u*m;t[0]=c*p,t[4]=-c*m,t[8]=h,t[1]=v+_*h,t[5]=g-T*h,t[9]=-u*c,t[2]=T-g*h,t[6]=_+v*h,t[10]=l*c}else if(e.order==="YXZ"){const g=c*p,v=c*m,_=h*p,T=h*m;t[0]=g+T*u,t[4]=_*u-v,t[8]=l*h,t[1]=l*m,t[5]=l*p,t[9]=-u,t[2]=v*u-_,t[6]=T+g*u,t[10]=l*c}else if(e.order==="ZXY"){const g=c*p,v=c*m,_=h*p,T=h*m;t[0]=g-T*u,t[4]=-l*m,t[8]=_+v*u,t[1]=v+_*u,t[5]=l*p,t[9]=T-g*u,t[2]=-l*h,t[6]=u,t[10]=l*c}else if(e.order==="ZYX"){const g=l*p,v=l*m,_=u*p,T=u*m;t[0]=c*p,t[4]=_*h-v,t[8]=g*h+T,t[1]=c*m,t[5]=T*h+g,t[9]=v*h-_,t[2]=-h,t[6]=u*c,t[10]=l*c}else if(e.order==="YZX"){const g=l*c,v=l*h,_=u*c,T=u*h;t[0]=c*p,t[4]=T-g*m,t[8]=_*m+v,t[1]=m,t[5]=l*p,t[9]=-u*p,t[2]=-h*p,t[6]=v*m+_,t[10]=g-T*m}else if(e.order==="XZY"){const g=l*c,v=l*h,_=u*c,T=u*h;t[0]=c*p,t[4]=-m,t[8]=h*p,t[1]=g*m+T,t[5]=l*p,t[9]=v*m-_,t[2]=_*m-v,t[6]=u*p,t[10]=T*m+g}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(aB,e,sB)}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(),Sp.crossVectors(la,Hr),a[0]=Hr.x,a[4]=Sp.x,a[8]=la.x,a[1]=Hr.y,a[5]=Sp.y,a[9]=la.y,a[2]=Hr.z,a[6]=Sp.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],m=i[5],g=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],te=a[6],V=a[10],J=a[14],X=a[3],re=a[7],he=a[11],_e=a[15];return s[0]=l*R+u*w+c*j+h*X,s[4]=l*L+u*B+c*te+h*re,s[8]=l*z+u*Q+c*V+h*he,s[12]=l*C+u*k+c*J+h*_e,s[1]=p*R+m*w+g*j+v*X,s[5]=p*L+m*B+g*te+v*re,s[9]=p*z+m*Q+g*V+v*he,s[13]=p*C+m*k+g*J+v*_e,s[2]=_*R+T*w+b*j+y*X,s[6]=_*L+T*B+b*te+y*re,s[10]=_*z+T*Q+b*V+y*he,s[14]=_*C+T*k+b*J+y*_e,s[3]=S*R+E*w+A*j+I*X,s[7]=S*L+E*B+A*te+I*re,s[11]=S*z+E*Q+A*V+I*he,s[15]=S*C+E*k+A*J+I*_e,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],m=e[6],g=e[10],v=e[14],_=e[3],T=e[7],b=e[11],y=e[15];return _*(+s*c*m-a*h*m-s*u*g+i*h*g+a*u*v-i*c*v)+T*(+t*c*v-t*h*g+s*l*g-a*l*v+a*h*p-s*c*p)+b*(+t*h*m-t*u*v-s*l*m+i*l*v+s*u*p-i*h*p)+y*(-a*u*p-t*c*m+t*u*g+a*l*m-i*l*g+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],m=e[9],g=e[10],v=e[11],_=e[12],T=e[13],b=e[14],y=e[15],S=m*b*h-T*g*h+T*c*v-u*b*v-m*c*y+u*g*y,E=_*g*h-p*b*h-_*c*v+l*b*v+p*c*y-l*g*y,A=p*T*h-_*m*h+_*u*v-l*T*v-p*u*y+l*m*y,I=_*m*c-p*T*c-_*u*g+l*T*g+p*u*b-l*m*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*g*s-m*b*s-T*a*v+i*b*v+m*a*y-i*g*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]=(m*c*s-u*g*s-m*a*h+i*g*h+u*a*v-i*c*v)*L,e[4]=E*L,e[5]=(p*b*s-_*g*s+_*a*v-t*b*v-p*a*y+t*g*y)*L,e[6]=(_*c*s-l*b*s-_*a*h+t*b*h+l*a*y-t*c*y)*L,e[7]=(l*g*s-p*c*s+p*a*h-t*g*h-l*a*v+t*c*v)*L,e[8]=A*L,e[9]=(_*m*s-p*T*s-_*i*v+t*T*v+p*i*y-t*m*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*m*s-p*i*h+t*m*h+l*i*v-t*u*v)*L,e[12]=I*L,e[13]=(p*T*a-_*m*a+_*i*g-t*T*g-p*i*b+t*m*b)*L,e[14]=(_*u*a-l*T*a-_*i*c+t*T*c+l*i*b-t*u*b)*L,e[15]=(l*m*a-p*u*a+p*i*c-t*m*c-l*i*g+t*u*g)*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,m=u+u,g=s*h,v=s*p,_=s*m,T=l*p,b=l*m,y=u*m,S=c*h,E=c*p,A=c*m,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-(g+y))*R,a[6]=(b+S)*R,a[7]=0,a[8]=(_+E)*L,a[9]=(b-S)*L,a[10]=(1-(g+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=Tu.set(a[0],a[1],a[2]).length();const l=Tu.set(a[4],a[5],a[6]).length(),u=Tu.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,m=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]*=m,Ka.elements[9]*=m,Ka.elements[10]*=m,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),m=(t+e)/(t-e),g=(i+a)/(i-a);let v,_;if(u===Ss)v=-(l+s)/(l-s),_=-2*l*s/(l-s);else if(u===zh)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]=m,c[12]=0,c[1]=0,c[5]=p,c[9]=g,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),m=1/(l-s),g=(t+e)*h,v=(i+a)*p;let _,T;if(u===Ss)_=(l+s)*m,T=-2*m;else if(u===zh)_=s*m,T=-1*m;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-g,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 Tu=new P,Ka=new ct,aB=new P(0,0,0),sB=new P(1,1,1),Hr=new P,Sp=new P,la=new P,iA=new ct,aA=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],m=a[2],g=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(g,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(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(bn(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-m,v),this._z=Math.atan2(-l,h)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-bn(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(g,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(-m,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(g,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 iA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iA,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return aA.setFromEuler(this),this.setFromQuaternion(aA,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 Cc{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 rB=0;const sA=new P,Au=new Qi,Zs=new ct,bp=new P,Af=new P,oB=new P,lB=new Qi,rA=new P(1,0,0),oA=new P(0,1,0),lA=new P(0,0,1),uA={type:"added"},uB={type:"removed"},wu={type:"childadded",child:null},$y={type:"childremoved",child:null};class Bt extends Cs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rB++}),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 ct},normalMatrix:{value:new yt}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=Bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cc,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 Au.setFromAxisAngle(e,t),this.quaternion.multiply(Au),this}rotateOnWorldAxis(e,t){return Au.setFromAxisAngle(e,t),this.quaternion.premultiply(Au),this}rotateX(e){return this.rotateOnAxis(rA,e)}rotateY(e){return this.rotateOnAxis(oA,e)}rotateZ(e){return this.rotateOnAxis(lA,e)}translateOnAxis(e,t){return sA.copy(e).applyQuaternion(this.quaternion),this.position.add(sA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rA,e)}translateY(e){return this.translateOnAxis(oA,e)}translateZ(e){return this.translateOnAxis(lA,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?bp.copy(e):bp.set(e,t,i);const a=this.parent;this.updateWorldMatrix(!0,!1),Af.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zs.lookAt(Af,bp,this.up):Zs.lookAt(bp,Af,this.up),this.quaternion.setFromRotationMatrix(Zs),a&&(Zs.extractRotation(a.matrixWorld),Au.setFromRotationMatrix(Zs),this.quaternion.premultiply(Au.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(uA),wu.child=e,this.dispatchEvent(wu),wu.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(uB),$y.child=e,this.dispatchEvent($y),$y.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(uA),wu.child=e,this.dispatchEvent(wu),wu.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(Af,e,oB),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Af,lB,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 m=c[h];s(e.shapes,m)}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),m=l(e.shapes),g=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),m.length>0&&(i.shapes=m),g.length>0&&(i.skeletons=g),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,e_=new P,Qs=new P,Cu=new P,Ru=new P,cA=new P,t_=new P,n_=new P,i_=new P,a_=new Pt,s_=new Pt,r_=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),e_.subVectors(e,t);const l=Ja.dot(Ja),u=Ja.dot(js),c=Ja.dot(e_),h=js.dot(js),p=js.dot(e_),m=l*h-u*u;if(m===0)return s.set(0,0,0),null;const g=1/m,v=(h*c-u*p)*g,_=(l*p-u*c)*g;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 a_.setScalar(0),s_.setScalar(0),r_.setScalar(0),a_.fromBufferAttribute(e,t),s_.fromBufferAttribute(e,i),r_.fromBufferAttribute(e,a),l.setScalar(0),l.addScaledVector(a_,s.x),l.addScaledVector(s_,s.y),l.addScaledVector(r_,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;Cu.subVectors(a,i),Ru.subVectors(s,i),t_.subVectors(e,i);const c=Cu.dot(t_),h=Ru.dot(t_);if(c<=0&&h<=0)return t.copy(i);n_.subVectors(e,a);const p=Cu.dot(n_),m=Ru.dot(n_);if(p>=0&&m<=p)return t.copy(a);const g=c*m-p*h;if(g<=0&&c>=0&&p<=0)return l=c/(c-p),t.copy(i).addScaledVector(Cu,l);i_.subVectors(e,s);const v=Cu.dot(i_),_=Ru.dot(i_);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(Ru,u);const b=p*_-v*m;if(b<=0&&m-p>=0&&v-_>=0)return cA.subVectors(s,a),u=(m-p)/(m-p+(v-_)),t.copy(a).addScaledVector(cA,u);const y=1/(b+T+g);return l=T*y,u=g*y,t.copy(i).addScaledVector(Cu,l).addScaledVector(Ru,u)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const RD={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},Mp={h:0,s:0,l:0};function o_(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 He{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=mb(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=o_(l,s,e+1/3),this.g=o_(l,s,e),this.b=o_(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=RD[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=pc(e.r),this.g=pc(e.g),this.b=pc(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 m=l-u;switch(h=p<=.5?m/(l+u):m/(2-l-u),l){case i:c=(a-s)/m+(a<s?6:0);break;case a:c=(s-i)/m+2;break;case s:c=(i-a)/m+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(Mp);const i=ch(Vr.h,Mp.h,t),a=ch(Vr.s,Mp.s,t),s=ch(Vr.l,Mp.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 He;He.NAMES=RD;let cB=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:cB++}),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=ig,this.blendDst=ag,this.blendEquation=Kr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new He(0,0,0),this.blendAlpha=0,this.depthFunc=Dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Hx,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!==ig&&(i.blendSrc=this.blendSrc),this.blendDst!==ag&&(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!==Hx&&(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 He(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=ad,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=fB();function fB(){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 kf(n){const e=n>>10;return nr.uint32View[0]=nr.mantissaTable[nr.offsetTable[e]+(n&1023)]+nr.exponentTable[e],nr.floatView[0]}const hB={toHalfFloat:Gi,fromHalfFloat:kf},In=new P,Ep=new de;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=Ih,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++)Ep.fromBufferAttribute(this,t),Ep.applyMatrix3(e),this.setXY(t,Ep.x,Ep.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=xt(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=xt(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=xt(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=xt(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=xt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),i=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(a,this.array),s=xt(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!==Ih&&(e.usage=this.usage),e}}class dB extends tn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class pB extends tn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class mB extends tn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class gB extends tn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class vb extends tn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class vB extends tn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class yb extends tn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class yB extends tn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=kf(this.array[e*this.itemSize]);return this.normalized&&(t=Di(t,this.array)),t}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize]=Gi(t),this}getY(e){let t=kf(this.array[e*this.itemSize+1]);return this.normalized&&(t=Di(t,this.array)),t}setY(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+1]=Gi(t),this}getZ(e){let t=kf(this.array[e*this.itemSize+2]);return this.normalized&&(t=Di(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+2]=Gi(t),this}getW(e){let t=kf(this.array[e*this.itemSize+3]);return this.normalized&&(t=Di(t,this.array)),t}setW(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+3]=Gi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),i=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(a,this.array),s=xt(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 Ke extends tn{constructor(e,t,i){super(new Float32Array(e),t,i)}}let _B=0;const Da=new ct,l_=new Bt,Du=new P,ua=new Li,wf=new Li,$n=new P;class Mt extends Cs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_B++}),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(TD(e)?yb:vb)(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 yt().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 l_.lookAt(e),l_.updateMatrix(),this.applyMatrix4(l_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Du).negate(),this.translate(Du.x,Du.y,Du.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 Ke(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?($n.addVectors(this.boundingBox.min,ua.min),this.boundingBox.expandByPoint($n),$n.addVectors(this.boundingBox.max,ua.max),this.boundingBox.expandByPoint($n)):(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];wf.setFromBufferAttribute(u),this.morphTargetsRelative?($n.addVectors(ua.min,wf.min),ua.expandByPoint($n),$n.addVectors(ua.max,wf.max),ua.expandByPoint($n)):(ua.expandByPoint(wf.min),ua.expandByPoint(wf.max))}ua.getCenter(i);let a=0;for(let s=0,l=e.count;s<l;s++)$n.fromBufferAttribute(e,s),a=Math.max(a,i.distanceToSquared($n));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++)$n.fromBufferAttribute(u,h),c&&(Du.fromBufferAttribute(e,h),$n.add(Du)),a=Math.max(a,i.distanceToSquared($n))}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,m=new P,g=new de,v=new de,_=new de,T=new P,b=new P;function y(z,C,w){h.fromBufferAttribute(i,z),p.fromBufferAttribute(i,C),m.fromBufferAttribute(i,w),g.fromBufferAttribute(s,z),v.fromBufferAttribute(s,C),_.fromBufferAttribute(s,w),p.sub(h),m.sub(h),v.sub(g),_.sub(g);const B=1/(v.x*_.y-_.x*v.y);isFinite(B)&&(T.copy(p).multiplyScalar(_.y).addScaledVector(m,-v.y).multiplyScalar(B),b.copy(m).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 g=0,v=i.count;g<v;g++)i.setXYZ(g,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,m=new P;if(e)for(let g=0,v=e.count;g<v;g+=3){const _=e.getX(g+0),T=e.getX(g+1),b=e.getX(g+2);a.fromBufferAttribute(t,_),s.fromBufferAttribute(t,T),l.fromBufferAttribute(t,b),p.subVectors(l,s),m.subVectors(a,s),p.cross(m),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 g=0,v=t.count;g<v;g+=3)a.fromBufferAttribute(t,g+0),s.fromBufferAttribute(t,g+1),l.fromBufferAttribute(t,g+2),p.subVectors(l,s),m.subVectors(a,s),p.cross(m),i.setXYZ(g+0,p.x,p.y,p.z),i.setXYZ(g+1,p.x,p.y,p.z),i.setXYZ(g+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++)$n.fromBufferAttribute(e,t),$n.normalize(),e.setXYZ(t,$n.x,$n.y,$n.z)}toNonIndexed(){function e(u,c){const h=u.array,p=u.itemSize,m=u.normalized,g=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++)g[_++]=h[v++]}return new tn(g,p,m)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Mt,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,m=h.length;p<m;p++){const g=h[p],v=e(g,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 m=0,g=h.length;m<g;m++){const v=h[m];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=[],m=s[h];for(let g=0,v=m.length;g<v;g++)p.push(m[g].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 m=l[h];this.addGroup(m.start,m.count,m.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 fA=new ct,Zo=new Vc,Tp=new bi,hA=new P,Ap=new P,wp=new P,Cp=new P,u_=new P,Rp=new P,dA=new P,Dp=new P;class Hn extends Bt{constructor(e=new Mt,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){Rp.set(0,0,0);for(let c=0,h=s.length;c<h;c++){const p=u[c],m=s[c];p!==0&&(u_.fromBufferAttribute(m,e),l?Rp.addScaledVector(u_,p):Rp.addScaledVector(u_.sub(t),p))}t.add(Rp)}return t}raycast(e,t){const i=this.geometry,a=this.material,s=this.matrixWorld;a!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Tp.copy(i.boundingSphere),Tp.applyMatrix4(s),Zo.copy(e.ray).recast(e.near),!(Tp.containsPoint(Zo.origin)===!1&&(Zo.intersectSphere(Tp,hA)===null||Zo.origin.distanceToSquared(hA)>(e.far-e.near)**2))&&(fA.copy(s).invert(),Zo.copy(e.ray).applyMatrix4(fA),!(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,m=s.attributes.normal,g=s.groups,v=s.drawRange;if(u!==null)if(Array.isArray(l))for(let _=0,T=g.length;_<T;_++){const b=g[_],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=Up(this,y,e,i,h,p,m,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=Up(this,l,e,i,h,p,m,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=g.length;_<T;_++){const b=g[_],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=Up(this,y,e,i,h,p,m,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=Up(this,l,e,i,h,p,m,S,E,A),a&&(a.faceIndex=Math.floor(b/3),t.push(a))}}}}function xB(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;Dp.copy(u),Dp.applyMatrix4(n.matrixWorld);const h=t.ray.origin.distanceTo(Dp);return h<t.near||h>t.far?null:{distance:h,point:Dp.clone(),object:n}}function Up(n,e,t,i,a,s,l,u,c,h){n.getVertexPosition(u,Ap),n.getVertexPosition(c,wp),n.getVertexPosition(h,Cp);const p=xB(n,e,t,i,Ap,wp,Cp,dA);if(p){const m=new P;Yi.getBarycoord(dA,Ap,wp,Cp,m),a&&(p.uv=Yi.getInterpolatedAttribute(a,u,c,h,m,new de)),s&&(p.uv1=Yi.getInterpolatedAttribute(s,u,c,h,m,new de)),l&&(p.normal=Yi.getInterpolatedAttribute(l,u,c,h,m,new P),p.normal.dot(i.direction)>0&&p.normal.multiplyScalar(-1));const g={a:u,b:c,c:h,normal:new P,materialIndex:0};Yi.getNormal(Ap,wp,Cp,g.normal),p.face=g,p.barycoord=m}return p}class Vl extends Mt{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=[],m=[];let g=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 Ke(h,3)),this.setAttribute("normal",new Ke(p,3)),this.setAttribute("uv",new Ke(m,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,te=L+1,V=z+1;let J=0,X=0;const re=new P;for(let he=0;he<V;he++){const _e=he*B-k;for(let we=0;we<te;we++){const Je=we*w-Q;re[T]=Je*S,re[b]=_e*E,re[y]=j,h.push(re.x,re.y,re.z),re[T]=0,re[b]=0,re[y]=R>0?1:-1,p.push(re.x,re.y,re.z),m.push(we/L),m.push(1-he/z),J+=1}}for(let he=0;he<z;he++)for(let _e=0;_e<L;_e++){const we=g+_e+te*he,Je=g+_e+te*(he+1),ee=g+(_e+1)+te*(he+1),me=g+(_e+1)+te*he;c.push(we,Je,me),c.push(Je,ee,me),X+=6}u.addGroup(v,X,C),v+=X,g+=J}}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 Rc(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=Rc(n[t]);for(const a in i)e[a]=i[a]}return e}function SB(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function DD(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ut.workingColorSpace}const UD={clone:Rc,merge:Ci};var bB=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,MB=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class ss extends Mi{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=bB,this.fragmentShader=MB,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=Rc(e.uniforms),this.uniformsGroups=SB(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 x0 extends Bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,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,pA=new de,mA=new de;class Bn extends x0{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=wc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ml*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return wc*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,pA,mA),t.subVectors(mA,pA)}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 Uu=-90,Lu=1;class LD extends Bt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const a=new Bn(Uu,Lu,e,t);a.layers=this.layers,this.add(a);const s=new Bn(Uu,Lu,e,t);s.layers=this.layers,this.add(s);const l=new Bn(Uu,Lu,e,t);l.layers=this.layers,this.add(l);const u=new Bn(Uu,Lu,e,t);u.layers=this.layers,this.add(u);const c=new Bn(Uu,Lu,e,t);c.layers=this.layers,this.add(c);const h=new Bn(Uu,Lu,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===zh)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,m=e.getRenderTarget(),g=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(m,g,v),e.xr.enabled=_,i.texture.needsPMREMUpdate=!0}}class od 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 ND extends as{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 od(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:Wn}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 ss({name:"CubemapFromEquirect",uniforms:Rc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ui,blending:cr});s.uniforms.tEquirect.value=t;const l=new Hn(a,s),u=t.minFilter;return t.minFilter===xs&&(t.minFilter=Wn),new LD(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 c_=new P,EB=new P,TB=new yt;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=c_.subVectors(i,t).cross(EB.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(c_),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||TB.getNormalMatrix(e),a=this.coplanarPoint(c_).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,Lp=new P;class ld{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],m=a[6],g=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,g-h,b-v,A-y).normalize(),i[1].setComponents(c+s,g+h,b+v,A+y).normalize(),i[2].setComponents(c+l,g+p,b+_,A+S).normalize(),i[3].setComponents(c-l,g-p,b-_,A-S).normalize(),i[4].setComponents(c-u,g-m,b-T,A-E).normalize(),t===Ss)i[5].setComponents(c+u,g+m,b+T,A+E).normalize();else if(t===zh)i[5].setComponents(u,m,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(Lp.x=a.normal.x>0?e.max.x:e.min.x,Lp.y=a.normal.y>0?e.max.y:e.min.y,Lp.z=a.normal.z>0?e.max.z:e.min.z,a.distanceToPoint(Lp)<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 ID(){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 AB(n){const e=new WeakMap;function t(u,c){const h=u.array,p=u.usage,m=h.byteLength,g=n.createBuffer();n.bindBuffer(c,g),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:g,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:m}}function i(u,c,h){const p=c.array,m=c.updateRanges;if(n.bindBuffer(h,u),m.length===0)n.bufferSubData(h,0,p);else{m.sort((v,_)=>v.start-_.start);let g=0;for(let v=1;v<m.length;v++){const _=m[g],T=m[v];T.start<=_.start+_.count+1?_.count=Math.max(_.count,T.start+T.count-_.start):(++g,m[g]=T)}m.length=g+1;for(let v=0,_=m.length;v<_;v++){const T=m[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 kc extends Mt{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,m=e/u,g=t/c,v=[],_=[],T=[],b=[];for(let y=0;y<p;y++){const S=y*g-l;for(let E=0;E<h;E++){const A=E*m-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 Ke(_,3)),this.setAttribute("normal",new Ke(T,3)),this.setAttribute("uv",new Ke(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kc(e.width,e.height,e.widthSegments,e.heightSegments)}}var wB=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,CB=`#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`,RB=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,DB=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,UB=`#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`,LB=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,NB=`#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`,IB=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,zB=`#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`,OB=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,PB=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,BB=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,FB=`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`,HB=`#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`,VB=`#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`,kB=`#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`,GB=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,WB=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,XB=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,qB=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,YB=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,ZB=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
#endif`,jB=`#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`,QB=`#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`,KB=`#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`,JB=`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`,$B=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,e4=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,t4=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,n4=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,i4="gl_FragColor = linearToOutputTexel( gl_FragColor );",a4=`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 );
}`,s4=`#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`,r4=`#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`,o4=`#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`,l4=`#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`,u4=`#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`,c4=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,f4=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,h4=`#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`,d4=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,p4=`#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
}`,m4=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,g4=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,v4=`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`,y4=`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`,_4=`#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`,x4=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,S4=`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`,b4=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,M4=`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`,E4=`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`,T4=`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 );
}`,A4=`
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`,w4=`#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`,C4=`#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`,R4=`#if defined( USE_LOGDEPTHBUF )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,D4=`#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,U4=`#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
#endif`,L4=`#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,N4=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,I4=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,z4=`#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`,O4=`#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`,P4=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,B4=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,F4=`#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`,H4=`#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`,V4=`#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`,k4=`#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`,G4=`#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`,W4=`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;`,X4=`#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`,q4=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,Y4=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,Z4=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,j4=`#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`,Q4=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,K4=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,J4=`#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`,$4=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,eF=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,tF=`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 );
}`,nF=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,iF=`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;`,aF=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,sF=`#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`,rF=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,oF=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,lF=`#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`,uF=`#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`,cF=`#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`,fF=`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;
}`,hF=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,dF=`#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`,pF=`#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`,mF=`#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`,gF=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,vF=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,yF=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,_F=`#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; }`,xF=`#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`,SF=`#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`,bF=`#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`,MF=`#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`,EF=`#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`,TF=`#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 AF=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,wF=`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>
}`,CF=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,RF=`#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>
}`,DF=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,UF=`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>
}`,LF=`#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;
}`,NF=`#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
}`,IF=`#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;
}`,zF=`#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 );
}`,OF=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,PF=`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>
}`,BF=`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>
}`,FF=`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>
}`,HF=`#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>
}`,VF=`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>
}`,kF=`#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>
}`,GF=`#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>
}`,WF=`#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;
}`,XF=`#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>
}`,qF=`#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
}`,YF=`#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
}`,ZF=`#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>
}`,jF=`#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>
}`,QF=`#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
}`,KF=`#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>
}`,JF=`#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>
}`,$F=`#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>
}`,e5=`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>
}`,t5=`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>
}`,n5=`#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>
}`,i5=`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>
}`,a5=`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>
}`,s5=`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>
}`,bt={alphahash_fragment:wB,alphahash_pars_fragment:CB,alphamap_fragment:RB,alphamap_pars_fragment:DB,alphatest_fragment:UB,alphatest_pars_fragment:LB,aomap_fragment:NB,aomap_pars_fragment:IB,batching_pars_vertex:zB,batching_vertex:OB,begin_vertex:PB,beginnormal_vertex:BB,bsdfs:FB,iridescence_fragment:HB,bumpmap_pars_fragment:VB,clipping_planes_fragment:kB,clipping_planes_pars_fragment:GB,clipping_planes_pars_vertex:WB,clipping_planes_vertex:XB,color_fragment:qB,color_pars_fragment:YB,color_pars_vertex:ZB,color_vertex:jB,common:QB,cube_uv_reflection_fragment:KB,defaultnormal_vertex:JB,displacementmap_pars_vertex:$B,displacementmap_vertex:e4,emissivemap_fragment:t4,emissivemap_pars_fragment:n4,colorspace_fragment:i4,colorspace_pars_fragment:a4,envmap_fragment:s4,envmap_common_pars_fragment:r4,envmap_pars_fragment:o4,envmap_pars_vertex:l4,envmap_physical_pars_fragment:_4,envmap_vertex:u4,fog_vertex:c4,fog_pars_vertex:f4,fog_fragment:h4,fog_pars_fragment:d4,gradientmap_pars_fragment:p4,lightmap_pars_fragment:m4,lights_lambert_fragment:g4,lights_lambert_pars_fragment:v4,lights_pars_begin:y4,lights_toon_fragment:x4,lights_toon_pars_fragment:S4,lights_phong_fragment:b4,lights_phong_pars_fragment:M4,lights_physical_fragment:E4,lights_physical_pars_fragment:T4,lights_fragment_begin:A4,lights_fragment_maps:w4,lights_fragment_end:C4,logdepthbuf_fragment:R4,logdepthbuf_pars_fragment:D4,logdepthbuf_pars_vertex:U4,logdepthbuf_vertex:L4,map_fragment:N4,map_pars_fragment:I4,map_particle_fragment:z4,map_particle_pars_fragment:O4,metalnessmap_fragment:P4,metalnessmap_pars_fragment:B4,morphinstance_vertex:F4,morphcolor_vertex:H4,morphnormal_vertex:V4,morphtarget_pars_vertex:k4,morphtarget_vertex:G4,normal_fragment_begin:W4,normal_fragment_maps:X4,normal_pars_fragment:q4,normal_pars_vertex:Y4,normal_vertex:Z4,normalmap_pars_fragment:j4,clearcoat_normal_fragment_begin:Q4,clearcoat_normal_fragment_maps:K4,clearcoat_pars_fragment:J4,iridescence_pars_fragment:$4,opaque_fragment:eF,packing:tF,premultiplied_alpha_fragment:nF,project_vertex:iF,dithering_fragment:aF,dithering_pars_fragment:sF,roughnessmap_fragment:rF,roughnessmap_pars_fragment:oF,shadowmap_pars_fragment:lF,shadowmap_pars_vertex:uF,shadowmap_vertex:cF,shadowmask_pars_fragment:fF,skinbase_vertex:hF,skinning_pars_vertex:dF,skinning_vertex:pF,skinnormal_vertex:mF,specularmap_fragment:gF,specularmap_pars_fragment:vF,tonemapping_fragment:yF,tonemapping_pars_fragment:_F,transmission_fragment:xF,transmission_pars_fragment:SF,uv_pars_fragment:bF,uv_pars_vertex:MF,uv_vertex:EF,worldpos_vertex:TF,background_vert:AF,background_frag:wF,backgroundCube_vert:CF,backgroundCube_frag:RF,cube_vert:DF,cube_frag:UF,depth_vert:LF,depth_frag:NF,distanceRGBA_vert:IF,distanceRGBA_frag:zF,equirect_vert:OF,equirect_frag:PF,linedashed_vert:BF,linedashed_frag:FF,meshbasic_vert:HF,meshbasic_frag:VF,meshlambert_vert:kF,meshlambert_frag:GF,meshmatcap_vert:WF,meshmatcap_frag:XF,meshnormal_vert:qF,meshnormal_frag:YF,meshphong_vert:ZF,meshphong_frag:jF,meshphysical_vert:QF,meshphysical_frag:KF,meshtoon_vert:JF,meshtoon_frag:$F,points_vert:e5,points_frag:t5,shadow_vert:n5,shadow_frag:i5,sprite_vert:a5,sprite_frag:s5},Le={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yt}},envmap:{envMap:{value:null},envMapRotation:{value:new yt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yt},normalScale:{value:new de(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(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 He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0},uvTransform:{value:new yt}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}}},ts={basic:{uniforms:Ci([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.fog]),vertexShader:bt.meshbasic_vert,fragmentShader:bt.meshbasic_frag},lambert:{uniforms:Ci([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new He(0)}}]),vertexShader:bt.meshlambert_vert,fragmentShader:bt.meshlambert_frag},phong:{uniforms:Ci([Le.common,Le.specularmap,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,Le.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30}}]),vertexShader:bt.meshphong_vert,fragmentShader:bt.meshphong_frag},standard:{uniforms:Ci([Le.common,Le.envmap,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.roughnessmap,Le.metalnessmap,Le.fog,Le.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag},toon:{uniforms:Ci([Le.common,Le.aomap,Le.lightmap,Le.emissivemap,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.gradientmap,Le.fog,Le.lights,{emissive:{value:new He(0)}}]),vertexShader:bt.meshtoon_vert,fragmentShader:bt.meshtoon_frag},matcap:{uniforms:Ci([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,Le.fog,{matcap:{value:null}}]),vertexShader:bt.meshmatcap_vert,fragmentShader:bt.meshmatcap_frag},points:{uniforms:Ci([Le.points,Le.fog]),vertexShader:bt.points_vert,fragmentShader:bt.points_frag},dashed:{uniforms:Ci([Le.common,Le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bt.linedashed_vert,fragmentShader:bt.linedashed_frag},depth:{uniforms:Ci([Le.common,Le.displacementmap]),vertexShader:bt.depth_vert,fragmentShader:bt.depth_frag},normal:{uniforms:Ci([Le.common,Le.bumpmap,Le.normalmap,Le.displacementmap,{opacity:{value:1}}]),vertexShader:bt.meshnormal_vert,fragmentShader:bt.meshnormal_frag},sprite:{uniforms:Ci([Le.sprite,Le.fog]),vertexShader:bt.sprite_vert,fragmentShader:bt.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bt.background_vert,fragmentShader:bt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new yt}},vertexShader:bt.backgroundCube_vert,fragmentShader:bt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bt.cube_vert,fragmentShader:bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bt.equirect_vert,fragmentShader:bt.equirect_frag},distanceRGBA:{uniforms:Ci([Le.common,Le.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bt.distanceRGBA_vert,fragmentShader:bt.distanceRGBA_frag},shadow:{uniforms:Ci([Le.lights,Le.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:bt.shadow_vert,fragmentShader:bt.shadow_frag}};ts.physical={uniforms:Ci([ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yt},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yt},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yt},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yt},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yt},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yt}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag};const Np={r:0,b:0,g:0},Qo=new ba,r5=new ct;function o5(n,e,t,i,a,s,l){const u=new He(0);let c=s===!0?0:1,h,p,m=null,g=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===Fc)?(p===void 0&&(p=new Hn(new Vl(1,1,1),new ss({name:"BackgroundCubeMaterial",uniforms:Rc(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(r5.makeRotationFromEuler(Qo)),p.material.toneMapped=Ut.getTransfer(A.colorSpace)!==Zt,(m!==A||g!==A.version||v!==n.toneMapping)&&(p.material.needsUpdate=!0,m=A,g=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 Hn(new kc(2,2),new ss({name:"BackgroundMaterial",uniforms:Rc(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),(m!==A||g!==A.version||v!==n.toneMapping)&&(h.material.needsUpdate=!0,m=A,g=A.version,v=n.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null))}function y(S,E){S.getRGB(Np,DD(n)),i.buffers.color.setClear(Np.r,Np.g,Np.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 l5(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},a=g(null);let s=a,l=!1;function u(w,B,Q,k,j){let te=!1;const V=m(k,Q,B);s!==V&&(s=V,h(s.object)),te=v(w,k,Q,j),te&&_(w,k,Q,j),j!==null&&e.update(j,n.ELEMENT_ARRAY_BUFFER),(te||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 m(w,B,Q){const k=Q.wireframe===!0;let j=i[w.id];j===void 0&&(j={},i[w.id]=j);let te=j[B.id];te===void 0&&(te={},j[B.id]=te);let V=te[k];return V===void 0&&(V=g(c()),te[k]=V),V}function g(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,te=B.attributes;let V=0;const J=Q.getAttributes();for(const X in J)if(J[X].location>=0){const he=j[X];let _e=te[X];if(_e===void 0&&(X==="instanceMatrix"&&w.instanceMatrix&&(_e=w.instanceMatrix),X==="instanceColor"&&w.instanceColor&&(_e=w.instanceColor)),he===void 0||he.attribute!==_e||_e&&he.data!==_e.data)return!0;V++}return s.attributesNum!==V||s.index!==k}function _(w,B,Q,k){const j={},te=B.attributes;let V=0;const J=Q.getAttributes();for(const X in J)if(J[X].location>=0){let he=te[X];he===void 0&&(X==="instanceMatrix"&&w.instanceMatrix&&(he=w.instanceMatrix),X==="instanceColor"&&w.instanceColor&&(he=w.instanceColor));const _e={};_e.attribute=he,he&&he.data&&(_e.data=he.data),j[X]=_e,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,te,V){V===!0?n.vertexAttribIPointer(w,B,Q,j,te):n.vertexAttribPointer(w,B,Q,k,j,te)}function A(w,B,Q,k){T();const j=k.attributes,te=Q.getAttributes(),V=B.defaultAttributeValues;for(const J in te){const X=te[J];if(X.location>=0){let re=j[J];if(re===void 0&&(J==="instanceMatrix"&&w.instanceMatrix&&(re=w.instanceMatrix),J==="instanceColor"&&w.instanceColor&&(re=w.instanceColor)),re!==void 0){const he=re.normalized,_e=re.itemSize,we=e.get(re);if(we===void 0)continue;const Je=we.buffer,ee=we.type,me=we.bytesPerElement,Oe=ee===n.INT||ee===n.UNSIGNED_INT||re.gpuType===h0;if(re.isInterleavedBufferAttribute){const Ee=re.data,Ye=Ee.stride,et=re.offset;if(Ee.isInstancedInterleavedBuffer){for(let Ze=0;Ze<X.locationSize;Ze++)y(X.location+Ze,Ee.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=Ee.meshPerAttribute*Ee.count)}else for(let Ze=0;Ze<X.locationSize;Ze++)b(X.location+Ze);n.bindBuffer(n.ARRAY_BUFFER,Je);for(let Ze=0;Ze<X.locationSize;Ze++)E(X.location+Ze,_e/X.locationSize,ee,he,Ye*me,(et+_e/X.locationSize*Ze)*me,Oe)}else{if(re.isInstancedBufferAttribute){for(let Ee=0;Ee<X.locationSize;Ee++)y(X.location+Ee,re.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Ee=0;Ee<X.locationSize;Ee++)b(X.location+Ee);n.bindBuffer(n.ARRAY_BUFFER,Je);for(let Ee=0;Ee<X.locationSize;Ee++)E(X.location+Ee,_e/X.locationSize,ee,he,_e*me,_e/X.locationSize*Ee*me,Oe)}}else if(V!==void 0){const he=V[J];if(he!==void 0)switch(he.length){case 2:n.vertexAttrib2fv(X.location,he);break;case 3:n.vertexAttrib3fv(X.location,he);break;case 4:n.vertexAttrib4fv(X.location,he);break;default:n.vertexAttrib1fv(X.location,he)}}}}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 u5(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,m){m!==0&&(n.drawArraysInstanced(i,h,p,m),t.update(p,i,m))}function u(h,p,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,h,0,p,0,m);let v=0;for(let _=0;_<m;_++)v+=p[_];t.update(v,i,1)}function c(h,p,m,g){if(m===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let _=0;_<h.length;_++)l(h[_],p[_],g[_]);else{v.multiDrawArraysInstancedWEBGL(i,h,0,p,0,g,0,m);let _=0;for(let T=0;T<m;T++)_+=p[T]*g[T];t.update(_,i,1)}}this.setMode=a,this.render=s,this.renderInstances=l,this.renderMultiDraw=u,this.renderMultiDrawInstances=c}function c5(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===Hc&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==is&&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 m=t.logarithmicDepthBuffer===!0,g=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:m,reverseDepthBuffer:g,maxTextures:v,maxVertexTextures:_,maxTextureSize:T,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:S,maxVaryings:E,maxFragmentUniforms:A,vertexTextures:I,maxSamples:R}}function f5(n){const e=this;let t=null,i=0,a=!1,s=!1;const l=new qr,u=new yt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,g){const v=m.length!==0||g||i!==0||a;return a=g,i=m.length,v},this.beginShadows=function(){s=!0,p(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,g){t=p(m,g,0)},this.setState=function(m,g,v){const _=m.clippingPlanes,T=m.clipIntersection,b=m.clipShadows,y=n.get(m);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(_,g,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(m,g,v,_){const T=m!==null?m.length:0;let b=null;if(T!==0){if(b=c.value,_!==!0||b===null){const y=v+T*4,S=g.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(m[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 h5(n){let e=new WeakMap;function t(l,u){return u===Ch?l.mapping=yr:u===Rh&&(l.mapping=yo),l}function i(l){if(l&&l.isTexture){const u=l.mapping;if(u===Ch||u===Rh)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 ND(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 kl extends x0{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 ac=4,gA=[.125,.215,.35,.446,.526,.582],fl=20,f_=new kl,vA=new He;let h_=null,d_=0,p_=0,m_=!1;const cl=(1+Math.sqrt(5))/2,Nu=1/cl,yA=[new P(-cl,Nu,0),new P(cl,Nu,0),new P(-Nu,0,cl),new P(Nu,0,cl),new P(0,cl,-Nu),new P(0,cl,Nu),new P(-1,1,-1),new P(1,1,-1),new P(-1,1,1),new P(1,1,1)];class kx{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){h_=this._renderer.getRenderTarget(),d_=this._renderer.getActiveCubeFace(),p_=this._renderer.getActiveMipmapLevel(),m_=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=SA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xA(),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(h_,d_,p_),this._renderer.xr.enabled=m_,e.scissorTest=!1,Ip(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),h_=this._renderer.getRenderTarget(),d_=this._renderer.getActiveCubeFace(),p_=this._renderer.getActiveMipmapLevel(),m_=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:Wn,minFilter:Wn,generateMipmaps:!1,type:Hc,format:Si,colorSpace:Mo,depthBuffer:!1},a=_A(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_A(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=d5(s)),this._blurMaterial=p5(s,e,t)}return a}_compileMaterial(e){const t=new Hn(this._lodPlanes[0],e);this._renderer.compile(t,f_)}_sceneToCubeUV(e,t,i,a){const u=new Bn(90,1,t,i),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,g=p.toneMapping;p.getClearColor(vA),p.toneMapping=Ms,p.autoClear=!1;const v=new Eo({name:"PMREM.Background",side:Ui,depthWrite:!1,depthTest:!1}),_=new Hn(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(vA),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;Ip(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=g,p.autoClear=m,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,a=e.mapping===yr||e.mapping===yo;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=SA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xA());const s=a?this._cubemapMaterial:this._equirectMaterial,l=new Hn(this._lodPlanes[0],s),u=s.uniforms;u.envMap.value=e;const c=this._cubeSize;Ip(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(l,f_)}_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=yA[(a-s-1)%yA.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,m=new Hn(this._lodPlanes[a],h),g=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;g.envMap.value=e.texture,g.samples.value=b,g.weights.value=y,g.latitudinal.value=l==="latitudinal",u&&(g.poleAxis.value=u);const{_lodMax:E}=this;g.dTheta.value=_,g.mipInt.value=E-i;const A=this._sizeLods[a],I=3*A*(a>E-ac?a-E+ac:0),R=4*(this._cubeSize-A);Ip(t,I,R,3*A,2*A),c.setRenderTarget(t),c.render(m,f_)}}function d5(n){const e=[],t=[],i=[];let a=n;const s=n-ac+1+gA.length;for(let l=0;l<s;l++){const u=Math.pow(2,a);t.push(u);let c=1/u;l>n-ac?c=gA[l-n+ac-1]:l===0&&(c=0),i.push(c);const h=1/(u-2),p=-h,m=1+h,g=[p,p,m,p,m,m,p,p,m,m,p,m],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(g,b*_*R);const w=[R,R,R,R,R,R];A.set(w,y*_*R)}const I=new Mt;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>ac&&a--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function _A(n,e,t){const i=new as(n,e,t);return i.texture.mapping=Fc,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ip(n,e,t,i,a){n.viewport.set(e,t,i,a),n.scissor.set(e,t,i,a)}function p5(n,e,t){const i=new Float32Array(fl),a=new P(0,1,0);return new ss({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:_b(),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 xA(){return new ss({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_b(),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 SA(){return new ss({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_b(),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 _b(){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 m5(n){let e=new WeakMap,t=null;function i(u){if(u&&u.isTexture){const c=u.mapping,h=c===Ch||c===Rh,p=c===yr||c===yo;if(h||p){let m=e.get(u);const g=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==g)return t===null&&(t=new kx(n)),m=h?t.fromEquirectangular(u,m):t.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),m.texture;if(m!==void 0)return m.texture;{const v=u.image;return h&&v&&v.height>0||p&&v&&a(v)?(t===null&&(t=new kx(n)),m=h?t.fromEquirectangular(u):t.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),u.addEventListener("dispose",s),m.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 g5(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&&Vf("THREE.WebGLRenderer: "+i+" extension not supported."),a}}}function v5(n,e,t,i){const a={},s=new WeakMap;function l(m){const g=m.target;g.index!==null&&e.remove(g.index);for(const _ in g.attributes)e.remove(g.attributes[_]);for(const _ in g.morphAttributes){const T=g.morphAttributes[_];for(let b=0,y=T.length;b<y;b++)e.remove(T[b])}g.removeEventListener("dispose",l),delete a[g.id];const v=s.get(g);v&&(e.remove(v),s.delete(g)),i.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,t.memory.geometries--}function u(m,g){return a[g.id]===!0||(g.addEventListener("dispose",l),a[g.id]=!0,t.memory.geometries++),g}function c(m){const g=m.attributes;for(const _ in g)e.update(g[_],n.ARRAY_BUFFER);const v=m.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(m){const g=[],v=m.index,_=m.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];g.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;g.push(I,R,R,L,L,I)}}else return;const b=new(TD(g)?yb:vb)(g,1);b.version=T;const y=s.get(m);y&&e.remove(y),s.set(m,b)}function p(m){const g=s.get(m);if(g){const v=m.index;v!==null&&g.version<v.version&&h(m)}else h(m);return s.get(m)}return{get:u,update:c,getWireframeAttribute:p}}function y5(n,e,t){let i;function a(g){i=g}let s,l;function u(g){s=g.type,l=g.bytesPerElement}function c(g,v){n.drawElements(i,v,s,g*l),t.update(v,i,1)}function h(g,v,_){_!==0&&(n.drawElementsInstanced(i,v,s,g*l,_),t.update(v,i,_))}function p(g,v,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,v,0,s,g,0,_);let b=0;for(let y=0;y<_;y++)b+=v[y];t.update(b,i,1)}function m(g,v,_,T){if(_===0)return;const b=e.get("WEBGL_multi_draw");if(b===null)for(let y=0;y<g.length;y++)h(g[y]/l,v[y],T[y]);else{b.multiDrawElementsInstancedWEBGL(i,v,0,s,g,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=m}function _5(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 x5(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,m=p!==void 0?p.length:0;let g=i.get(u);if(g===void 0||g.count!==m){let C=function(){L.dispose(),i.delete(u),u.removeEventListener("dispose",C)};g!==void 0&&g.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*m),L=new _0(R,A,I,m);L.type=Zi,L.needsUpdate=!0;const z=E*4;for(let w=0;w<m;w++){const B=b[w],Q=y[w],k=S[w],j=A*I*4*w;for(let te=0;te<B.count;te++){const V=te*z;v===!0&&(a.fromBufferAttribute(B,te),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,te),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,te),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)}}g={count:m,texture:L,size:new de(A,I)},i.set(u,g),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",g.texture,t),c.getUniforms().setValue(n,"morphTargetsTextureSize",g.size)}return{update:s}}function S5(n,e,t,i){let a=new WeakMap;function s(c){const h=i.render.frame,p=c.geometry,m=e.get(c,p);if(a.get(m)!==h&&(e.update(m),a.set(m,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 g=c.skeleton;a.get(g)!==h&&(g.update(),a.set(g,h))}return m}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 xb 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 zD=new Mn,bA=new xb(1,1),OD=new _0,PD=new gb,BD=new od,MA=[],EA=[],TA=new Float32Array(16),AA=new Float32Array(9),wA=new Float32Array(4);function Gc(n,e,t){const i=n[0];if(i<=0||i>0)return n;const a=e*t;let s=MA[a];if(s===void 0&&(s=new Float32Array(a),MA[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 qn(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 Yn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function S0(n,e){let t=EA[e];t===void 0&&(t=new Int32Array(e),EA[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function b5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function M5(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(qn(t,e))return;n.uniform2fv(this.addr,e),Yn(t,e)}}function E5(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(qn(t,e))return;n.uniform3fv(this.addr,e),Yn(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||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(qn(t,e))return;n.uniform4fv(this.addr,e),Yn(t,e)}}function A5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(qn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Yn(t,e)}else{if(qn(t,i))return;wA.set(i),n.uniformMatrix2fv(this.addr,!1,wA),Yn(t,i)}}function w5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(qn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Yn(t,e)}else{if(qn(t,i))return;AA.set(i),n.uniformMatrix3fv(this.addr,!1,AA),Yn(t,i)}}function C5(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(qn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Yn(t,e)}else{if(qn(t,i))return;TA.set(i),n.uniformMatrix4fv(this.addr,!1,TA),Yn(t,i)}}function R5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function D5(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(qn(t,e))return;n.uniform2iv(this.addr,e),Yn(t,e)}}function U5(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(qn(t,e))return;n.uniform3iv(this.addr,e),Yn(t,e)}}function L5(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(qn(t,e))return;n.uniform4iv(this.addr,e),Yn(t,e)}}function N5(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function I5(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(qn(t,e))return;n.uniform2uiv(this.addr,e),Yn(t,e)}}function z5(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(qn(t,e))return;n.uniform3uiv(this.addr,e),Yn(t,e)}}function O5(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(qn(t,e))return;n.uniform4uiv(this.addr,e),Yn(t,e)}}function P5(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?(bA.compareFunction=pb,s=bA):s=zD,t.setTexture2D(e||s,a)}function B5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTexture3D(e||PD,a)}function F5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTextureCube(e||BD,a)}function H5(n,e,t){const i=this.cache,a=t.allocateTextureUnit();i[0]!==a&&(n.uniform1i(this.addr,a),i[0]=a),t.setTexture2DArray(e||OD,a)}function V5(n){switch(n){case 5126:return b5;case 35664:return M5;case 35665:return E5;case 35666:return T5;case 35674:return A5;case 35675:return w5;case 35676:return C5;case 5124:case 35670:return R5;case 35667:case 35671:return D5;case 35668:case 35672:return U5;case 35669:case 35673:return L5;case 5125:return N5;case 36294:return I5;case 36295:return z5;case 36296:return O5;case 35678:case 36198:case 36298:case 36306:case 35682:return P5;case 35679:case 36299:case 36307:return B5;case 35680:case 36300:case 36308:case 36293:return F5;case 36289:case 36303:case 36311:case 36292:return H5}}function k5(n,e){n.uniform1fv(this.addr,e)}function G5(n,e){const t=Gc(e,this.size,2);n.uniform2fv(this.addr,t)}function W5(n,e){const t=Gc(e,this.size,3);n.uniform3fv(this.addr,t)}function X5(n,e){const t=Gc(e,this.size,4);n.uniform4fv(this.addr,t)}function q5(n,e){const t=Gc(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function Y5(n,e){const t=Gc(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function Z5(n,e){const t=Gc(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function j5(n,e){n.uniform1iv(this.addr,e)}function Q5(n,e){n.uniform2iv(this.addr,e)}function K5(n,e){n.uniform3iv(this.addr,e)}function J5(n,e){n.uniform4iv(this.addr,e)}function $5(n,e){n.uniform1uiv(this.addr,e)}function eH(n,e){n.uniform2uiv(this.addr,e)}function tH(n,e){n.uniform3uiv(this.addr,e)}function nH(n,e){n.uniform4uiv(this.addr,e)}function iH(n,e,t){const i=this.cache,a=e.length,s=S0(t,a);qn(i,s)||(n.uniform1iv(this.addr,s),Yn(i,s));for(let l=0;l!==a;++l)t.setTexture2D(e[l]||zD,s[l])}function aH(n,e,t){const i=this.cache,a=e.length,s=S0(t,a);qn(i,s)||(n.uniform1iv(this.addr,s),Yn(i,s));for(let l=0;l!==a;++l)t.setTexture3D(e[l]||PD,s[l])}function sH(n,e,t){const i=this.cache,a=e.length,s=S0(t,a);qn(i,s)||(n.uniform1iv(this.addr,s),Yn(i,s));for(let l=0;l!==a;++l)t.setTextureCube(e[l]||BD,s[l])}function rH(n,e,t){const i=this.cache,a=e.length,s=S0(t,a);qn(i,s)||(n.uniform1iv(this.addr,s),Yn(i,s));for(let l=0;l!==a;++l)t.setTexture2DArray(e[l]||OD,s[l])}function oH(n){switch(n){case 5126:return k5;case 35664:return G5;case 35665:return W5;case 35666:return X5;case 35674:return q5;case 35675:return Y5;case 35676:return Z5;case 5124:case 35670:return j5;case 35667:case 35671:return Q5;case 35668:case 35672:return K5;case 35669:case 35673:return J5;case 5125:return $5;case 36294:return eH;case 36295:return tH;case 36296:return nH;case 35678:case 36198:case 36298:case 36306:case 35682:return iH;case 35679:case 36299:case 36307:return aH;case 35680:case 36300:case 36308:case 36293:return sH;case 36289:case 36303:case 36311:case 36292:return rH}}class lH{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=V5(t.type)}}class uH{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=oH(t.type)}}class cH{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 g_=/(\w+)(\])?(\[|\.)?/g;function CA(n,e){n.seq.push(e),n.map[e.id]=e}function fH(n,e,t){const i=n.name,a=i.length;for(g_.lastIndex=0;;){const s=g_.exec(i),l=g_.lastIndex;let u=s[1];const c=s[2]==="]",h=s[3];if(c&&(u=u|0),h===void 0||h==="["&&l+2===a){CA(t,h===void 0?new lH(u,n,e):new uH(u,n,e));break}else{let m=t.map[u];m===void 0&&(m=new cH(u),CA(t,m)),t=m}}}class Tm{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);fH(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 RA(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const hH=37297;let dH=0;function pH(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 DA=new yt;function mH(n){Ut._getMatrix(DA,Ut.workingColorSpace,n);const e=`mat3( ${DA.elements.map(t=>t.toFixed(4))} )`;switch(Ut.getTransfer(n)){case rd:return[e,"LinearTransferOETF"];case Zt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function UA(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+`
`+pH(n.getShaderSource(e),l)}else return a}function gH(n,e){const t=mH(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function vH(n,e){let t;switch(e){case sD:t="Linear";break;case rD:t="Reinhard";break;case oD:t="Cineon";break;case nb:t="ACESFilmic";break;case uD:t="AgX";break;case cD:t="Neutral";break;case lD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const zp=new P;function yH(){Ut.getLuminanceCoefficients(zp);const n=zp.x.toFixed(4),e=zp.y.toFixed(4),t=zp.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
`)}function _H(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Gf).join(`
`)}function xH(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function SH(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 Gf(n){return n!==""}function LA(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 NA(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const bH=/^[ \t]*#include +<([\w\d./]+)>/gm;function Gx(n){return n.replace(bH,EH)}const MH=new Map;function EH(n,e){let t=bt[e];if(t===void 0){const i=MH.get(e);if(i!==void 0)t=bt[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 Gx(t)}const TH=/#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 IA(n){return n.replace(TH,AH)}function AH(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 zA(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 wH(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===c0?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===ih?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===$a&&(e="SHADOWMAP_TYPE_VSM"),e}function CH(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case yr:case yo:e="ENVMAP_TYPE_CUBE";break;case Fc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function RH(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case yo:e="ENVMAP_MODE_REFRACTION";break}return e}function DH(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case ad:e="ENVMAP_BLENDING_MULTIPLY";break;case iD:e="ENVMAP_BLENDING_MIX";break;case aD:e="ENVMAP_BLENDING_ADD";break}return e}function UH(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 LH(n,e,t,i){const a=n.getContext(),s=t.defines;let l=t.vertexShader,u=t.fragmentShader;const c=wH(t),h=CH(t),p=RH(t),m=DH(t),g=UH(t),v=_H(t),_=xH(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(Gf).join(`
`),b.length>0&&(b+=`
`),y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Gf).join(`
`),y.length>0&&(y+=`
`)):(b=[zA(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(Gf).join(`
`),y=[zA(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 "+m:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.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?bt.tonemapping_pars_fragment:"",t.toneMapping!==Ms?vH("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",bt.colorspace_pars_fragment,gH("linearToOutputTexel",t.outputColorSpace),yH(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Gf).join(`
`)),l=Gx(l),l=LA(l,t),l=NA(l,t),u=Gx(u),u=LA(u,t),u=NA(u,t),l=IA(l),u=IA(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===Vx?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Vx?"":"#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=RA(a,a.VERTEX_SHADER,E),R=RA(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 te=!0,V=!0;if(a.getProgramParameter(T,a.LINK_STATUS)===!1)if(te=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(a,T,I,R);else{const J=UA(a,I,"vertex"),X=UA(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+`
`+J+`
`+X)}else Q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Q):(k===""||j==="")&&(V=!1);V&&(B.diagnostics={runnable:te,programLog:Q,vertexShader:{log:k,prefix:b},fragmentShader:{log:j,prefix:y}})}a.deleteShader(I),a.deleteShader(R),z=new Tm(a,T),C=SH(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,hH)),w},this.destroy=function(){i.releaseStatesOfProgram(this),a.deleteProgram(T),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=dH++,this.cacheKey=e,this.usedTimes=1,this.program=T,this.vertexShader=I,this.fragmentShader=R,this}let NH=0;class IH{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 zH(e),t.set(e,i)),i}}class zH{constructor(e){this.id=NH++,this.code=e,this.usedTimes=0}}function OH(n,e,t,i,a,s,l){const u=new Cc,c=new IH,h=new Set,p=[],m=a.logarithmicDepthBuffer,g=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,te=k.geometry,V=C.isMeshStandardMaterial?Q.environment:null,J=(C.isMeshStandardMaterial?t:e).get(C.envMap||V),X=J&&J.mapping===Fc?J.image.height:null,re=_[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 he=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,_e=he!==void 0?he.length:0;let we=0;te.morphAttributes.position!==void 0&&(we=1),te.morphAttributes.normal!==void 0&&(we=2),te.morphAttributes.color!==void 0&&(we=3);let Je,ee,me,Oe;if(re){const Ft=ts[re];Je=Ft.vertexShader,ee=Ft.fragmentShader}else Je=C.vertexShader,ee=C.fragmentShader,c.update(C),me=c.getVertexShaderID(C),Oe=c.getFragmentShaderID(C);const Ee=n.getRenderTarget(),Ye=n.state.buffers.depth.getReversed(),et=k.isInstancedMesh===!0,Ze=k.isBatchedMesh===!0,je=!!C.map,ue=!!C.matcap,ge=!!J,F=!!C.aoMap,Ve=!!C.lightMap,ve=!!C.bumpMap,Ae=!!C.normalMap,Te=!!C.displacementMap,tt=!!C.emissiveMap,Ue=!!C.metalnessMap,O=!!C.roughnessMap,D=C.anisotropy>0,Z=C.clearcoat>0,oe=C.dispersion>0,pe=C.iridescence>0,le=C.sheen>0,Pe=C.transmission>0,Re=D&&!!C.anisotropyMap,De=Z&&!!C.clearcoatMap,gt=Z&&!!C.clearcoatNormalMap,xe=Z&&!!C.clearcoatRoughnessMap,Xe=pe&&!!C.iridescenceMap,nt=pe&&!!C.iridescenceThicknessMap,st=le&&!!C.sheenColorMap,qe=le&&!!C.sheenRoughnessMap,Rt=!!C.specularMap,dt=!!C.specularColorMap,Kt=!!C.specularIntensityMap,G=Pe&&!!C.transmissionMap,Ie=Pe&&!!C.thicknessMap,se=!!C.gradientMap,fe=!!C.alphaMap,Be=C.alphaTest>0,Ne=!!C.alphaHash,pt=!!C.extensions;let rn=Ms;C.toneMapped&&(Ee===null||Ee.isXRRenderTarget===!0)&&(rn=n.toneMapping);const fn={shaderID:re,shaderType:C.type,shaderName:C.name,vertexShader:Je,fragmentShader:ee,defines:C.defines,customVertexShaderID:me,customFragmentShaderID:Oe,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:v,batching:Ze,batchingColor:Ze&&k._colorsTexture!==null,instancing:et,instancingColor:et&&k.instanceColor!==null,instancingMorph:et&&k.morphTexture!==null,supportsVertexTextures:g,outputColorSpace:Ee===null?n.outputColorSpace:Ee.isXRRenderTarget===!0?Ee.texture.colorSpace:Mo,alphaToCoverage:!!C.alphaToCoverage,map:je,matcap:ue,envMap:ge,envMapMode:ge&&J.mapping,envMapCubeUVHeight:X,aoMap:F,lightMap:Ve,bumpMap:ve,normalMap:Ae,displacementMap:g&&Te,emissiveMap:tt,normalMapObjectSpace:Ae&&C.normalMapType===vD,normalMapTangentSpace:Ae&&C.normalMapType===bo,metalnessMap:Ue,roughnessMap:O,anisotropy:D,anisotropyMap:Re,clearcoat:Z,clearcoatMap:De,clearcoatNormalMap:gt,clearcoatRoughnessMap:xe,dispersion:oe,iridescence:pe,iridescenceMap:Xe,iridescenceThicknessMap:nt,sheen:le,sheenColorMap:st,sheenRoughnessMap:qe,specularMap:Rt,specularColorMap:dt,specularIntensityMap:Kt,transmission:Pe,transmissionMap:G,thicknessMap:Ie,gradientMap:se,opaque:C.transparent===!1&&C.blending===Sl&&C.alphaToCoverage===!1,alphaMap:fe,alphaTest:Be,alphaHash:Ne,combine:C.combine,mapUv:je&&T(C.map.channel),aoMapUv:F&&T(C.aoMap.channel),lightMapUv:Ve&&T(C.lightMap.channel),bumpMapUv:ve&&T(C.bumpMap.channel),normalMapUv:Ae&&T(C.normalMap.channel),displacementMapUv:Te&&T(C.displacementMap.channel),emissiveMapUv:tt&&T(C.emissiveMap.channel),metalnessMapUv:Ue&&T(C.metalnessMap.channel),roughnessMapUv:O&&T(C.roughnessMap.channel),anisotropyMapUv:Re&&T(C.anisotropyMap.channel),clearcoatMapUv:De&&T(C.clearcoatMap.channel),clearcoatNormalMapUv:gt&&T(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:xe&&T(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Xe&&T(C.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&T(C.iridescenceThicknessMap.channel),sheenColorMapUv:st&&T(C.sheenColorMap.channel),sheenRoughnessMapUv:qe&&T(C.sheenRoughnessMap.channel),specularMapUv:Rt&&T(C.specularMap.channel),specularColorMapUv:dt&&T(C.specularColorMap.channel),specularIntensityMapUv:Kt&&T(C.specularIntensityMap.channel),transmissionMapUv:G&&T(C.transmissionMap.channel),thicknessMapUv:Ie&&T(C.thicknessMap.channel),alphaMapUv:fe&&T(C.alphaMap.channel),vertexTangents:!!te.attributes.tangent&&(Ae||D),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!te.attributes.uv&&(je||fe),fog:!!j,useFog:C.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:m,reverseDepthBuffer:Ye,skinning:k.isSkinnedMesh===!0,morphTargets:te.morphAttributes.position!==void 0,morphNormals:te.morphAttributes.normal!==void 0,morphColors:te.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:we,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:je&&C.map.isVideoTexture===!0&&Ut.getTransfer(C.map.colorSpace)===Zt,decodeVideoTextureEmissive:tt&&C.emissiveMap.isVideoTexture===!0&&Ut.getTransfer(C.emissiveMap.colorSpace)===Zt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===ns,flipSided:C.side===Ui,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:pt&&C.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pt&&C.extensions.multiDraw===!0||Ze)&&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=UD.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 LH(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 PH(){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 BH(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 OA(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 PA(){const n=[];let e=0;const t=[],i=[],a=[];function s(){e=0,t.length=0,i.length=0,a.length=0}function l(m,g,v,_,T,b){let y=n[e];return y===void 0?(y={id:m.id,object:m,geometry:g,material:v,groupOrder:_,renderOrder:m.renderOrder,z:T,group:b},n[e]=y):(y.id=m.id,y.object=m,y.geometry=g,y.material=v,y.groupOrder=_,y.renderOrder=m.renderOrder,y.z=T,y.group=b),e++,y}function u(m,g,v,_,T,b){const y=l(m,g,v,_,T,b);v.transmission>0?i.push(y):v.transparent===!0?a.push(y):t.push(y)}function c(m,g,v,_,T,b){const y=l(m,g,v,_,T,b);v.transmission>0?i.unshift(y):v.transparent===!0?a.unshift(y):t.unshift(y)}function h(m,g){t.length>1&&t.sort(m||BH),i.length>1&&i.sort(g||OA),a.length>1&&a.sort(g||OA)}function p(){for(let m=e,g=n.length;m<g;m++){const v=n[m];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 FH(){let n=new WeakMap;function e(i,a){const s=n.get(i);let l;return s===void 0?(l=new PA,n.set(i,[l])):a>=s.length?(l=new PA,s.push(l)):l=s[a],l}function t(){n=new WeakMap}return{get:e,dispose:t}}function HH(){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 He};break;case"SpotLight":t={position:new P,direction:new P,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new P,halfWidth:new P,halfHeight:new P};break}return n[e.id]=t,t}}}function VH(){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 de};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let kH=0;function GH(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function WH(n){const e=new HH,t=VH(),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 ct,l=new ct;function u(h){let p=0,m=0,g=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(GH);for(let C=0,w=h.length;C<w;C++){const B=h[C],Q=B.color,k=B.intensity,j=B.distance,te=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)p+=Q.r*k,m+=Q.g*k,g+=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 J=B.shadow,X=t.get(B);X.shadowIntensity=J.intensity,X.shadowBias=J.bias,X.shadowNormalBias=J.normalBias,X.shadowRadius=J.radius,X.shadowMapSize=J.mapSize,i.directionalShadow[v]=X,i.directionalShadowMap[v]=te,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 J=B.shadow;if(B.map&&(i.spotLightMap[I]=B.map,I++,J.updateMatrices(B),B.castShadow&&R++),i.spotLightMatrix[T]=J.matrix,B.castShadow){const X=t.get(B);X.shadowIntensity=J.intensity,X.shadowBias=J.bias,X.shadowNormalBias=J.normalBias,X.shadowRadius=J.radius,X.shadowMapSize=J.mapSize,i.spotShadow[T]=X,i.spotShadowMap[T]=te,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 J=B.shadow,X=t.get(B);X.shadowIntensity=J.intensity,X.shadowBias=J.bias,X.shadowNormalBias=J.normalBias,X.shadowRadius=J.radius,X.shadowMapSize=J.mapSize,X.shadowCameraNear=J.camera.near,X.shadowCameraFar=J.camera.far,i.pointShadow[_]=X,i.pointShadowMap[_]=te,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=Le.LTC_FLOAT_1,i.rectAreaLTC2=Le.LTC_FLOAT_2):(i.rectAreaLTC1=Le.LTC_HALF_1,i.rectAreaLTC2=Le.LTC_HALF_2)),i.ambient[0]=p,i.ambient[1]=m,i.ambient[2]=g;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=kH++)}function c(h,p){let m=0,g=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[m];A.direction.setFromMatrixPosition(E.matrixWorld),a.setFromMatrixPosition(E.target.matrixWorld),A.direction.sub(a),A.direction.transformDirection(b),m++}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[g];A.position.setFromMatrixPosition(E.matrixWorld),A.position.applyMatrix4(b),g++}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 BA(n){const e=new WH(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 XH(n){let e=new WeakMap;function t(a,s=0){const l=e.get(a);let u;return l===void 0?(u=new BA(n),e.set(a,[u])):s>=l.length?(u=new BA(n),l.push(u)):u=l[s],u}function i(){e=new WeakMap}return{get:t,dispose:i}}class Sb extends Mi{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=mD,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 bb 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 qH=`void main() {
gl_Position = vec4( position, 1.0 );
}`,YH=`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 ZH(n,e,t){let i=new ld;const a=new de,s=new de,l=new Pt,u=new Sb({depthPacking:gD}),c=new bb,h={},p=t.maxTextureSize,m={[vr]:Ui,[Ui]:vr,[ns]:ns},g=new ss({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:qH,fragmentShader:YH}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const _=new Mt;_.setAttribute("position",new tn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const T=new Hn(_,g),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=c0;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 te=0,V=R.length;te<V;te++){const J=R[te],X=J.shadow;if(X===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;a.copy(X.mapSize);const re=X.getFrameExtents();if(a.multiply(re),s.copy(X.mapSize),(a.x>p||a.y>p)&&(a.x>p&&(s.x=Math.floor(p/re.x),a.x=s.x*re.x,X.mapSize.x=s.x),a.y>p&&(s.y=Math.floor(p/re.y),a.y=s.y*re.y,X.mapSize.y=s.y)),X.map===null||k===!0||j===!0){const _e=this.type!==$a?{minFilter:di,magFilter:di}:{};X.map!==null&&X.map.dispose(),X.map=new as(a.x,a.y,_e),X.map.texture.name=J.name+".shadowMap",X.camera.updateProjectionMatrix()}n.setRenderTarget(X.map),n.clear();const he=X.getViewportCount();for(let _e=0;_e<he;_e++){const we=X.getViewport(_e);l.set(s.x*we.x,s.y*we.y,s.x*we.z,s.y*we.w),Q.viewport(l),X.updateMatrices(J,_e),i=X.getFrustum(),A(L,z,X.camera,J,this.type)}X.isPointLightShadow!==!0&&this.type===$a&&S(X,z),X.needsUpdate=!1}y=this.type,b.needsUpdate=!1,n.setRenderTarget(C,w,B)};function S(R,L){const z=e.update(T);g.defines.VSM_SAMPLES!==R.blurSamples&&(g.defines.VSM_SAMPLES=R.blurSamples,v.defines.VSM_SAMPLES=R.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new as(a.x,a.y)),g.uniforms.shadow_pass.value=R.map.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,n.setRenderTarget(R.mapPass),n.clear(),n.renderBufferDirect(L,null,z,g,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 te=j[k];te===void 0&&(te=w.clone(),j[k]=te,L.addEventListener("dispose",I)),w=te}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:m[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 te=k.groups;for(let V=0,J=te.length;V<J;V++){const X=te[V],re=j[X.materialIndex];if(re&&re.visible){const he=E(R,re,C,w);R.onBeforeShadow(n,R,L,z,k,he,X),n.renderBufferDirect(z,null,k,he,R,X),R.onAfterShadow(n,R,L,z,k,he,X)}}}else if(j.visible){const te=E(R,j,C,w);R.onBeforeShadow(n,R,L,z,k,te,null),n.renderBufferDirect(z,null,k,te,R,null),R.onAfterShadow(n,R,L,z,k,te,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 jH={[sg]:rg,[og]:cg,[lg]:fg,[Dl]:ug,[rg]:sg,[cg]:og,[fg]:lg,[ug]:Dl};function QH(n,e){function t(){let G=!1;const Ie=new Pt;let se=null;const fe=new Pt(0,0,0,0);return{setMask:function(Be){se!==Be&&!G&&(n.colorMask(Be,Be,Be,Be),se=Be)},setLocked:function(Be){G=Be},setClear:function(Be,Ne,pt,rn,fn){fn===!0&&(Be*=rn,Ne*=rn,pt*=rn),Ie.set(Be,Ne,pt,rn),fe.equals(Ie)===!1&&(n.clearColor(Be,Ne,pt,rn),fe.copy(Ie))},reset:function(){G=!1,se=null,fe.set(-1,0,0,0)}}}function i(){let G=!1,Ie=!1,se=null,fe=null,Be=null;return{setReversed:function(Ne){if(Ie!==Ne){const pt=e.get("EXT_clip_control");Ie?pt.clipControlEXT(pt.LOWER_LEFT_EXT,pt.ZERO_TO_ONE_EXT):pt.clipControlEXT(pt.LOWER_LEFT_EXT,pt.NEGATIVE_ONE_TO_ONE_EXT);const rn=Be;Be=null,this.setClear(rn)}Ie=Ne},getReversed:function(){return Ie},setTest:function(Ne){Ne?Ee(n.DEPTH_TEST):Ye(n.DEPTH_TEST)},setMask:function(Ne){se!==Ne&&!G&&(n.depthMask(Ne),se=Ne)},setFunc:function(Ne){if(Ie&&(Ne=jH[Ne]),fe!==Ne){switch(Ne){case sg:n.depthFunc(n.NEVER);break;case rg:n.depthFunc(n.ALWAYS);break;case og:n.depthFunc(n.LESS);break;case Dl:n.depthFunc(n.LEQUAL);break;case lg:n.depthFunc(n.EQUAL);break;case ug:n.depthFunc(n.GEQUAL);break;case cg:n.depthFunc(n.GREATER);break;case fg:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}fe=Ne}},setLocked:function(Ne){G=Ne},setClear:function(Ne){Be!==Ne&&(Ie&&(Ne=1-Ne),n.clearDepth(Ne),Be=Ne)},reset:function(){G=!1,se=null,fe=null,Be=null,Ie=!1}}}function a(){let G=!1,Ie=null,se=null,fe=null,Be=null,Ne=null,pt=null,rn=null,fn=null;return{setTest:function(Ft){G||(Ft?Ee(n.STENCIL_TEST):Ye(n.STENCIL_TEST))},setMask:function(Ft){Ie!==Ft&&!G&&(n.stencilMask(Ft),Ie=Ft)},setFunc:function(Ft,Ii,zi){(se!==Ft||fe!==Ii||Be!==zi)&&(n.stencilFunc(Ft,Ii,zi),se=Ft,fe=Ii,Be=zi)},setOp:function(Ft,Ii,zi){(Ne!==Ft||pt!==Ii||rn!==zi)&&(n.stencilOp(Ft,Ii,zi),Ne=Ft,pt=Ii,rn=zi)},setLocked:function(Ft){G=Ft},setClear:function(Ft){fn!==Ft&&(n.clearStencil(Ft),fn=Ft)},reset:function(){G=!1,Ie=null,se=null,fe=null,Be=null,Ne=null,pt=null,rn=null,fn=null}}}const s=new t,l=new i,u=new a,c=new WeakMap,h=new WeakMap;let p={},m={},g=new WeakMap,v=[],_=null,T=!1,b=null,y=null,S=null,E=null,A=null,I=null,R=null,L=new He(0,0,0),z=0,C=!1,w=null,B=null,Q=null,k=null,j=null;const te=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,J=0;const X=n.getParameter(n.VERSION);X.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(X)[1]),V=J>=1):X.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),V=J>=2);let re=null,he={};const _e=n.getParameter(n.SCISSOR_BOX),we=n.getParameter(n.VIEWPORT),Je=new Pt().fromArray(_e),ee=new Pt().fromArray(we);function me(G,Ie,se,fe){const Be=new Uint8Array(4),Ne=n.createTexture();n.bindTexture(G,Ne),n.texParameteri(G,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(G,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let pt=0;pt<se;pt++)G===n.TEXTURE_3D||G===n.TEXTURE_2D_ARRAY?n.texImage3D(Ie,0,n.RGBA,1,1,fe,0,n.RGBA,n.UNSIGNED_BYTE,Be):n.texImage2D(Ie+pt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Be);return Ne}const Oe={};Oe[n.TEXTURE_2D]=me(n.TEXTURE_2D,n.TEXTURE_2D,1),Oe[n.TEXTURE_CUBE_MAP]=me(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Oe[n.TEXTURE_2D_ARRAY]=me(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Oe[n.TEXTURE_3D]=me(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),ve(!1),Ae(zx),Ee(n.CULL_FACE),F(cr);function Ee(G){p[G]!==!0&&(n.enable(G),p[G]=!0)}function Ye(G){p[G]!==!1&&(n.disable(G),p[G]=!1)}function et(G,Ie){return m[G]!==Ie?(n.bindFramebuffer(G,Ie),m[G]=Ie,G===n.DRAW_FRAMEBUFFER&&(m[n.FRAMEBUFFER]=Ie),G===n.FRAMEBUFFER&&(m[n.DRAW_FRAMEBUFFER]=Ie),!0):!1}function Ze(G,Ie){let se=v,fe=!1;if(G){se=g.get(Ie),se===void 0&&(se=[],g.set(Ie,se));const Be=G.textures;if(se.length!==Be.length||se[0]!==n.COLOR_ATTACHMENT0){for(let Ne=0,pt=Be.length;Ne<pt;Ne++)se[Ne]=n.COLOR_ATTACHMENT0+Ne;se.length=Be.length,fe=!0}}else se[0]!==n.BACK&&(se[0]=n.BACK,fe=!0);fe&&n.drawBuffers(se)}function je(G){return _!==G?(n.useProgram(G),_=G,!0):!1}const ue={[Kr]:n.FUNC_ADD,[H3]:n.FUNC_SUBTRACT,[V3]:n.FUNC_REVERSE_SUBTRACT};ue[k3]=n.MIN,ue[G3]=n.MAX;const ge={[W3]:n.ZERO,[X3]:n.ONE,[q3]:n.SRC_COLOR,[ig]:n.SRC_ALPHA,[J3]:n.SRC_ALPHA_SATURATE,[Q3]:n.DST_COLOR,[Z3]:n.DST_ALPHA,[Y3]:n.ONE_MINUS_SRC_COLOR,[ag]:n.ONE_MINUS_SRC_ALPHA,[K3]:n.ONE_MINUS_DST_COLOR,[j3]:n.ONE_MINUS_DST_ALPHA,[$3]:n.CONSTANT_COLOR,[eD]:n.ONE_MINUS_CONSTANT_COLOR,[tD]:n.CONSTANT_ALPHA,[nD]:n.ONE_MINUS_CONSTANT_ALPHA};function F(G,Ie,se,fe,Be,Ne,pt,rn,fn,Ft){if(G===cr){T===!0&&(Ye(n.BLEND),T=!1);return}if(T===!1&&(Ee(n.BLEND),T=!0),G!==F3){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 Ox:n.blendFunc(n.ONE,n.ONE);break;case Px:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Bx: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 Ox:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Px:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Bx: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}Be=Be||Ie,Ne=Ne||se,pt=pt||fe,(Ie!==y||Be!==A)&&(n.blendEquationSeparate(ue[Ie],ue[Be]),y=Ie,A=Be),(se!==S||fe!==E||Ne!==I||pt!==R)&&(n.blendFuncSeparate(ge[se],ge[fe],ge[Ne],ge[pt]),S=se,E=fe,I=Ne,R=pt),(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 Ve(G,Ie){G.side===ns?Ye(n.CULL_FACE):Ee(n.CULL_FACE);let se=G.side===Ui;Ie&&(se=!se),ve(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)),tt(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?Ee(n.SAMPLE_ALPHA_TO_COVERAGE):Ye(n.SAMPLE_ALPHA_TO_COVERAGE)}function ve(G){w!==G&&(G?n.frontFace(n.CW):n.frontFace(n.CCW),w=G)}function Ae(G){G!==O3?(Ee(n.CULL_FACE),G!==B&&(G===zx?n.cullFace(n.BACK):G===P3?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Ye(n.CULL_FACE),B=G}function Te(G){G!==Q&&(V&&n.lineWidth(G),Q=G)}function tt(G,Ie,se){G?(Ee(n.POLYGON_OFFSET_FILL),(k!==Ie||j!==se)&&(n.polygonOffset(Ie,se),k=Ie,j=se)):Ye(n.POLYGON_OFFSET_FILL)}function Ue(G){G?Ee(n.SCISSOR_TEST):Ye(n.SCISSOR_TEST)}function O(G){G===void 0&&(G=n.TEXTURE0+te-1),re!==G&&(n.activeTexture(G),re=G)}function D(G,Ie,se){se===void 0&&(re===null?se=n.TEXTURE0+te-1:se=re);let fe=he[se];fe===void 0&&(fe={type:void 0,texture:void 0},he[se]=fe),(fe.type!==G||fe.texture!==Ie)&&(re!==se&&(n.activeTexture(se),re=se),n.bindTexture(G,Ie||Oe[G]),fe.type=G,fe.texture=Ie)}function Z(){const G=he[re];G!==void 0&&G.type!==void 0&&(n.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function oe(){try{n.compressedTexImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function pe(){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 Pe(){try{n.texSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Re(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function De(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function gt(){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 Xe(){try{n.texImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function nt(){try{n.texImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function st(G){Je.equals(G)===!1&&(n.scissor(G.x,G.y,G.z,G.w),Je.copy(G))}function qe(G){ee.equals(G)===!1&&(n.viewport(G.x,G.y,G.z,G.w),ee.copy(G))}function Rt(G,Ie){let se=h.get(Ie);se===void 0&&(se=new WeakMap,h.set(Ie,se));let fe=se.get(G);fe===void 0&&(fe=n.getUniformBlockIndex(Ie,G.name),se.set(G,fe))}function dt(G,Ie){const fe=h.get(Ie).get(G);c.get(Ie)!==fe&&(n.uniformBlockBinding(Ie,fe,G.__bindingPointIndex),c.set(Ie,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={},re=null,he={},m={},g=new WeakMap,v=[],_=null,T=!1,b=null,y=null,S=null,E=null,A=null,I=null,R=null,L=new He(0,0,0),z=0,C=!1,w=null,B=null,Q=null,k=null,j=null,Je.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:Ye,bindFramebuffer:et,drawBuffers:Ze,useProgram:je,setBlending:F,setMaterial:Ve,setFlipSided:ve,setCullFace:Ae,setLineWidth:Te,setPolygonOffset:tt,setScissorTest:Ue,activeTexture:O,bindTexture:D,unbindTexture:Z,compressedTexImage2D:oe,compressedTexImage3D:pe,texImage2D:Xe,texImage3D:nt,updateUBOMapping:Rt,uniformBlockBinding:dt,texStorage2D:gt,texStorage3D:xe,texSubImage2D:le,texSubImage3D:Pe,compressedTexSubImage2D:Re,compressedTexSubImage3D:De,scissor:st,viewport:qe,reset:Kt}}function KH(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 JH(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 $H(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function Wx(n,e,t,i){const a=e6(i);switch(t){case ob:return n*e;case ub:return n*e;case cb:return n*e*2;case m0:return n*e/a.components*a.byteLength;case sd:return n*e/a.components*a.byteLength;case fb:return n*e*2/a.components*a.byteLength;case g0:return n*e*2/a.components*a.byteLength;case lb:return n*e*3/a.components*a.byteLength;case Si:return n*e*4/a.components*a.byteLength;case v0:return n*e*4/a.components*a.byteLength;case sh:case rh:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case oh:case lh:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case dg:case mg:return Math.max(n,16)*Math.max(e,8)/4;case hg:case pg:return Math.max(n,8)*Math.max(e,8)/2;case gg:case vg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case yg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case _g:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case xg:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Sg:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case bg:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Mg:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Eg:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Tg:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Ag:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case wg:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Cg:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Rg:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Dg:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Ug:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Lg:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case uh:case Ng:case Ig:return Math.ceil(n/4)*Math.ceil(e/4)*16;case hb:case zg:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Og:case Pg:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function e6(n){switch(n){case is:case ab:return{byteLength:1,components:1};case Ac:case sb:case Hc:return{byteLength:2,components:1};case d0:case p0:return{byteLength:2,components:4};case _r:case h0:case Zi:return{byteLength:4,components:1};case rb:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const t6={contain:KH,cover:JH,fill:$H,getByteLength:Wx};function n6(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 de,p=new WeakMap;let m;const g=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):Oh("canvas")}function T(O,D,Z){let oe=1;const pe=Ue(O);if((pe.width>Z||pe.height>Z)&&(oe=Z/Math.max(pe.width,pe.height)),oe<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(oe*pe.width),Pe=Math.floor(oe*pe.height);m===void 0&&(m=_(le,Pe));const Re=D?_(le,Pe):m;return Re.width=le,Re.height=Pe,Re.getContext("2d").drawImage(O,0,0,le,Pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+pe.width+"x"+pe.height+") to ("+le+"x"+Pe+")."),Re}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+pe.width+"x"+pe.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,oe,pe=!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 Pe=pe?rd:Ut.getTransfer(oe);Z===n.FLOAT&&(le=n.RGBA32F),Z===n.HALF_FLOAT&&(le=n.RGBA16F),Z===n.UNSIGNED_BYTE&&(le=Pe===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===Ac&&(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===Ac&&(Z=n.DEPTH_COMPONENT16),Z}function I(O,D){return b(O)===!0||O.isFramebufferTexture&&O.minFilter!==di&&O.minFilter!==Wn?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,oe=g.get(Z);if(oe){const pe=oe[D.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&C(O),Object.keys(oe).length===0&&g.delete(Z)}i.remove(O)}function C(O){const D=i.get(O);n.deleteTexture(D.__webglTexture);const Z=O.source,oe=g.get(Z);delete oe[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 oe=0;oe<6;oe++){if(Array.isArray(D.__webglFramebuffer[oe]))for(let pe=0;pe<D.__webglFramebuffer[oe].length;pe++)n.deleteFramebuffer(D.__webglFramebuffer[oe][pe]);else n.deleteFramebuffer(D.__webglFramebuffer[oe]);D.__webglDepthbuffer&&n.deleteRenderbuffer(D.__webglDepthbuffer[oe])}else{if(Array.isArray(D.__webglFramebuffer))for(let oe=0;oe<D.__webglFramebuffer.length;oe++)n.deleteFramebuffer(D.__webglFramebuffer[oe]);else n.deleteFramebuffer(D.__webglFramebuffer);if(D.__webglDepthbuffer&&n.deleteRenderbuffer(D.__webglDepthbuffer),D.__webglMultisampledFramebuffer&&n.deleteFramebuffer(D.__webglMultisampledFramebuffer),D.__webglColorRenderbuffer)for(let oe=0;oe<D.__webglColorRenderbuffer.length;oe++)D.__webglColorRenderbuffer[oe]&&n.deleteRenderbuffer(D.__webglColorRenderbuffer[oe]);D.__webglDepthRenderbuffer&&n.deleteRenderbuffer(D.__webglDepthRenderbuffer)}const Z=O.textures;for(let oe=0,pe=Z.length;oe<pe;oe++){const le=i.get(Z[oe]);le.__webglTexture&&(n.deleteTexture(le.__webglTexture),l.memory.textures--),i.remove(Z[oe])}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 te(O,D){const Z=i.get(O);if(O.isVideoTexture&&Te(O),O.isRenderTargetTexture===!1&&O.version>0&&Z.__version!==O.version){const oe=O.image;if(oe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(oe.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 J(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 X(O,D){const Z=i.get(O);if(O.version>0&&Z.__version!==O.version){me(Z,O,D);return}t.bindTexture(n.TEXTURE_CUBE_MAP,Z.__webglTexture,n.TEXTURE0+D)}const re={[Dh]:n.REPEAT,[Ba]:n.CLAMP_TO_EDGE,[Uh]:n.MIRRORED_REPEAT},he={[di]:n.NEAREST,[ib]:n.NEAREST_MIPMAP_NEAREST,[nc]:n.NEAREST_MIPMAP_LINEAR,[Wn]:n.LINEAR,[ah]:n.LINEAR_MIPMAP_NEAREST,[xs]:n.LINEAR_MIPMAP_LINEAR},_e={[yD]:n.NEVER,[ED]:n.ALWAYS,[_D]:n.LESS,[pb]:n.LEQUAL,[xD]:n.EQUAL,[MD]:n.GEQUAL,[SD]:n.GREATER,[bD]:n.NOTEQUAL};function we(O,D){if(D.type===Zi&&e.has("OES_texture_float_linear")===!1&&(D.magFilter===Wn||D.magFilter===ah||D.magFilter===nc||D.magFilter===xs||D.minFilter===Wn||D.minFilter===ah||D.minFilter===nc||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,re[D.wrapS]),n.texParameteri(O,n.TEXTURE_WRAP_T,re[D.wrapT]),(O===n.TEXTURE_3D||O===n.TEXTURE_2D_ARRAY)&&n.texParameteri(O,n.TEXTURE_WRAP_R,re[D.wrapR]),n.texParameteri(O,n.TEXTURE_MAG_FILTER,he[D.magFilter]),n.texParameteri(O,n.TEXTURE_MIN_FILTER,he[D.minFilter]),D.compareFunction&&(n.texParameteri(O,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(O,n.TEXTURE_COMPARE_FUNC,_e[D.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(D.magFilter===di||D.minFilter!==nc&&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 Je(O,D){let Z=!1;O.__webglInit===void 0&&(O.__webglInit=!0,D.addEventListener("dispose",R));const oe=D.source;let pe=g.get(oe);pe===void 0&&(pe={},g.set(oe,pe));const le=j(D);if(le!==O.__cacheKey){pe[le]===void 0&&(pe[le]={texture:n.createTexture(),usedTimes:0},l.memory.textures++,Z=!0),pe[le].usedTimes++;const Pe=pe[O.__cacheKey];Pe!==void 0&&(pe[O.__cacheKey].usedTimes--,Pe.usedTimes===0&&C(D)),O.__cacheKey=le,O.__webglTexture=pe[le].texture}return Z}function ee(O,D,Z){let oe=n.TEXTURE_2D;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(oe=n.TEXTURE_2D_ARRAY),D.isData3DTexture&&(oe=n.TEXTURE_3D);const pe=Je(O,D),le=D.source;t.bindTexture(oe,O.__webglTexture,n.TEXTURE0+Z);const Pe=i.get(le);if(le.version!==Pe.__version||pe===!0){t.activeTexture(n.TEXTURE0+Z);const Re=Ut.getPrimaries(Ut.workingColorSpace),De=D.colorSpace===tr?null:Ut.getPrimaries(D.colorSpace),gt=D.colorSpace===tr||Re===De?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,gt);let xe=T(D.image,!1,a.maxTextureSize);xe=tt(D,xe);const Xe=s.convert(D.format,D.colorSpace),nt=s.convert(D.type);let st=E(D.internalFormat,Xe,nt,D.colorSpace,D.isVideoTexture);we(oe,D);let qe;const Rt=D.mipmaps,dt=D.isVideoTexture!==!0,Kt=Pe.__version===void 0||pe===!0,G=le.dataReady,Ie=I(D,xe);if(D.isDepthTexture)st=A(D.format===Ll,D.type),Kt&&(dt?t.texStorage2D(n.TEXTURE_2D,1,st,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,st,xe.width,xe.height,0,Xe,nt,null));else if(D.isDataTexture)if(Rt.length>0){dt&&Kt&&t.texStorage2D(n.TEXTURE_2D,Ie,st,Rt[0].width,Rt[0].height);for(let se=0,fe=Rt.length;se<fe;se++)qe=Rt[se],dt?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,qe.width,qe.height,Xe,nt,qe.data):t.texImage2D(n.TEXTURE_2D,se,st,qe.width,qe.height,0,Xe,nt,qe.data);D.generateMipmaps=!1}else dt?(Kt&&t.texStorage2D(n.TEXTURE_2D,Ie,st,xe.width,xe.height),G&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,xe.width,xe.height,Xe,nt,xe.data)):t.texImage2D(n.TEXTURE_2D,0,st,xe.width,xe.height,0,Xe,nt,xe.data);else if(D.isCompressedTexture)if(D.isCompressedArrayTexture){dt&&Kt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ie,st,Rt[0].width,Rt[0].height,xe.depth);for(let se=0,fe=Rt.length;se<fe;se++)if(qe=Rt[se],D.format!==Si)if(Xe!==null)if(dt){if(G)if(D.layerUpdates.size>0){const Be=Wx(qe.width,qe.height,D.format,D.type);for(const Ne of D.layerUpdates){const pt=qe.data.subarray(Ne*Be/qe.data.BYTES_PER_ELEMENT,(Ne+1)*Be/qe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,Ne,qe.width,qe.height,1,Xe,pt)}D.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,0,qe.width,qe.height,xe.depth,Xe,qe.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,se,st,qe.width,qe.height,xe.depth,0,qe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else dt?G&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,se,0,0,0,qe.width,qe.height,xe.depth,Xe,nt,qe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,se,st,qe.width,qe.height,xe.depth,0,Xe,nt,qe.data)}else{dt&&Kt&&t.texStorage2D(n.TEXTURE_2D,Ie,st,Rt[0].width,Rt[0].height);for(let se=0,fe=Rt.length;se<fe;se++)qe=Rt[se],D.format!==Si?Xe!==null?dt?G&&t.compressedTexSubImage2D(n.TEXTURE_2D,se,0,0,qe.width,qe.height,Xe,qe.data):t.compressedTexImage2D(n.TEXTURE_2D,se,st,qe.width,qe.height,0,qe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):dt?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,qe.width,qe.height,Xe,nt,qe.data):t.texImage2D(n.TEXTURE_2D,se,st,qe.width,qe.height,0,Xe,nt,qe.data)}else if(D.isDataArrayTexture)if(dt){if(Kt&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ie,st,xe.width,xe.height,xe.depth),G)if(D.layerUpdates.size>0){const se=Wx(xe.width,xe.height,D.format,D.type);for(const fe of D.layerUpdates){const Be=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,Xe,nt,Be)}D.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,Xe,nt,xe.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,st,xe.width,xe.height,xe.depth,0,Xe,nt,xe.data);else if(D.isData3DTexture)dt?(Kt&&t.texStorage3D(n.TEXTURE_3D,Ie,st,xe.width,xe.height,xe.depth),G&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,Xe,nt,xe.data)):t.texImage3D(n.TEXTURE_3D,0,st,xe.width,xe.height,xe.depth,0,Xe,nt,xe.data);else if(D.isFramebufferTexture){if(Kt)if(dt)t.texStorage2D(n.TEXTURE_2D,Ie,st,xe.width,xe.height);else{let se=xe.width,fe=xe.height;for(let Be=0;Be<Ie;Be++)t.texImage2D(n.TEXTURE_2D,Be,st,se,fe,0,Xe,nt,null),se>>=1,fe>>=1}}else if(Rt.length>0){if(dt&&Kt){const se=Ue(Rt[0]);t.texStorage2D(n.TEXTURE_2D,Ie,st,se.width,se.height)}for(let se=0,fe=Rt.length;se<fe;se++)qe=Rt[se],dt?G&&t.texSubImage2D(n.TEXTURE_2D,se,0,0,Xe,nt,qe):t.texImage2D(n.TEXTURE_2D,se,st,Xe,nt,qe);D.generateMipmaps=!1}else if(dt){if(Kt){const se=Ue(xe);t.texStorage2D(n.TEXTURE_2D,Ie,st,se.width,se.height)}G&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Xe,nt,xe)}else t.texImage2D(n.TEXTURE_2D,0,st,Xe,nt,xe);b(D)&&y(oe),Pe.__version=le.version,D.onUpdate&&D.onUpdate(D)}O.__version=D.version}function me(O,D,Z){if(D.image.length!==6)return;const oe=Je(O,D),pe=D.source;t.bindTexture(n.TEXTURE_CUBE_MAP,O.__webglTexture,n.TEXTURE0+Z);const le=i.get(pe);if(pe.version!==le.__version||oe===!0){t.activeTexture(n.TEXTURE0+Z);const Pe=Ut.getPrimaries(Ut.workingColorSpace),Re=D.colorSpace===tr?null:Ut.getPrimaries(D.colorSpace),De=D.colorSpace===tr||Pe===Re?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,De);const gt=D.isCompressedTexture||D.image[0].isCompressedTexture,xe=D.image[0]&&D.image[0].isDataTexture,Xe=[];for(let fe=0;fe<6;fe++)!gt&&!xe?Xe[fe]=T(D.image[fe],!0,a.maxCubemapSize):Xe[fe]=xe?D.image[fe].image:D.image[fe],Xe[fe]=tt(D,Xe[fe]);const nt=Xe[0],st=s.convert(D.format,D.colorSpace),qe=s.convert(D.type),Rt=E(D.internalFormat,st,qe,D.colorSpace),dt=D.isVideoTexture!==!0,Kt=le.__version===void 0||oe===!0,G=pe.dataReady;let Ie=I(D,nt);we(n.TEXTURE_CUBE_MAP,D);let se;if(gt){dt&&Kt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ie,Rt,nt.width,nt.height);for(let fe=0;fe<6;fe++){se=Xe[fe].mipmaps;for(let Be=0;Be<se.length;Be++){const Ne=se[Be];D.format!==Si?st!==null?dt?G&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be,0,0,Ne.width,Ne.height,st,Ne.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be,Rt,Ne.width,Ne.height,0,Ne.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):dt?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be,0,0,Ne.width,Ne.height,st,qe,Ne.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be,Rt,Ne.width,Ne.height,0,st,qe,Ne.data)}}}else{if(se=D.mipmaps,dt&&Kt){se.length>0&&Ie++;const fe=Ue(Xe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ie,Rt,fe.width,fe.height)}for(let fe=0;fe<6;fe++)if(xe){dt?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,Xe[fe].width,Xe[fe].height,st,qe,Xe[fe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Rt,Xe[fe].width,Xe[fe].height,0,st,qe,Xe[fe].data);for(let Be=0;Be<se.length;Be++){const pt=se[Be].image[fe].image;dt?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be+1,0,0,pt.width,pt.height,st,qe,pt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be+1,Rt,pt.width,pt.height,0,st,qe,pt.data)}}else{dt?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,st,qe,Xe[fe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Rt,st,qe,Xe[fe]);for(let Be=0;Be<se.length;Be++){const Ne=se[Be];dt?G&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be+1,0,0,st,qe,Ne.image[fe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Be+1,Rt,st,qe,Ne.image[fe])}}}b(D)&&y(n.TEXTURE_CUBE_MAP),le.__version=pe.version,D.onUpdate&&D.onUpdate(D)}O.__version=D.version}function Oe(O,D,Z,oe,pe,le){const Pe=s.convert(Z.format,Z.colorSpace),Re=s.convert(Z.type),De=E(Z.internalFormat,Pe,Re,Z.colorSpace),gt=i.get(D),xe=i.get(Z);if(xe.__renderTarget=D,!gt.__hasExternalTextures){const Xe=Math.max(1,D.width>>le),nt=Math.max(1,D.height>>le);pe===n.TEXTURE_3D||pe===n.TEXTURE_2D_ARRAY?t.texImage3D(pe,le,De,Xe,nt,D.depth,0,Pe,Re,null):t.texImage2D(pe,le,De,Xe,nt,0,Pe,Re,null)}t.bindFramebuffer(n.FRAMEBUFFER,O),Ae(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,oe,pe,xe.__webglTexture,0,ve(D)):(pe===n.TEXTURE_2D||pe>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,oe,pe,xe.__webglTexture,le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ee(O,D,Z){if(n.bindRenderbuffer(n.RENDERBUFFER,O),D.depthBuffer){const oe=D.depthTexture,pe=oe&&oe.isDepthTexture?oe.type:null,le=A(D.stencilBuffer,pe),Pe=D.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Re=ve(D);Ae(D)?u.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Re,le,D.width,D.height):Z?n.renderbufferStorageMultisample(n.RENDERBUFFER,Re,le,D.width,D.height):n.renderbufferStorage(n.RENDERBUFFER,le,D.width,D.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Pe,n.RENDERBUFFER,O)}else{const oe=D.textures;for(let pe=0;pe<oe.length;pe++){const le=oe[pe],Pe=s.convert(le.format,le.colorSpace),Re=s.convert(le.type),De=E(le.internalFormat,Pe,Re,le.colorSpace),gt=ve(D);Z&&Ae(D)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,gt,De,D.width,D.height):Ae(D)?u.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,gt,De,D.width,D.height):n.renderbufferStorage(n.RENDERBUFFER,De,D.width,D.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ye(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 oe=i.get(D.depthTexture);oe.__renderTarget=D,(!oe.__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),te(D.depthTexture,0);const pe=oe.__webglTexture,le=ve(D);if(D.depthTexture.format===bl)Ae(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,pe,0,le):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,pe,0);else if(D.depthTexture.format===Ll)Ae(D)?u.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,pe,0,le):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function et(O){const D=i.get(O),Z=O.isWebGLCubeRenderTarget===!0;if(D.__boundDepthTexture!==O.depthTexture){const oe=O.depthTexture;if(D.__depthDisposeCallback&&D.__depthDisposeCallback(),oe){const pe=()=>{delete D.__boundDepthTexture,delete D.__depthDisposeCallback,oe.removeEventListener("dispose",pe)};oe.addEventListener("dispose",pe),D.__depthDisposeCallback=pe}D.__boundDepthTexture=oe}if(O.depthTexture&&!D.__autoAllocateDepthBuffer){if(Z)throw new Error("target.depthTexture not supported in Cube render targets");Ye(D.__webglFramebuffer,O)}else if(Z){D.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)if(t.bindFramebuffer(n.FRAMEBUFFER,D.__webglFramebuffer[oe]),D.__webglDepthbuffer[oe]===void 0)D.__webglDepthbuffer[oe]=n.createRenderbuffer(),Ee(D.__webglDepthbuffer[oe],O,!1);else{const pe=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=D.__webglDepthbuffer[oe];n.bindRenderbuffer(n.RENDERBUFFER,le),n.framebufferRenderbuffer(n.FRAMEBUFFER,pe,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 oe=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=D.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,pe),n.framebufferRenderbuffer(n.FRAMEBUFFER,oe,n.RENDERBUFFER,pe)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ze(O,D,Z){const oe=i.get(O);D!==void 0&&Oe(oe.__webglFramebuffer,O,O.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),Z!==void 0&&et(O)}function je(O){const D=O.texture,Z=i.get(O),oe=i.get(D);O.addEventListener("dispose",L);const pe=O.textures,le=O.isWebGLCubeRenderTarget===!0,Pe=pe.length>1;if(Pe||(oe.__webglTexture===void 0&&(oe.__webglTexture=n.createTexture()),oe.__version=D.version,l.memory.textures++),le){Z.__webglFramebuffer=[];for(let Re=0;Re<6;Re++)if(D.mipmaps&&D.mipmaps.length>0){Z.__webglFramebuffer[Re]=[];for(let De=0;De<D.mipmaps.length;De++)Z.__webglFramebuffer[Re][De]=n.createFramebuffer()}else Z.__webglFramebuffer[Re]=n.createFramebuffer()}else{if(D.mipmaps&&D.mipmaps.length>0){Z.__webglFramebuffer=[];for(let Re=0;Re<D.mipmaps.length;Re++)Z.__webglFramebuffer[Re]=n.createFramebuffer()}else Z.__webglFramebuffer=n.createFramebuffer();if(Pe)for(let Re=0,De=pe.length;Re<De;Re++){const gt=i.get(pe[Re]);gt.__webglTexture===void 0&&(gt.__webglTexture=n.createTexture(),l.memory.textures++)}if(O.samples>0&&Ae(O)===!1){Z.__webglMultisampledFramebuffer=n.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let Re=0;Re<pe.length;Re++){const De=pe[Re];Z.__webglColorRenderbuffer[Re]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,Z.__webglColorRenderbuffer[Re]);const gt=s.convert(De.format,De.colorSpace),xe=s.convert(De.type),Xe=E(De.internalFormat,gt,xe,De.colorSpace,O.isXRRenderTarget===!0),nt=ve(O);n.renderbufferStorageMultisample(n.RENDERBUFFER,nt,Xe,O.width,O.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,Z.__webglColorRenderbuffer[Re])}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,oe.__webglTexture),we(n.TEXTURE_CUBE_MAP,D);for(let Re=0;Re<6;Re++)if(D.mipmaps&&D.mipmaps.length>0)for(let De=0;De<D.mipmaps.length;De++)Oe(Z.__webglFramebuffer[Re][De],O,D,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,De);else Oe(Z.__webglFramebuffer[Re],O,D,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0);b(D)&&y(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Pe){for(let Re=0,De=pe.length;Re<De;Re++){const gt=pe[Re],xe=i.get(gt);t.bindTexture(n.TEXTURE_2D,xe.__webglTexture),we(n.TEXTURE_2D,gt),Oe(Z.__webglFramebuffer,O,gt,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,0),b(gt)&&y(n.TEXTURE_2D)}t.unbindTexture()}else{let Re=n.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(Re=O.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Re,oe.__webglTexture),we(Re,D),D.mipmaps&&D.mipmaps.length>0)for(let De=0;De<D.mipmaps.length;De++)Oe(Z.__webglFramebuffer[De],O,D,n.COLOR_ATTACHMENT0,Re,De);else Oe(Z.__webglFramebuffer,O,D,n.COLOR_ATTACHMENT0,Re,0);b(D)&&y(Re),t.unbindTexture()}O.depthBuffer&&et(O)}function ue(O){const D=O.textures;for(let Z=0,oe=D.length;Z<oe;Z++){const pe=D[Z];if(b(pe)){const le=S(O),Pe=i.get(pe).__webglTexture;t.bindTexture(le,Pe),y(le),t.unbindTexture()}}}const ge=[],F=[];function Ve(O){if(O.samples>0){if(Ae(O)===!1){const D=O.textures,Z=O.width,oe=O.height;let pe=n.COLOR_BUFFER_BIT;const le=O.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Pe=i.get(O),Re=D.length>1;if(Re)for(let De=0;De<D.length;De++)t.bindFramebuffer(n.FRAMEBUFFER,Pe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+De,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Pe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+De,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Pe.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Pe.__webglFramebuffer);for(let De=0;De<D.length;De++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(pe|=n.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(pe|=n.STENCIL_BUFFER_BIT)),Re){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Pe.__webglColorRenderbuffer[De]);const gt=i.get(D[De]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,gt,0)}n.blitFramebuffer(0,0,Z,oe,0,0,Z,oe,pe,n.NEAREST),c===!0&&(ge.length=0,F.length=0,ge.push(n.COLOR_ATTACHMENT0+De),O.depthBuffer&&O.resolveDepthBuffer===!1&&(ge.push(le),F.push(le),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,F)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,ge))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Re)for(let De=0;De<D.length;De++){t.bindFramebuffer(n.FRAMEBUFFER,Pe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+De,n.RENDERBUFFER,Pe.__webglColorRenderbuffer[De]);const gt=i.get(D[De]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Pe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+De,n.TEXTURE_2D,gt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Pe.__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 ve(O){return Math.min(a.maxSamples,O.samples)}function Ae(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 tt(O,D){const Z=O.colorSpace,oe=O.format,pe=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||Z!==Mo&&Z!==tr&&(Ut.getTransfer(Z)===Zt?(oe!==Si||pe!==is)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Z)),D}function Ue(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=te,this.setTexture2DArray=V,this.setTexture3D=J,this.setTextureCube=X,this.rebindTextures=Ze,this.setupRenderTarget=je,this.updateRenderTargetMipmap=ue,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=et,this.setupFrameBufferTexture=Oe,this.useMultisampledRTT=Ae}function FD(n,e){function t(i,a=tr){let s;const l=Ut.getTransfer(a);if(i===is)return n.UNSIGNED_BYTE;if(i===d0)return n.UNSIGNED_SHORT_4_4_4_4;if(i===p0)return n.UNSIGNED_SHORT_5_5_5_1;if(i===rb)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===ab)return n.BYTE;if(i===sb)return n.SHORT;if(i===Ac)return n.UNSIGNED_SHORT;if(i===h0)return n.INT;if(i===_r)return n.UNSIGNED_INT;if(i===Zi)return n.FLOAT;if(i===Hc)return n.HALF_FLOAT;if(i===ob)return n.ALPHA;if(i===lb)return n.RGB;if(i===Si)return n.RGBA;if(i===ub)return n.LUMINANCE;if(i===cb)return n.LUMINANCE_ALPHA;if(i===bl)return n.DEPTH_COMPONENT;if(i===Ll)return n.DEPTH_STENCIL;if(i===m0)return n.RED;if(i===sd)return n.RED_INTEGER;if(i===fb)return n.RG;if(i===g0)return n.RG_INTEGER;if(i===v0)return n.RGBA_INTEGER;if(i===sh||i===rh||i===oh||i===lh)if(l===Zt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===sh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===rh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===lh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===sh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===rh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===oh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===lh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===hg||i===dg||i===pg||i===mg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===hg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===dg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===pg)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===mg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===gg||i===vg||i===yg)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===gg||i===vg)return l===Zt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===yg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(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||i===Lg)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===_g)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===xg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Sg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===bg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Mg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Eg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Tg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Ag)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===wg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Cg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Rg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Dg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Ug)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Lg)return l===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===uh||i===Ng||i===Ig)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===uh)return l===Zt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ng)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ig)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===hb||i===zg||i===Og||i===Pg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===uh)return s.COMPRESSED_RED_RGTC1_EXT;if(i===zg)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Og)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Pg)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 HD extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class sc extends Bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const i6={type:"move"};class v_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sc,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 sc,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 sc,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"],m=h.joints["thumb-tip"],g=p.position.distanceTo(m.position),v=.02,_=.005;h.inputState.pinching&&g>v+_?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&g<=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(i6)))}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 sc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const a6=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,s6=`
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 r6{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 ss({vertexShader:a6,fragmentShader:s6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new kc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class o6 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,m=null,g=null,v=null,_=null;const T=new r6,b=t.getContextAttributes();let y=null,S=null;const E=[],A=[],I=new de;let R=null;const L=new Bn;L.viewport=new Pt;const z=new Bn;z.viewport=new Pt;const C=[L,z],w=new HD;let B=null,Q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let me=E[ee];return me===void 0&&(me=new v_,E[ee]=me),me.getTargetRaySpace()},this.getControllerGrip=function(ee){let me=E[ee];return me===void 0&&(me=new v_,E[ee]=me),me.getGripSpace()},this.getHand=function(ee){let me=E[ee];return me===void 0&&(me=new v_,E[ee]=me),me.getHandSpace()};function k(ee){const me=A.indexOf(ee.inputSource);if(me===-1)return;const Oe=E[me];Oe!==void 0&&(Oe.update(ee.inputSource,ee.frame,h||l),Oe.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",te);for(let ee=0;ee<E.length;ee++){const me=A[ee];me!==null&&(A[ee]=null,E[ee].disconnect(me))}B=null,Q=null,T.reset(),e.setRenderTarget(y),v=null,g=null,m=null,a=null,S=null,Je.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 g!==null?g:v},this.getBinding=function(){return m},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",te),b.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(I),a.renderState.layers===void 0){const me={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(a,t,me),a.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),S=new as(v.framebufferWidth,v.framebufferHeight,{format:Si,type:is,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})}else{let me=null,Oe=null,Ee=null;b.depth&&(Ee=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,me=b.stencil?Ll:bl,Oe=b.stencil?Ul:_r);const Ye={colorFormat:t.RGBA8,depthFormat:Ee,scaleFactor:s};m=new XRWebGLBinding(a,t),g=m.createProjectionLayer(Ye),a.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),S=new as(g.textureWidth,g.textureHeight,{format:Si,type:is,depthTexture:new xb(g.textureWidth,g.textureHeight,Oe,void 0,void 0,void 0,void 0,void 0,void 0,me),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(c),h=null,l=await a.requestReferenceSpace(u),Je.setContext(a),Je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode},this.getDepthTexture=function(){return T.getDepthTexture()};function te(ee){for(let me=0;me<ee.removed.length;me++){const Oe=ee.removed[me],Ee=A.indexOf(Oe);Ee>=0&&(A[Ee]=null,E[Ee].disconnect(Oe))}for(let me=0;me<ee.added.length;me++){const Oe=ee.added[me];let Ee=A.indexOf(Oe);if(Ee===-1){for(let et=0;et<E.length;et++)if(et>=A.length){A.push(Oe),Ee=et;break}else if(A[et]===null){A[et]=Oe,Ee=et;break}if(Ee===-1)break}const Ye=E[Ee];Ye&&Ye.connect(Oe)}}const V=new P,J=new P;function X(ee,me,Oe){V.setFromMatrixPosition(me.matrixWorld),J.setFromMatrixPosition(Oe.matrixWorld);const Ee=V.distanceTo(J),Ye=me.projectionMatrix.elements,et=Oe.projectionMatrix.elements,Ze=Ye[14]/(Ye[10]-1),je=Ye[14]/(Ye[10]+1),ue=(Ye[9]+1)/Ye[5],ge=(Ye[9]-1)/Ye[5],F=(Ye[8]-1)/Ye[0],Ve=(et[8]+1)/et[0],ve=Ze*F,Ae=Ze*Ve,Te=Ee/(-F+Ve),tt=Te*-F;if(me.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(tt),ee.translateZ(Te),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),Ye[10]===-1)ee.projectionMatrix.copy(me.projectionMatrix),ee.projectionMatrixInverse.copy(me.projectionMatrixInverse);else{const Ue=Ze+Te,O=je+Te,D=ve-tt,Z=Ae+(Ee-tt),oe=ue*je/O*Ue,pe=ge*je/O*Ue;ee.projectionMatrix.makePerspective(D,Z,oe,pe,Ue,O),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function re(ee,me){me===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(me.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(a===null)return;let me=ee.near,Oe=ee.far;T.texture!==null&&(T.depthNear>0&&(me=T.depthNear),T.depthFar>0&&(Oe=T.depthFar)),w.near=z.near=L.near=me,w.far=z.far=L.far=Oe,(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,Ye=w.cameras;re(w,Ee);for(let et=0;et<Ye.length;et++)re(Ye[et],Ee);Ye.length===2?X(w,L,z):w.projectionMatrix.copy(L.projectionMatrix),he(ee,w,Ee)};function he(ee,me,Oe){Oe===null?ee.matrix.copy(me.matrixWorld):(ee.matrix.copy(Oe.matrixWorld),ee.matrix.invert(),ee.matrix.multiply(me.matrixWorld)),ee.matrix.decompose(ee.position,ee.quaternion,ee.scale),ee.updateMatrixWorld(!0),ee.projectionMatrix.copy(me.projectionMatrix),ee.projectionMatrixInverse.copy(me.projectionMatrixInverse),ee.isPerspectiveCamera&&(ee.fov=wc*2*Math.atan(1/ee.projectionMatrix.elements[5]),ee.zoom=1)}this.getCamera=function(){return w},this.getFoveation=function(){if(!(g===null&&v===null))return c},this.setFoveation=function(ee){c=ee,g!==null&&(g.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 _e=null;function we(ee,me){if(p=me.getViewerPose(h||l),_=me,p!==null){const Oe=p.views;v!==null&&(e.setRenderTargetFramebuffer(S,v.framebuffer),e.setRenderTarget(S));let Ee=!1;Oe.length!==w.cameras.length&&(w.cameras.length=0,Ee=!0);for(let et=0;et<Oe.length;et++){const Ze=Oe[et];let je=null;if(v!==null)je=v.getViewport(Ze);else{const ge=m.getViewSubImage(g,Ze);je=ge.viewport,et===0&&(e.setRenderTargetTextures(S,ge.colorTexture,g.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(S))}let ue=C[et];ue===void 0&&(ue=new Bn,ue.layers.enable(et),ue.viewport=new Pt,C[et]=ue),ue.matrix.fromArray(Ze.transform.matrix),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.projectionMatrix.fromArray(Ze.projectionMatrix),ue.projectionMatrixInverse.copy(ue.projectionMatrix).invert(),ue.viewport.set(je.x,je.y,je.width,je.height),et===0&&(w.matrix.copy(ue.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),Ee===!0&&w.cameras.push(ue)}const Ye=a.enabledFeatures;if(Ye&&Ye.includes("depth-sensing")){const et=m.getDepthInformation(Oe[0]);et&&et.isValid&&et.texture&&T.init(e,et,a.renderState)}}for(let Oe=0;Oe<E.length;Oe++){const Ee=A[Oe],Ye=E[Oe];Ee!==null&&Ye!==void 0&&Ye.update(Ee,me,h||l)}_e&&_e(ee,me),me.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:me}),_=null}const Je=new ID;Je.setAnimationLoop(we),this.setAnimationLoop=function(ee){_e=ee},this.dispose=function(){}}}const Ko=new ba,l6=new ct;function u6(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,DD(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),m(b,y)):y.isMeshPhongMaterial?(s(b,y),p(b,y)):y.isMeshStandardMaterial?(s(b,y),g(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(l6.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 m(b,y){y.gradientMap&&(b.gradientMap.value=y.gradientMap)}function g(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 c6(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&&(g(S),s[S.id]=R)}function p(S){const E=m();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 m(){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 g(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 te=0;te<k.length;te++){const V=k[te],J=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+=J.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,te=k.length;j<te;j++){const V=k[j],J=T(V),X=A%I,re=X%J.boundary,he=X+re;A+=re,he!==0&&I-he<J.storage&&(A+=I-he),Q.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),Q.__offset=A,A+=J.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 VD{constructor(e={}){const{canvas:t=AD(),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:m=!1,reverseDepthBuffer:g=!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 He(0);let te=0,V=t.width,J=t.height,X=1,re=null,he=null;const _e=new Pt(0,0,V,J),we=new Pt(0,0,V,J);let Je=!1;const ee=new ld;let me=!1,Oe=!1;const Ee=new ct,Ye=new ct,et=new P,Ze=new Pt,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ue=!1;function ge(){return z===null?X:1}let F=i;function Ve(N,W){return t.getContext(N,W)}try{const N={alpha:!0,depth:a,stencil:s,antialias:u,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:p,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${u0}`),t.addEventListener("webglcontextlost",fe,!1),t.addEventListener("webglcontextrestored",Be,!1),t.addEventListener("webglcontextcreationerror",Ne,!1),F===null){const W="webgl2";if(F=Ve(W,N),F===null)throw Ve(W)?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 ve,Ae,Te,tt,Ue,O,D,Z,oe,pe,le,Pe,Re,De,gt,xe,Xe,nt,st,qe,Rt,dt,Kt,G;function Ie(){ve=new g5(F),ve.init(),dt=new FD(F,ve),Ae=new c5(F,ve,e,dt),Te=new QH(F,ve),Ae.reverseDepthBuffer&&g&&Te.buffers.depth.setReversed(!0),tt=new _5(F),Ue=new PH,O=new n6(F,ve,Te,Ue,Ae,dt,tt),D=new h5(A),Z=new m5(A),oe=new AB(F),Kt=new l5(F,oe),pe=new v5(F,oe,tt,Kt),le=new S5(F,pe,oe,tt),st=new x5(F,Ae,O),xe=new f5(Ue),Pe=new OH(A,D,Z,ve,Ae,Kt,xe),Re=new u6(A,Ue),De=new FH,gt=new XH(ve),nt=new o5(A,D,Z,Te,le,v,c),Xe=new ZH(A,le,Ae),G=new c6(F,tt,Ae,Te),qe=new u5(F,ve,tt),Rt=new y5(F,ve,tt),tt.programs=Pe.programs,A.capabilities=Ae,A.extensions=ve,A.properties=Ue,A.renderLists=De,A.shadowMap=Xe,A.state=Te,A.info=tt}Ie();const se=new o6(A,F);this.xr=se,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const N=ve.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ve.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(N){N!==void 0&&(X=N,this.setSize(V,J,!1))},this.getSize=function(N){return N.set(V,J)},this.setSize=function(N,W,$=!0){if(se.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=N,J=W,t.width=Math.floor(N*X),t.height=Math.floor(W*X),$===!0&&(t.style.width=N+"px",t.style.height=W+"px"),this.setViewport(0,0,N,W)},this.getDrawingBufferSize=function(N){return N.set(V*X,J*X).floor()},this.setDrawingBufferSize=function(N,W,$){V=N,J=W,X=$,t.width=Math.floor(N*$),t.height=Math.floor(W*$),this.setViewport(0,0,N,W)},this.getCurrentViewport=function(N){return N.copy(B)},this.getViewport=function(N){return N.copy(_e)},this.setViewport=function(N,W,$,ne){N.isVector4?_e.set(N.x,N.y,N.z,N.w):_e.set(N,W,$,ne),Te.viewport(B.copy(_e).multiplyScalar(X).round())},this.getScissor=function(N){return N.copy(we)},this.setScissor=function(N,W,$,ne){N.isVector4?we.set(N.x,N.y,N.z,N.w):we.set(N,W,$,ne),Te.scissor(Q.copy(we).multiplyScalar(X).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(N){Te.setScissorTest(Je=N)},this.setOpaqueSort=function(N){re=N},this.setTransparentSort=function(N){he=N},this.getClearColor=function(N){return N.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(N=!0,W=!0,$=!0){let ne=0;if(N){let q=!1;if(z!==null){const Me=z.texture.format;q=Me===v0||Me===g0||Me===sd}if(q){const Me=z.texture.type,ze=Me===is||Me===_r||Me===Ac||Me===Ul||Me===d0||Me===p0,Qe=nt.getClearColor(),ke=nt.getClearAlpha(),rt=Qe.r,mt=Qe.g,Ge=Qe.b;ze?(_[0]=rt,_[1]=mt,_[2]=Ge,_[3]=ke,F.clearBufferuiv(F.COLOR,0,_)):(T[0]=rt,T[1]=mt,T[2]=Ge,T[3]=ke,F.clearBufferiv(F.COLOR,0,T))}else ne|=F.COLOR_BUFFER_BIT}W&&(ne|=F.DEPTH_BUFFER_BIT),$&&(ne|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),F.clear(ne)},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",Be,!1),t.removeEventListener("webglcontextcreationerror",Ne,!1),De.dispose(),gt.dispose(),Ue.dispose(),D.dispose(),Z.dispose(),le.dispose(),Kt.dispose(),G.dispose(),Pe.dispose(),se.dispose(),se.removeEventListener("sessionstart",br),se.removeEventListener("sessionend",wo),us.stop()};function fe(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Be(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const N=tt.autoReset,W=Xe.enabled,$=Xe.autoUpdate,ne=Xe.needsUpdate,q=Xe.type;Ie(),tt.autoReset=N,Xe.enabled=W,Xe.autoUpdate=$,Xe.needsUpdate=ne,Xe.type=q}function Ne(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function pt(N){const W=N.target;W.removeEventListener("dispose",pt),rn(W)}function rn(N){fn(N),Ue.remove(N)}function fn(N){const W=Ue.get(N).programs;W!==void 0&&(W.forEach(function($){Pe.releaseProgram($)}),N.isShaderMaterial&&Pe.releaseShaderCache(N))}this.renderBufferDirect=function(N,W,$,ne,q,Me){W===null&&(W=je);const ze=q.isMesh&&q.matrixWorld.determinant()<0,Qe=cs(N,W,$,ne,q);Te.setMaterial(ne,ze);let ke=$.index,rt=1;if(ne.wireframe===!0){if(ke=pe.getWireframeAttribute($),ke===void 0)return;rt=2}const mt=$.drawRange,Ge=$.attributes.position;let ht=mt.start*rt,Wt=(mt.start+mt.count)*rt;Me!==null&&(ht=Math.max(ht,Me.start*rt),Wt=Math.min(Wt,(Me.start+Me.count)*rt)),ke!==null?(ht=Math.max(ht,0),Wt=Math.min(Wt,ke.count)):Ge!=null&&(ht=Math.max(ht,0),Wt=Math.min(Wt,Ge.count));const ot=Wt-ht;if(ot<0||ot===1/0)return;Kt.setup(q,ne,Qe,$,ke);let Zn,zt=qe;if(ke!==null&&(Zn=oe.get(ke),zt=Rt,zt.setIndex(Zn)),q.isMesh)ne.wireframe===!0?(Te.setLineWidth(ne.wireframeLinewidth*ge()),zt.setMode(F.LINES)):zt.setMode(F.TRIANGLES);else if(q.isLine){let $e=ne.linewidth;$e===void 0&&($e=1),Te.setLineWidth($e*ge()),q.isLineSegments?zt.setMode(F.LINES):q.isLineLoop?zt.setMode(F.LINE_LOOP):zt.setMode(F.LINE_STRIP)}else q.isPoints?zt.setMode(F.POINTS):q.isSprite&&zt.setMode(F.TRIANGLES);if(q.isBatchedMesh)if(q._multiDrawInstances!==null)zt.renderMultiDrawInstances(q._multiDrawStarts,q._multiDrawCounts,q._multiDrawCount,q._multiDrawInstances);else if(ve.get("WEBGL_multi_draw"))zt.renderMultiDraw(q._multiDrawStarts,q._multiDrawCounts,q._multiDrawCount);else{const $e=q._multiDrawStarts,Ea=q._multiDrawCounts,Ht=q._multiDrawCount,Ei=ke?oe.get(ke).bytesPerElement:1,hs=Ue.get(ne).currentProgram.getUniforms();for(let ii=0;ii<Ht;ii++)hs.setValue(F,"_gl_DrawID",ii),zt.render($e[ii]/Ei,Ea[ii])}else if(q.isInstancedMesh)zt.renderInstances(ht,ot,q.count);else if($.isInstancedBufferGeometry){const $e=$._maxInstanceCount!==void 0?$._maxInstanceCount:1/0,Ea=Math.min($.instanceCount,$e);zt.renderInstances(ht,ot,Ea)}else zt.render(ht,ot)};function Ft(N,W,$){N.transparent===!0&&N.side===ns&&N.forceSinglePass===!1?(N.side=Ui,N.needsUpdate=!0,Ds(N,W,$),N.side=vr,N.needsUpdate=!0,Ds(N,W,$),N.side=ns):Ds(N,W,$)}this.compile=function(N,W,$=null){$===null&&($=N),y=gt.get($),y.init(W),E.push(y),$.traverseVisible(function(q){q.isLight&&q.layers.test(W.layers)&&(y.pushLight(q),q.castShadow&&y.pushShadow(q))}),N!==$&&N.traverseVisible(function(q){q.isLight&&q.layers.test(W.layers)&&(y.pushLight(q),q.castShadow&&y.pushShadow(q))}),y.setupLights();const ne=new Set;return N.traverse(function(q){if(!(q.isMesh||q.isPoints||q.isLine||q.isSprite))return;const Me=q.material;if(Me)if(Array.isArray(Me))for(let ze=0;ze<Me.length;ze++){const Qe=Me[ze];Ft(Qe,$,q),ne.add(Qe)}else Ft(Me,$,q),ne.add(Me)}),E.pop(),y=null,ne},this.compileAsync=function(N,W,$=null){const ne=this.compile(N,W,$);return new Promise(q=>{function Me(){if(ne.forEach(function(ze){Ue.get(ze).currentProgram.isReady()&&ne.delete(ze)}),ne.size===0){q(N);return}setTimeout(Me,10)}ve.get("KHR_parallel_shader_compile")!==null?Me():setTimeout(Me,10)})};let Ii=null;function zi(N){Ii&&Ii(N)}function br(){us.stop()}function wo(){us.start()}const us=new ID;us.setAnimationLoop(zi),typeof self<"u"&&us.setContext(self),this.setAnimationLoop=function(N){Ii=N,se.setAnimationLoop(N),N===null?us.stop():us.start()},se.addEventListener("sessionstart",br),se.addEventListener("sessionend",wo),this.render=function(N,W){if(W!==void 0&&W.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(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),se.enabled===!0&&se.isPresenting===!0&&(se.cameraAutoUpdate===!0&&se.updateCamera(W),W=se.getCamera()),N.isScene===!0&&N.onBeforeRender(A,N,W,z),y=gt.get(N,E.length),y.init(W),E.push(y),Ye.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),ee.setFromProjectionMatrix(Ye),Oe=this.localClippingEnabled,me=xe.init(this.clippingPlanes,Oe),b=De.get(N,S.length),b.init(),S.push(b),se.enabled===!0&&se.isPresenting===!0){const Me=A.xr.getDepthSensingMesh();Me!==null&&Mr(Me,W,-1/0,A.sortObjects)}Mr(N,W,0,A.sortObjects),b.finish(),A.sortObjects===!0&&b.sort(re,he),ue=se.enabled===!1||se.isPresenting===!1||se.hasDepthSensing()===!1,ue&&nt.addToRenderList(b,N),this.info.render.frame++,me===!0&&xe.beginShadows();const $=y.state.shadowsArray;Xe.render($,N,W),me===!0&&xe.endShadows(),this.info.autoReset===!0&&this.info.reset();const ne=b.opaque,q=b.transmissive;if(y.setupLights(),W.isArrayCamera){const Me=W.cameras;if(q.length>0)for(let ze=0,Qe=Me.length;ze<Qe;ze++){const ke=Me[ze];Xl(ne,q,N,ke)}ue&&nt.render(N);for(let ze=0,Qe=Me.length;ze<Qe;ze++){const ke=Me[ze];Co(b,N,ke,ke.viewport)}}else q.length>0&&Xl(ne,q,N,W),ue&&nt.render(N),Co(b,N,W);z!==null&&(O.updateMultisampleRenderTarget(z),O.updateRenderTargetMipmap(z)),N.isScene===!0&&N.onAfterRender(A,N,W),Kt.resetDefaultState(),C=-1,w=null,E.pop(),E.length>0?(y=E[E.length-1],me===!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,W,$,ne){if(N.visible===!1)return;if(N.layers.test(W.layers)){if(N.isGroup)$=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(W);else if(N.isLight)y.pushLight(N),N.castShadow&&y.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ee.intersectsSprite(N)){ne&&Ze.setFromMatrixPosition(N.matrixWorld).applyMatrix4(Ye);const ze=le.update(N),Qe=N.material;Qe.visible&&b.push(N,ze,Qe,$,Ze.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ee.intersectsObject(N))){const ze=le.update(N),Qe=N.material;if(ne&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Ze.copy(N.boundingSphere.center)):(ze.boundingSphere===null&&ze.computeBoundingSphere(),Ze.copy(ze.boundingSphere.center)),Ze.applyMatrix4(N.matrixWorld).applyMatrix4(Ye)),Array.isArray(Qe)){const ke=ze.groups;for(let rt=0,mt=ke.length;rt<mt;rt++){const Ge=ke[rt],ht=Qe[Ge.materialIndex];ht&&ht.visible&&b.push(N,ze,ht,$,Ze.z,Ge)}}else Qe.visible&&b.push(N,ze,Qe,$,Ze.z,null)}}const Me=N.children;for(let ze=0,Qe=Me.length;ze<Qe;ze++)Mr(Me[ze],W,$,ne)}function Co(N,W,$,ne){const q=N.opaque,Me=N.transmissive,ze=N.transparent;y.setupLightsView($),me===!0&&xe.setGlobalState(A.clippingPlanes,$),ne&&Te.viewport(B.copy(ne)),q.length>0&&Ma(q,W,$),Me.length>0&&Ma(Me,W,$),ze.length>0&&Ma(ze,W,$),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function Xl(N,W,$,ne){if(($.isScene===!0?$.overrideMaterial:null)!==null)return;y.state.transmissionRenderTarget[ne.id]===void 0&&(y.state.transmissionRenderTarget[ne.id]=new as(1,1,{generateMipmaps:!0,type:ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float")?Hc:is,minFilter:xs,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ut.workingColorSpace}));const Me=y.state.transmissionRenderTarget[ne.id],ze=ne.viewport||B;Me.setSize(ze.z,ze.w);const Qe=A.getRenderTarget();A.setRenderTarget(Me),A.getClearColor(j),te=A.getClearAlpha(),te<1&&A.setClearColor(16777215,.5),A.clear(),ue&&nt.render($);const ke=A.toneMapping;A.toneMapping=Ms;const rt=ne.viewport;if(ne.viewport!==void 0&&(ne.viewport=void 0),y.setupLightsView(ne),me===!0&&xe.setGlobalState(A.clippingPlanes,ne),Ma(N,$,ne),O.updateMultisampleRenderTarget(Me),O.updateRenderTargetMipmap(Me),ve.has("WEBGL_multisampled_render_to_texture")===!1){let mt=!1;for(let Ge=0,ht=W.length;Ge<ht;Ge++){const Wt=W[Ge],ot=Wt.object,Zn=Wt.geometry,zt=Wt.material,$e=Wt.group;if(zt.side===ns&&ot.layers.test(ne.layers)){const Ea=zt.side;zt.side=Ui,zt.needsUpdate=!0,qc(ot,$,ne,Zn,zt,$e),zt.side=Ea,zt.needsUpdate=!0,mt=!0}}mt===!0&&(O.updateMultisampleRenderTarget(Me),O.updateRenderTargetMipmap(Me))}A.setRenderTarget(Qe),A.setClearColor(j,te),rt!==void 0&&(ne.viewport=rt),A.toneMapping=ke}function Ma(N,W,$){const ne=W.isScene===!0?W.overrideMaterial:null;for(let q=0,Me=N.length;q<Me;q++){const ze=N[q],Qe=ze.object,ke=ze.geometry,rt=ne===null?ze.material:ne,mt=ze.group;Qe.layers.test($.layers)&&qc(Qe,W,$,ke,rt,mt)}}function qc(N,W,$,ne,q,Me){N.onBeforeRender(A,W,$,ne,q,Me),N.modelViewMatrix.multiplyMatrices($.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),q.onBeforeRender(A,W,$,ne,N,Me),q.transparent===!0&&q.side===ns&&q.forceSinglePass===!1?(q.side=Ui,q.needsUpdate=!0,A.renderBufferDirect($,W,ne,q,N,Me),q.side=vr,q.needsUpdate=!0,A.renderBufferDirect($,W,ne,q,N,Me),q.side=ns):A.renderBufferDirect($,W,ne,q,N,Me),N.onAfterRender(A,W,$,ne,q,Me)}function Ds(N,W,$){W.isScene!==!0&&(W=je);const ne=Ue.get(N),q=y.state.lights,Me=y.state.shadowsArray,ze=q.state.version,Qe=Pe.getParameters(N,q.state,Me,W,$),ke=Pe.getProgramCacheKey(Qe);let rt=ne.programs;ne.environment=N.isMeshStandardMaterial?W.environment:null,ne.fog=W.fog,ne.envMap=(N.isMeshStandardMaterial?Z:D).get(N.envMap||ne.environment),ne.envMapRotation=ne.environment!==null&&N.envMap===null?W.environmentRotation:N.envMapRotation,rt===void 0&&(N.addEventListener("dispose",pt),rt=new Map,ne.programs=rt);let mt=rt.get(ke);if(mt!==void 0){if(ne.currentProgram===mt&&ne.lightsStateVersion===ze)return Yl(N,Qe),mt}else Qe.uniforms=Pe.getUniforms(N),N.onBeforeCompile(Qe,A),mt=Pe.acquireProgram(Qe,ke),rt.set(ke,mt),ne.uniforms=Qe.uniforms;const Ge=ne.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(Ge.clippingPlanes=xe.uniform),Yl(N,Qe),ne.needsLights=Ro(N),ne.lightsStateVersion=ze,ne.needsLights&&(Ge.ambientLightColor.value=q.state.ambient,Ge.lightProbe.value=q.state.probe,Ge.directionalLights.value=q.state.directional,Ge.directionalLightShadows.value=q.state.directionalShadow,Ge.spotLights.value=q.state.spot,Ge.spotLightShadows.value=q.state.spotShadow,Ge.rectAreaLights.value=q.state.rectArea,Ge.ltc_1.value=q.state.rectAreaLTC1,Ge.ltc_2.value=q.state.rectAreaLTC2,Ge.pointLights.value=q.state.point,Ge.pointLightShadows.value=q.state.pointShadow,Ge.hemisphereLights.value=q.state.hemi,Ge.directionalShadowMap.value=q.state.directionalShadowMap,Ge.directionalShadowMatrix.value=q.state.directionalShadowMatrix,Ge.spotShadowMap.value=q.state.spotShadowMap,Ge.spotLightMatrix.value=q.state.spotLightMatrix,Ge.spotLightMap.value=q.state.spotLightMap,Ge.pointShadowMap.value=q.state.pointShadowMap,Ge.pointShadowMatrix.value=q.state.pointShadowMatrix),ne.currentProgram=mt,ne.uniformsList=null,mt}function ql(N){if(N.uniformsList===null){const W=N.currentProgram.getUniforms();N.uniformsList=Tm.seqWithValue(W.seq,N.uniforms)}return N.uniformsList}function Yl(N,W){const $=Ue.get(N);$.outputColorSpace=W.outputColorSpace,$.batching=W.batching,$.batchingColor=W.batchingColor,$.instancing=W.instancing,$.instancingColor=W.instancingColor,$.instancingMorph=W.instancingMorph,$.skinning=W.skinning,$.morphTargets=W.morphTargets,$.morphNormals=W.morphNormals,$.morphColors=W.morphColors,$.morphTargetsCount=W.morphTargetsCount,$.numClippingPlanes=W.numClippingPlanes,$.numIntersection=W.numClipIntersection,$.vertexAlphas=W.vertexAlphas,$.vertexTangents=W.vertexTangents,$.toneMapping=W.toneMapping}function cs(N,W,$,ne,q){W.isScene!==!0&&(W=je),O.resetTextureUnits();const Me=W.fog,ze=ne.isMeshStandardMaterial?W.environment:null,Qe=z===null?A.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Mo,ke=(ne.isMeshStandardMaterial?Z:D).get(ne.envMap||ze),rt=ne.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,mt=!!$.attributes.tangent&&(!!ne.normalMap||ne.anisotropy>0),Ge=!!$.morphAttributes.position,ht=!!$.morphAttributes.normal,Wt=!!$.morphAttributes.color;let ot=Ms;ne.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(ot=A.toneMapping);const Zn=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,zt=Zn!==void 0?Zn.length:0,$e=Ue.get(ne),Ea=y.state.lights;if(me===!0&&(Oe===!0||N!==w)){const ai=N===w&&ne.id===C;xe.setState(ne,N,ai)}let Ht=!1;ne.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==Ea.state.version||$e.outputColorSpace!==Qe||q.isBatchedMesh&&$e.batching===!1||!q.isBatchedMesh&&$e.batching===!0||q.isBatchedMesh&&$e.batchingColor===!0&&q.colorTexture===null||q.isBatchedMesh&&$e.batchingColor===!1&&q.colorTexture!==null||q.isInstancedMesh&&$e.instancing===!1||!q.isInstancedMesh&&$e.instancing===!0||q.isSkinnedMesh&&$e.skinning===!1||!q.isSkinnedMesh&&$e.skinning===!0||q.isInstancedMesh&&$e.instancingColor===!0&&q.instanceColor===null||q.isInstancedMesh&&$e.instancingColor===!1&&q.instanceColor!==null||q.isInstancedMesh&&$e.instancingMorph===!0&&q.morphTexture===null||q.isInstancedMesh&&$e.instancingMorph===!1&&q.morphTexture!==null||$e.envMap!==ke||ne.fog===!0&&$e.fog!==Me||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==xe.numPlanes||$e.numIntersection!==xe.numIntersection)||$e.vertexAlphas!==rt||$e.vertexTangents!==mt||$e.morphTargets!==Ge||$e.morphNormals!==ht||$e.morphColors!==Wt||$e.toneMapping!==ot||$e.morphTargetsCount!==zt)&&(Ht=!0):(Ht=!0,$e.__version=ne.version);let Ei=$e.currentProgram;Ht===!0&&(Ei=Ds(ne,W,q));let hs=!1,ii=!1,En=!1;const ft=Ei.getUniforms(),Ti=$e.uniforms;if(Te.useProgram(Ei.program)&&(hs=!0,ii=!0,En=!0),ne.id!==C&&(C=ne.id,ii=!0),hs||w!==N){Te.buffers.depth.getReversed()?(Ee.copy(N.projectionMatrix),KP(Ee),JP(Ee),ft.setValue(F,"projectionMatrix",Ee)):ft.setValue(F,"projectionMatrix",N.projectionMatrix),ft.setValue(F,"viewMatrix",N.matrixWorldInverse);const Ta=ft.map.cameraPosition;Ta!==void 0&&Ta.setValue(F,et.setFromMatrixPosition(N.matrixWorld)),Ae.logarithmicDepthBuffer&&ft.setValue(F,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(ne.isMeshPhongMaterial||ne.isMeshToonMaterial||ne.isMeshLambertMaterial||ne.isMeshBasicMaterial||ne.isMeshStandardMaterial||ne.isShaderMaterial)&&ft.setValue(F,"isOrthographic",N.isOrthographicCamera===!0),w!==N&&(w=N,ii=!0,En=!0)}if(q.isSkinnedMesh){ft.setOptional(F,q,"bindMatrix"),ft.setOptional(F,q,"bindMatrixInverse");const ai=q.skeleton;ai&&(ai.boneTexture===null&&ai.computeBoneTexture(),ft.setValue(F,"boneTexture",ai.boneTexture,O))}q.isBatchedMesh&&(ft.setOptional(F,q,"batchingTexture"),ft.setValue(F,"batchingTexture",q._matricesTexture,O),ft.setOptional(F,q,"batchingIdTexture"),ft.setValue(F,"batchingIdTexture",q._indirectTexture,O),ft.setOptional(F,q,"batchingColorTexture"),q._colorsTexture!==null&&ft.setValue(F,"batchingColorTexture",q._colorsTexture,O));const ka=$.morphAttributes;if((ka.position!==void 0||ka.normal!==void 0||ka.color!==void 0)&&st.update(q,$,Ei),(ii||$e.receiveShadow!==q.receiveShadow)&&($e.receiveShadow=q.receiveShadow,ft.setValue(F,"receiveShadow",q.receiveShadow)),ne.isMeshGouraudMaterial&&ne.envMap!==null&&(Ti.envMap.value=ke,Ti.flipEnvMap.value=ke.isCubeTexture&&ke.isRenderTargetTexture===!1?-1:1),ne.isMeshStandardMaterial&&ne.envMap===null&&W.environment!==null&&(Ti.envMapIntensity.value=W.environmentIntensity),ii&&(ft.setValue(F,"toneMappingExposure",A.toneMappingExposure),$e.needsLights&&fs(Ti,En),Me&&ne.fog===!0&&Re.refreshFogUniforms(Ti,Me),Re.refreshMaterialUniforms(Ti,ne,X,J,y.state.transmissionRenderTarget[N.id]),Tm.upload(F,ql($e),Ti,O)),ne.isShaderMaterial&&ne.uniformsNeedUpdate===!0&&(Tm.upload(F,ql($e),Ti,O),ne.uniformsNeedUpdate=!1),ne.isSpriteMaterial&&ft.setValue(F,"center",q.center),ft.setValue(F,"modelViewMatrix",q.modelViewMatrix),ft.setValue(F,"normalMatrix",q.normalMatrix),ft.setValue(F,"modelMatrix",q.matrixWorld),ne.isShaderMaterial||ne.isRawShaderMaterial){const ai=ne.uniformsGroups;for(let Ta=0,jn=ai.length;Ta<jn;Ta++){const Do=ai[Ta];G.update(Do,Ei),G.bind(Do,Ei)}}return Ei}function fs(N,W){N.ambientLightColor.needsUpdate=W,N.lightProbe.needsUpdate=W,N.directionalLights.needsUpdate=W,N.directionalLightShadows.needsUpdate=W,N.pointLights.needsUpdate=W,N.pointLightShadows.needsUpdate=W,N.spotLights.needsUpdate=W,N.spotLightShadows.needsUpdate=W,N.rectAreaLights.needsUpdate=W,N.hemisphereLights.needsUpdate=W}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,W,$){Ue.get(N.texture).__webglTexture=W,Ue.get(N.depthTexture).__webglTexture=$;const ne=Ue.get(N);ne.__hasExternalTextures=!0,ne.__autoAllocateDepthBuffer=$===void 0,ne.__autoAllocateDepthBuffer||ve.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ne.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,W){const $=Ue.get(N);$.__webglFramebuffer=W,$.__useDefaultFramebuffer=W===void 0},this.setRenderTarget=function(N,W=0,$=0){z=N,R=W,L=$;let ne=!0,q=null,Me=!1,ze=!1;if(N){const ke=Ue.get(N);if(ke.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(F.FRAMEBUFFER,null),ne=!1;else if(ke.__webglFramebuffer===void 0)O.setupRenderTarget(N);else if(ke.__hasExternalTextures)O.rebindTextures(N,Ue.get(N.texture).__webglTexture,Ue.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const Ge=N.depthTexture;if(ke.__boundDepthTexture!==Ge){if(Ge!==null&&Ue.has(Ge)&&(N.width!==Ge.image.width||N.height!==Ge.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(N)}}const rt=N.texture;(rt.isData3DTexture||rt.isDataArrayTexture||rt.isCompressedArrayTexture)&&(ze=!0);const mt=Ue.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(mt[W])?q=mt[W][$]:q=mt[W],Me=!0):N.samples>0&&O.useMultisampledRTT(N)===!1?q=Ue.get(N).__webglMultisampledFramebuffer:Array.isArray(mt)?q=mt[$]:q=mt,B.copy(N.viewport),Q.copy(N.scissor),k=N.scissorTest}else B.copy(_e).multiplyScalar(X).floor(),Q.copy(we).multiplyScalar(X).floor(),k=Je;if(Te.bindFramebuffer(F.FRAMEBUFFER,q)&&ne&&Te.drawBuffers(N,q),Te.viewport(B),Te.scissor(Q),Te.setScissorTest(k),Me){const ke=Ue.get(N.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+W,ke.__webglTexture,$)}else if(ze){const ke=Ue.get(N.texture),rt=W||0;F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,ke.__webglTexture,$||0,rt)}C=-1},this.readRenderTargetPixels=function(N,W,$,ne,q,Me,ze){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Qe=Ue.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&ze!==void 0&&(Qe=Qe[ze]),Qe){Te.bindFramebuffer(F.FRAMEBUFFER,Qe);try{const ke=N.texture,rt=ke.format,mt=ke.type;if(!Ae.textureFormatReadable(rt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ae.textureTypeReadable(mt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=N.width-ne&&$>=0&&$<=N.height-q&&F.readPixels(W,$,ne,q,dt.convert(rt),dt.convert(mt),Me)}finally{const ke=z!==null?Ue.get(z).__webglFramebuffer:null;Te.bindFramebuffer(F.FRAMEBUFFER,ke)}}},this.readRenderTargetPixelsAsync=async function(N,W,$,ne,q,Me,ze){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Qe=Ue.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&ze!==void 0&&(Qe=Qe[ze]),Qe){const ke=N.texture,rt=ke.format,mt=ke.type;if(!Ae.textureFormatReadable(rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ae.textureTypeReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(W>=0&&W<=N.width-ne&&$>=0&&$<=N.height-q){Te.bindFramebuffer(F.FRAMEBUFFER,Qe);const Ge=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Ge),F.bufferData(F.PIXEL_PACK_BUFFER,Me.byteLength,F.STREAM_READ),F.readPixels(W,$,ne,q,dt.convert(rt),dt.convert(mt),0);const ht=z!==null?Ue.get(z).__webglFramebuffer:null;Te.bindFramebuffer(F.FRAMEBUFFER,ht);const Wt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await QP(F,Wt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Ge),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,Me),F.deleteBuffer(Ge),F.deleteSync(Wt),Me}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,W=null,$=0){N.isTexture!==!0&&(Vf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),W=arguments[0]||null,N=arguments[1]);const ne=Math.pow(2,-$),q=Math.floor(N.image.width*ne),Me=Math.floor(N.image.height*ne),ze=W!==null?W.x:0,Qe=W!==null?W.y:0;O.setTexture2D(N,0),F.copyTexSubImage2D(F.TEXTURE_2D,$,0,0,ze,Qe,q,Me),Te.unbindTexture()},this.copyTextureToTexture=function(N,W,$=null,ne=null,q=0){N.isTexture!==!0&&(Vf("WebGLRenderer: copyTextureToTexture function signature has changed."),ne=arguments[0]||null,N=arguments[1],W=arguments[2],q=arguments[3]||0,$=null);let Me,ze,Qe,ke,rt,mt,Ge,ht,Wt;const ot=N.isCompressedTexture?N.mipmaps[q]:N.image;$!==null?(Me=$.max.x-$.min.x,ze=$.max.y-$.min.y,Qe=$.isBox3?$.max.z-$.min.z:1,ke=$.min.x,rt=$.min.y,mt=$.isBox3?$.min.z:0):(Me=ot.width,ze=ot.height,Qe=ot.depth||1,ke=0,rt=0,mt=0),ne!==null?(Ge=ne.x,ht=ne.y,Wt=ne.z):(Ge=0,ht=0,Wt=0);const Zn=dt.convert(W.format),zt=dt.convert(W.type);let $e;W.isData3DTexture?(O.setTexture3D(W,0),$e=F.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(O.setTexture2DArray(W,0),$e=F.TEXTURE_2D_ARRAY):(O.setTexture2D(W,0),$e=F.TEXTURE_2D),F.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,W.flipY),F.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),F.pixelStorei(F.UNPACK_ALIGNMENT,W.unpackAlignment);const Ea=F.getParameter(F.UNPACK_ROW_LENGTH),Ht=F.getParameter(F.UNPACK_IMAGE_HEIGHT),Ei=F.getParameter(F.UNPACK_SKIP_PIXELS),hs=F.getParameter(F.UNPACK_SKIP_ROWS),ii=F.getParameter(F.UNPACK_SKIP_IMAGES);F.pixelStorei(F.UNPACK_ROW_LENGTH,ot.width),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,ot.height),F.pixelStorei(F.UNPACK_SKIP_PIXELS,ke),F.pixelStorei(F.UNPACK_SKIP_ROWS,rt),F.pixelStorei(F.UNPACK_SKIP_IMAGES,mt);const En=N.isDataArrayTexture||N.isData3DTexture,ft=W.isDataArrayTexture||W.isData3DTexture;if(N.isRenderTargetTexture||N.isDepthTexture){const Ti=Ue.get(N),ka=Ue.get(W),ai=Ue.get(Ti.__renderTarget),Ta=Ue.get(ka.__renderTarget);Te.bindFramebuffer(F.READ_FRAMEBUFFER,ai.__webglFramebuffer),Te.bindFramebuffer(F.DRAW_FRAMEBUFFER,Ta.__webglFramebuffer);for(let jn=0;jn<Qe;jn++)En&&F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Ue.get(N).__webglTexture,q,mt+jn),N.isDepthTexture?(ft&&F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Ue.get(W).__webglTexture,q,Wt+jn),F.blitFramebuffer(ke,rt,Me,ze,Ge,ht,Me,ze,F.DEPTH_BUFFER_BIT,F.NEAREST)):ft?F.copyTexSubImage3D($e,q,Ge,ht,Wt+jn,ke,rt,Me,ze):F.copyTexSubImage2D($e,q,Ge,ht,Wt+jn,ke,rt,Me,ze);Te.bindFramebuffer(F.READ_FRAMEBUFFER,null),Te.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else ft?N.isDataTexture||N.isData3DTexture?F.texSubImage3D($e,q,Ge,ht,Wt,Me,ze,Qe,Zn,zt,ot.data):W.isCompressedArrayTexture?F.compressedTexSubImage3D($e,q,Ge,ht,Wt,Me,ze,Qe,Zn,ot.data):F.texSubImage3D($e,q,Ge,ht,Wt,Me,ze,Qe,Zn,zt,ot):N.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,q,Ge,ht,Me,ze,Zn,zt,ot.data):N.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,q,Ge,ht,ot.width,ot.height,Zn,ot.data):F.texSubImage2D(F.TEXTURE_2D,q,Ge,ht,Me,ze,Zn,zt,ot);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,hs),F.pixelStorei(F.UNPACK_SKIP_IMAGES,ii),q===0&&W.generateMipmaps&&F.generateMipmap($e),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,W,$=null,ne=null,q=0){return N.isTexture!==!0&&(Vf("WebGLRenderer: copyTextureToTexture3D function signature has changed."),$=arguments[0]||null,ne=arguments[1]||null,N=arguments[2],W=arguments[3],q=arguments[4]||0),Vf('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(N,W,$,ne,q)},this.initRenderTarget=function(N){Ue.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 b0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new He(e),this.density=t}clone(){return new b0(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class M0{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new He(e),this.near=t,this.far=i}clone(){return new M0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Mb 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 E0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ih,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=xt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=xt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=xt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=xt(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=xt(t,this.array),i=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(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=xt(t,this.array),i=xt(i,this.array),a=xt(a,this.array),s=xt(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 Eb extends Mi{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new He(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 Iu;const Cf=new P,zu=new P,Ou=new P,Pu=new de,Rf=new de,kD=new ct,Op=new P,Df=new P,Pp=new P,FA=new de,y_=new de,HA=new de;class GD extends Bt{constructor(e=new Eb){if(super(),this.isSprite=!0,this.type="Sprite",Iu===void 0){Iu=new Mt;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 E0(t,5);Iu.setIndex([0,1,2,0,2,3]),Iu.setAttribute("position",new Nl(i,3,0,!1)),Iu.setAttribute("uv",new Nl(i,2,3,!1))}this.geometry=Iu,this.material=e,this.center=new de(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),zu.setFromMatrixScale(this.matrixWorld),kD.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ou.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&zu.multiplyScalar(-Ou.z);const i=this.material.rotation;let a,s;i!==0&&(s=Math.cos(i),a=Math.sin(i));const l=this.center;Bp(Op.set(-.5,-.5,0),Ou,l,zu,a,s),Bp(Df.set(.5,-.5,0),Ou,l,zu,a,s),Bp(Pp.set(.5,.5,0),Ou,l,zu,a,s),FA.set(0,0),y_.set(1,0),HA.set(1,1);let u=e.ray.intersectTriangle(Op,Df,Pp,!1,Cf);if(u===null&&(Bp(Df.set(-.5,.5,0),Ou,l,zu,a,s),y_.set(0,1),u=e.ray.intersectTriangle(Op,Pp,Df,!1,Cf),u===null))return;const c=e.ray.origin.distanceTo(Cf);c<e.near||c>e.far||t.push({distance:c,point:Cf.clone(),uv:Yi.getInterpolation(Cf,Op,Df,Pp,FA,y_,HA,new de),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 Bp(n,e,t,i,a,s){Pu.subVectors(n,t).addScalar(.5).multiply(i),a!==void 0?(Rf.x=s*Pu.x-a*Pu.y,Rf.y=a*Pu.x+s*Pu.y):Rf.copy(Pu),n.copy(e),n.x+=Rf.x,n.y+=Rf.y,n.applyMatrix4(kD)}const Fp=new P,VA=new P;class WD 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){Fp.setFromMatrixPosition(this.matrixWorld);const a=e.ray.origin.distanceTo(Fp);this.getObjectForDistance(a).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Fp.setFromMatrixPosition(e.matrixWorld),VA.setFromMatrixPosition(this.matrixWorld);const i=Fp.distanceTo(VA)/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 kA=new P,GA=new Pt,WA=new Pt,f6=new P,XA=new ct,Hp=new P,__=new bi,qA=new ct,x_=new Vc;class XD extends Hn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fx,this.bindMatrix=new ct,this.bindMatrixInverse=new ct,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,Hp),this.boundingBox.expandByPoint(Hp)}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,Hp),this.boundingSphere.expandByPoint(Hp)}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(),__.copy(this.boundingSphere),__.applyMatrix4(a),e.ray.intersectsSphere(__)!==!1&&(qA.copy(a).invert(),x_.copy(e.ray).applyMatrix4(qA),!(this.boundingBox!==null&&x_.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,x_)))}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===Fx?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===fD?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,a=this.geometry;GA.fromBufferAttribute(a.attributes.skinIndex,e),WA.fromBufferAttribute(a.attributes.skinWeight,e),kA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const l=WA.getComponent(s);if(l!==0){const u=GA.getComponent(s);XA.multiplyMatrices(i.bones[u].matrixWorld,i.boneInverses[u]),t.addScaledVector(f6.copy(kA).applyMatrix4(XA),l)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Tb 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,m,g){super(null,l,u,c,h,p,a,s,m,g),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const YA=new ct,h6=new ct;class T0{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 ct)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ct;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:h6;YA.multiplyMatrices(u,t[s]),YA.toArray(i,s*16)}a!==null&&(a.needsUpdate=!0)}clone(){return new T0(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 Tb),this.bones.push(l),this.boneInverses.push(new ct().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 Dc 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 Bu=new ct,ZA=new ct,Vp=[],jA=new Li,d6=new ct,Uf=new Hn,Lf=new bi;class qD extends Hn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Dc(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,d6)}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,Bu),jA.copy(e.boundingBox).applyMatrix4(Bu),this.boundingBox.union(jA)}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,Bu),Lf.copy(e.boundingSphere).applyMatrix4(Bu),this.boundingSphere.union(Lf)}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(Uf.geometry=this.geometry,Uf.material=this.material,Uf.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Lf.copy(this.boundingSphere),Lf.applyMatrix4(i),e.ray.intersectsSphere(Lf)!==!1))for(let s=0;s<a;s++){this.getMatrixAt(s,Bu),ZA.multiplyMatrices(i,Bu),Uf.matrixWorld=ZA,Uf.raycast(e,Vp);for(let l=0,u=Vp.length;l<u;l++){const c=Vp[l];c.instanceId=s,c.object=this,t.push(c)}Vp.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Dc(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,m0,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 S_(n,e){return n-e}function p6(n,e){return n.z-e.z}function m6(n,e){return e.z-n.z}class g6{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 ct,v6=new He(1,1,1),b_=new ld,kp=new Li,Jo=new bi,Nf=new P,QA=new P,y6=new P,M_=new g6,_i=new Hn,Gp=[];function _6(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 YD extends Hn{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 Mt,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,sd,_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),m=new tn(p,c,h);t.setAttribute(s,m)}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,kp).applyMatrix4(ki),e.union(kp)}}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(S_),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&&(v6.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(S_),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 m=t.getAttribute(p),g=i.getAttribute(p);_6(m,g,c);const v=m.itemSize;for(let _=m.count,T=h;_<T;_++){const b=c+_;for(let y=0;y<v;y++)g.setComponent(b,y,0)}g.needsUpdate=!0,g.addUpdateRange(c*v,h*v)}if(a){const p=u.indexStart,m=u.reservedIndexCount;u.indexCount=t.getIndex().count;for(let g=0;g<l.count;g++)s.setX(p+g,c+l.getX(g));for(let g=l.count,v=m;g<v;g++)s.setX(p+g,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:m,reservedIndexCount:g}=h,v=s.index,_=v.array,T=e-m;for(let b=p;b<p+g;b++)_[b]=_[b]+T;v.array.copyWithin(t,p,p+g),v.addUpdateRange(t,g),h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:p,reservedVertexCount:m}=h,g=s.attributes;for(const v in g){const _=g[v],{array:T,itemSize:b}=_;T.copyWithin(e*b,p*b,(p+m)*b),_.addUpdateRange(e*b,m*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(Nf.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,kp),kp.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 m=h;l&&(m=l.getX(m)),Nf.fromBufferAttribute(u,m),c=Math.max(c,s.center.distanceToSquared(Nf))}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(S_);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 Mt,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,Gp);for(let m=0,g=Gp.length;m<g;m++){const v=Gp[m];v.object=this,v.batchId=u,t.push(v)}Gp.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,m=this._geometryInfo,g=this.perObjectFrustumCulled,v=this._indirectTexture,_=v.image.data;g&&(ki.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),b_.setFromProjectionMatrix(ki,e.coordinateSystem));let T=0;if(this.sortObjects){ki.copy(this.matrixWorld).invert(),Nf.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(g&&(I=!b_.intersectsSphere(Jo)),!I){const R=m[A],L=y6.subVectors(Jo.center,Nf).dot(QA);M_.push(R.start,R.count,L,S)}}const b=M_.list,y=this.customSort;y===null?b.sort(s.transparent?m6:p6):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++}M_.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(g&&(this.getMatrixAt(b,ki),this.getBoundingSphereAt(S,Jo).applyMatrix4(ki),E=!b_.intersectsSphere(Jo)),!E){const A=m[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 He(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 Fg=new P,Hg=new P,KA=new ct,If=new Vc,Wp=new bi,E_=new P,JA=new P;class _o extends Bt{constructor(e=new Mt,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++)Fg.fromBufferAttribute(t,a-1),Hg.fromBufferAttribute(t,a),i[a]=i[a-1],i[a]+=Fg.distanceTo(Hg);e.setAttribute("lineDistance",new Ke(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(),Wp.copy(i.boundingSphere),Wp.applyMatrix4(a),Wp.radius+=s,e.ray.intersectsSphere(Wp)===!1)return;KA.copy(a).invert(),If.copy(e.ray).applyMatrix4(KA);const u=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,h=this.isLineSegments?2:1,p=i.index,g=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,If,c,y,S);E&&t.push(E)}if(this.isLineLoop){const T=p.getX(_-1),b=p.getX(v),y=Xp(this,e,If,c,T,b);y&&t.push(y)}}else{const v=Math.max(0,l.start),_=Math.min(g.count,l.start+l.count);for(let T=v,b=_-1;T<b;T+=h){const y=Xp(this,e,If,c,T,T+1);y&&t.push(y)}if(this.isLineLoop){const T=Xp(this,e,If,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(Fg.fromBufferAttribute(l,a),Hg.fromBufferAttribute(l,s),t.distanceSqToSegment(Fg,Hg,E_,JA)>i)return;E_.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(E_);if(!(c<e.near||c>e.far))return{distance:c,point:JA.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}const $A=new P,ew=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)$A.fromBufferAttribute(t,a),ew.fromBufferAttribute(t,a+1),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+$A.distanceTo(ew);e.setAttribute("lineDistance",new Ke(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ZD extends _o{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ab extends Mi{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new He(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 tw=new ct,Xx=new Vc,qp=new bi,Yp=new P;class jD extends Bt{constructor(e=new Mt,t=new Ab){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(),qp.copy(i.boundingSphere),qp.applyMatrix4(a),qp.radius+=s,e.ray.intersectsSphere(qp)===!1)return;tw.copy(a).invert(),Xx.copy(e.ray).applyMatrix4(tw);const u=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=u*u,h=i.index,m=i.attributes.position;if(h!==null){const g=Math.max(0,l.start),v=Math.min(h.count,l.start+l.count);for(let _=g,T=v;_<T;_++){const b=h.getX(_);Yp.fromBufferAttribute(m,b),nw(Yp,b,c,a,e,t,this)}}else{const g=Math.max(0,l.start),v=Math.min(m.count,l.start+l.count);for(let _=g,T=v;_<T;_++)Yp.fromBufferAttribute(m,_),nw(Yp,_,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 nw(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 x6 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:Wn,this.magFilter=s!==void 0?s:Wn,this.generateMipmaps=!1;const p=this;function m(){p.needsUpdate=!0,e.requestVideoFrameCallback(m)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(m)}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 S6 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 A0 extends Mn{constructor(e,t,i,a,s,l,u,c,h,p,m,g){super(null,l,u,c,h,p,a,s,m,g),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class b6 extends A0{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 M6 extends A0{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 E6 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 os{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],g=i[a+1]-p,v=(l-p)/g;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 de: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 ct;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),m=Math.abs(a[0].y),g=Math.abs(a[0].z);p<=h&&(h=p,i.set(1,0,0)),m<=h&&(h=m,i.set(0,1,0)),g<=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 w0 extends os{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 de){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),m=Math.sin(this.aRotation),g=c-this.aX,v=h-this.aY;c=g*p-v*m+this.aX,h=g*m+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 QD extends w0{constructor(e,t,i,a,s,l){super(e,t,i,i,a,s,l),this.isArcCurve=!0,this.type="ArcCurve"}}function wb(){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,m){let g=(l-s)/h-(u-s)/(h+p)+(u-l)/p,v=(u-l)/p-(c-l)/(p+m)+(c-u)/m;g*=p,v*=p,a(l,u,g,v)},calc:function(s){const l=s*s,u=l*s;return n+e*s+t*l+i*u}}}const Zp=new P,T_=new wb,A_=new wb,w_=new wb;class KD extends os{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]:(Zp.subVectors(a[0],a[1]).add(a[0]),h=Zp);const m=a[u%s],g=a[(u+1)%s];if(this.closed||u+2<s?p=a[(u+2)%s]:(Zp.subVectors(a[s-1],a[s-2]).add(a[s-1]),p=Zp),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let _=Math.pow(h.distanceToSquared(m),v),T=Math.pow(m.distanceToSquared(g),v),b=Math.pow(g.distanceToSquared(p),v);T<1e-4&&(T=1),_<1e-4&&(_=T),b<1e-4&&(b=T),T_.initNonuniformCatmullRom(h.x,m.x,g.x,p.x,_,T,b),A_.initNonuniformCatmullRom(h.y,m.y,g.y,p.y,_,T,b),w_.initNonuniformCatmullRom(h.z,m.z,g.z,p.z,_,T,b)}else this.curveType==="catmullrom"&&(T_.initCatmullRom(h.x,m.x,g.x,p.x,this.tension),A_.initCatmullRom(h.y,m.y,g.y,p.y,this.tension),w_.initCatmullRom(h.z,m.z,g.z,p.z,this.tension));return i.set(T_.calc(c),A_.calc(c),w_.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 iw(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 T6(n,e){const t=1-n;return t*t*e}function A6(n,e){return 2*(1-n)*n*e}function w6(n,e){return n*n*e}function fh(n,e,t,i){return T6(n,e)+A6(n,t)+w6(n,i)}function C6(n,e){const t=1-n;return t*t*t*e}function R6(n,e){const t=1-n;return 3*t*t*n*e}function D6(n,e){return 3*(1-n)*n*n*e}function U6(n,e){return n*n*n*e}function hh(n,e,t,i,a){return C6(n,e)+R6(n,t)+D6(n,i)+U6(n,a)}class Cb extends os{constructor(e=new de,t=new de,i=new de,a=new de){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=a}getPoint(e,t=new de){const i=t,a=this.v0,s=this.v1,l=this.v2,u=this.v3;return i.set(hh(e,a.x,s.x,l.x,u.x),hh(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 JD extends os{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(hh(e,a.x,s.x,l.x,u.x),hh(e,a.y,s.y,l.y,u.y),hh(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 Rb extends os{constructor(e=new de,t=new de){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new de){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 de){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 $D extends os{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 Db extends os{constructor(e=new de,t=new de,i=new de){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new de){const i=t,a=this.v0,s=this.v1,l=this.v2;return i.set(fh(e,a.x,s.x,l.x),fh(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 Ub extends os{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(fh(e,a.x,s.x,l.x),fh(e,a.y,s.y,l.y),fh(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 Lb extends os{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new de){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],m=a[l>a.length-3?a.length-1:l+2];return i.set(iw(u,c.x,h.x,p.x,m.x),iw(u,c.y,h.y,p.y,m.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 de().fromArray(a))}return this}}var Vg=Object.freeze({__proto__:null,ArcCurve:QD,CatmullRomCurve3:KD,CubicBezierCurve:Cb,CubicBezierCurve3:JD,EllipseCurve:w0,LineCurve:Rb,LineCurve3:$D,QuadraticBezierCurve:Db,QuadraticBezierCurve3:Ub,SplineCurve:Lb});class eU extends os{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 Vg[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 Vg[a.type]().fromJSON(a))}return this}}class Ph extends eU{constructor(e){super(),this.type="Path",this.currentPoint=new de,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 Rb(this.currentPoint.clone(),new de(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,a){const s=new Db(this.currentPoint.clone(),new de(e,t),new de(i,a));return this.curves.push(s),this.currentPoint.set(i,a),this}bezierCurveTo(e,t,i,a,s,l){const u=new Cb(this.currentPoint.clone(),new de(e,t),new de(i,a),new de(s,l));return this.curves.push(u),this.currentPoint.set(s,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Lb(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 w0(e,t,i,a,s,l,u,c);if(this.curves.length>0){const m=h.getPoint(0);m.equals(this.currentPoint)||this.lineTo(m.x,m.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 Mt{constructor(e=[new de(0,-.5),new de(.5,0),new de(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,m=new P,g=new de,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++){m.x=e[R].x*A,m.y=e[R].y,m.z=e[R].x*I,l.push(m.x,m.y,m.z),g.x=S/t,g.y=R/(e.length-1),u.push(g.x,g.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 Ke(l,3)),this.setAttribute("uv",new Ke(u,2)),this.setAttribute("normal",new Ke(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 C0 extends ud{constructor(e=1,t=1,i=4,a=8){const s=new Ph;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 C0(e.radius,e.length,e.capSegments,e.radialSegments)}}class R0 extends Mt{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 de;l.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(let m=0,g=3;m<=t;m++,g+=3){const v=i+m/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[g]/e+1)/2,p.y=(l[g+1]/e+1)/2,c.push(p.x,p.y)}for(let m=1;m<=t;m++)s.push(m,m+1,0);this.setIndex(s),this.setAttribute("position",new Ke(l,3)),this.setAttribute("normal",new Ke(u,3)),this.setAttribute("uv",new Ke(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new R0(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Wc extends Mt{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=[],m=[],g=[],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 Ke(m,3)),this.setAttribute("normal",new Ke(g,3)),this.setAttribute("uv",new Ke(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,te=Math.sin(j),V=Math.cos(j);I.x=B*te,I.y=-w*i+b,I.z=B*V,m.push(I.x,I.y,I.z),A.set(te,L,V).normalize(),g.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 de,L=new P;let z=0;const C=A===!0?e:t,w=A===!0?1:-1;for(let Q=1;Q<=a;Q++)m.push(0,b*w,0),g.push(0,w,0),v.push(.5,.5),_++;const B=_;for(let Q=0;Q<=a;Q++){const j=Q/a*c+u,te=Math.cos(j),V=Math.sin(j);L.x=C*V,L.y=b*w,L.z=C*te,m.push(L.x,L.y,L.z),g.push(0,w,0),R.x=te*.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 Wc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class D0 extends Wc{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 D0(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class To extends Mt{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 Ke(s,3)),this.setAttribute("normal",new Ke(s.slice(),3)),this.setAttribute("uv",new Ke(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?(g(L[z][w+1]),g(L[z+1][w]),g(L[z][w])):(g(L[z][w+1]),g(L[z+1][w+1]),g(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)}_(),m()}function m(){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 g(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 de,L=new de,z=new de;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 U0 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 U0(e.radius,e.detail)}}const jp=new P,Qp=new P,C_=new P,Kp=new Yi;class tU extends Mt{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"],m=new Array(3),g={},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}=Kp;if(T.fromBufferAttribute(u,h[0]),b.fromBufferAttribute(u,h[1]),y.fromBufferAttribute(u,h[2]),Kp.getNormal(C_),m[0]=`${Math.round(T.x*a)},${Math.round(T.y*a)},${Math.round(T.z*a)}`,m[1]=`${Math.round(b.x*a)},${Math.round(b.y*a)},${Math.round(b.z*a)}`,m[2]=`${Math.round(y.x*a)},${Math.round(y.y*a)},${Math.round(y.z*a)}`,!(m[0]===m[1]||m[1]===m[2]||m[2]===m[0]))for(let S=0;S<3;S++){const E=(S+1)%3,A=m[S],I=m[E],R=Kp[p[S]],L=Kp[p[E]],z=`${A}_${I}`,C=`${I}_${A}`;C in g&&g[C]?(C_.dot(g[C].normal)<=s&&(v.push(R.x,R.y,R.z),v.push(L.x,L.y,L.z)),g[C]=null):z in g||(g[z]={index0:h[S],index1:h[E],normal:C_.clone()})}}for(const _ in g)if(g[_]){const{index0:T,index1:b}=g[_];jp.fromBufferAttribute(u,T),Qp.fromBufferAttribute(u,b),v.push(jp.x,jp.y,jp.z),v.push(Qp.x,Qp.y,Qp.z)}this.setAttribute("position",new Ke(v,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class El extends Ph{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 Ph().fromJSON(a))}return this}}const L6={triangulate:function(n,e,t=2){const i=e&&e.length,a=i?e[0]*t:n.length;let s=nU(n,0,a,t,!0);const l=[];if(!s||s.next===s.prev)return l;let u,c,h,p,m,g,v;if(i&&(s=P6(n,e,s,t)),n.length>80*t){u=h=n[0],c=p=n[1];for(let _=t;_<a;_+=t)m=n[_],g=n[_+1],m<u&&(u=m),g<c&&(c=g),m>h&&(h=m),g>p&&(p=g);v=Math.max(h-u,p-c),v=v!==0?32767/v:0}return Bh(s,l,t,u,c,v,0),l}};function nU(n,e,t,i,a){let s,l;if(a===Z6(n,e,t,i)>0)for(s=e;s<t;s+=i)l=aw(s,n[s],n[s+1],l);else for(s=t-i;s>=e;s-=i)l=aw(s,n[s],n[s+1],l);return l&&L0(l,l.next)&&(Hh(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&&(L0(t,t.next)||vn(t.prev,t,t.next)===0)){if(Hh(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Bh(n,e,t,i,a,s,l){if(!n)return;!l&&s&&k6(n,i,a,s);let u=n,c,h;for(;n.prev!==n.next;){if(c=n.prev,h=n.next,s?I6(n,i,a,s):N6(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(h.i/t|0),Hh(n),n=h.next,u=h.next;continue}if(n=h,n===u){l?l===1?(n=z6(Il(n),e,t),Bh(n,e,t,i,a,s,2)):l===2&&O6(n,e,t,i,a,s):Bh(Il(n),e,t,i,a,s,1);break}}}function N6(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,m=u<c?u<h?u:h:c<h?c:h,g=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<=g&&_.y>=m&&_.y<=v&&rc(a,u,s,c,l,h,_.x,_.y)&&vn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function I6(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,m=s.y,g=l.y,v=u<c?u<h?u:h:c<h?c:h,_=p<m?p<g?p:g:m<g?m:g,T=u>c?u>h?u:h:c>h?c:h,b=p>m?p>g?p:g:m>g?m:g,y=qx(v,_,e,t,i),S=qx(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&&rc(u,p,c,m,h,g,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&&rc(u,p,c,m,h,g,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&&rc(u,p,c,m,h,g,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&&rc(u,p,c,m,h,g,A.x,A.y)&&vn(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function z6(n,e,t){let i=n;do{const a=i.prev,s=i.next.next;!L0(a,s)&&iU(a,i,i.next,s)&&Fh(a,s)&&Fh(s,a)&&(e.push(a.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Hh(i),Hh(i.next),i=n=s),i=i.next}while(i!==n);return Il(i)}function O6(n,e,t,i,a,s){let l=n;do{let u=l.next.next;for(;u!==l.prev;){if(l.i!==u.i&&X6(l,u)){let c=aU(l,u);l=Il(l,l.next),c=Il(c,c.next),Bh(l,e,t,i,a,s,0),Bh(c,e,t,i,a,s,0);return}u=u.next}l=l.next}while(l!==n)}function P6(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=nU(n,u,c,i,!1),h===h.next&&(h.steiner=!0),a.push(W6(h));for(a.sort(B6),s=0;s<a.length;s++)t=F6(a[s],t);return t}function B6(n,e){return n.x-e.x}function F6(n,e){const t=H6(n,e);if(!t)return e;const i=aU(t,n);return Il(i,i.next),Il(t,t.next)}function H6(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 g=t.x+(l-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=s&&g>i&&(i=g,a=t.x<t.next.x?t:t.next,g===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,m;t=a;do s>=t.x&&t.x>=c&&s!==t.x&&rc(l<h?s:i,l,c,h,l<h?i:s,l,t.x,t.y)&&(m=Math.abs(l-t.y)/(s-t.x),Fh(t,n)&&(m<p||m===p&&(t.x>a.x||t.x===a.x&&V6(a,t)))&&(a=t,p=m)),t=t.next;while(t!==u);return a}function V6(n,e){return vn(n.prev,n,e.prev)<0&&vn(e.next,n,n.next)<0}function k6(n,e,t,i){let a=n;do a.z===0&&(a.z=qx(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,G6(a)}function G6(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 qx(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 W6(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 rc(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 X6(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!q6(n,e)&&(Fh(n,e)&&Fh(e,n)&&Y6(n,e)&&(vn(n.prev,n,e.prev)||vn(n,e.prev,e))||L0(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 L0(n,e){return n.x===e.x&&n.y===e.y}function iU(n,e,t,i){const a=$p(vn(n,e,t)),s=$p(vn(n,e,i)),l=$p(vn(t,i,n)),u=$p(vn(t,i,e));return!!(a!==s&&l!==u||a===0&&Jp(n,t,e)||s===0&&Jp(n,i,e)||l===0&&Jp(t,n,i)||u===0&&Jp(t,e,i))}function Jp(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 $p(n){return n>0?1:n<0?-1:0}function q6(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&&iU(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Fh(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 Y6(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 aU(n,e){const t=new Yx(n.i,n.x,n.y),i=new Yx(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 aw(n,e,t,i){const a=new Yx(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 Hh(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 Yx(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 Z6(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=[];sw(e),rw(i,e);let l=e.length;t.forEach(sw);for(let c=0;c<t.length;c++)a.push(l),l+=t[c].length,rw(i,t[c]);const u=L6.triangulate(i,a);for(let c=0;c<u.length;c+=3)s.push(u.slice(c,c+3));return s}}function sw(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function rw(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class N0 extends Mt{constructor(e=new El([new de(.5,.5),new de(-.5,.5),new de(-.5,-.5),new de(.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 Ke(a,3)),this.setAttribute("uv",new Ke(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,m=t.depth!==void 0?t.depth:1;let g=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:j6;let E,A=!1,I,R,L,z;y&&(E=y.getSpacedPoints(p),A=!0,g=!1,I=y.computeFrenetFrames(p,!1),R=new P,L=new P,z=new P),g||(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 ue=0,ge=B.length;ue<ge;ue++){const F=B[ue];Ts.isClockWise(F)&&(B[ue]=F.reverse())}}const k=Ts.triangulateShape(w,B),j=w;for(let ue=0,ge=B.length;ue<ge;ue++){const F=B[ue];w=w.concat(F)}function te(ue,ge,F){return ge||console.error("THREE.ExtrudeGeometry: vec does not exist"),ue.clone().addScaledVector(ge,F)}const V=w.length,J=k.length;function X(ue,ge,F){let Ve,ve,Ae;const Te=ue.x-ge.x,tt=ue.y-ge.y,Ue=F.x-ue.x,O=F.y-ue.y,D=Te*Te+tt*tt,Z=Te*O-tt*Ue;if(Math.abs(Z)>Number.EPSILON){const oe=Math.sqrt(D),pe=Math.sqrt(Ue*Ue+O*O),le=ge.x-tt/oe,Pe=ge.y+Te/oe,Re=F.x-O/pe,De=F.y+Ue/pe,gt=((Re-le)*O-(De-Pe)*Ue)/(Te*O-tt*Ue);Ve=le+Te*gt-ue.x,ve=Pe+tt*gt-ue.y;const xe=Ve*Ve+ve*ve;if(xe<=2)return new de(Ve,ve);Ae=Math.sqrt(xe/2)}else{let oe=!1;Te>Number.EPSILON?Ue>Number.EPSILON&&(oe=!0):Te<-Number.EPSILON?Ue<-Number.EPSILON&&(oe=!0):Math.sign(tt)===Math.sign(O)&&(oe=!0),oe?(Ve=-tt,ve=Te,Ae=Math.sqrt(D)):(Ve=Te,ve=tt,Ae=Math.sqrt(D/2))}return new de(Ve/Ae,ve/Ae)}const re=[];for(let ue=0,ge=j.length,F=ge-1,Ve=ue+1;ue<ge;ue++,F++,Ve++)F===ge&&(F=0),Ve===ge&&(Ve=0),re[ue]=X(j[ue],j[F],j[Ve]);const he=[];let _e,we=re.concat();for(let ue=0,ge=B.length;ue<ge;ue++){const F=B[ue];_e=[];for(let Ve=0,ve=F.length,Ae=ve-1,Te=Ve+1;Ve<ve;Ve++,Ae++,Te++)Ae===ve&&(Ae=0),Te===ve&&(Te=0),_e[Ve]=X(F[Ve],F[Ae],F[Te]);he.push(_e),we=we.concat(_e)}for(let ue=0;ue<b;ue++){const ge=ue/b,F=v*Math.cos(ge*Math.PI/2),Ve=_*Math.sin(ge*Math.PI/2)+T;for(let ve=0,Ae=j.length;ve<Ae;ve++){const Te=te(j[ve],re[ve],Ve);Ee(Te.x,Te.y,-F)}for(let ve=0,Ae=B.length;ve<Ae;ve++){const Te=B[ve];_e=he[ve];for(let tt=0,Ue=Te.length;tt<Ue;tt++){const O=te(Te[tt],_e[tt],Ve);Ee(O.x,O.y,-F)}}}const Je=_+T;for(let ue=0;ue<V;ue++){const ge=g?te(w[ue],we[ue],Je):w[ue];A?(L.copy(I.normals[0]).multiplyScalar(ge.x),R.copy(I.binormals[0]).multiplyScalar(ge.y),z.copy(E[0]).add(L).add(R),Ee(z.x,z.y,z.z)):Ee(ge.x,ge.y,0)}for(let ue=1;ue<=p;ue++)for(let ge=0;ge<V;ge++){const F=g?te(w[ge],we[ge],Je):w[ge];A?(L.copy(I.normals[ue]).multiplyScalar(F.x),R.copy(I.binormals[ue]).multiplyScalar(F.y),z.copy(E[ue]).add(L).add(R),Ee(z.x,z.y,z.z)):Ee(F.x,F.y,m/p*ue)}for(let ue=b-1;ue>=0;ue--){const ge=ue/b,F=v*Math.cos(ge*Math.PI/2),Ve=_*Math.sin(ge*Math.PI/2)+T;for(let ve=0,Ae=j.length;ve<Ae;ve++){const Te=te(j[ve],re[ve],Ve);Ee(Te.x,Te.y,m+F)}for(let ve=0,Ae=B.length;ve<Ae;ve++){const Te=B[ve];_e=he[ve];for(let tt=0,Ue=Te.length;tt<Ue;tt++){const O=te(Te[tt],_e[tt],Ve);A?Ee(O.x,O.y+E[p-1].y,E[p-1].x+F):Ee(O.x,O.y,m+F)}}}ee(),me();function ee(){const ue=a.length/3;if(g){let ge=0,F=V*ge;for(let Ve=0;Ve<J;Ve++){const ve=k[Ve];Ye(ve[2]+F,ve[1]+F,ve[0]+F)}ge=p+b*2,F=V*ge;for(let Ve=0;Ve<J;Ve++){const ve=k[Ve];Ye(ve[0]+F,ve[1]+F,ve[2]+F)}}else{for(let ge=0;ge<J;ge++){const F=k[ge];Ye(F[2],F[1],F[0])}for(let ge=0;ge<J;ge++){const F=k[ge];Ye(F[0]+V*p,F[1]+V*p,F[2]+V*p)}}i.addGroup(ue,a.length/3-ue,0)}function me(){const ue=a.length/3;let ge=0;Oe(j,ge),ge+=j.length;for(let F=0,Ve=B.length;F<Ve;F++){const ve=B[F];Oe(ve,ge),ge+=ve.length}i.addGroup(ue,a.length/3-ue,1)}function Oe(ue,ge){let F=ue.length;for(;--F>=0;){const Ve=F;let ve=F-1;ve<0&&(ve=ue.length-1);for(let Ae=0,Te=p+b*2;Ae<Te;Ae++){const tt=V*Ae,Ue=V*(Ae+1),O=ge+Ve+tt,D=ge+ve+tt,Z=ge+ve+Ue,oe=ge+Ve+Ue;et(O,D,Z,oe)}}}function Ee(ue,ge,F){c.push(ue),c.push(ge),c.push(F)}function Ye(ue,ge,F){Ze(ue),Ze(ge),Ze(F);const Ve=a.length/3,ve=S.generateTopUV(i,a,Ve-3,Ve-2,Ve-1);je(ve[0]),je(ve[1]),je(ve[2])}function et(ue,ge,F,Ve){Ze(ue),Ze(ge),Ze(Ve),Ze(ge),Ze(F),Ze(Ve);const ve=a.length/3,Ae=S.generateSideWallUV(i,a,ve-6,ve-3,ve-2,ve-1);je(Ae[0]),je(Ae[1]),je(Ae[3]),je(Ae[1]),je(Ae[2]),je(Ae[3])}function Ze(ue){a.push(c[ue*3+0]),a.push(c[ue*3+1]),a.push(c[ue*3+2])}function je(ue){s.push(ue.x),s.push(ue.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 Q6(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 Vg[a.type]().fromJSON(a)),new N0(i,e.options)}}const j6={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 de(s,l),new de(u,c),new de(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],m=e[i*3+2],g=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 de(l,1-c),new de(h,1-m),new de(g,1-_),new de(T,1-y)]:[new de(u,1-c),new de(p,1-m),new de(v,1-_),new de(b,1-y)]}};function Q6(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 I0 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 I0(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 z0 extends Mt{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 m=e;const g=(t-e)/a,v=new P,_=new de;for(let T=0;T<=a;T++){for(let b=0;b<=i;b++){const y=s+b/i*l;v.x=m*Math.cos(y),v.y=m*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)}m+=g}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 Ke(c,3)),this.setAttribute("normal",new Ke(h,3)),this.setAttribute("uv",new Ke(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new z0(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class O0 extends Mt{constructor(e=new El([new de(0,.5),new de(-.5,-.5),new de(.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 Ke(a,3)),this.setAttribute("normal",new Ke(s,3)),this.setAttribute("uv",new Ke(l,2));function h(p){const m=a.length/3,g=p.extractPoints(t);let v=g.shape;const _=g.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]+m,A=S[1]+m,I=S[2]+m;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 K6(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 O0(i,e.curveSegments)}}function K6(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 Mt{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=[],m=new P,g=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;m.x=-e*Math.cos(a+R*s)*Math.sin(l+E*u),m.y=e*Math.cos(l+E*u),m.z=e*Math.sin(a+R*s)*Math.sin(l+E*u),_.push(m.x,m.y,m.z),g.copy(m).normalize(),T.push(g.x,g.y,g.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 Ke(_,3)),this.setAttribute("normal",new Ke(T,3)),this.setAttribute("uv",new Ke(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 P0 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 P0(e.radius,e.detail)}}class B0 extends Mt{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,m=new P,g=new P;for(let v=0;v<=i;v++)for(let _=0;_<=a;_++){const T=_/a*s,b=v/i*Math.PI*2;m.x=(e+t*Math.cos(b))*Math.cos(T),m.y=(e+t*Math.cos(b))*Math.sin(T),m.z=t*Math.sin(b),u.push(m.x,m.y,m.z),p.x=e*Math.cos(T),p.y=e*Math.sin(T),g.subVectors(m,p).normalize(),c.push(g.x,g.y,g.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 Ke(u,3)),this.setAttribute("normal",new Ke(c,3)),this.setAttribute("uv",new Ke(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new B0(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class F0 extends Mt{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=[],m=new P,g=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);m.x=v.x+(L*y.x+z*T.x),m.y=v.y+(L*y.y+z*T.y),m.z=v.z+(L*y.z+z*T.z),c.push(m.x,m.y,m.z),g.subVectors(m,v).normalize(),h.push(g.x,g.y,g.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 Ke(c,3)),this.setAttribute("normal",new Ke(h,3)),this.setAttribute("uv",new Ke(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 F0(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class H0 extends Mt{constructor(e=new Ub(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 de;let p=new P;const m=[],g=[],v=[],_=[];T(),this.setIndex(_),this.setAttribute("position",new Ke(m,3)),this.setAttribute("normal",new Ke(g,3)),this.setAttribute("uv",new Ke(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(),g.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,m.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 H0(new Vg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class sU extends Mt{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 m=c[h],g=m.start,v=m.count;for(let _=g,T=g+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),ow(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,m=3*u+(h+1)%3;a.fromBufferAttribute(l,p),s.fromBufferAttribute(l,m),ow(a,s,i)===!0&&(t.push(a.x,a.y,a.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ke(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function ow(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 lw=Object.freeze({__proto__:null,BoxGeometry:Vl,CapsuleGeometry:C0,CircleGeometry:R0,ConeGeometry:D0,CylinderGeometry:Wc,DodecahedronGeometry:U0,EdgesGeometry:tU,ExtrudeGeometry:N0,IcosahedronGeometry:I0,LatheGeometry:ud,OctahedronGeometry:cd,PlaneGeometry:kc,PolyhedronGeometry:To,RingGeometry:z0,ShapeGeometry:O0,SphereGeometry:fd,TetrahedronGeometry:P0,TorusGeometry:B0,TorusKnotGeometry:F0,TubeGeometry:H0,WireframeGeometry:sU});class rU extends Mi{static get type(){return"ShadowMaterial"}constructor(e){super(),this.isShadowMaterial=!0,this.color=new He(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 oU extends ss{static get type(){return"RawShaderMaterial"}constructor(e){super(e),this.isRawShaderMaterial=!0}}class Nb extends Mi{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new He(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 He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new de(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 lU extends Nb{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 de(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 He(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 He(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new He(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 uU extends Mi{static get type(){return"MeshPhongMaterial"}constructor(e){super(),this.isMeshPhongMaterial=!0,this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new de(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=ad,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 cU extends Mi{static get type(){return"MeshToonMaterial"}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new He(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new de(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 fU 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 de(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 hU extends Mi{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new de(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=ad,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 dU extends Mi{static get type(){return"MeshMatcapMaterial"}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new He(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bo,this.normalScale=new de(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 pU 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 mU(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function gU(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 Zx(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 Ib(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 J6(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(),m=[],g=[];for(let v=0;v<h.times.length;++v){const _=h.times[v]*a;if(!(_<t||_>=i)){m.push(h.times[v]);for(let T=0;T<p;++T)g.push(h.values[v*p+T])}}m.length!==0&&(h.times=ml(m,h.times.constructor),h.values=ml(g,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 $6(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 m=u.getValueSize();u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);let g=0;const v=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);const _=u.times.length-1;let T;if(s<=u.times[0]){const y=p,S=m-p;T=u.values.slice(y,S)}else if(s>=u.times[_]){const y=_*m+p,S=y+m-p;T=u.values.slice(y,S)}else{const y=u.createInterpolant(),S=p,E=m-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+g;if(c==="quaternion")Qi.multiplyQuaternionsFlat(h.values,S,T,0,h.values,S);else{const E=v-g*2;for(let A=0;A<E;++A)h.values[S+A]-=T[A]}}}return n.blendMode=db,n}const eV={convertArray:ml,isTypedArray:mU,getKeyframeOrder:gU,sortedArray:Zx,flattenJSON:Ib,subclip:J6,makeClipAdditive:$6};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 vU 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 Nh: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 Nh: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,m=this._offsetNext,g=this._weightPrev,v=this._weightNext,_=(i-t)/(a-t),T=_*_,b=T*_,y=-g*b+2*g*T-g*_,S=(1+g)*b+(-1.5-2*g)*T+(-.5+g)*_+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[m+I];return s}}class zb 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),m=1-p;for(let g=0;g!==u;++g)s[g]=l[h+g]*m+l[c+g]*p;return s}}class yU extends hd{constructor(e,t,i,a){super(e,t,i,a)}interpolate_(e){return this.copySampleValue_(e-1)}}class ls{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 yU(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new zb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vU(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Lh:t=this.InterpolantFactoryMethodDiscrete;break;case Bg:t=this.InterpolantFactoryMethodLinear;break;case Em: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 Lh;case this.InterpolantFactoryMethodLinear:return Bg;case this.InterpolantFactoryMethodSmooth:return Em}}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&&mU(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()===Em,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 m=u*i,g=m-i,v=m+i;for(let _=0;_!==i;++_){const T=t[m+_];if(T!==t[g+_]||T!==t[v+_]){c=!0;break}}}if(c){if(u!==l){e[l]=e[u];const m=u*i,g=l*i;for(let v=0;v!==i;++v)t[g+v]=t[m+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}}ls.prototype.TimeBufferType=Float32Array;ls.prototype.ValueBufferType=Float32Array;ls.prototype.DefaultInterpolation=Bg;class Gl extends ls{constructor(e,t,i){super(e,t,i)}}Gl.prototype.ValueTypeName="bool";Gl.prototype.ValueBufferType=Array;Gl.prototype.DefaultInterpolation=Lh;Gl.prototype.InterpolantFactoryMethodLinear=void 0;Gl.prototype.InterpolantFactoryMethodSmooth=void 0;class Ob extends ls{}Ob.prototype.ValueTypeName="color";class Vh extends ls{}Vh.prototype.ValueTypeName="number";class _U 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 ls{InterpolantFactoryMethodLinear(e){return new _U(this.times,this.values,this.getValueSize(),e)}}dd.prototype.ValueTypeName="quaternion";dd.prototype.InterpolantFactoryMethodSmooth=void 0;class Wl extends ls{constructor(e,t,i){super(e,t,i)}}Wl.prototype.ValueTypeName="string";Wl.prototype.ValueBufferType=Array;Wl.prototype.DefaultInterpolation=Lh;Wl.prototype.InterpolantFactoryMethodLinear=void 0;Wl.prototype.InterpolantFactoryMethodSmooth=void 0;class kh extends ls{}kh.prototype.ValueTypeName="vector";class Gh{constructor(e="",t=-1,i=[],a=y0){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(nV(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(ls.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=gU(c);c=Zx(c,1,p),h=Zx(h,1,p),!a&&c[0]===0&&(c.push(s),h.push(h[0])),l.push(new Vh(".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 m=p[1];let g=a[m];g||(a[m]=g=[]),g.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(m,g,v,_,T){if(v.length!==0){const b=[],y=[];Ib(v,b,y,_),b.length!==0&&T.push(new m(g,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 m=0;m<h.length;m++){const g=h[m].keys;if(!(!g||g.length===0))if(g[0].morphTargets){const v={};let _;for(_=0;_<g.length;_++)if(g[_].morphTargets)for(let T=0;T<g[_].morphTargets.length;T++)v[g[_].morphTargets[T]]=-1;for(const T in v){const b=[],y=[];for(let S=0;S!==g[_].morphTargets.length;++S){const E=g[_];b.push(E.time),y.push(E.morphTarget===T?1:0)}a.push(new Vh(".morphTargetInfluence["+T+"]",b,y))}c=v.length*l}else{const v=".bones["+t[m].name+"]";i(kh,v+".position",g,"pos",a),i(dd,v+".quaternion",g,"rot",a),i(kh,v+".scale",g,"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 tV(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Vh;case"vector":case"vector2":case"vector3":case"vector4":return kh;case"color":return Ob;case"quaternion":return dd;case"bool":case"boolean":return Gl;case"string":return Wl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function nV(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=tV(n.type);if(n.times===void 0){const t=[],i=[];Ib(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 Pb{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,m){return h.push(p,m),this},this.removeHandler=function(p){const m=h.indexOf(p);return m!==-1&&h.splice(m,2),this},this.getHandler=function(p){for(let m=0,g=h.length;m<g;m+=2){const v=h[m],_=h[m+1];if(v.global&&(v.lastIndex=0),v.test(p))return _}return null}}}const xU=new Pb;class $i{constructor(e){this.manager=e!==void 0?e:xU,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 iV 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],m=h.body.getReader(),g=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),v=g?parseInt(g):0,_=v!==0;let T=0;const b=new ReadableStream({start(y){S();function S(){m.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 iV(`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 m=/charset="?([^;"\s]*)"?/i.exec(u),g=m&&m[1]?m[1].toLowerCase():void 0,v=new TextDecoder(g);return h.arrayBuffer().then(_=>v.decode(_))}}}).then(h=>{rr.add(e,h);const p=Ks[e];delete Ks[e];for(let m=0,g=p.length;m<g;m++){const v=p[m];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 m=0,g=p.length;m<g;m++){const v=p[m];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 aV 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=Gh.parse(e[i]);t.push(a)}return t}}class sV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=[],u=new A0,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(m){c.load(e[m],function(g){const v=s.parse(g,!0);l[m]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},h+=1,h===6&&(v.mipmapCount===1&&(u.minFilter=Wn),u.image=l,u.format=v.format,u.needsUpdate=!0,t&&t(u))},i,a)}if(Array.isArray(e))for(let m=0,g=e.length;m<g;++m)p(m);else c.load(e,function(m){const g=s.parse(m,!0);if(g.isCubemap){const v=g.mipmaps.length/g.mipmapCount;for(let _=0;_<v;_++){l[_]={mipmaps:[]};for(let T=0;T<g.mipmapCount;T++)l[_].mipmaps.push(g.mipmaps[_*g.mipmapCount+T]),l[_].format=g.format,l[_].width=g.width,l[_].height=g.height}u.image=l}else u.image.width=g.width,u.image.height=g.height,u.mipmaps=g.mipmaps;g.mipmapCount===1&&(u.minFilter=Wn),u.format=g.format,u.needsUpdate=!0,t&&t(u)},i,a);return u}}class Wh 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=Oh("img");function c(){p(),rr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(m){p(),a&&a(m),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 rV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=new od;s.colorSpace=xi;const l=new Wh(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 oV 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:Wn,l.minFilter=h.minFilter!==void 0?h.minFilter:Wn,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=Wn),h.generateMipmaps!==void 0&&(l.generateMipmaps=h.generateMipmaps),l.needsUpdate=!0,t&&t(l,h)},i,a),l}}class lV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=new Mn,l=new Wh(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 He(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 SU 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 He(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const R_=new ct,uw=new P,cw=new P;class Bb{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new de(512,512),this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ld,this._frameExtents=new de(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;uw.setFromMatrixPosition(e.matrixWorld),t.position.copy(uw),cw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(cw),t.updateMatrixWorld(),R_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(R_),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(R_)}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 uV extends Bb{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=wc*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 bU 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 uV}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 fw=new ct,zf=new P,D_=new P;class cV extends Bb{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new de(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()),zf.setFromMatrixPosition(e.matrixWorld),i.position.copy(zf),D_.copy(i.position),D_.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(D_),i.updateMatrixWorld(),a.makeTranslation(-zf.x,-zf.y,-zf.z),fw.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fw)}}class MU 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 cV}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 fV extends Bb{constructor(){super(new kl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class EU 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 fV}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class TU extends Ao{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class AU 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 wU{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 CU extends Ao{constructor(e=new wU,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 V0 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 He().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 He().setHex(l.value);break;case"v2":a.uniforms[s].value=new de().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 yt().fromArray(l.value);break;case"m4":a.uniforms[s].value=new ct().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 de().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 de().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 V0.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:rU,SpriteMaterial:Eb,RawShaderMaterial:oU,ShaderMaterial:ss,PointsMaterial:Ab,MeshPhysicalMaterial:lU,MeshStandardMaterial:Nb,MeshPhongMaterial:uU,MeshToonMaterial:cU,MeshNormalMaterial:fU,MeshLambertMaterial:hU,MeshDepthMaterial:Sb,MeshDistanceMaterial:bb,MeshBasicMaterial:Eo,MeshMatcapMaterial:dU,LineDashedMaterial:pU,LineBasicMaterial:Ni,Material:Mi};return new t[e]}}class jx{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 RU extends Mt{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 DU 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=ic(b.type,y),E=new E0(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 RU:new Mt,u=e.data.index;if(u!==void 0){const v=ic(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=ic(_.type,_.array),y=_.isInstancedBufferAttribute?Dc: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=ic(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 m=e.data.groups||e.data.drawcalls||e.data.offsets;if(m!==void 0)for(let v=0,_=m.length;v!==_;++v){const T=m[v];l.addGroup(T.start,T.count,T.materialIndex)}const g=e.data.boundingSphere;if(g!==void 0){const v=new P;g.center!==void 0&&v.fromArray(g.center),l.boundingSphere=new bi(v,g.radius)}return e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}class hV extends $i{constructor(e){super(e)}load(e,t,i,a){const s=this,l=this.path===""?jx.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(m){a!==void 0&&a(m),console.error("THREE:ObjectLoader: Can't parse "+e+".",m.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===""?jx.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 m=!1;for(const g in l)if(l[g].data instanceof HTMLImageElement){m=!0;break}m===!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 T0().fromJSON(e[s],a);i[u.uuid]=u}return i}parseGeometries(e,t){const i={};if(e!==void 0){const a=new DU;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 lw?u=lw[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 V0;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=Gh.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:ic(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new Pb(t);s=new Wh(c),s.setCrossOrigin(this.crossOrigin);for(let h=0,p=e.length;h<p;h++){const m=e[h],g=m.url;if(Array.isArray(g)){const v=[];for(let _=0,T=g.length;_<T;_++){const b=g[_],y=u(b);y!==null&&(y instanceof HTMLImageElement?v.push(y):v.push(new Es(y.data,y.width,y.height)))}a[m.uuid]=new pl(v)}else{const v=u(m.url);a[m.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:ic(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){a=new Wh(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 m=0,g=h.length;m<g;m++){const v=h[m],_=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 od,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,dV)),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],hw),p.wrapT=i(u.wrap[1],hw)),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,dw)),u.magFilter!==void 0&&(p.magFilter=i(u.magFilter,dw)),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(g){return t[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",g),t[g]}function c(g){if(g!==void 0){if(Array.isArray(g)){const v=[];for(let _=0,T=g.length;_<T;_++){const b=g[_];i[b]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",b),v.push(i[b])}return v}return i[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),i[g]}}function h(g){return a[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",g),a[g]}let p,m;switch(e.type){case"Scene":l=new Mb,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new He(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 M0(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new b0(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 Bn(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 kl(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 TU(e.color,e.intensity);break;case"DirectionalLight":l=new EU(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new MU(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new AU(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new bU(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"";break;case"HemisphereLight":l=new SU(e.color,e.groundColor,e.intensity);break;case"LightProbe":l=new CU().fromJSON(e);break;case"SkinnedMesh":p=u(e.geometry),m=c(e.material),l=new XD(p,m),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),m=c(e.material),l=new Hn(p,m);break;case"InstancedMesh":p=u(e.geometry),m=c(e.material);const g=e.count,v=e.instanceMatrix,_=e.instanceColor;l=new qD(p,m,g),l.instanceMatrix=new Dc(new Float32Array(v.array),16),_!==void 0&&(l.instanceColor=new Dc(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":p=u(e.geometry),m=c(e.material),l=new YD(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,m),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 WD;break;case"Line":l=new _o(u(e.geometry),c(e.material));break;case"LineLoop":l=new ZD(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 jD(u(e.geometry),c(e.material));break;case"Sprite":l=new GD(c(e.material));break;case"Group":l=new sc;break;case"Bone":l=new Tb;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 g=e.children;for(let v=0;v<g.length;v++)l.add(this.parseObject(g[v],t,i,a,s))}if(e.animations!==void 0){const g=e.animations;for(let v=0;v<g.length;v++){const _=g[v];l.animations.push(s[_])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const g=e.levels;for(let v=0;v<g.length;v++){const _=g[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 dV={UVMapping:f0,CubeReflectionMapping:yr,CubeRefractionMapping:yo,EquirectangularReflectionMapping:Ch,EquirectangularRefractionMapping:Rh,CubeUVReflectionMapping:Fc},hw={RepeatWrapping:Dh,ClampToEdgeWrapping:Ba,MirroredRepeatWrapping:Uh},dw={NearestFilter:di,NearestMipmapNearestFilter:ib,NearestMipmapLinearFilter:nc,LinearFilter:Wn,LinearMipmapNearestFilter:ah,LinearMipmapLinearFilter:xs};class pV 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 em;class Fb{static getContext(){return em===void 0&&(em=new(window.AudioContext||window.webkitAudioContext)),em}static setContext(e){em=e}}class mV 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);Fb.getContext().decodeAudioData(h,function(m){t(m)}).catch(u)}catch(h){u(h)}},i,a);function u(c){a?a(c):console.error(c),s.manager.itemError(e)}}}const pw=new ct,mw=new ct,el=new ct;class gV{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Bn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Bn,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;mw.elements[12]=-a,pw.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(mw),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(pw)}}class Hb{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gw(),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=gw();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function gw(){return performance.now()}const tl=new P,vw=new Qi,vV=new P,nl=new P;class yV extends Bt{constructor(){super(),this.type="AudioListener",this.context=Fb.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Hb}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,vw,vV),nl.set(0,0,-1).applyQuaternion(vw),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 UU 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,yw=new Qi,_V=new P,al=new P;class xV extends UU{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,yw,_V),al.set(0,0,1).applyQuaternion(yw);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 SV{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 LU{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 Vb="\\[\\]\\.:\\/",bV=new RegExp("["+Vb+"]","g"),kb="[^"+Vb+"]",MV="[^"+Vb.replace("\\.","")+"]",EV=/((?:WC+[\/:])*)/.source.replace("WC",kb),TV=/(WCOD+)?/.source.replace("WCOD",MV),AV=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kb),wV=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kb),CV=new RegExp("^"+EV+TV+AV+wV+"$"),RV=["material","materials","bones","map"];class DV{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(bV,"")}static parseTrackName(e){const t=CV.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);RV.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=DV;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 UV{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,m=arguments.length;p!==m;++p){const g=arguments[p],v=g.uuid;let _=t[v];if(_===void 0){_=c++,t[v]=_,e.push(g);for(let T=0,b=l;T!==b;++T)s[T].push(new Ot(g,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]=g;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(g,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 m=s++,g=e[m];t[g.uuid]=p,e[p]=g,t[h]=m,e[m]=c;for(let v=0,_=a;v!==_;++v){const T=i[v],b=T[m],y=T[p];T[p]=b,T[m]=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,m=t[p];if(m!==void 0)if(delete t[p],m<s){const g=--s,v=e[g],_=--l,T=e[_];t[v.uuid]=m,e[m]=v,t[T.uuid]=g,e[g]=T,e.pop();for(let b=0,y=a;b!==y;++b){const S=i[b],E=S[g],A=S[_];S[m]=E,S[g]=A,S.pop()}}else{const g=--l,v=e[g];g>0&&(t[v.uuid]=m),e[m]=v,e.pop();for(let _=0,T=a;_!==T;++_){const b=i[_];b[m]=b[g],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_,m=new Array(h);a=s.length,i[e]=a,l.push(e),u.push(t),s.push(m);for(let g=p,v=c.length;g!==v;++g){const _=c[g];m[g]=new Ot(_,e,t)}return m}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 NU{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=dD,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 db:for(let p=0,m=c.length;p!==m;++p)c[p].evaluate(l),h[p].accumulateAdditive(u);break;case y0:default:for(let p=0,m=c.length;p!==m;++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===pD;if(e===0)return s===-1?a:l&&(s&1)===1?t-a:a;if(i===hD){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=Nh,t?a.endingEnd=this.zeroSlopeAtEnd?dl:hl:a.endingEnd=Nh)}_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 LV=new Float32Array(1);class NV 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 m=0;m!==s;++m){const g=a[m],v=g.name;let _=p[v];if(_!==void 0)++_.referenceCount,l[m]=_;else{if(_=l[m],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,c,v));continue}const T=t&&t._propertyBindings[m].binding.parsedPath;_=new LU(Ot.create(i,v,T),g.ValueTypeName,g.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,c,v),l[m]=_}u[m].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 m=u.actionByRoot,g=(e._localRoot||this._root).uuid;delete m[g],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 zb(new Float32Array(2),new Float32Array(2),1,LV),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"?Gh.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=y0),c!==void 0){const m=c.actionByRoot[s];if(m!==void 0&&m.blendMode===i)return m;h=c.knownActions[0],l===null&&(l=h._clip)}if(l===null)return null;const p=new NU(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"?Gh.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,m=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,m._cacheIndex=p,t[p]=m,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 Gb{constructor(e){this.value=e}clone(){return new Gb(this.value.clone===void 0?this.value:this.value.clone())}}let IV=0;class zV extends Cs{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:IV++}),this.name="",this.usage=Ih,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 OV extends E0{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 PV{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 _w=new ct;class IU{constructor(e,t,i=0,a=1/0){this.ray=new Vc(e,t),this.near=i,this.far=a,this.camera=null,this.layers=new Cc,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 _w.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_w),this}intersectObject(e,t=!0,i=[]){return Qx(e,this,i,t),i.sort(xw),i}intersectObjects(e,t=!0,i=[]){for(let a=0,s=e.length;a<s;a++)Qx(e[a],this,i,t);return i.sort(xw),i}}function xw(n,e){return n.distance-e.distance}function Qx(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++)Qx(s[l],e,t,!0)}}class BV{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 FV{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 Wb{constructor(e,t,i,a){Wb.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 Sw=new de;class HV{constructor(e=new de(1/0,1/0),t=new de(-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=Sw.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,Sw).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 bw=new P,tm=new P;class VV{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){bw.subVectors(e,this.start),tm.subVectors(this.end,this.start);const i=tm.dot(tm);let s=tm.dot(bw)/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 Mw=new P;class kV extends Bt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Mt,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 Ke(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),Mw.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Mw),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Gr=new P,nm=new ct,U_=new ct;class GV extends Rs{constructor(e){const t=zU(e),i=new Mt,a=[],s=[],l=new He(0,0,1),u=new He(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 Ke(a,3)),i.setAttribute("color",new Ke(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");U_.copy(this.root.matrixWorld).invert();for(let s=0,l=0;s<t.length;s++){const u=t[s];u.parent&&u.parent.isBone&&(nm.multiplyMatrices(U_,u.matrixWorld),Gr.setFromMatrixPosition(nm),a.setXYZ(l,Gr.x,Gr.y,Gr.z),nm.multiplyMatrices(U_,u.parent.matrixWorld),Gr.setFromMatrixPosition(nm),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 zU(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,zU(n.children[t]));return e}class WV extends Hn{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 XV=new P,Ew=new He,Tw=new He;class qV 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 Hn(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");Ew.copy(this.light.color),Tw.copy(this.light.groundColor);for(let i=0,a=t.count;i<a;i++){const s=i<a/2?Ew:Tw;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(XV.setFromMatrixPosition(this.light.matrixWorld).negate())}}class YV extends Rs{constructor(e=10,t=10,i=4473924,a=8947848){i=new He(i),a=new He(a);const s=t/2,l=e/t,u=e/2,c=[],h=[];for(let g=0,v=0,_=-u;g<=t;g++,_+=l){c.push(-u,0,_,u,0,_),c.push(_,0,-u,_,0,u);const T=g===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 Mt;p.setAttribute("position",new Ke(c,3)),p.setAttribute("color",new Ke(h,3));const m=new Ni({vertexColors:!0,toneMapped:!1});super(p,m),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class ZV extends Rs{constructor(e=10,t=16,i=8,a=64,s=4473924,l=8947848){s=new He(s),l=new He(l);const u=[],c=[];if(t>1)for(let m=0;m<t;m++){const g=m/t*(Math.PI*2),v=Math.sin(g)*e,_=Math.cos(g)*e;u.push(0,0,0),u.push(v,0,_);const T=m&1?s:l;c.push(T.r,T.g,T.b),c.push(T.r,T.g,T.b)}for(let m=0;m<i;m++){const g=m&1?s:l,v=e-e/i*m;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(g.r,g.g,g.b),T=(_+1)/a*(Math.PI*2),b=Math.sin(T)*v,y=Math.cos(T)*v,u.push(b,0,y),c.push(g.r,g.g,g.b)}}const h=new Mt;h.setAttribute("position",new Ke(u,3)),h.setAttribute("color",new Ke(c,3));const p=new Ni({vertexColors:!0,toneMapped:!1});super(h,p),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Aw=new P,im=new P,ww=new P;class jV 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 Mt;a.setAttribute("position",new Ke([-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 Mt,a.setAttribute("position",new Ke([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),Aw.setFromMatrixPosition(this.light.matrixWorld),im.setFromMatrixPosition(this.light.target.matrixWorld),ww.subVectors(im,Aw),this.lightPlane.lookAt(im),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(im),this.targetLine.scale.z=ww.length()}}const am=new P,_n=new x0;class QV extends Rs{constructor(e){const t=new Mt,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 Ke(a,3)),t.setAttribute("color",new Ke(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 He(16755200),p=new He(16711680),m=new He(43775),g=new He(16777215),v=new He(3355443);this.setColors(h,p,m,g,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){am.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],am.x,am.y,am.z)}}const sm=new Li;class KV 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 Mt;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&&sm.setFromObject(this.object),sm.isEmpty())return;const t=sm.min,i=sm.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 JV 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 Mt;s.setIndex(new tn(i,1)),s.setAttribute("position",new Ke(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 $V 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 Mt;l.setAttribute("position",new Ke(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 Mt;c.setAttribute("position",new Ke(u,3)),c.computeBoundingSphere(),this.add(new Hn(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 Cw=new P;let rm,L_;class ek 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",rm===void 0&&(rm=new Mt,rm.setAttribute("position",new Ke([0,0,0,0,1,0],3)),L_=new Wc(0,.5,1,5,1),L_.translate(0,-.5,0)),this.position.copy(t),this.line=new _o(rm,new Ni({color:a,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Hn(L_,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{Cw.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Cw,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 tk 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 Mt;a.setAttribute("position",new Ke(t,3)),a.setAttribute("color",new Ke(i,3));const s=new Ni({vertexColors:!0,toneMapped:!1});super(a,s),this.type="AxesHelper"}setColors(e,t,i){const a=new He,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 nk{constructor(){this.type="ShapePath",this.color=new He,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ph,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 m=[],g=[];let v=[],_=0,T;g[_]=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&&g[_]&&_++,g[_]={s:new El,p:T},g[_].s.curves=u.curves,p&&_++,v[_]=[]):v[_].push({h:u,p:T[0]});if(!g[0])return t(s);if(g.length>1){let y=!1,S=0;for(let E=0,A=g.length;E<A;E++)m[E]=[];for(let E=0,A=g.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<g.length;C++)i(L.p,g[C].p)&&(E!==C&&S++,z?(z=!1,m[C].push(L)):y=!0);z&&m[E].push(L)}}S>0&&y===!1&&(v=m)}let b;for(let y=0,S=g.length;y<S;y++){c=g[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 ik 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 ak extends as{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:u0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=u0);const sk=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:nb,AddEquation:Kr,AddOperation:aD,AdditiveAnimationBlendMode:db,AdditiveBlending:Ox,AgXToneMapping:uD,AlphaFormat:ob,AlwaysCompare:ED,AlwaysDepth:rg,AlwaysStencilFunc:Hx,AmbientLight:TU,AnimationAction:NU,AnimationClip:Gh,AnimationLoader:aV,AnimationMixer:NV,AnimationObjectGroup:UV,AnimationUtils:eV,ArcCurve:QD,ArrayCamera:HD,ArrowHelper:ek,AttachedBindMode:Fx,Audio:UU,AudioAnalyser:SV,AudioContext:Fb,AudioListener:yV,AudioLoader:mV,AxesHelper:tk,BackSide:Ui,BasicDepthPacking:mD,BasicShadowMap:B3,BatchedMesh:YD,Bone:Tb,BooleanKeyframeTrack:Gl,Box2:HV,Box3:Li,Box3Helper:JV,BoxGeometry:Vl,BoxHelper:KV,BufferAttribute:tn,BufferGeometry:Mt,BufferGeometryLoader:DU,ByteType:ab,Cache:rr,Camera:x0,CameraHelper:QV,CanvasTexture:E6,CapsuleGeometry:C0,CatmullRomCurve3:KD,CineonToneMapping:oD,CircleGeometry:R0,ClampToEdgeWrapping:Ba,Clock:Hb,Color:He,ColorKeyframeTrack:Ob,ColorManagement:Ut,CompressedArrayTexture:b6,CompressedCubeTexture:M6,CompressedTexture:A0,CompressedTextureLoader:sV,ConeGeometry:D0,ConstantAlphaFactor:tD,ConstantColorFactor:$3,Controls:ik,CubeCamera:LD,CubeReflectionMapping:yr,CubeRefractionMapping:yo,CubeTexture:od,CubeTextureLoader:rV,CubeUVReflectionMapping:Fc,CubicBezierCurve:Cb,CubicBezierCurve3:JD,CubicInterpolant:vU,CullFaceBack:zx,CullFaceFront:P3,CullFaceFrontBack:JO,CullFaceNone:O3,Curve:os,CurvePath:eU,CustomBlending:F3,CustomToneMapping:lD,CylinderGeometry:Wc,Cylindrical:FV,Data3DTexture:gb,DataArrayTexture:_0,DataTexture:Es,DataTextureLoader:oV,DataUtils:hB,DecrementStencilOp:hP,DecrementWrapStencilOp:pP,DefaultLoadingManager:xU,DepthFormat:bl,DepthStencilFormat:Ll,DepthTexture:xb,DetachedBindMode:fD,DirectionalLight:EU,DirectionalLightHelper:jV,DiscreteInterpolant:yU,DodecahedronGeometry:U0,DoubleSide:ns,DstAlphaFactor:Z3,DstColorFactor:Q3,DynamicCopyUsage:RP,DynamicDrawUsage:MP,DynamicReadUsage:AP,EdgesGeometry:tU,EllipseCurve:w0,EqualCompare:xD,EqualDepth:lg,EqualStencilFunc:yP,EquirectangularReflectionMapping:Ch,EquirectangularRefractionMapping:Rh,Euler:ba,EventDispatcher:Cs,ExtrudeGeometry:N0,FileLoader:xr,Float16BufferAttribute:yB,Float32BufferAttribute:Ke,FloatType:Zi,Fog:M0,FogExp2:b0,FramebufferTexture:S6,FrontSide:vr,Frustum:ld,GLBufferAttribute:PV,GLSL1:UP,GLSL3:Vx,GreaterCompare:SD,GreaterDepth:cg,GreaterEqualCompare:MD,GreaterEqualDepth:ug,GreaterEqualStencilFunc:bP,GreaterStencilFunc:xP,GridHelper:YV,Group:sc,HalfFloatType:Hc,HemisphereLight:SU,HemisphereLightHelper:qV,IcosahedronGeometry:I0,ImageBitmapLoader:pV,ImageLoader:Wh,ImageUtils:wD,IncrementStencilOp:fP,IncrementWrapStencilOp:dP,InstancedBufferAttribute:Dc,InstancedBufferGeometry:RU,InstancedInterleavedBuffer:OV,InstancedMesh:qD,Int16BufferAttribute:gB,Int32BufferAttribute:vB,Int8BufferAttribute:dB,IntType:h0,InterleavedBuffer:E0,InterleavedBufferAttribute:Nl,Interpolant:hd,InterpolateDiscrete:Lh,InterpolateLinear:Bg,InterpolateSmooth:Em,InvertStencilOp:mP,KeepStencilOp:ul,KeyframeTrack:ls,LOD:WD,LatheGeometry:ud,Layers:Cc,LessCompare:_D,LessDepth:og,LessEqualCompare:pb,LessEqualDepth:Dl,LessEqualStencilFunc:_P,LessStencilFunc:vP,Light:Ao,LightProbe:CU,Line:_o,Line3:VV,LineBasicMaterial:Ni,LineCurve:Rb,LineCurve3:$D,LineDashedMaterial:pU,LineLoop:ZD,LineSegments:Rs,LinearFilter:Wn,LinearInterpolant:zb,LinearMipMapLinearFilter:nP,LinearMipMapNearestFilter:tP,LinearMipmapLinearFilter:xs,LinearMipmapNearestFilter:ah,LinearSRGBColorSpace:Mo,LinearToneMapping:sD,LinearTransfer:rd,Loader:$i,LoaderUtils:jx,LoadingManager:Pb,LoopOnce:hD,LoopPingPong:pD,LoopRepeat:dD,LuminanceAlphaFormat:cb,LuminanceFormat:ub,MOUSE:QO,Material:Mi,MaterialLoader:V0,MathUtils:ZP,Matrix2:Wb,Matrix3:yt,Matrix4:ct,MaxEquation:G3,Mesh:Hn,MeshBasicMaterial:Eo,MeshDepthMaterial:Sb,MeshDistanceMaterial:bb,MeshLambertMaterial:hU,MeshMatcapMaterial:dU,MeshNormalMaterial:fU,MeshPhongMaterial:uU,MeshPhysicalMaterial:lU,MeshStandardMaterial:Nb,MeshToonMaterial:cU,MinEquation:k3,MirroredRepeatWrapping:Uh,MixOperation:iD,MultiplyBlending:Bx,MultiplyOperation:ad,NearestFilter:di,NearestMipMapLinearFilter:eP,NearestMipMapNearestFilter:$O,NearestMipmapLinearFilter:nc,NearestMipmapNearestFilter:ib,NeutralToneMapping:cD,NeverCompare:yD,NeverDepth:sg,NeverStencilFunc:gP,NoBlending:cr,NoColorSpace:tr,NoToneMapping:Ms,NormalAnimationBlendMode:y0,NormalBlending:Sl,NotEqualCompare:bD,NotEqualDepth:fg,NotEqualStencilFunc:SP,NumberKeyframeTrack:Vh,Object3D:Bt,ObjectLoader:hV,ObjectSpaceNormalMap:vD,OctahedronGeometry:cd,OneFactor:X3,OneMinusConstantAlphaFactor:nD,OneMinusConstantColorFactor:eD,OneMinusDstAlphaFactor:j3,OneMinusDstColorFactor:K3,OneMinusSrcAlphaFactor:ag,OneMinusSrcColorFactor:Y3,OrthographicCamera:kl,PCFShadowMap:c0,PCFSoftShadowMap:ih,PMREMGenerator:kx,Path:Ph,PerspectiveCamera:Bn,Plane:qr,PlaneGeometry:kc,PlaneHelper:$V,PointLight:MU,PointLightHelper:WV,Points:jD,PointsMaterial:Ab,PolarGridHelper:ZV,PolyhedronGeometry:To,PositionalAudio:xV,PropertyBinding:Ot,PropertyMixer:LU,QuadraticBezierCurve:Db,QuadraticBezierCurve3:Ub,Quaternion:Qi,QuaternionKeyframeTrack:dd,QuaternionLinearInterpolant:_U,RED_GREEN_RGTC2_Format:Og,RED_RGTC1_Format:hb,REVISION:u0,RGBADepthPacking:gD,RGBAFormat:Si,RGBAIntegerFormat:v0,RGBA_ASTC_10x10_Format:Dg,RGBA_ASTC_10x5_Format:wg,RGBA_ASTC_10x6_Format:Cg,RGBA_ASTC_10x8_Format:Rg,RGBA_ASTC_12x10_Format:Ug,RGBA_ASTC_12x12_Format:Lg,RGBA_ASTC_4x4_Format:_g,RGBA_ASTC_5x4_Format:xg,RGBA_ASTC_5x5_Format:Sg,RGBA_ASTC_6x5_Format:bg,RGBA_ASTC_6x6_Format:Mg,RGBA_ASTC_8x5_Format:Eg,RGBA_ASTC_8x6_Format:Tg,RGBA_ASTC_8x8_Format:Ag,RGBA_BPTC_Format:uh,RGBA_ETC2_EAC_Format:yg,RGBA_PVRTC_2BPPV1_Format:mg,RGBA_PVRTC_4BPPV1_Format:pg,RGBA_S3TC_DXT1_Format:rh,RGBA_S3TC_DXT3_Format:oh,RGBA_S3TC_DXT5_Format:lh,RGBDepthPacking:oP,RGBFormat:lb,RGBIntegerFormat:iP,RGB_BPTC_SIGNED_Format:Ng,RGB_BPTC_UNSIGNED_Format:Ig,RGB_ETC1_Format:gg,RGB_ETC2_Format:vg,RGB_PVRTC_2BPPV1_Format:dg,RGB_PVRTC_4BPPV1_Format:hg,RGB_S3TC_DXT1_Format:sh,RGDepthPacking:lP,RGFormat:fb,RGIntegerFormat:g0,RawShaderMaterial:oU,Ray:Vc,Raycaster:IU,RectAreaLight:AU,RedFormat:m0,RedIntegerFormat:sd,ReinhardToneMapping:rD,RenderTarget:CD,RepeatWrapping:Dh,ReplaceStencilOp:cP,ReverseSubtractEquation:V3,RingGeometry:z0,SIGNED_RED_GREEN_RGTC2_Format:Pg,SIGNED_RED_RGTC1_Format:zg,SRGBColorSpace:xi,SRGBTransfer:Zt,Scene:Mb,ShaderChunk:bt,ShaderLib:ts,ShaderMaterial:ss,ShadowMaterial:rU,Shape:El,ShapeGeometry:O0,ShapePath:nk,ShapeUtils:Ts,ShortType:sb,Skeleton:T0,SkeletonHelper:GV,SkinnedMesh:XD,Source:pl,Sphere:bi,SphereGeometry:fd,Spherical:BV,SphericalHarmonics3:wU,SplineCurve:Lb,SpotLight:bU,SpotLightHelper:kV,Sprite:GD,SpriteMaterial:Eb,SrcAlphaFactor:ig,SrcAlphaSaturateFactor:J3,SrcColorFactor:q3,StaticCopyUsage:CP,StaticDrawUsage:Ih,StaticReadUsage:TP,StereoCamera:gV,StreamCopyUsage:DP,StreamDrawUsage:EP,StreamReadUsage:wP,StringKeyframeTrack:Wl,SubtractEquation:H3,SubtractiveBlending:Px,TOUCH:KO,TangentSpaceNormalMap:bo,TetrahedronGeometry:P0,Texture:Mn,TextureLoader:lV,TextureUtils:t6,TorusGeometry:B0,TorusKnotGeometry:F0,Triangle:Yi,TriangleFanDrawMode:rP,TriangleStripDrawMode:sP,TrianglesDrawMode:aP,TubeGeometry:H0,UVMapping:f0,Uint16BufferAttribute:vb,Uint32BufferAttribute:yb,Uint8BufferAttribute:pB,Uint8ClampedBufferAttribute:mB,Uniform:Gb,UniformsGroup:zV,UniformsLib:Le,UniformsUtils:UD,UnsignedByteType:is,UnsignedInt248Type:Ul,UnsignedInt5999Type:rb,UnsignedIntType:_r,UnsignedShort4444Type:d0,UnsignedShort5551Type:p0,UnsignedShortType:Ac,VSMShadowMap:$a,Vector2:de,Vector3:P,Vector4:Pt,VectorKeyframeTrack:kh,VideoTexture:x6,WebGL3DRenderTarget:nB,WebGLArrayRenderTarget:tB,WebGLCoordinateSystem:Ss,WebGLCubeRenderTarget:ND,WebGLMultipleRenderTargets:ak,WebGLRenderTarget:as,WebGLRenderer:VD,WebGLUtils:FD,WebGPUCoordinateSystem:zh,WireframeGeometry:sU,WrapAroundEnding:Nh,ZeroCurvatureEnding:hl,ZeroFactor:W3,ZeroSlopeEnding:dl,ZeroStencilOp:uP,createCanvasElement:AD},Symbol.toStringTag,{value:"Module"}));var OU={exports:{}},PU={};/**
* @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 k0=Fe,rk=_I;function ok(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var lk=typeof Object.is=="function"?Object.is:ok,uk=rk.useSyncExternalStore,ck=k0.useRef,fk=k0.useEffect,hk=k0.useMemo,dk=k0.useDebugValue;PU.useSyncExternalStoreWithSelector=function(n,e,t,i,a){var s=ck(null);if(s.current===null){var l={hasValue:!1,value:null};s.current=l}else l=s.current;s=hk(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 m=_}return m=v}if(_=m,lk(p,v))return _;var T=i(v);return a!==void 0&&a(_,T)?(p=v,_):(p=v,m=T)}var h=!1,p,m,g=t===void 0?null:t;return[function(){return c(e())},g===null?void 0:function(){return c(g())}]},[e,t,i,a]);var u=uk(n,s[0],s[1]);return fk(function(){l.hasValue=!0,l.value=u},[u]),dk(u),u};OU.exports=PU;var pk=OU.exports;const mk=sS(pk),Rw=n=>{let e;const t=new Set,i=(h,p)=>{const m=typeof h=="function"?h(e):h;if(!Object.is(m,e)){const g=e;e=p??(typeof m!="object"||m===null)?m:Object.assign({},e,m),t.forEach(v=>v(e,g))}},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},gk=n=>n?Rw(n):Rw,{useSyncExternalStoreWithSelector:vk}=mk,yk=n=>n;function _k(n,e=yk,t){const i=vk(n.subscribe,n.getState,n.getInitialState,e,t);return Ww.useDebugValue(i),i}const Dw=(n,e)=>{const t=gk(n),i=(a,s=e)=>_k(t,a,s);return Object.assign(i,t),i},xk=(n,e)=>n?Dw(n,e):Dw;function Xb(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const a=Xb(i,e,t);if(a)return a;i=e?null:i.sibling}}function BU(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const qb=BU(Fe.createContext(null));class FU extends Fe.Component{render(){return Fe.createElement(qb.Provider,{value:this._reactInternals},this.props.children)}}function HU(){const n=Fe.useContext(qb);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Fe.useId();return Fe.useMemo(()=>{for(const t of[n,n==null?void 0:n.alternate]){if(!t)continue;const i=Xb(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 Sk=Symbol.for("react.context"),bk=n=>n!==null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Sk;function Mk(){const n=HU(),[e]=Fe.useState(()=>new Map);e.clear();let t=n;for(;t;){const i=t.type;bk(i)&&i!==qb&&!e.has(i)&&e.set(i,Fe.use(BU(i))),t=t.return}return e}function Ek(){const n=Mk();return Fe.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>Fe.createElement(e,null,Fe.createElement(t.Provider,{...i,value:n.get(t)})),e=>Fe.createElement(FU,{...e})),[n])}function VU(n){let e=n.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const kU=n=>n&&n.isOrthographicCamera,Tk=n=>n&&n.hasOwnProperty("current"),Ak=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"))()?Fe.useLayoutEffect:Fe.useEffect;function GU(n){const e=Fe.useRef(n);return pd(()=>void(e.current=n),[n]),e}function wk(){const n=HU(),e=Ek();return Fe.useMemo(()=>({children:t})=>{const a=!!Xb(n,!0,s=>s.type===Fe.StrictMode)?Fe.StrictMode:Fe.Fragment;return fa.jsx(a,{children:fa.jsx(e,{children:t})})},[n,e])}function Ck({set:n}){return pd(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}const Rk=(n=>(n=class extends Fe.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 WU(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 Fu(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 Dk(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 XU=["children","key","ref"];function Uk(n){const e={};for(const t in n)XU.includes(t)||(e[t]=n[t]);return e}function kg(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:Uk(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 Uw=/-\d+$/;function Gg(n,e){if(gn.str(e.props.attach)){if(Uw.test(e.props.attach)){const a=e.props.attach.replace(Uw,""),{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 Wg(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 Kx=[...XU,"args","dispose","attach","object","onUpdate","dispose"],Lw=new Map;function Lk(n){let e=Lw.get(n.constructor);try{e||(e=new n.constructor,Lw.set(n.constructor,e))}catch{}return e}function Nk(n,e){const t={};for(const i in e)if(!Kx.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(Kx.includes(i)||e.hasOwnProperty(i))continue;const{root:a,key:s}=Xh(n.object,i);if(a.constructor&&a.constructor.length===0){const l=Lk(a);gn.und(l)||(t[s]=l[s])}else t[s]=0}return t}const Ik=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],zk=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Jr(n,e){var t;const i=n.__r3f,a=i&&VU(i).getState(),s=i==null?void 0:i.eventCount;for(const u in e){let c=e[u];if(Kx.includes(u))continue;if(i&&zk.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:m}=Xh(n,u);if(m===void 0&&(typeof h!="object"||h===null))throw Error(`R3F: Cannot set "${u}". Ensure it is an object before setting "${p}".`);if(m instanceof Cc&&c instanceof Cc)m.mask=c.mask;else if(m instanceof He&&Ak(c))m.set(c);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof m.copy=="function"&&c!=null&&c.constructor&&m.constructor===c.constructor)m.copy(c);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&Array.isArray(c))typeof m.fromArray=="function"?m.fromArray(c):m.set(...c);else if(m!==null&&typeof m=="object"&&typeof m.set=="function"&&typeof c=="number")typeof m.setScalar=="function"?m.setScalar(c):m.set(c);else{var l;h[p]=c,a&&!a.linear&&Ik.includes(p)&&(l=h[p])!=null&&l.isTexture&&h[p].format===Si&&h[p].type===is&&(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 Ok(n,e){n.manual||(kU(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 om(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function qU(n,e,t,i){const a=t.get(e);a&&(t.delete(e),t.size===0&&(n.delete(i),a.target.releasePointerCapture(i)))}function Pk(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)=>{qU(t.capturedMap,e,i,a)})}function Bk(n){function e(c){const{internal:h}=n.getState(),p=c.offsetX-h.initialClick[0],m=c.offsetY-h.initialClick[1];return Math.round(Math.sqrt(p*p+m*m))}function t(c){return c.filter(h=>["Move","Over","Enter","Out","Leave"].some(p=>{var m;return(m=h.__r3f)==null?void 0:m.handlers["onPointer"+p]}))}function i(c,h){const p=n.getState(),m=new Set,g=[],v=h?h(p.internal.interaction):p.internal.interaction;for(let y=0;y<v.length;y++){const S=Fu(v[y]);S&&(S.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(c,p);function _(y){const S=Fu(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=Fu(y.object),A=Fu(S.object);return!E||!A?y.distance-S.distance:A.events.priority-E.events.priority||y.distance-S.distance}).filter(y=>{const S=om(y);return m.has(S)?!1:(m.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&&g.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())m.has(om(y.intersection))||g.push(y.intersection);return g}function a(c,h,p,m){if(c.length){const g={stopped:!1};for(const v of c){let _=Fu(v.object);if(_||v.object.traverseAncestors(T=>{const b=Fu(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&&qU(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:g.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=g.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(m(z),g.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(m=>m.object===p.object&&m.index===p.index&&m.instanceId===p.instanceId)){const g=p.eventObject.__r3f;if(h.hovered.delete(om(p)),g!=null&&g.eventCount){const v=g.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 m=h[p].__r3f;m==null||m.handlers.onPointerMissed==null||m.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:m,internal:g}=n.getState();g.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"&&(g.initialClick=[p.offsetX,p.offsetY],g.initialHits=b.map(E=>E.eventObject)),_&&!b.length&&y<=2&&(l(p,g.interaction),m&&m(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=om(E),z=g.hovered.get(L);z?z.stopped&&E.stopPropagation():(g.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?(!_||g.initialHits.includes(A))&&(l(p,g.interaction.filter(z=>!g.initialHits.includes(z))),L(E)):_&&g.initialHits.includes(A)&&l(p,g.interaction.filter(z=>!g.initialHits.includes(z)))}}a(b,p,y,S)}}return{handlePointer:u}}const Nw=n=>!!(n!=null&&n.render),YU=Fe.createContext(null),Fk=(n,e)=>{const t=xk((u,c)=>{const h=new P,p=new P,m=new P;function g(y=c().camera,S=p,E=c().size){const{width:A,height:I,top:R,left:L}=E,z=A/I;S.isVector3?m.copy(S):m.set(...S);const C=y.getWorldPosition(h).distanceTo(m);if(kU(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 de;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 Hb,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:g},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,...g(I,p,R)}}))},setDpr:y=>u(S=>{const E=WU(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:Fe.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:m}=t.getState();if(c.width!==a.width||c.height!==a.height||h.dpr!==s){a=c,s=h.dpr,Ok(u,c),h.dpr>0&&p.setPixelRatio(h.dpr);const g=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(c.width,c.height,g)}u!==l&&(l=u,m(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(u)}})))}),t.subscribe(u=>n(u)),t};function ZU(){const n=Fe.useContext(YU);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Hk(n=t=>t,e){return ZU()(n,e)}function Vk(n,e=0){const t=ZU(),i=t.getState().internal.subscribe,a=GU(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 kk=1,Gk=8,Wk=32,Xk=2;var qk={version:"9.5.0"};function Yk(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Iw={exports:{}},zw={exports:{}},Ow;function Zk(){return Ow||(Ow=1,function(n){n.exports=function(e){function t(r,o,f,d){return new ML(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=G1&&r[G1]||r["@@iterator"],typeof r=="function"?r:null)}function m(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===CL?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $l:return"Fragment";case Rv:return"Profiler";case V1:return"StrictMode";case Uv:return"Suspense";case Lv:return"SuspenseList";case Iv:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case Jl:return"Portal";case Ar:return r.displayName||"Context";case k1:return(r._context.displayName||"Context")+".Consumer";case Dv:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Nv:return o=r.displayName||null,o!==null?o:m(r.type)||"Memo";case wr:o=r._payload,r=r._init;try{return m(r(o))}catch{}}return null}function g(r){return{current:r}}function v(r){0>nu||(r.current=Hv[nu],Hv[nu]=null,nu--)}function _(r,o){nu++,Hv[nu]=r.current,r.current=o}function T(r){return r>>>=0,r===0?32:31-(nI(r)/iI|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=Od;return Od<<=1,!(Od&62914560)&&(Od=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,ae=r.expirationTimes,ye=r.hiddenUpdates;for(f=U&~f;0<f;){var Ce=31-na(f),Se=1<<Ce;H[Ce]=0,ae[Ce]=-1;var We=ye[Ce];if(We!==null)for(ye[Ce]=null,Ce=0;Ce<We.length;Ce++){var vt=We[Ce];vt!==null&&(vt.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 lI=="function"&&uI(r),ia&&typeof ia.setStrictMode=="function")try{ia.setStrictMode(sf,r)}catch{}}function j(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}function te(r){if(Gv===void 0)try{throw Error()}catch(f){var o=f.stack.trim().match(/\n( *(at )?)/);Gv=o&&o[1]||"",mE=-1<f.stack.indexOf(`
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Gv+r+mE}function V(r,o){if(!r||Wv)return"";Wv=!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(vt){var We=vt}Reflect.construct(r,[],Se)}else{try{Se.call()}catch(vt){We=vt}r.call(Se.prototype)}}else{try{throw Error()}catch(vt){We=vt}(Se=r())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(vt){if(vt&&We&&typeof vt.stack=="string")return[vt.stack,We.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 ae=U.split(`
`),ye=H.split(`
`);for(x=d=0;d<ae.length&&!ae[d].includes("DetermineComponentFrameRoot");)d++;for(;x<ye.length&&!ye[x].includes("DetermineComponentFrameRoot");)x++;if(d===ae.length||x===ye.length)for(d=ae.length-1,x=ye.length-1;1<=d&&0<=x&&ae[d]!==ye[x];)x--;for(;1<=d&&0<=x;d--,x--)if(ae[d]!==ye[x]){if(d!==1||x!==1)do if(d--,x--,0>x||ae[d]!==ye[x]){var Ce=`
`+ae[d].replace(" at new "," at ");return r.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",r.displayName)),Ce}while(1<=d&&0<=x);break}}}finally{Wv=!1,Error.prepareStackTrace=f}return(f=r?r.displayName||r.name:"")?te(f):""}function J(r,o){switch(r.tag){case 26:case 27:case 5:return te(r.type);case 16:return te("Lazy");case 13:return r.child!==o&&o!==null?te("Suspense Fallback"):te("Suspense");case 19:return te("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 te("Activity");default:return""}}function X(r){try{var o="",f=null;do o+=J(r,f),f=r,r=r.return;while(r);return o}catch(d){return`
Error generating stack: `+d.message+`
`+d.stack}}function re(r,o){if(typeof r=="object"&&r!==null){var f=gE.get(r);return f!==void 0?f:(o={value:r,source:o,stack:X(o)},gE.set(r,o),o)}return{value:r,source:o,stack:X(o)}}function he(r,o){au[su++]=rf,au[su++]=Bd,Bd=r,rf=o}function _e(r,o,f){Aa[wa++]=ms,Aa[wa++]=gs,Aa[wa++]=Cr,Cr=r;var d=ms;r=gs;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,ms=1<<32-na(o)+x|f<<x|d,gs=M+r}else ms=1<<M|f<<x|d,gs=r}function we(r){r.return!==null&&(he(r,1),_e(r,1,0))}function Je(r){for(;r===Bd;)Bd=au[--su],au[su]=null,rf=au[--su],au[su]=null;for(;r===Cr;)Cr=Aa[--wa],Aa[wa]=null,gs=Aa[--wa],Aa[wa]=null,ms=Aa[--wa],Aa[wa]=null}function ee(r,o){Aa[wa++]=ms,Aa[wa++]=gs,Aa[wa++]=Cr,ms=o.id,gs=o.overflow,Cr=r}function me(r,o){_(Rr,o),_(of,r),_(ri,null),r=UL(o),v(ri),_(ri,r)}function Oe(){v(ri),v(of),v(Rr)}function Ee(r){r.memoizedState!==null&&_(Fd,r);var o=ri.current,f=LL(o,r.type);o!==f&&(_(of,r),_(ri,f))}function Ye(r){of.current===r&&(v(ri),v(of)),Fd.current===r&&(v(Fd),zs?Oo._currentValue=eu:Oo._currentValue2=eu)}function et(r){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ve(re(o,r)),Xv}function Ze(r,o){if(!gi)throw Error(a(175));LN(r.stateNode,r.type,r.memoizedProps,o,r)||et(r,!0)}function je(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 ue(r){if(!gi||r!==oi)return!1;if(!Nt)return je(r),Nt=!0,!1;var o=r.tag;if(Vn?o!==3&&o!==27&&(o!==5||nE(r.type)&&!Nd(r.type,r.memoizedProps))&&dn&&et(r):o!==3&&(o!==5||nE(r.type)&&!Nd(r.type,r.memoizedProps))&&dn&&et(r),je(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=PN(r)}else if(o===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));dn=ON(r)}else dn=Vn&&o===27?bN(r.type,dn):oi?tE(r.stateNode):null;return!0}function ge(){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 Ve(r){Dr===null?Dr=[r]:Dr.push(r)}function ve(r,o,f){zs?(_(Hd,o._currentValue),o._currentValue=f):(_(Hd,o._currentValue2),o._currentValue2=f)}function Ae(r){var o=Hd.current;zs?r._currentValue=o:r._currentValue2=o,v(Hd)}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 tt(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 ae=0;ae<o.length;ae++)if(H.context===o[ae]){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 Ue(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===Fd.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&&tt(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 pe(Po,r)}function oe(r,o){return Po===null&&D(r),pe(r,o)}function pe(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 fI,data:new Map,refCount:0}}function Pe(r){r.refCount--,r.refCount===0&&hI(dI,function(){r.controller.abort()})}function Re(){}function De(r){r!==ru&&r.next===null&&(ru===null?Vd=ru=r:ru=ru.next=r),kd=!0,qv||(qv=!0,Rt())}function gt(r,o){if(!Yv&&kd){Yv=!0;do for(var f=!1,d=Vd;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,qe(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,qe(d,M));d=d.next}while(f);Yv=!1}}function xe(){Xe()}function Xe(){kd=qv=!1;var r=0;Bo!==0&&VL()&&(r=Bo);for(var o=Pi(),f=null,d=Vd;d!==null;){var x=d.next,M=nt(d,o);M===0?(d.next=null,f===null?Vd=x:f.next=x,x===null&&(ru=f)):(f=d,(r!==0||M&3)&&(kd=!0)),d=x}kn!==0&&kn!==5||gt(r),Bo!==0&&(Bo=0)}function nt(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,ae=x[U];ae===-1?(!(H&f)||H&d)&&(x[U]=E(H,o)):ae<=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&&Vv(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&&Vv(d),Q(f)){case 2:case 8:f=rI;break;case 32:f=kv;break;case 268435456:f=oI;break;default:f=kv}return d=st.bind(null,r),f=Pd(f,d),r.callbackPriority=o,r.callbackNode=f,o}return d!==null&&d!==null&&Vv(d),r.callbackPriority=2,r.callbackNode=null,2}function st(r,o){if(kn!==0&&kn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var f=r.callbackNode;if(ef()&&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:(g1(r,d,o),nt(r,Pi()),r.callbackNode!=null&&r.callbackNode===f?st.bind(null,r):null)}function qe(r,o){if(ef())return null;g1(r,o,!0)}function Rt(){ZL?jL(function(){Tt&6?Pd(dE,xe):Xe()}):Pd(dE,xe)}function dt(){if(Bo===0){var r=ou;r===0&&(r=Id,Id<<=1,!(Id&261888)&&(Id=256)),Bo=r}return Bo}function Kt(r,o){if(lf===null){var f=lf=[];Zv=0,ou=dt(),lu={status:"pending",value:void 0,then:function(d){f.push(d)}}}return Zv++,o.then(G,G),o}function G(){if(--Zv===0&&lf!==null){lu!==null&&(lu.status="fulfilled");var r=lf;lf=null,ou=0,lu=null;for(var o=0;o<r.length;o++)(0,r[o])()}}function Ie(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 Be(){var r=se();return r===null?null:{parent:zs?pn._currentValue:pn._currentValue2,pool:r}}function Ne(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(!cI.call(o,x)||!aa(r[x],o[x]))return!1}return!0}function pt(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(Re,Re),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(Re,Re);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,uu}}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,uu):f}}function Ft(){if(Ho===null)throw Error(a(459));var r=Ho;return Ho=null,r}function Ii(r){if(r===uu||r===Gd)throw Error(a(483))}function zi(r){var o=uf;return uf+=1,cu===null&&(cu=[]),rn(cu,r,o)}function br(r,o){o=o.props.ref,r.ref=o!==void 0?o:null}function wo(r,o){throw o.$$typeof===AL?Error(a(525)):(r=Object.prototype.toString.call(o),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r)))}function us(r){function o(K,Y){if(r){var ie=K.deletions;ie===null?(K.deletions=[Y],K.flags|=16):ie.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,ie){return K.index=ie,r?(ie=K.alternate,ie!==null?(ie=ie.index,ie<Y?(K.flags|=67108866,Y):ie):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function U(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function H(K,Y,ie,be){return Y===null||Y.tag!==6?(Y=Tv(ie,K.mode,be),Y.return=K,Y):(Y=x(Y,ie),Y.return=K,Y)}function ae(K,Y,ie,be){var at=ie.type;return at===$l?Ce(K,Y,ie.props.children,be,ie.key):Y!==null&&(Y.elementType===at||typeof at=="object"&&at!==null&&at.$$typeof===wr&&fn(at)===Y.type)?(Y=x(Y,ie.props),br(Y,ie),Y.return=K,Y):(Y=Dd(ie.type,ie.key,ie.props,null,K.mode,be),br(Y,ie),Y.return=K,Y)}function ye(K,Y,ie,be){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ie.containerInfo||Y.stateNode.implementation!==ie.implementation?(Y=Av(ie,K.mode,be),Y.return=K,Y):(Y=x(Y,ie.children||[]),Y.return=K,Y)}function Ce(K,Y,ie,be,at){return Y===null||Y.tag!==7?(Y=Io(ie,K.mode,be,at),Y.return=K,Y):(Y=x(Y,ie),Y.return=K,Y)}function Se(K,Y,ie){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Tv(""+Y,K.mode,ie),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case Ud:return ie=Dd(Y.type,Y.key,Y.props,null,K.mode,ie),br(ie,Y),ie.return=K,ie;case Jl:return Y=Av(Y,K.mode,ie),Y.return=K,Y;case wr:return Y=fn(Y),Se(K,Y,ie)}if(Ld(Y)||p(Y))return Y=Io(Y,K.mode,ie,null),Y.return=K,Y;if(typeof Y.then=="function")return Se(K,zi(Y),ie);if(Y.$$typeof===Ar)return Se(K,oe(K,Y),ie);wo(K,Y)}return null}function We(K,Y,ie,be){var at=Y!==null?Y.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return at!==null?null:H(K,Y,""+ie,be);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case Ud:return ie.key===at?ae(K,Y,ie,be):null;case Jl:return ie.key===at?ye(K,Y,ie,be):null;case wr:return ie=fn(ie),We(K,Y,ie,be)}if(Ld(ie)||p(ie))return at!==null?null:Ce(K,Y,ie,be,null);if(typeof ie.then=="function")return We(K,Y,zi(ie),be);if(ie.$$typeof===Ar)return We(K,Y,oe(K,ie),be);wo(K,ie)}return null}function vt(K,Y,ie,be,at){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return K=K.get(ie)||null,H(Y,K,""+be,at);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case Ud:return K=K.get(be.key===null?ie:be.key)||null,ae(Y,K,be,at);case Jl:return K=K.get(be.key===null?ie:be.key)||null,ye(Y,K,be,at);case wr:return be=fn(be),vt(K,Y,ie,be,at)}if(Ld(be)||p(be))return K=K.get(ie)||null,Ce(Y,K,be,at,null);if(typeof be.then=="function")return vt(K,Y,ie,zi(be),at);if(be.$$typeof===Ar)return vt(K,Y,ie,oe(Y,be),at);wo(Y,be)}return null}function Nn(K,Y,ie,be){for(var at=null,mn=null,lt=Y,kt=Y=0,Jn=null;lt!==null&&kt<ie.length;kt++){lt.index>kt?(Jn=lt,lt=null):Jn=lt.sibling;var Gt=We(K,lt,ie[kt],be);if(Gt===null){lt===null&&(lt=Jn);break}r&<&&Gt.alternate===null&&o(K,lt),Y=M(Gt,Y,kt),mn===null?at=Gt:mn.sibling=Gt,mn=Gt,lt=Jn}if(kt===ie.length)return f(K,lt),Nt&&he(K,kt),at;if(lt===null){for(;kt<ie.length;kt++)lt=Se(K,ie[kt],be),lt!==null&&(Y=M(lt,Y,kt),mn===null?at=lt:mn.sibling=lt,mn=lt);return Nt&&he(K,kt),at}for(lt=d(lt);kt<ie.length;kt++)Jn=vt(lt,K,kt,ie[kt],be),Jn!==null&&(r&&Jn.alternate!==null&<.delete(Jn.key===null?kt:Jn.key),Y=M(Jn,Y,kt),mn===null?at=Jn:mn.sibling=Jn,mn=Jn);return r&<.forEach(function(Or){return o(K,Or)}),Nt&&he(K,kt),at}function gf(K,Y,ie,be){if(ie==null)throw Error(a(151));for(var at=null,mn=null,lt=Y,kt=Y=0,Jn=null,Gt=ie.next();lt!==null&&!Gt.done;kt++,Gt=ie.next()){lt.index>kt?(Jn=lt,lt=null):Jn=lt.sibling;var Or=We(K,lt,Gt.value,be);if(Or===null){lt===null&&(lt=Jn);break}r&<&&Or.alternate===null&&o(K,lt),Y=M(Or,Y,kt),mn===null?at=Or:mn.sibling=Or,mn=Or,lt=Jn}if(Gt.done)return f(K,lt),Nt&&he(K,kt),at;if(lt===null){for(;!Gt.done;kt++,Gt=ie.next())Gt=Se(K,Gt.value,be),Gt!==null&&(Y=M(Gt,Y,kt),mn===null?at=Gt:mn.sibling=Gt,mn=Gt);return Nt&&he(K,kt),at}for(lt=d(lt);!Gt.done;kt++,Gt=ie.next())Gt=vt(lt,K,kt,Gt.value,be),Gt!==null&&(r&&Gt.alternate!==null&<.delete(Gt.key===null?kt:Gt.key),Y=M(Gt,Y,kt),mn===null?at=Gt:mn.sibling=Gt,mn=Gt);return r&<.forEach(function(vI){return o(K,vI)}),Nt&&he(K,kt),at}function Wo(K,Y,ie,be){if(typeof ie=="object"&&ie!==null&&ie.type===$l&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case Ud:e:{for(var at=ie.key;Y!==null;){if(Y.key===at){if(at=ie.type,at===$l){if(Y.tag===7){f(K,Y.sibling),be=x(Y,ie.props.children),be.return=K,K=be;break e}}else if(Y.elementType===at||typeof at=="object"&&at!==null&&at.$$typeof===wr&&fn(at)===Y.type){f(K,Y.sibling),be=x(Y,ie.props),br(be,ie),be.return=K,K=be;break e}f(K,Y);break}else o(K,Y);Y=Y.sibling}ie.type===$l?(be=Io(ie.props.children,K.mode,be,ie.key),be.return=K,K=be):(be=Dd(ie.type,ie.key,ie.props,null,K.mode,be),br(be,ie),be.return=K,K=be)}return U(K);case Jl:e:{for(at=ie.key;Y!==null;){if(Y.key===at)if(Y.tag===4&&Y.stateNode.containerInfo===ie.containerInfo&&Y.stateNode.implementation===ie.implementation){f(K,Y.sibling),be=x(Y,ie.children||[]),be.return=K,K=be;break e}else{f(K,Y);break}else o(K,Y);Y=Y.sibling}be=Av(ie,K.mode,be),be.return=K,K=be}return U(K);case wr:return ie=fn(ie),Wo(K,Y,ie,be)}if(Ld(ie))return Nn(K,Y,ie,be);if(p(ie)){if(at=p(ie),typeof at!="function")throw Error(a(150));return ie=at.call(ie),gf(K,Y,ie,be)}if(typeof ie.then=="function")return Wo(K,Y,zi(ie),be);if(ie.$$typeof===Ar)return Wo(K,Y,oe(K,ie),be);wo(K,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Y!==null&&Y.tag===6?(f(K,Y.sibling),be=x(Y,ie),be.return=K,K=be):(f(K,Y),be=Tv(ie,K.mode,be),be.return=K,K=be),U(K)):f(K,Y)}return function(K,Y,ie,be){try{uf=0;var at=Wo(K,Y,ie,be);return cu=null,at}catch(lt){if(lt===uu||lt===Gd)throw lt;var mn=t(29,lt,null,K.mode);return mn.lanes=be,mn.return=K,mn}finally{}}}function Mr(){for(var r=fu,o=Qv=fu=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&&qc(f,x,M)}}function Co(r,o,f,d){Ra[fu++]=r,Ra[fu++]=o,Ra[fu++]=f,Ra[fu++]=d,Qv|=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 qc(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<mf)throw mf=0,ly=null,Error(a(185));for(var o=r.return;o!==null;)r=o,o=r.return;return r.tag===3?r.stateNode:null}function ql(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yl(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 cs(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function fs(r,o,f){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Tt&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),qc(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 W(){if(Kv){var r=lu;if(r!==null)throw r}}function $(r,o,f,d){Kv=!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 ae=H,ye=ae.next;ae.next=null,U===null?M=ye:U.next=ye,U=ae;var Ce=r.alternate;Ce!==null&&(Ce=Ce.updateQueue,H=Ce.lastBaseUpdate,H!==U&&(H===null?Ce.firstBaseUpdate=ye:H.next=ye,Ce.lastBaseUpdate=ae))}if(M!==null){var Se=x.baseState;U=0,Ce=ye=ae=null,H=M;do{var We=H.lane&-536870913,vt=We!==H.lane;if(vt?(Dt&We)===We:(d&We)===We){We!==0&&We===ou&&(Kv=!0),Ce!==null&&(Ce=Ce.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Nn=r,gf=H;We=o;var Wo=f;switch(gf.tag){case 1:if(Nn=gf.payload,typeof Nn=="function"){Se=Nn.call(Wo,Se,We);break e}Se=Nn;break e;case 3:Nn.flags=Nn.flags&-65537|128;case 0:if(Nn=gf.payload,We=typeof Nn=="function"?Nn.call(Wo,Se,We):Nn,We==null)break e;Se=Cv({},Se,We);break e;case 2:Ur=!0}}We=H.callback,We!==null&&(r.flags|=64,vt&&(r.flags|=8192),vt=x.callbacks,vt===null?x.callbacks=[We]:vt.push(We))}else vt={lane:We,tag:H.tag,payload:H.payload,callback:H.callback,next:null},Ce===null?(ye=Ce=vt,ae=Se):Ce=Ce.next=vt,U|=We;if(H=H.next,H===null){if(H=x.shared.pending,H===null)break;vt=H,H=vt.next,vt.next=null,x.lastBaseUpdate=vt,x.shared.pending=null}}while(!0);Ce===null&&(ae=Se),x.baseState=ae,x.firstBaseUpdate=ye,x.lastBaseUpdate=Ce,M===null&&(x.shared.lanes=0),Nr|=U,r.lanes=U,r.memoizedState=Se}}function ne(r,o){if(typeof r!="function")throw Error(a(191,r));r.call(o)}function q(r,o){var f=r.callbacks;if(f!==null)for(r.callbacks=null,r=0;r<f.length;r++)ne(f[r],o)}function Me(r,o){r=Hs,_(Xd,r),_(hu,o),Hs=r|o.baseLanes}function ze(){_(Xd,Hs),_(hu,hu.current)}function Qe(){Hs=Xd.current,v(hu),v(Xd)}function ke(r){var o=r.alternate;_(Tn,Tn.current&1),_(sa,r),Ya===null&&(o===null||hu.current!==null||o.memoizedState!==null)&&(Ya=r)}function rt(r){_(Tn,Tn.current),_(sa,r),Ya===null&&(Ya=r)}function mt(r){r.tag===22?(_(Tn,Tn.current),_(sa,r),Ya===null&&(Ya=r)):Ge()}function Ge(){_(Tn,Tn.current),_(sa,sa.current)}function ht(r){v(sa),Ya===r&&(Ya=null),v(Tn)}function Wt(r){for(var o=r;o!==null;){if(o.tag===13){var f=o.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||Pv(f)||Bv(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 ot(){throw Error(a(321))}function Zn(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,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,it.H=r===null||r.memoizedState===null?_E:Jv,ko=!1,M=f(d,x),ko=!1,du&&(M=Ea(o,f,d,x)),$e(r),M}function $e(r){it.H=ff;var o=Jt!==null&&Jt.next!==null;if(Bs=0,Rn=Jt=_t=null,qd=!1,cf=0,pu=null,o)throw Error(a(300));r===null||Dn||(r=r.dependencies,r!==null&&O(r)&&(Dn=!0))}function Ea(r,o,f,d){_t=r;var x=0;do{if(du&&(pu=null),cf=0,du=!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)}it.H=xE,M=o(f,d)}while(du);return M}function Ht(){var r=it.H,o=r.useState()[0];return o=typeof o.then=="function"?ka(o):o,r=r.useState()[0],(Jt!==null?Jt.memoizedState:null)!==r&&(_t.flags|=1024),o}function Ei(){var r=Yd!==0;return Yd=0,r}function hs(r,o,f){o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~f}function ii(r){if(qd){for(r=r.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}qd=!1}Bs=0,Rn=Jt=_t=null,du=!1,cf=Yd=0,pu=null}function En(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?_t.memoizedState=Rn=r:Rn=Rn.next=r,Rn}function ft(){if(Jt===null){var r=_t.alternate;r=r!==null?r.memoizedState:null}else r=Jt.next;var o=Rn===null?_t.memoizedState:Rn.next;if(o!==null)Rn=o,Jt=r;else{if(r===null)throw _t.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?_t.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=cf;return cf+=1,pu===null&&(pu=[]),r=rn(pu,r,o),o=_t,(Rn===null?o.memoizedState:Rn.next)===null&&(o=o.alternate,it.H=o===null||o.memoizedState===null?_E:Jv),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=_t.updateQueue;if(f!==null&&(o=f.memoCache),o==null){var d=_t.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(),_t.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]=wL;return o.index++,f}function jn(r,o){return typeof o=="function"?o(r):o}function Do(r){var o=ft();return W0(o,Jt,r)}function W0(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,ae=null,ye=o,Ce=!1;do{var Se=ye.lane&-536870913;if(Se!==ye.lane?(Dt&Se)===Se:(Bs&Se)===Se){var We=ye.revertLane;if(We===0)ae!==null&&(ae=ae.next={lane:0,revertLane:0,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null}),Se===ou&&(Ce=!0);else if((Bs&We)===We){ye=ye.next,We===ou&&(Ce=!0);continue}else Se={lane:0,revertLane:ye.revertLane,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},ae===null?(H=ae=Se,U=M):ae=ae.next=Se,_t.lanes|=We,Nr|=We;Se=ye.action,ko&&f(M,Se),M=ye.hasEagerState?ye.eagerState:f(M,Se)}else We={lane:Se,revertLane:ye.revertLane,gesture:ye.gesture,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},ae===null?(H=ae=We,U=M):ae=ae.next=We,_t.lanes|=Se,Nr|=Se;ye=ye.next}while(ye!==null&&ye!==o);if(ae===null?U=M:ae.next=H,!aa(M,r.memoizedState)&&(Dn=!0,Ce&&(f=lu,f!==null)))throw f;r.memoizedState=M,r.baseState=U,r.baseQueue=ae,d.lastRenderedState=M}return x===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function X0(r){var o=ft(),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 jb(r,o,f){var d=_t,x=ft(),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,Z0(Jb.bind(null,d,x,r),[r]),x.getSnapshot!==o||U||Rn!==null&&Rn.memoizedState.tag&1){if(d.flags|=2048,Zl(9,{destroy:void 0},Kb.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=_t.updateQueue,o===null?(o=Ti(),_t.updateQueue=o,o.stores=[r]):(f=o.stores,f===null?o.stores=[r]:f.push(r))}function Kb(r,o,f,d){o.value=f,o.getSnapshot=d,$b(o)&&eM(r)}function Jb(r,o,f){return f(function(){$b(o)&&eM(r)})}function $b(r){var o=r.getSnapshot;r=r.value;try{var f=o();return!aa(r,f)}catch{return!0}}function eM(r){var o=Ma(r,2);o!==null&&Oi(o,r,2)}function q0(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:jn,lastRenderedState:r},o}function tM(r,o,f,d){return r.baseState=f,W0(r,Jt,typeof d=="function"?d:jn)}function iL(r,o,f,d,x){if(yd(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)}};it.T!==null?f(!0):M.isTransition=!1,d(M),f=o.pending,f===null?(M.next=o.pending=M,nM(o,M)):(M.next=f.next,o.pending=f.next=M)}}function nM(r,o){var f=o.action,d=o.payload,x=r.state;if(o.isTransition){var M=it.T,U={};it.T=U;try{var H=f(x,d),ae=it.S;ae!==null&&ae(U,H),iM(r,o,H)}catch(ye){Y0(r,o,ye)}finally{M!==null&&U.types!==null&&(M.types=U.types),it.T=M}}else try{M=f(x,d),iM(r,o,M)}catch(ye){Y0(r,o,ye)}}function iM(r,o,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(d){aM(r,o,d)},function(d){return Y0(r,o,d)}):aM(r,o,f)}function aM(r,o,f){o.status="fulfilled",o.value=f,sM(o),r.state=f,o=r.pending,o!==null&&(f=o.next,f===o?r.pending=null:(f=f.next,o.next=f,nM(r,f)))}function Y0(r,o,f){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=f,sM(o),o=o.next;while(o!==d)}r.action=null}function sM(r){r=r.listeners;for(var o=0;o<r.length;o++)(0,r[o])()}function rM(r,o){return o}function oM(r,o){if(Nt){var f=nn.formState;if(f!==null){e:{var d=_t;if(Nt){if(dn){var x=xN(dn,Ca);if(x){dn=tE(x),d=SN(x);break e}}et(d)}d=!1}d&&(o=f[0])}}f=En(),f.memoizedState=f.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rM,lastRenderedState:o},f.queue=d,f=TM.bind(null,_t,d),d.dispatch=f,d=q0(!1);var M=J0.bind(null,_t,!1,d.queue);return d=En(),x={state:o,dispatch:null,action:r,pending:null},d.queue=x,f=iL.bind(null,_t,x,M,f),x.dispatch=f,d.memoizedState=r,[o,f,!1]}function lM(r){var o=ft();return uM(o,Jt,r)}function uM(r,o,f){if(o=W0(r,o,rM)[0],r=Do(jn)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=ka(o)}catch(U){throw U===uu?Gd:U}else d=o;o=ft();var x=o.queue,M=x.dispatch;return f!==o.memoizedState&&(_t.flags|=2048,Zl(9,{destroy:void 0},aL.bind(null,x,f),null)),[d,M,r]}function aL(r,o){r.action=o}function cM(r){var o=ft(),f=Jt;if(f!==null)return uM(o,f,r);ft(),o=o.memoizedState,f=ft();var d=f.queue.dispatch;return f.memoizedState=r,[o,d,!1]}function Zl(r,o,f,d){return r={tag:r,create:f,deps:d,inst:o,next:null},o=_t.updateQueue,o===null&&(o=Ti(),_t.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 fM(){return ft().memoizedState}function gd(r,o,f,d){var x=En();_t.flags|=r,x.memoizedState=Zl(1|o,{destroy:void 0},f,d===void 0?null:d)}function vd(r,o,f,d){var x=ft();d=d===void 0?null:d;var M=x.memoizedState.inst;Jt!==null&&d!==null&&Zn(d,Jt.memoizedState.deps)?x.memoizedState=Zl(o,M,f,d):(_t.flags|=r,x.memoizedState=Zl(1|o,M,f,d))}function hM(r,o){gd(8390656,8,r,o)}function Z0(r,o){vd(2048,8,r,o)}function sL(r){_t.flags|=4;var o=_t.updateQueue;if(o===null)o=Ti(),_t.updateQueue=o,o.events=[r];else{var f=o.events;f===null?o.events=[r]:f.push(r)}}function dM(r){var o=ft().memoizedState;return sL({ref:o,nextImpl:r}),function(){if(Tt&2)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function pM(r,o){return vd(4,2,r,o)}function mM(r,o){return vd(4,4,r,o)}function gM(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 vM(r,o,f){f=f!=null?f.concat([r]):null,vd(4,4,gM.bind(null,o,r),f)}function j0(){}function yM(r,o){var f=ft();o=o===void 0?null:o;var d=f.memoizedState;return o!==null&&Zn(o,d[1])?d[0]:(f.memoizedState=[r,o],r)}function _M(r,o){var f=ft();o=o===void 0?null:o;var d=f.memoizedState;if(o!==null&&Zn(o,d[1]))return d[0];if(d=r(),ko){k(!0);try{r()}finally{k(!1)}}return f.memoizedState=[d,o],d}function Q0(r,o,f){return f===void 0||Bs&1073741824&&!(Dt&261930)?r.memoizedState=o:(r.memoizedState=f,r=m1(),_t.lanes|=r,Nr|=r,f)}function xM(r,o,f,d){return aa(f,o)?f:hu.current!==null?(r=Q0(r,f,d),aa(r,o)||(Dn=!0),r):!(Bs&42)||Bs&1073741824&&!(Dt&261930)?(Dn=!0,r.memoizedState=f):(r=m1(),_t.lanes|=r,Nr|=r,o)}function SM(r,o,f,d,x){var M=Os();Qn(M!==0&&8>M?M:8);var U=it.T,H={};it.T=H,J0(r,!1,o,f);try{var ae=x(),ye=it.S;if(ye!==null&&ye(H,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var Ce=Ie(ae,d);Yc(r,o,Ce,ea(r))}else Yc(r,o,d,ea(r))}catch(Se){Yc(r,o,{then:function(){},status:"rejected",reason:Se},ea())}finally{Qn(M),U!==null&&H.types!==null&&(U.types=H.types),it.T=U}}function bM(r){var o=r.memoizedState;if(o!==null)return o;o={memoizedState:eu,baseState:eu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:eu},next:null};var f={};return o.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:f},next:null},r.memoizedState=o,r=r.alternate,r!==null&&(r.memoizedState=o),o}function K0(){return Z(Oo)}function MM(){return ft().memoizedState}function EM(){return ft().memoizedState}function rL(r){for(var o=r.return;o!==null;){switch(o.tag){case 24:case 3:var f=ea();r=cs(f);var d=fs(o,r,f);d!==null&&(Oi(d,o,f),Ro(d,o,f)),o={cache:le()},r.payload=o;return}o=o.return}}function oL(r,o,f){var d=ea();f={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},yd(r)?AM(o,f):(f=Xl(r,o,f,d),f!==null&&(Oi(f,r,d),wM(f,o,d)))}function TM(r,o,f){var d=ea();Yc(r,o,f,d)}function Yc(r,o,f,d){var x={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(yd(r))AM(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),wM(f,o,d),!0}return!1}function J0(r,o,f,d){if(d={lane:2,revertLane:dt(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},yd(r)){if(o)throw Error(a(479))}else o=Xl(r,f,d,2),o!==null&&Oi(o,r,2)}function yd(r){var o=r.alternate;return r===_t||o!==null&&o===_t}function AM(r,o){du=qd=!0;var f=r.pending;f===null?o.next=o:(o.next=f.next,f.next=o),r.pending=o}function wM(r,o,f){if(f&4194048){var d=o.lanes;d&=r.pendingLanes,f|=d,o.lanes=f,C(r,f)}}function $0(r,o,f,d){o=r.memoizedState,f=f(d,o),f=f==null?o:Cv({},o,f),r.memoizedState=f,r.lanes===0&&(r.updateQueue.baseState=f)}function CM(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?!Ne(f,d)||!Ne(x,M):!0}function RM(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&&$v.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=Cv({},f));for(var x in r)f[x]===void 0&&(f[x]=r[x])}return f}function _d(r,o){try{var f=r.onUncaughtError;f(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function DM(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 ev(r,o,f){return f=cs(f),f.tag=3,f.payload={element:null},f.callback=function(){_d(r,o)},f}function UM(r){return r=cs(r),r.tag=3,r}function LM(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(){DM(o,f,d)}}var U=f.stateNode;U!==null&&typeof U.componentDidCatch=="function"&&(r.callback=function(){DM(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 lL(r,o,f,d,x){if(f.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=f.alternate,o!==null&&Ue(o,f,x,!0),f=sa.current,f!==null){switch(f.tag){case 31:case 13:return Ya===null?Cd():f.alternate===null&&yn===0&&(yn=3),f.flags&=-257,f.flags|=65536,f.lanes=x,d===Wd?f.flags|=16384:(o=f.updateQueue,o===null?f.updateQueue=new Set([d]):o.add(d),Mv(r,d,x)),!1;case 22:return f.flags|=65536,d===Wd?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)),Mv(r,d,x)),!1}throw Error(a(435,f.tag))}return Mv(r,d,x),Cd(),!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}),Ve(re(r,f)))):(d!==Xv&&(o=Error(a(423),{cause:d}),Ve(re(o,f))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,d=re(d,f),x=ev(r.stateNode,d,x),N(r,x),yn!==4&&(yn=2)),!1;var M=Error(a(520),{cause:d});if(M=re(M,f),df===null?df=[M]:df.push(M),yn!==4&&(yn=2),o===null)return!0;d=re(d,f),f=o;do{switch(f.tag){case 3:return f.flags|=65536,r=x&-x,f.lanes|=r,r=ev(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=UM(x),LM(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?yE(o,null,f,d):Vo(o,r.child,f,d)}function NM(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?(hs(r,o,x),Us(r,o,x)):(Nt&&H&&we(o),o.flags|=1,si(r,o,d,x),o.child)}function IM(r,o,f,d,x){if(r===null){var M=f.type;return typeof M=="function"&&!Ev(M)&&M.defaultProps===void 0&&f.compare===null?(o.tag=15,o.type=M,zM(r,o,M,d,x)):(r=Dd(f.type,null,d,o,o.mode,x),r.ref=o.ref,r.return=o,o.child=r)}if(M=r.child,!ov(r,x)){var U=M.memoizedProps;if(f=f.compare,f=f!==null?f:Ne,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 zM(r,o,f,d,x){if(r!==null){var M=r.memoizedProps;if(Ne(M,d)&&r.ref===o.ref)if(Dn=!1,o.pendingProps=d=M,ov(r,x))r.flags&131072&&(Dn=!0);else return o.lanes=r.lanes,Us(r,o,x)}return tv(r,o,f,d,x)}function OM(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 PM(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):ze(),mt(o);else return d=o.lanes=536870912,PM(r,o,M!==null?M.baseLanes|f:f,f,d)}else M!==null?(fe(o,M.cachePool),Me(o,M),Ge(),o.memoizedState=null):(r!==null&&fe(o,null),ze(),Ge());return si(r,o,x,f),o.child}function Zc(r,o){return r!==null&&r.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function PM(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),ze(),mt(o),r!==null&&Ue(r,o,d,!0),o.childLanes=x,null}function xd(r,o){return o=bd({mode:o.mode,children:o.children},r.mode),o.ref=r.ref,r.child=o,o.return=r,o}function BM(r,o,f){return Vo(o,r.child,null,f),r=xd(o,o.pendingProps),r.flags|=2,ht(o),o.memoizedState=null,r}function uL(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=xd(o,d),o.lanes=536870912,Zc(null,r);if(rt(o),(r=dn)?(r=DN(r,Ca),r!==null&&(o.memoizedState={dehydrated:r,treeContext:Cr!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},f=z1(r),f.return=o,o.child=f,oi=o,dn=null)):r=null,r===null)throw et(o);return o.lanes=536870912,null}return xd(o,d)}var M=r.memoizedState;if(M!==null){var U=M.dehydrated;if(rt(o),x)if(o.flags&256)o.flags&=-257,o=BM(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||Ue(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),ey;Cd(),o=BM(r,o,f)}else r=M.treeContext,gi&&(dn=TN(U),oi=o,Nt=!0,Dr=null,Ca=!1,r!==null&&ee(o,r)),o=xd(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 Sd(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 tv(r,o,f,d,x){return D(o),f=zt(r,o,f,d,void 0,x),d=Ei(),r!==null&&!Dn?(hs(r,o,x),Us(r,o,x)):(Nt&&d&&we(o),o.flags|=1,si(r,o,f,x),o.child)}function FM(r,o,f,d,x,M){return D(o),o.updateQueue=null,f=Ea(o,d,f,x),$e(r),d=Ei(),r!==null&&!Dn?(hs(r,o,M),Us(r,o,M)):(Nt&&d&&we(o),o.flags|=1,si(r,o,f,M),o.child)}function HM(r,o,f,d,x){if(D(o),o.stateNode===null){var M=iu,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=$v,o.stateNode=M,M._reactInternals=o,M=o.stateNode,M.props=d,M.state=o.memoizedState,M.refs={},ql(o),U=f.contextType,M.context=typeof U=="object"&&U!==null?Z(U):iu,M.state=o.memoizedState,U=f.getDerivedStateFromProps,typeof U=="function"&&($0(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&&$v.enqueueReplaceState(M,M.state,null),$(o,d,M,x),W(),M.state=o.memoizedState),typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(r===null){M=o.stateNode;var H=o.memoizedProps,ae=Uo(f,H);M.props=ae;var ye=M.context,Ce=f.contextType;U=iu,typeof Ce=="object"&&Ce!==null&&(U=Z(Ce));var Se=f.getDerivedStateFromProps;Ce=typeof Se=="function"||typeof M.getSnapshotBeforeUpdate=="function",H=o.pendingProps!==H,Ce||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(H||ye!==U)&&RM(o,M,d,U),Ur=!1;var We=o.memoizedState;M.state=We,$(o,d,M,x),W(),ye=o.memoizedState,H||We!==ye||Ur?(typeof Se=="function"&&($0(o,f,Se,d),ye=o.memoizedState),(ae=Ur||CM(o,f,ae,d,We,ye,U))?(Ce||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=ye),M.props=d,M.state=ye,M.context=U,d=ae):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{M=o.stateNode,Yl(r,o),U=o.memoizedProps,Ce=Uo(f,U),M.props=Ce,Se=o.pendingProps,We=M.context,ye=f.contextType,ae=iu,typeof ye=="object"&&ye!==null&&(ae=Z(ye)),H=f.getDerivedStateFromProps,(ye=typeof H=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(U!==Se||We!==ae)&&RM(o,M,d,ae),Ur=!1,We=o.memoizedState,M.state=We,$(o,d,M,x),W();var vt=o.memoizedState;U!==Se||We!==vt||Ur||r!==null&&r.dependencies!==null&&O(r.dependencies)?(typeof H=="function"&&($0(o,f,H,d),vt=o.memoizedState),(Ce=Ur||CM(o,f,Ce,d,We,vt,ae)||r!==null&&r.dependencies!==null&&O(r.dependencies))?(ye||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(d,vt,ae),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(d,vt,ae)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||U===r.memoizedProps&&We===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&We===r.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=vt),M.props=d,M.state=vt,M.context=ae,d=Ce):(typeof M.componentDidUpdate!="function"||U===r.memoizedProps&&We===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&We===r.memoizedState||(o.flags|=1024),d=!1)}return M=d,Sd(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 VM(r,o,f,d){return ge(),o.flags|=256,si(r,o,f,d),o.child}function nv(r){return{baseLanes:r,cachePool:Be()}}function iv(r,o,f){return r=r!==null?r.childLanes&~f:0,o&&(r|=oa),r}function kM(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?ke(o):Ge(),(r=dn)?(r=UN(r,Ca),r!==null&&(o.memoizedState={dehydrated:r,treeContext:Cr!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},f=z1(r),f.return=o,o.child=f,oi=o,dn=null)):r=null,r===null)throw et(o);return Bv(r)?o.lanes=32:o.lanes=536870912,null}var H=d.children;return d=d.fallback,x?(Ge(),x=o.mode,H=bd({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=nv(f),d.childLanes=iv(r,U,f),o.memoizedState=ty,Zc(null,d)):(ke(o),av(o,H))}var ae=r.memoizedState;if(ae!==null&&(H=ae.dehydrated,H!==null)){if(M)o.flags&256?(ke(o),o.flags&=-257,o=sv(r,o,f)):o.memoizedState!==null?(Ge(),o.child=r.child,o.flags|=128,o=null):(Ge(),H=d.fallback,x=o.mode,d=bd({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=nv(f),d.childLanes=iv(r,U,f),o.memoizedState=ty,o=Zc(null,d));else if(ke(o),Bv(H))U=yN(H).digest,d=Error(a(419)),d.stack="",d.digest=U,Ve({value:d,source:null,stack:null}),o=sv(r,o,f);else if(Dn||Ue(r,o,f,!1),U=(f&r.childLanes)!==0,Dn||U){if(U=nn,U!==null&&(d=w(U,f),d!==0&&d!==ae.retryLane))throw ae.retryLane=d,Ma(r,d),Oi(U,r,d),ey;Pv(H)||Cd(),o=sv(r,o,f)}else Pv(H)?(o.flags|=192,o.child=r.child,o=null):(r=ae.treeContext,gi&&(dn=AN(H),oi=o,Nt=!0,Dr=null,Ca=!1,r!==null&&ee(o,r)),o=av(o,d.children),o.flags|=4096);return o}return x?(Ge(),H=d.fallback,x=o.mode,ae=r.child,M=ae.sibling,d=Is(ae,{mode:"hidden",children:d.children}),d.subtreeFlags=ae.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,Zc(null,d),d=o.child,H=r.child.memoizedState,H===null?H=nv(f):(x=H.cachePool,x!==null?(ae=zs?pn._currentValue:pn._currentValue2,x=x.parent!==ae?{parent:ae,pool:ae}:x):x=Be(),H={baseLanes:H.baseLanes|f,cachePool:x}),d.memoizedState=H,d.childLanes=iv(r,U,f),o.memoizedState=ty,Zc(r.child,d)):(ke(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 av(r,o){return o=bd({mode:"visible",children:o},r.mode),o.return=r,r.child=o}function bd(r,o){return r=t(22,r,null,o),r.lanes=0,r}function sv(r,o,f){return Vo(o,r.child,null,f),r=av(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function GM(r,o,f){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o),Te(r.return,o,f)}function rv(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 WM(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?rf:0,!H&&r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&GM(r,f,o);else if(r.tag===19)GM(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&&Wt(r)===null&&(x=f),f=f.sibling;f=x,f===null?(x=o.child,o.child=null):(x=f.sibling,f.sibling=null),rv(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&&Wt(r)===null){o.child=x;break}r=x.sibling,x.sibling=f,f=x,x=r}rv(o,!0,f,null,M,d);break;case"together":rv(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(Ue(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 ov(r,o){return r.lanes&o?!0:(r=r.dependencies,!!(r!==null&&O(r)))}function cL(r,o,f){switch(o.tag){case 3:me(o,o.stateNode.containerInfo),ve(o,pn,r.memoizedState.cache),ge();break;case 27:case 5:Ee(o);break;case 4:me(o,o.stateNode.containerInfo);break;case 10:ve(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,rt(o),null;break;case 13:var d=o.memoizedState;if(d!==null)return d.dehydrated!==null?(ke(o),o.flags|=128,null):f&o.child.childLanes?kM(r,o,f):(ke(o),r=Us(r,o,f),r!==null?r.sibling:null);ke(o);break;case 19:var x=(r.flags&128)!==0;if(d=(f&o.childLanes)!==0,d||(Ue(r,o,f,!1),d=(f&o.childLanes)!==0),x){if(d)return WM(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,OM(r,o,f,o.pendingProps);case 24:ve(o,pn,r.memoizedState.cache)}return Us(r,o,f)}function XM(r,o,f){if(r!==null)if(r.memoizedProps!==o.pendingProps)Dn=!0;else{if(!ov(r,f)&&!(o.flags&128))return Dn=!1,cL(r,o,f);Dn=(r.flags&131072)!==0}else Dn=!1,Nt&&o.flags&1048576&&_e(o,rf,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")Ev(r)?(d=Uo(r,d),o.tag=1,o=HM(null,o,r,d,f)):(o.tag=0,o=tv(null,o,r,d,f));else{if(r!=null){var x=r.$$typeof;if(x===Dv){o.tag=11,o=NM(null,o,r,d,f);break e}else if(x===Nv){o.tag=14,o=IM(null,o,r,d,f);break e}}throw o=m(r)||r,Error(a(306,o,""))}}return o;case 0:return tv(r,o,o.type,o.pendingProps,f);case 1:return d=o.type,x=Uo(d,o.pendingProps),HM(r,o,d,x,f);case 3:e:{if(me(o,o.stateNode.containerInfo),r===null)throw Error(a(387));var M=o.pendingProps;x=o.memoizedState,d=x.element,Yl(r,o),$(o,M,null,f);var U=o.memoizedState;if(M=U.cache,ve(o,pn,M),M!==x.cache&&tt(o,[pn],f,!0),W(),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=VM(r,o,M,f);break e}else if(M!==d){d=re(Error(a(424)),o),Ve(d),o=VM(r,o,M,f);break e}else for(gi&&(dn=EN(o.stateNode.containerInfo),oi=o,Nt=!0,Dr=null,Ca=!0),f=yE(o,null,M,f),o.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(ge(),M===d){o=Us(r,o,f);break e}si(r,o,M,f)}o=o.child}return o;case 26:if(qa)return Sd(r,o),r===null?(f=aE(o.type,null,o.pendingProps,null))?o.memoizedState=f:Nt||(o.stateNode=KN(o.type,o.pendingProps,Rr.current,o)):o.memoizedState=aE(o.type,r.memoizedProps,o.pendingProps,r.memoizedState),null;case 27:if(Vn)return Ee(o),r===null&&Vn&&Nt&&(d=o.stateNode=cE(o.type,o.pendingProps,Rr.current,ri.current,!1),oi=o,Ca=!0,dn=wN(o.type,d,dn)),si(r,o,o.pendingProps.children,f),Sd(r,o),r===null&&(o.flags|=4194304),o.child;case 5:return r===null&&Nt&&(ZN(o.type,o.pendingProps,ri.current),(x=d=dn)&&(d=CN(d,o.type,o.pendingProps,Ca),d!==null?(o.stateNode=d,oi=o,dn=MN(d),Ca=!1,x=!0):x=!1),x||et(o)),Ee(o),x=o.type,M=o.pendingProps,U=r!==null?r.memoizedProps:null,d=M.children,Nd(x,M)?d=null:U!==null&&Nd(x,U)&&(o.flags|=32),o.memoizedState!==null&&(x=zt(r,o,Ht,null,null,f),zs?Oo._currentValue=x:Oo._currentValue2=x),Sd(r,o),si(r,o,d,f),o.child;case 6:return r===null&&Nt&&(jN(o.pendingProps,ri.current),(r=f=dn)&&(f=RN(f,o.pendingProps,Ca),f!==null?(o.stateNode=f,oi=o,dn=null,r=!0):r=!1),r||et(o)),null;case 13:return kM(r,o,f);case 4:return me(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 NM(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,ve(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 IM(r,o,o.type,o.pendingProps,f);case 15:return zM(r,o,o.type,o.pendingProps,f);case 19:return WM(r,o,f);case 31:return uL(r,o,f);case 22:return OM(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},ql(o),ve(o,pn,x)):(r.lanes&f&&(Yl(r,o),$(o,null,null,f),W()),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),ve(o,pn,d)):(d=M.cache,ve(o,pn,d),d!==x.cache&&tt(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 Md(r){ps&&(r.flags|=8)}function qM(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 lv(r,o,f,d){if(mi)for(f=o.child;f!==null;){if(f.tag===5||f.tag===6)zv(r,f.stateNode);else if(!(f.tag===4||Vn&&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(ps)for(var x=o.child;x!==null;){if(x.tag===5){var M=x.stateNode;f&&d&&(M=$1(M,x.type,x.memoizedProps)),zv(r,M)}else if(x.tag===6)M=x.stateNode,f&&d&&(M=eE(M,x.memoizedProps)),zv(r,M);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)M=x.child,M!==null&&(M.return=x),lv(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 YM(r,o,f,d){var x=!1;if(ps)for(var M=o.child;M!==null;){if(M.tag===5){var U=M.stateNode;f&&d&&(U=$1(U,M.type,M.memoizedProps)),K1(r,U)}else if(M.tag===6)U=M.stateNode,f&&d&&(U=eE(U,M.memoizedProps)),K1(r,U);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)x=M.child,x!==null&&(x.return=M),YM(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 ZM(r,o){if(ps&&qM(r,o)){r=o.stateNode;var f=r.containerInfo,d=Q1();YM(d,o,!1,!1),r.pendingChildren=d,Ga(o),vN(f,d)}}function uv(r,o,f,d){if(mi)r.memoizedProps!==d&&Ga(o);else if(ps){var x=r.stateNode,M=r.memoizedProps;if((r=qM(r,o))||M!==d){var U=ri.current;M=gN(x,f,M,d,!r,null),M===x?o.stateNode=x:(Md(o),X1(M,f,d,U)&&Ga(o),o.stateNode=M,r&&lv(M,o,!1,!1))}else o.stateNode=x}}function cv(r,o,f,d,x){if(r.mode&32&&(f===null?GL(o,d):WL(o,f,d))){if(r.flags|=16777216,(x&335544128)===x||Ov(o,d))if(Y1(r.stateNode,o,d))r.flags|=8192;else if(x1())r.flags|=8192;else throw Ho=Wd,jv}else r.flags&=-16777217}function jM(r,o){if($N(o)){if(r.flags|=16777216,!uE(o))if(x1())r.flags|=8192;else throw Ho=Wd,jv}else r.flags&=-16777217}function Ed(r,o){o!==null&&(r.flags|=4),r.flags&16384&&(o=r.tag!==22?A():536870912,r.lanes|=o,vu|=o)}function jc(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 fL(r,o,f){var d=o.pendingProps;switch(Je(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),Ae(pn),Oe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(ue(o)?Ga(o):r===null||r.memoizedState.isDehydrated&&!(o.flags&256)||(o.flags|=1024,F())),ZM(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),jM(o,M)):(on(o),cv(o,x,null,d,f))):M?M!==r.memoizedState?(Ga(o),on(o),jM(o,M)):(on(o),o.flags&=-16777217):(M=r.memoizedProps,mi?M!==d&&Ga(o):uv(r,o,x,d),on(o),cv(o,x,M,d,f)),null}case 27:if(Vn){if(Ye(o),f=Rr.current,x=o.type,r!==null&&o.stateNode!=null)mi?r.memoizedProps!==d&&Ga(o):uv(r,o,x,d);else{if(!d){if(o.stateNode===null)throw Error(a(166));return on(o),null}r=ri.current,ue(o)?Ze(o,r):(r=cE(x,d,f,r,!0),o.stateNode=r,Ga(o))}return on(o),null}case 5:if(Ye(o),x=o.type,r!==null&&o.stateNode!=null)uv(r,o,x,d);else{if(!d){if(o.stateNode===null)throw Error(a(166));return on(o),null}if(M=ri.current,ue(o))Ze(o,M),kN(o.stateNode,x,d,M)&&(o.flags|=64);else{var U=zL(x,d,Rr.current,M,o);Md(o),lv(U,o,!1,!1),o.stateNode=U,X1(U,x,d,M)&&Ga(o)}}return on(o),cv(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):ps&&(f!==d?(r=Rr.current,f=ri.current,Md(o),o.stateNode=q1(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,ue(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}NN(r,f,o,d)||et(o,!0)}else Md(o),o.stateNode=q1(d,r,f,o)}return on(o),null;case 31:if(f=o.memoizedState,r===null||r.memoizedState!==null){if(d=ue(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));IN(r,o)}else ge(),!(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?(ht(o),o):(ht(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=ue(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));zN(x,o)}else ge(),!(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?(ht(o),o):(ht(o),null)}return ht(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),Ed(o,o.updateQueue),on(o),null);case 4:return Oe(),ZM(r,o),r===null&&FL(o.stateNode.containerInfo),on(o),null;case 10:return Ae(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)jc(d,!1);else{if(yn!==0||r!==null&&r.flags&128)for(r=o.child;r!==null;){if(M=Wt(r),M!==null){for(o.flags|=128,jc(d,!1),r=M.updateQueue,o.updateQueue=r,Ed(o,r),o.subtreeFlags=0,r=f,f=o.child;f!==null;)I1(f,r),f=f.sibling;return _(Tn,Tn.current&1|2),Nt&&he(o,d.treeForkCount),o.child}r=r.sibling}d.tail!==null&&Pi()>pf&&(o.flags|=128,x=!0,jc(d,!1),o.lanes=4194304)}else{if(!x)if(r=Wt(M),r!==null){if(o.flags|=128,x=!0,r=r.updateQueue,o.updateQueue=r,Ed(o,r),jc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!M.alternate&&!Nt)return on(o),null}else 2*Pi()-d.renderingStartTime>pf&&f!==536870912&&(o.flags|=128,x=!0,jc(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&&he(o,d.treeForkCount),r):(on(o),null);case 22:case 23:return ht(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&&Ed(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),Ae(pn),on(o),null;case 25:return null;case 30:return null}throw Error(a(156,o.tag))}function hL(r,o){switch(Je(o),o.tag){case 1:return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Ae(pn),Oe(),r=o.flags,r&65536&&!(r&128)?(o.flags=r&-65537|128,o):null;case 26:case 27:case 5:return Ye(o),null;case 31:if(o.memoizedState!==null){if(ht(o),o.alternate===null)throw Error(a(340));ge()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 13:if(ht(o),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(a(340));ge()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return v(Tn),null;case 4:return Oe(),null;case 10:return Ae(o.type),null;case 22:case 23:return ht(o),Qe(),r!==null&&v(Fo),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 24:return Ae(pn),null;case 25:return null;default:return null}}function QM(r,o){switch(Je(o),o.tag){case 3:Ae(pn),Oe();break;case 26:case 27:case 5:Ye(o);break;case 4:Oe();break;case 31:o.memoizedState!==null&&ht(o);break;case 13:ht(o);break;case 19:v(Tn);break;case 10:Ae(o.type);break;case 22:case 23:ht(o),Qe(),r!==null&&v(Fo);break;case 24:Ae(pn)}}function Qc(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 ae=f,ye=H;try{ye()}catch(Ce){Vt(x,ae,Ce)}}}d=d.next}while(d!==M)}}catch(Ce){Vt(o,o.return,Ce)}}function KM(r){var o=r.updateQueue;if(o!==null){var f=r.stateNode;try{q(o,f)}catch(d){Vt(r,r.return,d)}}}function JM(r,o,f){f.props=Uo(r.type,r.memoizedProps),f.state=r.memoizedState;try{f.componentWillUnmount()}catch(d){Vt(r,o,d)}}function Kc(r,o){try{var f=r.ref;if(f!==null){switch(r.tag){case 26:case 27:case 5:var d=tf(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 ds(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 $M(r){var o=r.type,f=r.memoizedProps,d=r.stateNode;try{sN(d,o,f,r)}catch(x){Vt(r,r.return,x)}}function fv(r,o,f){try{rN(r.stateNode,r.type,f,o,r)}catch(d){Vt(r,r.return,d)}}function e1(r){return r.tag===5||r.tag===3||(qa?r.tag===26:!1)||(Vn?r.tag===27&&tu(r.type):!1)||r.tag===4}function hv(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||e1(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(Vn&&r.tag===27&&tu(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 dv(r,o,f){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?lN(f,r,o):iN(f,r);else if(d!==4&&(Vn&&d===27&&tu(r.type)&&(f=r.stateNode,o=null),r=r.child,r!==null))for(dv(r,o,f),r=r.sibling;r!==null;)dv(r,o,f),r=r.sibling}function Td(r,o,f){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?oN(f,r,o):nN(f,r);else if(d!==4&&(Vn&&d===27&&tu(r.type)&&(f=r.stateNode),r=r.child,r!==null))for(Td(r,o,f),r=r.sibling;r!==null;)Td(r,o,f),r=r.sibling}function t1(r,o,f){r=r.containerInfo;try{J1(r,f)}catch(d){Vt(o,o.return,d)}}function n1(r){var o=r.stateNode,f=r.memoizedProps;try{tI(r.type,f,o,r)}catch(d){Vt(r,r.return,d)}}function dL(r,o){for(NL(r.containerInfo),Kn=o;Kn!==null;)if(r=Kn,o=r.child,(r.subtreeFlags&1028)!==0&&o!==null)o.return=r,Kn=o;else for(;Kn!==null;){r=Kn;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&&mN(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,Kn=o;break}Kn=r.return}}function i1(r,o,f){var d=f.flags;switch(f.tag){case 0:case 11:case 15:Ls(r,f),d&4&&Qc(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&&KM(f),d&512&&Kc(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=tf(f.child.stateNode);break;case 1:r=f.child.stateNode}try{q(d,r)}catch(U){Vt(f,f.return,U)}}break;case 27:Vn&&o===null&&d&4&&n1(f);case 26:case 5:if(Ls(r,f),o===null){if(d&4)$M(f);else if(d&64){r=f.type,o=f.memoizedProps,x=f.stateNode;try{BN(x,r,o,f)}catch(U){Vt(f,f.return,U)}}}d&512&&Kc(f,f.return);break;case 12:Ls(r,f);break;case 31:Ls(r,f),d&4&&s1(r,f);break;case 13:Ls(r,f),d&4&&r1(r,f),d&64&&(d=f.memoizedState,d!==null&&(d=d.dehydrated,d!==null&&(f=xL.bind(null,f),_N(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 a1(r){var o=r.alternate;o!==null&&(r.alternate=null,a1(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&kL(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 Wa(r,o,f){for(f=f.child;f!==null;)pv(r,o,f),f=f.sibling}function pv(r,o,f){if(ia&&typeof ia.onCommitFiberUnmount=="function")try{ia.onCommitFiberUnmount(sf,f)}catch{}switch(f.tag){case 26:if(qa){Un||ds(f,o),Wa(r,o,f),f.memoizedState?rE(f.memoizedState):f.stateNode&&lE(f.stateNode);break}case 27:if(Vn){Un||ds(f,o);var d=Ln,x=Bi;tu(f.type)&&(Ln=f.stateNode,Bi=!1),Wa(r,o,f),fE(f.stateNode),Ln=d,Bi=x;break}case 5:Un||ds(f,o);case 6:if(mi){if(d=Ln,x=Bi,Ln=null,Wa(r,o,f),Ln=d,Bi=x,Ln!==null)if(Bi)try{cN(Ln,f.stateNode)}catch(M){Vt(f,o,M)}else try{uN(Ln,f.stateNode)}catch(M){Vt(f,o,M)}}else Wa(r,o,f);break;case 18:mi&&Ln!==null&&(Bi?XN(Ln,f.stateNode):WN(Ln,f.stateNode));break;case 4:mi?(d=Ln,x=Bi,Ln=f.stateNode.containerInfo,Bi=!0,Wa(r,o,f),Ln=d,Bi=x):(ps&&t1(f.stateNode,f,Q1()),Wa(r,o,f));break;case 0:case 11:case 14:case 15:Er(2,f,o),Un||Er(4,f,o),Wa(r,o,f);break;case 1:Un||(ds(f,o),d=f.stateNode,typeof d.componentWillUnmount=="function"&&JM(f,o,d)),Wa(r,o,f);break;case 21:Wa(r,o,f);break;case 22:Un=(d=Un)||f.memoizedState!==null,Wa(r,o,f),Un=d;break;default:Wa(r,o,f)}}function s1(r,o){if(gi&&o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{HN(r)}catch(f){Vt(o,o.return,f)}}}function r1(r,o){if(gi&&o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{VN(r)}catch(f){Vt(o,o.return,f)}}function pL(r){switch(r.tag){case 31:case 13:case 19:var o=r.stateNode;return o===null&&(o=r.stateNode=new SE),o;case 22:return r=r.stateNode,o=r._retryCache,o===null&&(o=r._retryCache=new SE),o;default:throw Error(a(435,r.tag))}}function Ad(r,o){var f=pL(r);o.forEach(function(d){if(!f.has(d)){f.add(d);var x=SL.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(Vn){if(tu(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));pv(M,U,x),Ln=null,Bi=!1}else pv(M,U,x);M=x.alternate,M!==null&&(M.return=null),x.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)o1(o,r),o=o.sibling}function o1(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),Qc(3,r),Er(5,r,r.return));break;case 1:pi(o,r),Ai(r),d&512&&(Un||f===null||ds(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||ds(f,f.return)),d&4){d=f!==null?f.memoizedState:null;var M=r.memoizedState;f===null?M===null?r.stateNode===null?r.stateNode=QN(x,r.type,r.memoizedProps,r):oE(x,r.type,r.stateNode):r.stateNode=sE(x,M,r.memoizedProps):d!==M?(d===null?f.stateNode!==null&&lE(f.stateNode):rE(d),M===null?oE(x,r.type,r.stateNode):sE(x,M,r.memoizedProps)):M===null&&r.stateNode!==null&&fv(r,r.memoizedProps,f.memoizedProps)}break}case 27:if(Vn){pi(o,r),Ai(r),d&512&&(Un||f===null||ds(f,f.return)),f!==null&&d&4&&fv(r,r.memoizedProps,f.memoizedProps);break}case 5:if(pi(o,r),Ai(r),d&512&&(Un||f===null||ds(f,f.return)),mi){if(r.flags&32){x=r.stateNode;try{j1(x)}catch(Se){Vt(r,r.return,Se)}}d&4&&r.stateNode!=null&&(x=r.memoizedProps,fv(r,x,f!==null?f.memoizedProps:x)),d&1024&&(ny=!0)}else ps&&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{aN(x,f,d)}catch(Se){Vt(r,r.return,Se)}}break;case 3:if(qa?(JN(),x=Za,Za=Fv(o.containerInfo),pi(o,r),Za=x):pi(o,r),Ai(r),d&4){if(mi&&gi&&f!==null&&f.memoizedState.isDehydrated)try{FN(o.containerInfo)}catch(Se){Vt(r,r.return,Se)}if(ps){d=o.containerInfo,f=o.pendingChildren;try{J1(d,f)}catch(Se){Vt(r,r.return,Se)}}}ny&&(ny=!1,l1(r));break;case 4:qa?(f=Za,Za=Fv(r.stateNode.containerInfo),pi(o,r),Ai(r),Za=f):(pi(o,r),Ai(r)),d&4&&ps&&t1(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,Ad(r,d)));break;case 13:pi(o,r),Ai(r),r.child.flags&8192&&r.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&($d=Pi()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 22:x=r.memoizedState!==null;var U=f!==null&&f.memoizedState!==null,H=Fs,ae=Un;if(Fs=H||x,Un=ae||U,pi(o,r),Un=ae,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?fN(M):dN(U.stateNode,U.memoizedProps)}catch(Se){Vt(U,U.return,Se)}}}else if(o.tag===6){if(f===null){U=o;try{var ye=U.stateNode;x?hN(ye):pN(ye,U.memoizedProps)}catch(Se){Vt(U,U.return,Se)}}}else if(o.tag===18){if(f===null){U=o;try{var Ce=U.stateNode;x?qN(Ce):YN(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,Ad(r,f))));break;case 19:pi(o,r),Ai(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(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(e1(d)){f=d;break}d=d.return}if(mi){if(f==null)throw Error(a(160));switch(f.tag){case 27:if(Vn){var x=f.stateNode,M=hv(r);Td(r,M,x);break}case 5:var U=f.stateNode;f.flags&32&&(j1(U),f.flags&=-33);var H=hv(r);Td(r,H,U);break;case 3:case 4:var ae=f.stateNode.containerInfo,ye=hv(r);dv(r,ye,ae);break;default:throw Error(a(161))}}}catch(Ce){Vt(r,r.return,Ce)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function l1(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var o=r;l1(o),o.tag===5&&o.flags&1024&&YL(o.stateNode),r=r.sibling}}function Ls(r,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)i1(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:ds(o,o.return);var f=o.stateNode;typeof f.componentWillUnmount=="function"&&JM(o,o.return,f),Lo(o);break;case 27:Vn&&fE(o.stateNode);case 26:case 5:ds(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),Qc(4,M);break;case 1:if(Ns(x,M,f),d=M,x=d.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ye){Vt(d,d.return,ye)}if(d=M,x=d.updateQueue,x!==null){var H=d.stateNode;try{var ae=x.shared.hiddenCallbacks;if(ae!==null)for(x.shared.hiddenCallbacks=null,x=0;x<ae.length;x++)ne(ae[x],H)}catch(ye){Vt(d,d.return,ye)}}f&&U&64&&KM(M),Kc(M,M.return);break;case 27:Vn&&n1(M);case 26:case 5:Ns(x,M,f),f&&d===null&&U&4&&$M(M),Kc(M,M.return);break;case 12:Ns(x,M,f);break;case 31:Ns(x,M,f),f&&U&4&&s1(x,M);break;case 13:Ns(x,M,f),f&&U&4&&r1(x,M);break;case 22:M.memoizedState===null&&Ns(x,M,f),Kc(M,M.return);break;case 30:break;default:Ns(x,M,f)}o=o.sibling}}function mv(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&&Pe(f))}function gv(r,o){r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&Pe(r))}function Xa(r,o,f,d){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)u1(r,o,f,d),o=o.sibling}function u1(r,o,f,d){var x=o.flags;switch(o.tag){case 0:case 11:case 15:Xa(r,o,f,d),x&2048&&Qc(9,o);break;case 1:Xa(r,o,f,d);break;case 3:Xa(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&&Pe(r)));break;case 12:if(x&2048){Xa(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(ae){Vt(o,o.return,ae)}}else Xa(r,o,f,d);break;case 31:Xa(r,o,f,d);break;case 13:Xa(r,o,f,d);break;case 23:break;case 22:M=o.stateNode,U=o.alternate,o.memoizedState!==null?M._visibility&2?Xa(r,o,f,d):Jc(r,o):M._visibility&2?Xa(r,o,f,d):(M._visibility|=2,jl(r,o,f,d,(o.subtreeFlags&10256)!==0||!1)),x&2048&&mv(U,o);break;case 24:Xa(r,o,f,d),x&2048&&gv(o.alternate,o);break;default:Xa(r,o,f,d)}}function jl(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,ae=d,ye=U.flags;switch(U.tag){case 0:case 11:case 15:jl(M,U,H,ae,x),Qc(8,U);break;case 23:break;case 22:var Ce=U.stateNode;U.memoizedState!==null?Ce._visibility&2?jl(M,U,H,ae,x):Jc(M,U):(Ce._visibility|=2,jl(M,U,H,ae,x)),x&&ye&2048&&mv(U.alternate,U);break;case 24:jl(M,U,H,ae,x),x&&ye&2048&&gv(U.alternate,U);break;default:jl(M,U,H,ae,x)}o=o.sibling}}function Jc(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:Jc(f,d),x&2048&&mv(d.alternate,d);break;case 24:Jc(f,d),x&2048&&gv(d.alternate,d);break;default:Jc(f,d)}o=o.sibling}}function No(r,o,f){if(r.subtreeFlags&mu)for(r=r.child;r!==null;)c1(r,o,f),r=r.sibling}function c1(r,o,f){switch(r.tag){case 26:if(No(r,o,f),r.flags&mu)if(r.memoizedState!==null)eI(f,Za,r.memoizedState,r.memoizedProps);else{var d=r.stateNode,x=r.type;r=r.memoizedProps,((o&335544128)===o||Ov(x,r))&&Z1(f,d,x,r)}break;case 5:No(r,o,f),r.flags&mu&&(d=r.stateNode,x=r.type,r=r.memoizedProps,((o&335544128)===o||Ov(x,r))&&Z1(f,d,x,r));break;case 3:case 4:qa?(d=Za,Za=Fv(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=mu,mu=16777216,No(r,o,f),mu=d):No(r,o,f));break;default:No(r,o,f)}}function f1(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 $c(r){var o=r.deletions;if(r.flags&16){if(o!==null)for(var f=0;f<o.length;f++){var d=o[f];Kn=d,d1(d,r)}f1(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)h1(r),r=r.sibling}function h1(r){switch(r.tag){case 0:case 11:case 15:$c(r),r.flags&2048&&Er(9,r,r.return);break;case 3:$c(r);break;case 12:$c(r);break;case 22:var o=r.stateNode;r.memoizedState!==null&&o._visibility&2&&(r.return===null||r.return.tag!==13)?(o._visibility&=-3,wd(r)):$c(r);break;default:$c(r)}}function wd(r){var o=r.deletions;if(r.flags&16){if(o!==null)for(var f=0;f<o.length;f++){var d=o[f];Kn=d,d1(d,r)}f1(r)}for(r=r.child;r!==null;){switch(o=r,o.tag){case 0:case 11:case 15:Er(8,o,o.return),wd(o);break;case 22:f=o.stateNode,f._visibility&2&&(f._visibility&=-3,wd(o));break;default:wd(o)}r=r.sibling}}function d1(r,o){for(;Kn!==null;){var f=Kn;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:Pe(f.memoizedState.cache)}if(d=f.child,d!==null)d.return=f,Kn=d;else e:for(f=r;Kn!==null;){d=Kn;var x=d.sibling,M=d.return;if(a1(d),d===f){Kn=null;break e}if(x!==null){x.return=M,Kn=x;break e}Kn=M}}}function vv(r){var o=BL(r);if(o!=null){if(typeof o.memoizedProps["data-testname"]!="string")throw Error(a(364));return o}if(r=QL(r),r===null)throw Error(a(362));return r.stateNode.current}function yv(r,o){var f=r.tag;switch(o.$$typeof){case Zd:if(r.type===o.value)return!0;break;case jd: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||!af(d)){for(;U!=null&&yv(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 Qd:if((f===5||f===26||f===27)&&$L(r.stateNode,o.value))return!0;break;case Jd:if((f===5||f===6||f===26||f===27)&&(r=JL(r),r!==null&&0<=r.indexOf(o.value)))return!0;break;case Kd: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 _v(r){switch(r.$$typeof){case Zd:return"<"+(m(r.value)||"Unknown")+">";case jd:return":has("+(_v(r)||"")+")";case Qd:return'[role="'+r.value+'"]';case Jd:return'"'+r.value+'"';case Kd:return'[data-testname="'+r.value+'"]';default:throw Error(a(365))}}function p1(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||!af(x)){for(;H!=null&&yv(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 xv(r,o){if(!nf)throw Error(a(363));r=vv(r),r=p1(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)af(d)||o.push(d.stateNode);else for(d=d.child;d!==null;)r.push(d),d=d.sibling}return o}function ea(){return Tt&2&&Dt!==0?Dt&-Dt:it.T!==null?dt():HL()}function m1(){if(oa===0)if(!(Dt&536870912)||Nt){var r=zd;zd<<=1,!(zd&3932160)&&(zd=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)&&(Ql(r,0),Tr(r,Dt,oa,!1)),R(r,f),(!(Tt&2)||r!==nn)&&(r===nn&&(!(Tt&2)&&(Go|=f),yn===4&&Tr(r,Dt,oa,!1)),De(r))}function g1(r,o,f){if(Tt&6)throw Error(a(327));var d=!f&&(o&127)===0&&(o&r.expiredLanes)===0||S(r,o),x=d?vL(r,o):bv(r,o,!0),M=d;do{if(x===0){gu&&!d&&Tr(r,o,0,!1);break}else{if(f=r.current.alternate,M&&!mL(f)){x=bv(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=df;var ae=gi&&H.current.memoizedState.isDehydrated;if(ae&&(Ql(H,U).flags|=256),U=bv(H,U,!1),U!==2){if(iy&&!ae){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){Ql(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=$d+300-Pi(),10<x)){if(Tr(d,o,oa,!Lr),y(d,0,!0)!==0)break e;Vs=o,d.timeoutHandle=OL(v1.bind(null,d,f,Fi,ep,sy,o,oa,Go,vu,Lr,M,"Throttled",-0,0),x);break e}v1(d,f,Fi,ep,sy,o,oa,Go,vu,Lr,M,null,-0,0)}}break}while(!0);De(r)}function v1(r,o,f,d,x,M,U,H,ae,ye,Ce,Se,We,vt){if(r.timeoutHandle=zo,Se=o.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se=XL(),c1(o,M,Se);var Nn=(M&62914560)===M?$d-Pi():(M&4194048)===M?bE-Pi():0;if(Nn=qL(Se,Nn),Nn!==null){Vs=M,r.cancelPendingCommit=Nn(A1.bind(null,r,o,M,f,d,x,U,H,ae,Ce,Se,null,We,vt)),Tr(r,M,U,!ye);return}}A1(r,o,M,f,d,x,U,H,ae)}function mL(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&=~ay,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 y1(){return Tt&6?!0:(gt(0),!1)}function Sv(){if(At!==null){if(Yt===0)var r=At.return;else r=At,Ps=Po=null,ii(r),cu=null,uf=0,r=At;for(;r!==null;)QM(r.alternate,r),r=r.return;At=null}}function Ql(r,o){var f=r.timeoutHandle;f!==zo&&(r.timeoutHandle=zo,PL(f)),f=r.cancelPendingCommit,f!==null&&(r.cancelPendingCommit=null,f()),Vs=0,Sv(),nn=r,At=f=Is(r.current,null),Dt=o,Yt=0,ra=null,Lr=!1,gu=S(r,o),iy=!1,vu=oa=ay=Go=Nr=yn=0,Fi=df=null,sy=!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 _1(r,o){_t=null,it.H=ff,o===uu||o===Gd?(o=Ft(),Yt=3):o===jv?(o=Ft(),Yt=4):Yt=o===ey?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,ra=o,At===null&&(yn=1,_d(r,re(o,r.current)))}function x1(){var r=sa.current;return r===null?!0:(Dt&4194048)===Dt?Ya===null:(Dt&62914560)===Dt||Dt&536870912?r===Ya:!1}function S1(){var r=it.H;return it.H=ff,r===null?ff:r}function b1(){var r=it.A;return it.A=mI,r}function Cd(){yn=4,Lr||(Dt&4194048)!==Dt&&sa.current!==null||(gu=!0),!(Nr&134217727)&&!(Go&134217727)||nn===null||Tr(nn,Dt,oa,!1)}function bv(r,o,f){var d=Tt;Tt|=2;var x=S1(),M=b1();(nn!==r||Dt!==o)&&(ep=null,Ql(r,o)),o=!1;var U=yn;e:do try{if(Yt!==0&&At!==null){var H=At,ae=ra;switch(Yt){case 8:Sv(),U=6;break e;case 3:case 2:case 9:case 6:sa.current===null&&(o=!0);var ye=Yt;if(Yt=0,ra=null,Kl(r,H,ae,ye),f&&gu){U=0;break e}break;default:ye=Yt,Yt=0,ra=null,Kl(r,H,ae,ye)}}gL(),U=yn;break}catch(Ce){_1(r,Ce)}while(!0);return o&&r.shellSuspendCounter++,Ps=Po=null,Tt=d,it.H=x,it.A=M,At===null&&(nn=null,Dt=0,Mr()),U}function gL(){for(;At!==null;)M1(At)}function vL(r,o){var f=Tt;Tt|=2;var d=S1(),x=b1();nn!==r||Dt!==o?(ep=null,pf=Pi()+500,Ql(r,o)):gu=S(r,o);e:do try{if(Yt!==0&&At!==null){o=At;var M=ra;t:switch(Yt){case 1:Yt=0,ra=null,Kl(r,o,M,1);break;case 2:case 9:if(pt(M)){Yt=0,ra=null,E1(o);break}o=function(){Yt!==2&&Yt!==9||nn!==r||(Yt=7),De(r)},M.then(o,o);break e;case 3:Yt=7;break e;case 4:Yt=5;break e;case 7:pt(M)?(Yt=0,ra=null,E1(o)):(Yt=0,ra=null,Kl(r,o,M,7));break;case 5:var U=null;switch(At.tag){case 26:U=At.memoizedState;case 5:case 27:var H=At,ae=H.type,ye=H.pendingProps;if(U?uE(U):Y1(H.stateNode,ae,ye)){Yt=0,ra=null;var Ce=H.sibling;if(Ce!==null)At=Ce;else{var Se=H.return;Se!==null?(At=Se,Rd(Se)):At=null}break t}}Yt=0,ra=null,Kl(r,o,M,5);break;case 6:Yt=0,ra=null,Kl(r,o,M,6);break;case 8:Sv(),yn=6;break e;default:throw Error(a(462))}}yL();break}catch(We){_1(r,We)}while(!0);return Ps=Po=null,it.H=d,it.A=x,Tt=f,At!==null?0:(nn=null,Dt=0,Mr(),yn)}function yL(){for(;At!==null&&!aI();)M1(At)}function M1(r){var o=XM(r.alternate,r,Hs);r.memoizedProps=r.pendingProps,o===null?Rd(r):At=o}function E1(r){var o=r,f=o.alternate;switch(o.tag){case 15:case 0:o=FM(f,o,o.pendingProps,o.type,void 0,Dt);break;case 11:o=FM(f,o,o.pendingProps,o.type.render,o.ref,Dt);break;case 5:ii(o);default:QM(f,o),o=At=I1(o,Hs),o=XM(f,o,Hs)}r.memoizedProps=r.pendingProps,o===null?Rd(r):At=o}function Kl(r,o,f,d){Ps=Po=null,ii(o),cu=null,uf=0;var x=o.return;try{if(lL(r,x,o,f,Dt)){yn=1,_d(r,re(f,r.current)),At=null;return}}catch(M){if(x!==null)throw At=x,M;yn=1,_d(r,re(f,r.current)),At=null;return}o.flags&32768?(Nt||d===1?r=!0:gu||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))),T1(o,r)):Rd(o)}function Rd(r){var o=r;do{if(o.flags&32768){T1(o,Lr);return}r=o.return;var f=fL(o.alternate,o,Hs);if(f!==null){At=f;return}if(o=o.sibling,o!==null){At=o;return}At=o=r}while(o!==null);yn===0&&(yn=5)}function T1(r,o){do{var f=hL(r.alternate,r);if(f!==null){f.flags&=32767,At=f;return}if(f=r.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!o&&(r=r.sibling,r!==null)){At=r;return}At=r=f}while(r!==null);yn=6,At=null}function A1(r,o,f,d,x,M,U,H,ae){r.cancelPendingCommit=null;do ef();while(kn!==0);if(Tt&6)throw Error(a(327));if(o!==null){if(o===r.current)throw Error(a(177));if(M=o.lanes|o.childLanes,M|=Qv,L(r,f,M,U,H,ae),r===nn&&(At=nn=null,Dt=0),yu=o,zr=r,Vs=f,ry=M,oy=x,ME=d,o.subtreeFlags&10256||o.flags&10256?(r.callbackNode=null,r.callbackPriority=0,bL(kv,function(){return U1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=it.T,it.T=null,x=Os(),Qn(2),U=Tt,Tt|=4;try{dL(r,o,f)}finally{Tt=U,Qn(x),it.T=d}}kn=1,w1(),C1(),R1()}}function w1(){if(kn===1){kn=0;var r=zr,o=yu,f=(o.flags&13878)!==0;if(o.subtreeFlags&13878||f){f=it.T,it.T=null;var d=Os();Qn(2);var x=Tt;Tt|=4;try{o1(o,r),IL(r.containerInfo)}finally{Tt=x,Qn(d),it.T=f}}r.current=o,kn=2}}function C1(){if(kn===2){kn=0;var r=zr,o=yu,f=(o.flags&8772)!==0;if(o.subtreeFlags&8772||f){f=it.T,it.T=null;var d=Os();Qn(2);var x=Tt;Tt|=4;try{i1(r,o.alternate,o)}finally{Tt=x,Qn(d),it.T=f}}kn=3}}function R1(){if(kn===4||kn===3){kn=0,sI();var r=zr,o=yu,f=Vs,d=ME;o.subtreeFlags&10256||o.flags&10256?kn=5:(kn=0,yu=zr=null,D1(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(sf,o,void 0,(o.current.flags&128)===128)}catch{}if(d!==null){o=it.T,x=Os(),Qn(2),it.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{it.T=o,Qn(x)}}Vs&3&&ef(),De(r),x=r.pendingLanes,f&261930&&x&42?r===ly?mf++:(mf=0,ly=r):mf=0,gi&&GN(),gt(0)}}function D1(r,o){(r.pooledCacheLanes&=o)===0&&(o=r.pooledCache,o!=null&&(r.pooledCache=null,Pe(o)))}function ef(){return w1(),C1(),R1(),U1()}function U1(){if(kn!==5)return!1;var r=zr,o=ry;ry=0;var f=Q(Vs),d=32>f?32:f;f=it.T;var x=Os();try{Qn(d),it.T=null,d=oy,oy=null;var M=zr,U=Vs;if(kn=0,yu=zr=null,Vs=0,(Tt&6)!==0)throw Error(a(331));var H=Tt;if(Tt|=4,h1(M.current),u1(M,M.current,U,d),Tt=H,gt(0,!1),ia&&typeof ia.onPostCommitFiberRoot=="function")try{ia.onPostCommitFiberRoot(sf,M)}catch{}return!0}finally{Qn(x),it.T=f,D1(r,o)}}function L1(r,o,f){o=re(f,o),o=ev(r.stateNode,o,2),r=fs(r,o,2),r!==null&&(R(r,2),De(r))}function Vt(r,o,f){if(r.tag===3)L1(r,r,f);else for(;o!==null;){if(o.tag===3){L1(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=re(f,r),f=UM(2),d=fs(o,f,2),d!==null&&(LM(f,d,o,r),R(d,2),De(d));break}}o=o.return}}function Mv(r,o,f){var d=r.pingCache;if(d===null){d=r.pingCache=new gI;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)||(iy=!0,x.add(f),r=_L.bind(null,r,o,f),o.then(r,r))}function _L(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()-$d?!(Tt&2)&&Ql(r,0):ay|=f,vu===Dt&&(vu=0)),De(r)}function N1(r,o){o===0&&(o=A()),r=Ma(r,o),r!==null&&(R(r,o),De(r))}function xL(r){var o=r.memoizedState,f=0;o!==null&&(f=o.retryLane),N1(r,f)}function SL(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),N1(r,f)}function bL(r,o){return Pd(r,o)}function ML(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 Ev(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 I1(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 Dd(r,o,f,d,x,M){var U=0;if(d=r,typeof r=="function")Ev(r)&&(U=1);else if(typeof r=="string")U=qa&&Vn?iE(r,f,ri.current)?26:hE(r)?27:5:qa?iE(r,f,ri.current)?26:5:Vn&&hE(r)?27:5;else e:switch(r){case Iv:return r=t(31,f,o,x),r.elementType=Iv,r.lanes=M,r;case $l:return Io(f.children,x,M,o);case V1:U=8,x|=24;break;case Rv:return r=t(12,f,o,x|2),r.elementType=Rv,r.lanes=M,r;case Uv:return r=t(13,f,o,x),r.elementType=Uv,r.lanes=M,r;case Lv:return r=t(19,f,o,x),r.elementType=Lv,r.lanes=M,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Ar:U=10;break e;case k1:U=9;break e;case Dv:U=11;break e;case Nv: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 Tv(r,o,f){return r=t(6,r,null,o),r.lanes=f,r}function z1(r){var o=t(18,null,null,0);return o.stateNode=r,o}function Av(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 EL(r,o,f,d,x,M,U,H,ae){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=ae,this.incompleteTransitions=new Map}function O1(r,o,f,d,x,M,U,H,ae,ye,Ce,Se){return r=new EL(r,o,f,U,ae,ye,Ce,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},ql(M),r}function P1(r){return r?(r=iu,r):iu}function B1(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:tf(r.stateNode)}function F1(r,o,f,d,x,M){x=P1(x),d.context===null?d.context=x:d.pendingContext=x,d=cs(o),d.payload={element:f},M=M===void 0?null:M,M!==null&&(d.callback=M),f=fs(r,d,o),f!==null&&(Oi(f,r,o),Ro(f,r,o))}function H1(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var f=r.retryLane;r.retryLane=f!==0&&f<o?f:o}}function wv(r,o){H1(r,o),(r=r.alternate)&&H1(r,o)}var Et={},TL=Ww,ta=xI,Cv=Object.assign,AL=Symbol.for("react.element"),Ud=Symbol.for("react.transitional.element"),Jl=Symbol.for("react.portal"),$l=Symbol.for("react.fragment"),V1=Symbol.for("react.strict_mode"),Rv=Symbol.for("react.profiler"),k1=Symbol.for("react.consumer"),Ar=Symbol.for("react.context"),Dv=Symbol.for("react.forward_ref"),Uv=Symbol.for("react.suspense"),Lv=Symbol.for("react.suspense_list"),Nv=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),Iv=Symbol.for("react.activity"),wL=Symbol.for("react.memo_cache_sentinel"),G1=Symbol.iterator,CL=Symbol.for("react.client.reference"),Ld=Array.isArray,it=TL.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,RL=e.rendererVersion,DL=e.rendererPackageName,W1=e.extraDevToolsConfig,tf=e.getPublicInstance,UL=e.getRootHostContext,LL=e.getChildHostContext,NL=e.prepareForCommit,IL=e.resetAfterCommit,zL=e.createInstance;e.cloneMutableInstance;var zv=e.appendInitialChild,X1=e.finalizeInitialChildren,Nd=e.shouldSetTextContent,q1=e.createTextInstance;e.cloneMutableTextInstance;var OL=e.scheduleTimeout,PL=e.cancelTimeout,zo=e.noTimeout,zs=e.isPrimaryRenderer;e.warnsIfNotActing;var mi=e.supportsMutation,ps=e.supportsPersistence,gi=e.supportsHydration,BL=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var FL=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Qn=e.setCurrentUpdatePriority,Os=e.getCurrentUpdatePriority,HL=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var VL=e.shouldAttemptEagerTransition,kL=e.detachDeletedInstance;e.requestPostPaintCallback;var GL=e.maySuspendCommit,WL=e.maySuspendCommitOnUpdate,Ov=e.maySuspendCommitInSyncRender,Y1=e.preloadInstance,XL=e.startSuspendingCommit,Z1=e.suspendInstance;e.suspendOnActiveViewTransition;var qL=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var eu=e.NotPendingTransition,Oo=e.HostTransitionContext,YL=e.resetFormInstance;e.bindToConsole;var ZL=e.supportsMicrotasks,jL=e.scheduleMicrotask,nf=e.supportsTestSelectors,QL=e.findFiberRoot,KL=e.getBoundingRect,JL=e.getTextContent,af=e.isHiddenSubtree,$L=e.matchAccessibilityRole,eN=e.setFocusIfFocusable,tN=e.setupIntersectionObserver,nN=e.appendChild,iN=e.appendChildToContainer,aN=e.commitTextUpdate,sN=e.commitMount,rN=e.commitUpdate,oN=e.insertBefore,lN=e.insertInContainerBefore,uN=e.removeChild,cN=e.removeChildFromContainer,j1=e.resetTextContent,fN=e.hideInstance,hN=e.hideTextInstance,dN=e.unhideInstance,pN=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 mN=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var gN=e.cloneInstance,Q1=e.createContainerChildSet,K1=e.appendChildToContainerChildSet,vN=e.finalizeContainerChildren,J1=e.replaceContainerChildren,$1=e.cloneHiddenInstance,eE=e.cloneHiddenTextInstance,Pv=e.isSuspenseInstancePending,Bv=e.isSuspenseInstanceFallback,yN=e.getSuspenseInstanceFallbackErrorDetails,_N=e.registerSuspenseInstanceRetry,xN=e.canHydrateFormStateMarker,SN=e.isFormStateMarkerMatching,tE=e.getNextHydratableSibling,bN=e.getNextHydratableSiblingAfterSingleton,MN=e.getFirstHydratableChild,EN=e.getFirstHydratableChildWithinContainer,TN=e.getFirstHydratableChildWithinActivityInstance,AN=e.getFirstHydratableChildWithinSuspenseInstance,wN=e.getFirstHydratableChildWithinSingleton,CN=e.canHydrateInstance,RN=e.canHydrateTextInstance,DN=e.canHydrateActivityInstance,UN=e.canHydrateSuspenseInstance,LN=e.hydrateInstance,NN=e.hydrateTextInstance,IN=e.hydrateActivityInstance,zN=e.hydrateSuspenseInstance,ON=e.getNextHydratableInstanceAfterActivityInstance,PN=e.getNextHydratableInstanceAfterSuspenseInstance,BN=e.commitHydratedInstance,FN=e.commitHydratedContainer,HN=e.commitHydratedActivityInstance,VN=e.commitHydratedSuspenseInstance,kN=e.finalizeHydratedChildren,GN=e.flushHydrationEvents;e.clearActivityBoundary;var WN=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var XN=e.clearSuspenseBoundaryFromContainer,qN=e.hideDehydratedBoundary,YN=e.unhideDehydratedBoundary,nE=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var ZN=e.validateHydratableInstance,jN=e.validateHydratableTextInstance,qa=e.supportsResources,iE=e.isHostHoistableType,Fv=e.getHoistableRoot,aE=e.getResource,sE=e.acquireResource,rE=e.releaseResource,QN=e.hydrateHoistable,oE=e.mountHoistable,lE=e.unmountHoistable,KN=e.createHoistableInstance,JN=e.prepareToCommitHoistables,$N=e.mayResourceSuspendCommit,uE=e.preloadResource,eI=e.suspendResource,Vn=e.supportsSingletons,cE=e.resolveSingletonInstance,tI=e.acquireSingletonInstance,fE=e.releaseSingletonInstance,hE=e.isHostSingletonType,tu=e.isSingletonScope,Hv=[],nu=-1,iu={},na=Math.clz32?Math.clz32:T,nI=Math.log,iI=Math.LN2,Id=256,zd=262144,Od=4194304,Pd=ta.unstable_scheduleCallback,Vv=ta.unstable_cancelCallback,aI=ta.unstable_shouldYield,sI=ta.unstable_requestPaint,Pi=ta.unstable_now,dE=ta.unstable_ImmediatePriority,rI=ta.unstable_UserBlockingPriority,kv=ta.unstable_NormalPriority,oI=ta.unstable_IdlePriority,lI=ta.log,uI=ta.unstable_setDisableYieldValue,sf=null,ia=null,aa=typeof Object.is=="function"?Object.is:j,pE=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)},cI=Object.prototype.hasOwnProperty,Gv,mE,Wv=!1,gE=new WeakMap,au=[],su=0,Bd=null,rf=0,Aa=[],wa=0,Cr=null,ms=1,gs="",ri=g(null),of=g(null),Rr=g(null),Fd=g(null),oi=null,dn=null,Nt=!1,Dr=null,Ca=!1,Xv=Error(a(519)),Hd=g(null),Po=null,Ps=null,fI=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()})}},hI=ta.unstable_scheduleCallback,dI=ta.unstable_NormalPriority,pn={$$typeof:Ar,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Vd=null,ru=null,qv=!1,kd=!1,Yv=!1,Bo=0,lf=null,Zv=0,ou=0,lu=null,vE=it.S;it.S=function(r,o){bE=Pi(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&Kt(r,o),vE!==null&&vE(r,o)};var Fo=g(null),uu=Error(a(460)),jv=Error(a(474)),Gd=Error(a(542)),Wd={then:function(){}},Ho=null,cu=null,uf=0,Vo=us(!0),yE=us(!1),Ra=[],fu=0,Qv=0,Ur=!1,Kv=!1,hu=g(null),Xd=g(0),sa=g(null),Ya=null,Tn=g(0),Bs=0,_t=null,Jt=null,Rn=null,qd=!1,du=!1,ko=!1,Yd=0,cf=0,pu=null,pI=0,ff={readContext:Z,use:ai,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};ff.useEffectEvent=ot;var _E={readContext:Z,use:ai,useCallback:function(r,o){return En().memoizedState=[r,o===void 0?null:o],r},useContext:Z,useEffect:hM,useImperativeHandle:function(r,o,f){f=f!=null?f.concat([r]):null,gd(4194308,4,gM.bind(null,o,r),f)},useLayoutEffect:function(r,o){return gd(4194308,4,r,o)},useInsertionEffect:function(r,o){gd(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=oL.bind(null,_t,r),[d.memoizedState,r]},useRef:function(r){var o=En();return r={current:r},o.memoizedState=r},useState:function(r){r=q0(r);var o=r.queue,f=TM.bind(null,_t,o);return o.dispatch=f,[r.memoizedState,f]},useDebugValue:j0,useDeferredValue:function(r,o){var f=En();return Q0(f,r,o)},useTransition:function(){var r=q0(!1);return r=SM.bind(null,_t,r.queue,!0,!1),En().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,o,f){var d=_t,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,hM(Jb.bind(null,d,M,r),[r]),d.flags|=2048,Zl(9,{destroy:void 0},Kb.bind(null,d,M,f,o),null),f},useId:function(){var r=En(),o=nn.identifierPrefix;if(Nt){var f=gs,d=ms;f=(d&~(1<<32-na(d)-1)).toString(32)+f,o="_"+o+"R_"+f,f=Yd++,0<f&&(o+="H"+f.toString(32)),o+="_"}else f=pI++,o="_"+o+"r_"+f.toString(32)+"_";return r.memoizedState=o},useHostTransitionStatus:K0,useFormState:oM,useActionState:oM,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=J0.bind(null,_t,!0,f),f.dispatch=o,[r,o]},useMemoCache:Ta,useCacheRefresh:function(){return En().memoizedState=rL.bind(null,_t)},useEffectEvent:function(r){var o=En(),f={impl:r};return o.memoizedState=f,function(){if(Tt&2)throw Error(a(440));return f.impl.apply(void 0,arguments)}}},Jv={readContext:Z,use:ai,useCallback:yM,useContext:Z,useEffect:Z0,useImperativeHandle:vM,useInsertionEffect:pM,useLayoutEffect:mM,useMemo:_M,useReducer:Do,useRef:fM,useState:function(){return Do(jn)},useDebugValue:j0,useDeferredValue:function(r,o){var f=ft();return xM(f,Jt.memoizedState,r,o)},useTransition:function(){var r=Do(jn)[0],o=ft().memoizedState;return[typeof r=="boolean"?r:ka(r),o]},useSyncExternalStore:jb,useId:MM,useHostTransitionStatus:K0,useFormState:lM,useActionState:lM,useOptimistic:function(r,o){var f=ft();return tM(f,Jt,r,o)},useMemoCache:Ta,useCacheRefresh:EM};Jv.useEffectEvent=dM;var xE={readContext:Z,use:ai,useCallback:yM,useContext:Z,useEffect:Z0,useImperativeHandle:vM,useInsertionEffect:pM,useLayoutEffect:mM,useMemo:_M,useReducer:X0,useRef:fM,useState:function(){return X0(jn)},useDebugValue:j0,useDeferredValue:function(r,o){var f=ft();return Jt===null?Q0(f,r,o):xM(f,Jt.memoizedState,r,o)},useTransition:function(){var r=X0(jn)[0],o=ft().memoizedState;return[typeof r=="boolean"?r:ka(r),o]},useSyncExternalStore:jb,useId:MM,useHostTransitionStatus:K0,useFormState:cM,useActionState:cM,useOptimistic:function(r,o){var f=ft();return Jt!==null?tM(f,Jt,r,o):(f.baseState=r,[r,f.queue.dispatch])},useMemoCache:Ta,useCacheRefresh:EM};xE.useEffectEvent=dM;var $v={enqueueSetState:function(r,o,f){r=r._reactInternals;var d=ea(),x=cs(d);x.payload=o,f!=null&&(x.callback=f),o=fs(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=cs(d);x.tag=1,x.payload=o,f!=null&&(x.callback=f),o=fs(r,x,d),o!==null&&(Oi(o,r,d),Ro(o,r,d))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var f=ea(),d=cs(f);d.tag=2,o!=null&&(d.callback=o),o=fs(r,d,f),o!==null&&(Oi(o,r,f),Ro(o,r,f))}},ey=Error(a(461)),Dn=!1,ty={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Fs=!1,Un=!1,ny=!1,SE=typeof WeakSet=="function"?WeakSet:Set,Kn=null,Ln=null,Bi=!1,Za=null,mu=8192,mI={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}},Zd=0,jd=1,Qd=2,Kd=3,Jd=4;if(typeof Symbol=="function"&&Symbol.for){var hf=Symbol.for;Zd=hf("selector.component"),jd=hf("selector.has_pseudo_class"),Qd=hf("selector.role"),Kd=hf("selector.test_id"),Jd=hf("selector.text")}var gI=typeof WeakMap=="function"?WeakMap:Map,Tt=0,nn=null,At=null,Dt=0,Yt=0,ra=null,Lr=!1,gu=!1,iy=!1,Hs=0,yn=0,Nr=0,Go=0,ay=0,oa=0,vu=0,df=null,Fi=null,sy=!1,$d=0,bE=0,pf=1/0,ep=null,Ir=null,kn=0,zr=null,yu=null,Vs=0,ry=0,oy=null,ME=null,mf=0,ly=null;return Et.attemptContinuousHydration=function(r){if(r.tag===13||r.tag===31){var o=Ma(r,67108864);o!==null&&Oi(o,r,67108864),wv(r,67108864)}},Et.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),wv(r,o)}},Et.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}De(r),!(Tt&6)&&(pf=Pi()+500,gt(0))}}break;case 31:case 13:o=Ma(r,2),o!==null&&Oi(o,r,2),y1(),wv(r,2)}},Et.batchedUpdates=function(r,o){return r(o)},Et.createComponentSelector=function(r){return{$$typeof:Zd,value:r}},Et.createContainer=function(r,o,f,d,x,M,U,H,ae,ye){return O1(r,o,!1,null,f,d,M,null,U,H,ae,ye)},Et.createHasPseudoClassSelector=function(r){return{$$typeof:jd,value:r}},Et.createHydrationContainer=function(r,o,f,d,x,M,U,H,ae,ye,Ce,Se,We,vt){var Nn;return r=O1(f,d,!0,r,x,M,H,vt,ae,ye,Ce,Se),r.context=P1(null),f=r.current,d=ea(),d=B(d),x=cs(d),x.callback=(Nn=o)!=null?Nn:null,fs(f,x,d),o=d,r.current.lanes=o,R(r,o),De(r),r},Et.createPortal=function(r,o,f){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Jl,key:d==null?null:""+d,children:r,containerInfo:o,implementation:f}},Et.createRoleSelector=function(r){return{$$typeof:Qd,value:r}},Et.createTestNameSelector=function(r){return{$$typeof:Kd,value:r}},Et.createTextSelector=function(r){return{$$typeof:Jd,value:r}},Et.defaultOnCaughtError=function(r){console.error(r)},Et.defaultOnRecoverableError=function(r){pE(r)},Et.defaultOnUncaughtError=function(r){pE(r)},Et.deferredUpdates=function(r){var o=it.T,f=Os();try{return Qn(32),it.T=null,r()}finally{Qn(f),it.T=o}},Et.discreteUpdates=function(r,o,f,d,x){var M=it.T,U=Os();try{return Qn(2),it.T=null,r(o,f,d,x)}finally{Qn(U),it.T=M,Tt===0&&(pf=Pi()+500)}},Et.findAllNodes=xv,Et.findBoundingRects=function(r,o){if(!nf)throw Error(a(363));o=xv(r,o),r=[];for(var f=0;f<o.length;f++)r.push(KL(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 ae=r[H],ye=ae.x,Ce=ye+ae.width,Se=ae.y,We=Se+ae.height;if(d>=ye&&M>=Se&&x<=Ce&&U<=We){r.splice(o,1);break}else if(d!==ye||f.width!==ae.width||We<M||Se>U){if(!(M!==Se||f.height!==ae.height||Ce<d||ye>x)){ye>d&&(ae.width+=ye-d,ae.x=d),Ce<x&&(ae.width=x-ye),r.splice(o,1);break}}else{Se>M&&(ae.height+=Se-M,ae.y=M),We<U&&(ae.height=U-Se),r.splice(o,1);break}}}return r},Et.findHostInstance=B1,Et.findHostInstanceWithNoPortals=function(r){return r=u(r),r=r!==null?h(r):null,r===null?null:tf(r.stateNode)},Et.findHostInstanceWithWarning=function(r){return B1(r)},Et.flushPassiveEffects=ef,Et.flushSyncFromReconciler=function(r){var o=Tt;Tt|=1;var f=it.T,d=Os();try{if(Qn(2),it.T=null,r)return r()}finally{Qn(d),it.T=f,Tt=o,!(Tt&6)&>(0)}},Et.flushSyncWork=y1,Et.focusWithin=function(r,o){if(!nf)throw Error(a(363));for(r=vv(r),o=p1(r,o),o=Array.from(o),r=0;r<o.length;){var f=o[r++],d=f.tag;if(!af(f)){if((d===5||d===26||d===27)&&eN(f.stateNode))return!0;for(f=f.child;f!==null;)o.push(f),f=f.sibling}}return!1},Et.getFindAllNodesFailureDescription=function(r,o){if(!nf)throw Error(a(363));var f=0,d=[];r=[vv(r),0];for(var x=0;x<r.length;){var M=r[x++],U=M.tag,H=r[x++],ae=o[H];if((U!==5&&U!==26&&U!==27||!af(M))&&(yv(M,ae)&&(d.push(_v(ae)),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(_v(o[f]));return`findAllNodes was able to match part of the selector:
`+(d.join(" > ")+`
No matching component was found for:
`)+r.join(" > ")}return null},Et.getPublicRootInstance=function(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 27:case 5:return tf(r.child.stateNode);default:return r.child.stateNode}},Et.injectIntoDevTools=function(){var r={bundleType:0,version:RL,rendererPackageName:DL,currentDispatcherRef:it,reconcilerVersion:"19.2.0"};if(W1!==null&&(r.rendererConfig=W1),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")r=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)r=!0;else{try{sf=o.inject(r),ia=o}catch{}r=!!o.checkDCE}}return r},Et.isAlreadyRendering=function(){return(Tt&6)!==0},Et.observeVisibleRects=function(r,o,f,d){if(!nf)throw Error(a(363));r=xv(r,o);var x=tN(r,f,d).disconnect;return{disconnect:function(){x()}}},Et.shouldError=function(){return null},Et.shouldSuspend=function(){return!1},Et.startHostTransition=function(r,o,f,d){if(r.tag!==5)throw Error(a(476));var x=bM(r).queue;SM(r,x,o,eu,f===null?i:function(){var M=bM(r);return M.next===null&&(M=r.alternate.memoizedState),Yc(r,M.next.queue,{},ea()),f(d)})},Et.updateContainer=function(r,o,f,d){var x=o.current,M=ea();return F1(x,M,r,o,f,d),M},Et.updateContainerSync=function(r,o,f,d){return F1(o.current,2,r,o,f,d),2},Et},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})}(zw)),zw.exports}var Pw;function jk(){return Pw||(Pw=1,Iw.exports=Zk()),Iw.exports}var Qk=jk();const Kk=Yk(Qk);function Jk(n){const e=Kk(n);return e.injectIntoDevTools(),e}const jU=0,Uc={},$k=/^three(?=[A-Z])/,G0=n=>`${n[0].toUpperCase()}${n.slice(1)}`;let e8=0;const t8=n=>typeof n=="function";function n8(n){if(t8(n)){const e=`${e8++}`;return Uc[e]=n,e}else Object.assign(Uc,n)}function QU(n,e){const t=G0(n),i=Uc[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 i8(n,e,t){var i;return n=G0(n)in Uc?n:n.replace($k,""),QU(n,e),n==="primitive"&&(i=e.object)!=null&&i.__r3f&&delete e.object.__r3f,kg(e.object,t,n,e)}function a8(n){if(!n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?Wg(n.parent,n):qi(n.object)&&(n.object.visible=!1),n.isHidden=!0,Xc(n)}}function KU(n){if(n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?Gg(n.parent,n):qi(n.object)&&n.props.visible!==!1&&(n.object.visible=!0),n.isHidden=!1,Xc(n)}}function Yb(n,e,t){const i=e.root.getState();if(!(!n.parent&&n.object!==i.scene)){if(!e.object){var a,s;const l=Uc[G0(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)Gg(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)Yb(e,l);Xc(e)}}function N_(n,e){e&&(e.parent=n,n.children.push(e),Yb(n,e))}function Bw(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),Yb(n,e,t)}function JU(n){if(typeof n.dispose=="function"){const e=()=>{try{n.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():wm.unstable_scheduleCallback(wm.unstable_IdlePriority,e)}}function Jx(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?Wg(n,e):qi(e.object)&&qi(n.object)&&(n.object.remove(e.object),Pk(VU(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];Jx(e,l,a)}e.children.length=0,delete e.object.__r3f,a&&e.type!=="primitive"&&e.object.type!=="Scene"&&JU(e.object),t===void 0&&Xc(e)}function s8(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 Am=[];function r8(){for(const[t]of Am){const i=t.parent;if(i){t.props.attach?Wg(i,t):qi(t.object)&&qi(i.object)&&i.object.remove(t.object);for(const a of t.children)a.props.attach?Wg(t,a):qi(a.object)&&qi(t.object)&&t.object.remove(a.object)}t.isHidden&&KU(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&JU(t.object)}for(const[t,i,a]of Am){t.props=i;const s=t.parent;if(s){var n,e;const l=Uc[G0(t.type)];t.object=(n=t.props.object)!=null?n:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,s8(a,t.object),Jr(t.object,t.props),t.props.attach?Gg(s,t):qi(t.object)&&qi(s.object)&&s.object.add(t.object);for(const u of t.children)u.props.attach?Gg(t,u):qi(u.object)&&qi(t.object)&&t.object.add(u.object);Xc(t)}}Am.length=0}const I_=()=>{},Fw={};let lm=jU;const o8=0,l8=4,$x=Jk({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:i8,removeChild:Jx,appendChild:N_,appendInitialChild:N_,insertBefore:Bw,appendChildToContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||N_(t,e)},removeChildFromContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||Jx(t,e)},insertInContainerBefore(n,e,t){const i=n.getState().scene.__r3f;!e||!t||!i||Bw(i,e,t)},getRootHostContext:()=>Fw,getChildHostContext:()=>Fw,commitUpdate(n,e,t,i,a){var s,l,u;QU(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,m)=>{var g;return p!==((g=t.args)==null?void 0:g[m])}))&&(c=!0),c)Am.push([n,{...i},a]);else{const p=Nk(n,i);Object.keys(p).length&&(Object.assign(n.props,p),Jr(n.object,p))}(a.sibling===null||(a.flags&l8)===o8)&&r8()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:n=>n==null?void 0:n.object,prepareForCommit:()=>null,preparePortalMount:n=>kg(n.getState().scene,n,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:a8,unhideInstance:KU,createTextInstance:I_,hideTextInstance:I_,unhideTextInstance:I_,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:Fe.createContext(null),setCurrentUpdatePriority(n){lm=n},getCurrentUpdatePriority(){return lm},resolveUpdatePriority(){var n;if(lm!==jU)return lm;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 Xk;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Gk;default:return Wk}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:qk.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,Hu={objects:"shallow",strict:!1};function u8(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 c8(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||Fk(nS,Vw),l=t||$x.createContainer(s,kk,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(m={}){let g;p=new Promise(_e=>g=_e);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}=m,k=s.getState(),j=k.gl;if(!k.gl){const _e={canvas:n,powerPreference:"high-performance",antialias:!0,alpha:!0},we=typeof v=="function"?await v(_e):v;Nw(we)?j=we:j=new VD({..._e,...v}),k.set({gl:j})}let te=k.raycaster;te||k.set({raycaster:te=new IU});const{params:V,...J}=w||{};if(gn.equ(J,te,Hu)||Jr(te,{...J}),gn.equ(V,te.params,Hu)||Jr(te,{params:{...te.params,...V}}),!k.camera||k.camera===c&&!gn.equ(c,B,Hu)){c=B;const _e=B==null?void 0:B.isCamera,we=_e?B:R?new kl(0,0,0,0,.1,1e3):new Bn(75,0,.1,1e3);_e||(we.position.z=5,B&&(Jr(we,B),we.manual||("aspect"in B||"left"in B||"right"in B||"bottom"in B||"top"in B)&&(we.manual=!0,we.updateProjectionMatrix())),!k.camera&&!(B!=null&&B.rotation)&&we.lookAt(0,0,0)),k.set({camera:we}),te.camera=we}if(!k.scene){let _e;T!=null&&T.isScene?(_e=T,kg(_e,s,"",{})):(_e=new Mb,kg(_e,s,"",{}),T&&Jr(_e,T)),k.set({scene:_e})}b&&!k.events.handlers&&k.set({events:b(s)});const X=u8(n,_);if(gn.equ(X,k.size,Hu)||k.setSize(X.width,X.height,X.top,X.left),z&&k.viewport.dpr!==WU(z)&&k.setDpr(z),k.frameloop!==L&&k.setFrameloop(L),k.onPointerMissed||k.set({onPointerMissed:Q}),C&&!gn.equ(C,k.performance,Hu)&&k.set(_e=>({performance:{..._e.performance,...C}})),!k.xr){var re;const _e=(ee,me)=>{const Oe=s.getState();Oe.frameloop!=="never"&&Vw(ee,!0,Oe,me)},we=()=>{const ee=s.getState();ee.gl.xr.enabled=ee.gl.xr.isPresenting,ee.gl.xr.setAnimationLoop(ee.gl.xr.isPresenting?_e:null),ee.gl.xr.isPresenting||nS(ee)},Je={connect(){const ee=s.getState().gl;ee.xr.addEventListener("sessionstart",we),ee.xr.addEventListener("sessionend",we)},disconnect(){const ee=s.getState().gl;ee.xr.removeEventListener("sessionstart",we),ee.xr.removeEventListener("sessionend",we)}};typeof((re=j.xr)==null?void 0:re.addEventListener)=="function"&&Je.connect(),k.set({xr:Je})}if(j.shadowMap){const _e=j.shadowMap.enabled,we=j.shadowMap.type;if(j.shadowMap.enabled=!!S,gn.boo(S))j.shadowMap.type=ih;else if(gn.str(S)){var he;const Je={basic:B3,percentage:c0,soft:ih,variance:$a};j.shadowMap.type=(he=Je[S])!=null?he:ih}else gn.obj(S)&&Object.assign(j.shadowMap,S);(_e!==j.shadowMap.enabled||we!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}return Ut.enabled=!I,h||(j.outputColorSpace=E?Mo:xi,j.toneMapping=A?Ms:nb),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)&&!Nw(v)&&!gn.equ(v,j,Hu)&&Jr(j,v),u=y,h=!0,g(),this},render(m){return!h&&!p&&this.configure(),p.then(()=>{$x.updateContainer(fa.jsx(f8,{store:s,children:m,onCreated:u,rootElement:n}),l,null,()=>{})}),s},unmount(){$U(n)}}}function f8({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(YU.Provider,{value:n,children:e})}function $U(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),$x.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(),Dk(a.scene),zl.delete(n)}catch{}},500)})}}const h8=new Set,d8=new Set,p8=new Set;function z_(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function dh(n,e){switch(n){case"before":return z_(h8,e);case"after":return z_(d8,e);case"tail":return z_(p8,e)}}let O_,P_;function eS(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),O_=e.internal.subscribers;for(let a=0;a<O_.length;a++)P_=O_[a],P_.ref.current(P_.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,tS=!1,B_,Hw,Vu;function eL(n){Hw=requestAnimationFrame(eL),Xg=!0,B_=0,dh("before",n),tS=!0;for(const t of zl.values()){var e;Vu=t.store.getState(),Vu.internal.active&&(Vu.frameloop==="always"||Vu.internal.frames>0)&&!((e=Vu.gl.xr)!=null&&e.isPresenting)&&(B_+=eS(n,Vu))}if(tS=!1,dh("after",n),B_===0)return dh("tail",n),Xg=!1,cancelAnimationFrame(Hw)}function nS(n,e=1){var t;if(!n)return zl.forEach(i=>nS(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):tS?n.internal.frames=2:n.internal.frames=1,Xg||(Xg=!0,requestAnimationFrame(eL)))}function Vw(n,e=!0,t,i){if(e&&dh("before",n),t)eS(n,t,i);else for(const a of zl.values())eS(n,a.store.getState());e&&dh("after",n)}const F_={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 m8(n){const{handlePointer:e}=Bk(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(F_).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]=F_[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]=F_[a];i.connected.removeEventListener(l,s)}t(a=>({events:{...a.events,connected:void 0}}))}}}}function kw(n,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...i),e)}}function g8({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]=Fe.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=Fe.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=Fe.useRef(!1);Fe.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[m,g,v]=Fe.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&&!x8(u.current.lastBounds,w)&&l(u.current.lastBounds=w)};return[y,h?kw(y,h):y,c?kw(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=tL(y),T())};return y8(v,!!e),v8(g),Fe.useEffect(()=>{_(),T()},[e,v,g]),Fe.useEffect(()=>_,[]),[b,s,m]}function v8(n){Fe.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function y8(n,e){Fe.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function tL(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,...tL(n.parentElement)]}const _8=["x","y","top","bottom","left","right","width","height"],x8=(n,e)=>_8.every(t=>n[t]===e[t]);function S8({ref:n,children:e,fallback:t,resize:i,style:a,gl:s,events:l=m8,eventSource:u,eventPrefix:c,shadows:h,linear:p,flat:m,legacy:g,orthographic:v,frameloop:_,dpr:T,performance:b,raycaster:y,camera:S,scene:E,onPointerMissed:A,onCreated:I,...R}){Fe.useMemo(()=>n8(sk),[]);const L=wk(),[z,C]=g8({scroll:!0,debounce:{scroll:50,resize:0},...i}),w=Fe.useRef(null),B=Fe.useRef(null);Fe.useImperativeHandle(n,()=>w.current);const Q=GU(A),[k,j]=Fe.useState(!1),[te,V]=Fe.useState(!1);if(k)throw k;if(te)throw te;const J=Fe.useRef(null);pd(()=>{const re=w.current;if(C.width>0&&C.height>0&&re){J.current||(J.current=c8(re));async function he(){await J.current.configure({gl:s,scene:E,events:l,shadows:h,linear:p,flat:m,legacy:g,orthographic:v,frameloop:_,dpr:T,performance:b,raycaster:y,camera:S,size:C,onPointerMissed:(..._e)=>Q.current==null?void 0:Q.current(..._e),onCreated:_e=>{_e.events.connect==null||_e.events.connect(u?Tk(u)?u.current:u:B.current),c&&_e.setEvents({compute:(we,Je)=>{const ee=we[c+"X"],me=we[c+"Y"];Je.pointer.set(ee/Je.size.width*2-1,-(me/Je.size.height)*2+1),Je.raycaster.setFromCamera(Je.pointer,Je.camera)}}),I==null||I(_e)}}),J.current.render(fa.jsx(L,{children:fa.jsx(Rk,{set:V,children:fa.jsx(Fe.Suspense,{fallback:fa.jsx(Ck,{set:j}),children:e??null})})}))}he()}}),Fe.useEffect(()=>{const re=w.current;if(re)return()=>$U(re)},[]);const X=u?"none":"auto";return fa.jsx("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:X,...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 O8(n){return fa.jsx(FU,{children:fa.jsx(S8,{...n})})}function iS(){return iS=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},iS.apply(null,arguments)}const md=new P,Zb=new P,b8=new P,Gw=new de;function M8(n,e,t){const i=md.setFromMatrixPosition(n.matrixWorld);i.project(e);const a=t.width/2,s=t.height/2;return[i.x*a+a,-(i.y*s)+s]}function E8(n,e){const t=md.setFromMatrixPosition(n.matrixWorld),i=Zb.setFromMatrixPosition(e.matrixWorld),a=t.sub(i),s=e.getWorldDirection(b8);return a.angleTo(s)>Math.PI/2}function T8(n,e,t,i){const a=md.setFromMatrixPosition(n.matrixWorld),s=a.clone();s.project(e),Gw.set(s.x,s.y),t.setFromCamera(Gw,e);const l=t.intersectObjects(i,!0);if(l.length){const u=l[0].distance;return a.distanceTo(t.ray.origin)<u}return!0}function A8(n,e){if(e instanceof kl)return e.zoom;if(e instanceof Bn){const t=md.setFromMatrixPosition(n.matrixWorld),i=Zb.setFromMatrixPosition(e.matrixWorld),a=e.fov*Math.PI/180,s=t.distanceTo(i);return 1/(2*Math.tan(a/2)*s)}else return 1}function w8(n,e,t){if(e instanceof Bn||e instanceof kl){const i=md.setFromMatrixPosition(n.matrixWorld),a=Zb.setFromMatrixPosition(e.matrixWorld),s=i.distanceTo(a),l=(t[1]-t[0])/(e.far-e.near),u=t[1]-l*e.far;return Math.round(l*s+u)}}const aS=n=>Math.abs(n)<1e-10?0:n;function nL(n,e,t=""){let i="matrix3d(";for(let a=0;a!==16;a++)i+=aS(e[a]*n.elements[a])+(a!==15?",":")");return t+i}const C8=(n=>e=>nL(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),R8=(n=>(e,t)=>nL(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function D8(n){return n&&typeof n=="object"&&"current"in n}const P8=Fe.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:a,center:s,fullscreen:l,portal:u,distanceFactor:c,sprite:h=!1,transform:p=!1,occlude:m,onOcclude:g,castShadow:v,receiveShadow:_,material:T,geometry:b,zIndexRange:y=[16777271,0],calculatePosition:S=M8,as:E="div",wrapperClass:A,pointerEvents:I="auto",...R},L)=>{const{gl:z,camera:C,scene:w,size:B,raycaster:Q,events:k,viewport:j}=Hk(),[te]=Fe.useState(()=>document.createElement(E)),V=Fe.useRef(null),J=Fe.useRef(null),X=Fe.useRef(0),re=Fe.useRef([0,0]),he=Fe.useRef(null),_e=Fe.useRef(null),we=(u==null?void 0:u.current)||k.connected||z.domElement.parentNode,Je=Fe.useRef(null),ee=Fe.useRef(!1),me=Fe.useMemo(()=>m&&m!=="blending"||Array.isArray(m)&&m.length&&D8(m[0]),[m]);Fe.useLayoutEffect(()=>{const Ze=z.domElement;m&&m==="blending"?(Ze.style.zIndex=`${Math.floor(y[0]/2)}`,Ze.style.position="absolute",Ze.style.pointerEvents="none"):(Ze.style.zIndex=null,Ze.style.position=null,Ze.style.pointerEvents=null)},[m]),Fe.useLayoutEffect(()=>{if(J.current){const Ze=V.current=z3.createRoot(te);if(w.updateMatrixWorld(),p)te.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const je=S(J.current,C,B);te.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${je[0]}px,${je[1]}px,0);transform-origin:0 0;`}return we&&(a?we.prepend(te):we.appendChild(te)),()=>{we&&we.removeChild(te),Ze.unmount()}}},[we,p]),Fe.useLayoutEffect(()=>{A&&(te.className=A)},[A]);const Oe=Fe.useMemo(()=>p?{position:"absolute",top:0,left:0,width:B.width,height:B.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...l&&{top:-B.height/2,left:-B.width/2,width:B.width,height:B.height},...t},[t,s,l,B,p]),Ee=Fe.useMemo(()=>({position:"absolute",pointerEvents:I}),[I]);Fe.useLayoutEffect(()=>{if(ee.current=!1,p){var Ze;(Ze=V.current)==null||Ze.render(Fe.createElement("div",{ref:he,style:Oe},Fe.createElement("div",{ref:_e,style:Ee},Fe.createElement("div",{ref:L,className:i,style:t,children:n}))))}else{var je;(je=V.current)==null||je.render(Fe.createElement("div",{ref:L,style:Oe,className:i,children:n}))}});const Ye=Fe.useRef(!0);Vk(Ze=>{if(J.current){C.updateMatrixWorld(),J.current.updateWorldMatrix(!0,!1);const je=p?re.current:S(J.current,C,B);if(p||Math.abs(X.current-C.zoom)>e||Math.abs(re.current[0]-je[0])>e||Math.abs(re.current[1]-je[1])>e){const ue=E8(J.current,C);let ge=!1;me&&(Array.isArray(m)?ge=m.map(Ae=>Ae.current):m!=="blending"&&(ge=[w]));const F=Ye.current;if(ge){const Ae=T8(J.current,C,Q,ge);Ye.current=Ae&&!ue}else Ye.current=!ue;F!==Ye.current&&(g?g(!Ye.current):te.style.display=Ye.current?"block":"none");const Ve=Math.floor(y[0]/2),ve=m?me?[y[0],Ve]:[Ve-1,0]:y;if(te.style.zIndex=`${w8(J.current,C,ve)}`,p){const[Ae,Te]=[B.width/2,B.height/2],tt=C.projectionMatrix.elements[5]*Te,{isOrthographicCamera:Ue,top:O,left:D,bottom:Z,right:oe}=C,pe=C8(C.matrixWorldInverse),le=Ue?`scale(${tt})translate(${aS(-(oe+D)/2)}px,${aS((O+Z)/2)}px)`:`translateZ(${tt}px)`;let Pe=J.current.matrixWorld;h&&(Pe=C.matrixWorldInverse.clone().transpose().copyPosition(Pe).scale(J.current.scale),Pe.elements[3]=Pe.elements[7]=Pe.elements[11]=0,Pe.elements[15]=1),te.style.width=B.width+"px",te.style.height=B.height+"px",te.style.perspective=Ue?"":`${tt}px`,he.current&&_e.current&&(he.current.style.transform=`${le}${pe}translate(${Ae}px,${Te}px)`,_e.current.style.transform=R8(Pe,1/((c||10)/400)))}else{const Ae=c===void 0?1:A8(J.current,C)*c;te.style.transform=`translate3d(${je[0]}px,${je[1]}px,0) scale(${Ae})`}re.current=je,X.current=C.zoom}}if(!me&&Je.current&&!ee.current)if(p){if(he.current){const je=he.current.children[0];if(je!=null&&je.clientWidth&&je!=null&&je.clientHeight){const{isOrthographicCamera:ue}=C;if(ue||b)R.scale&&(Array.isArray(R.scale)?R.scale instanceof P?Je.current.scale.copy(R.scale.clone().divideScalar(1)):Je.current.scale.set(1/R.scale[0],1/R.scale[1],1/R.scale[2]):Je.current.scale.setScalar(1/R.scale));else{const ge=(c||10)/400,F=je.clientWidth*ge,Ve=je.clientHeight*ge;Je.current.scale.set(F,Ve,1)}ee.current=!0}}}else{const je=te.children[0];if(je!=null&&je.clientWidth&&je!=null&&je.clientHeight){const ue=1/j.factor,ge=je.clientWidth*ue,F=je.clientHeight*ue;Je.current.scale.set(ge,F,1),ee.current=!0}Je.current.lookAt(Ze.camera.position)}});const et=Fe.useMemo(()=>({vertexShader:p?void 0:`
/*
This shader is from the THREE's SpriteMaterial.
We need to turn the backing plane into a Sprite
(make it always face the camera) if "transfrom"
is false.
*/
#include <common>
void main() {
vec2 center = vec2(0., 1.);
float rotation = 0.0;
// This is somewhat arbitrary, but it seems to work well
// Need to figure out how to derive this dynamically if it even matters
float size = 0.03;
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
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;
}
`,fragmentShader:`
void main() {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}
`}),[p]);return Fe.createElement("group",iS({},R,{ref:J}),m&&!me&&Fe.createElement("mesh",{castShadow:v,receiveShadow:_,ref:Je},b||Fe.createElement("planeGeometry",null),T||Fe.createElement("shaderMaterial",{side:ns,vertexShader:et.vertexShader,fragmentShader:et.fragmentShader})))});export{Ox as A,Mt as B,He as C,P8 as H,nP as L,Sl as N,kl as O,Ab as P,N8 as R,Eb as S,P as V,I8 as _,tn as a,E6 as b,Wn as c,ss as d,Vk as e,O8 as f,Hk as u};