@reposkein/mcp 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binary-digests.json +4 -4
- package/dist/cli/view.js +35 -3
- package/dist/cli/view.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer/runIndexer.d.ts +0 -4
- package/dist/indexer/runIndexer.js +0 -6
- package/dist/indexer/runIndexer.js.map +1 -1
- package/dist/profile/impact.d.ts +8 -0
- package/dist/profile/impact.js +8 -0
- package/dist/profile/impact.js.map +1 -1
- package/dist/store/jsonlGraph.js +11 -2
- package/dist/store/jsonlGraph.js.map +1 -1
- package/dist/tools/impact.d.ts +6 -1
- package/dist/tools/impact.js +6 -1
- package/dist/tools/impact.js.map +1 -1
- package/dist/viz/assets/index-C_8UkiJ8.js +9 -0
- package/dist/viz/assets/r3f-Cku1OhB-.js +277 -0
- package/dist/viz/assets/tanstack-DyXcNRWk.js +77 -0
- package/dist/viz/assets/three-Z8XaLGmf.js +3839 -0
- package/dist/viz/index.html +4 -1
- package/package.json +2 -2
- package/scripts/chmod-bin.mjs +12 -0
- package/dist/viz/assets/index-D2l9gwcq.js +0 -4199
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import{r as xf,a as I,b as wf,g as Cf,j as st,R as Do}from"./tanstack-DyXcNRWk.js";import{R as Eu,O as Gi,P as Vi,S as zo,a as so,V as Of,b as Rf,B as Pf,N as Su,A as Mf,W as Uf,C as Df,c as Bt,d as Ge,e as zf,L as oo,f as Af,U as fn,T as Lf,D as Ur,g as Ho,h as Ao,i as Tu,j as Nf,Q as If,M as Bf,k as kf,l as Ff,m as Go,n as Hf,o as Qt,p as Ke,q as Gf,r as Vf,s as jf,F as xu,t as Rt,u as Bi,v as Wf,w as ki,x as $n,E as Vo,y as wu,z as Cu,G as bf,H as Pi,I as Yf,J as On,K as ve,X as Ou,Y as Ru,Z as Zf,_ as Qf,$ as Ia,a0 as Kf}from"./three-Z8XaLGmf.js";var Mi={},Ba;function Xf(){if(Ba)return Mi;Ba=1;var r=xf();return Mi.createRoot=r.createRoot,Mi.hydrateRoot=r.hydrateRoot,Mi}var qf=Xf(),lo={exports:{}},an={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-reconciler-constants.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var ka;function Jf(){return ka||(ka=1,an.ConcurrentRoot=1,an.ContinuousEventPriority=4,an.DefaultEventPriority=16,an.DiscreteEventPriority=1,an.IdleEventPriority=536870912,an.LegacyRoot=0),an}var Fa;function $f(){return Fa||(Fa=1,lo.exports=Jf()),lo.exports}var qn=$f();function ed(r){let i;const o=new Set,u=(S,h)=>{const m=typeof S=="function"?S(i):S;if(m!==i){const x=i;i=h?m:Object.assign({},i,m),o.forEach(E=>E(i,x))}},c=()=>i,d=(S,h=c,m=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let x=h(i);function E(){const O=h(i);if(!m(x,O)){const A=x;S(x=O,A)}}return o.add(E),()=>o.delete(E)},_={setState:u,getState:c,subscribe:(S,h,m)=>h||m?d(S,h,m):(o.add(S),()=>o.delete(S)),destroy:()=>o.clear()};return i=r(u,c,_),_}const td=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Ha=td?I.useEffect:I.useLayoutEffect;function nd(r){const i=typeof r=="function"?ed(r):r,o=(u=i.getState,c=Object.is)=>{const[,d]=I.useReducer(L=>L+1,0),f=i.getState(),g=I.useRef(f),_=I.useRef(u),S=I.useRef(c),h=I.useRef(!1),m=I.useRef();m.current===void 0&&(m.current=u(f));let x,E=!1;(g.current!==f||_.current!==u||S.current!==c||h.current)&&(x=u(f),E=!c(m.current,x)),Ha(()=>{E&&(m.current=x),g.current=f,_.current=u,S.current=c,h.current=!1});const O=I.useRef(f);Ha(()=>{const L=()=>{try{const y=i.getState(),C=_.current(y);S.current(m.current,C)||(g.current=y,m.current=C,d())}catch{h.current=!0,d()}},v=i.subscribe(L);return i.getState()!==O.current&&L(),v},[]);const A=E?x:m.current;return I.useDebugValue(A),A};return Object.assign(o,i),o[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const u=[o,i];return{next(){const c=u.length<=0;return{value:u.shift(),done:c}}}},o}var ao={exports:{}},uo={exports:{}},co={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Ga;function rd(){return Ga||(Ga=1,(function(r){function i(F,Q){var W=F.length;F.push(Q);e:for(;0<W;){var J=W-1>>>1,le=F[J];if(0<c(le,Q))F[J]=Q,F[W]=le,W=J;else break e}}function o(F){return F.length===0?null:F[0]}function u(F){if(F.length===0)return null;var Q=F[0],W=F.pop();if(W!==Q){F[0]=W;e:for(var J=0,le=F.length,oe=le>>>1;J<oe;){var Le=2*(J+1)-1,Ve=F[Le],lt=Le+1,kt=F[lt];if(0>c(Ve,W))lt<le&&0>c(kt,Ve)?(F[J]=kt,F[lt]=W,J=lt):(F[J]=Ve,F[Le]=W,J=Le);else if(lt<le&&0>c(kt,W))F[J]=kt,F[lt]=W,J=lt;else break e}}return Q}function c(F,Q){var W=F.sortIndex-Q.sortIndex;return W!==0?W:F.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;r.unstable_now=function(){return d.now()}}else{var f=Date,g=f.now();r.unstable_now=function(){return f.now()-g}}var _=[],S=[],h=1,m=null,x=3,E=!1,O=!1,A=!1,L=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var Q=o(S);Q!==null;){if(Q.callback===null)u(S);else if(Q.startTime<=F)u(S),Q.sortIndex=Q.expirationTime,i(_,Q);else break;Q=o(S)}}function U(F){if(A=!1,C(F),!O)if(o(_)!==null)O=!0,Ue(z);else{var Q=o(S);Q!==null&&Ce(U,Q.startTime-F)}}function z(F,Q){O=!1,A&&(A=!1,v(Y),Y=-1),E=!0;var W=x;try{for(C(Q),m=o(_);m!==null&&(!(m.expirationTime>Q)||F&&!B());){var J=m.callback;if(typeof J=="function"){m.callback=null,x=m.priorityLevel;var le=J(m.expirationTime<=Q);Q=r.unstable_now(),typeof le=="function"?m.callback=le:m===o(_)&&u(_),C(Q)}else u(_);m=o(_)}if(m!==null)var oe=!0;else{var Le=o(S);Le!==null&&Ce(U,Le.startTime-Q),oe=!1}return oe}finally{m=null,x=W,E=!1}}var N=!1,H=null,Y=-1,j=5,X=-1;function B(){return!(r.unstable_now()-X<j)}function ee(){if(H!==null){var F=r.unstable_now();X=F;var Q=!0;try{Q=H(!0,F)}finally{Q?ge():(N=!1,H=null)}}else N=!1}var ge;if(typeof y=="function")ge=function(){y(ee)};else if(typeof MessageChannel<"u"){var Ie=new MessageChannel,ce=Ie.port2;Ie.port1.onmessage=ee,ge=function(){ce.postMessage(null)}}else ge=function(){L(ee,0)};function Ue(F){H=F,N||(N=!0,ge())}function Ce(F,Q){Y=L(function(){F(r.unstable_now())},Q)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(F){F.callback=null},r.unstable_continueExecution=function(){O||E||(O=!0,Ue(z))},r.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<F?Math.floor(1e3/F):5},r.unstable_getCurrentPriorityLevel=function(){return x},r.unstable_getFirstCallbackNode=function(){return o(_)},r.unstable_next=function(F){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var W=x;x=Q;try{return F()}finally{x=W}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(F,Q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var W=x;x=F;try{return Q()}finally{x=W}},r.unstable_scheduleCallback=function(F,Q,W){var J=r.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?J+W:J):W=J,F){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=W+le,F={id:h++,callback:Q,priorityLevel:F,startTime:W,expirationTime:le,sortIndex:-1},W>J?(F.sortIndex=W,i(S,F),o(_)===null&&F===o(S)&&(A?(v(Y),Y=-1):A=!0,Ce(U,W-J))):(F.sortIndex=le,i(_,F),O||E||(O=!0,Ue(z))),F},r.unstable_shouldYield=B,r.unstable_wrapCallback=function(F){var Q=x;return function(){var W=x;x=Q;try{return F.apply(this,arguments)}finally{x=W}}}})(co)),co}var Va;function Pu(){return Va||(Va=1,uo.exports=rd()),uo.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-reconciler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var fo,ja;function id(){return ja||(ja=1,fo=function(i){var o={},u=wf(),c=Pu(),d=Object.assign;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var g=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_=Symbol.for("react.element"),S=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),O=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),U=Symbol.for("react.offscreen"),z=Symbol.iterator;function N(e){return e===null||typeof e!="object"?null:(e=z&&e[z]||e["@@iterator"],typeof e=="function"?e:null)}function H(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case S:return"Portal";case x:return"Profiler";case m:return"StrictMode";case L:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case O:return(e.displayName||"Context")+".Consumer";case E:return(e._context.displayName||"Context")+".Provider";case A:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case y:return t=e.displayName||null,t!==null?t:H(e.type)||"Memo";case C:t=e._payload,e=e._init;try{return H(e(t))}catch{}}return null}function Y(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return H(t);case 8:return t===m?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function j(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function X(e){if(j(e)!==e)throw Error(f(188))}function B(e){var t=e.alternate;if(!t){if(t=j(e),t===null)throw Error(f(188));return t!==e?null:e}for(var n=e,s=t;;){var l=n.return;if(l===null)break;var a=l.alternate;if(a===null){if(s=l.return,s!==null){n=s;continue}break}if(l.child===a.child){for(a=l.child;a;){if(a===n)return X(l),e;if(a===s)return X(l),t;a=a.sibling}throw Error(f(188))}if(n.return!==s.return)n=l,s=a;else{for(var p=!1,T=l.child;T;){if(T===n){p=!0,n=l,s=a;break}if(T===s){p=!0,s=l,n=a;break}T=T.sibling}if(!p){for(T=a.child;T;){if(T===n){p=!0,n=a,s=l;break}if(T===s){p=!0,s=a,n=l;break}T=T.sibling}if(!p)throw Error(f(189))}}if(n.alternate!==s)throw Error(f(190))}if(n.tag!==3)throw Error(f(188));return n.stateNode.current===n?e:t}function ee(e){return e=B(e),e!==null?ge(e):null}function ge(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ge(e);if(t!==null)return t;e=e.sibling}return null}function Ie(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){if(e.tag!==4){var t=Ie(e);if(t!==null)return t}e=e.sibling}return null}var ce=Array.isArray,Ue=i.getPublicInstance,Ce=i.getRootHostContext,F=i.getChildHostContext,Q=i.prepareForCommit,W=i.resetAfterCommit,J=i.createInstance,le=i.appendInitialChild,oe=i.finalizeInitialChildren,Le=i.prepareUpdate,Ve=i.shouldSetTextContent,lt=i.createTextInstance,kt=i.scheduleTimeout,Kt=i.cancelTimeout,Rn=i.noTimeout,Be=i.isPrimaryRenderer,ae=i.supportsMutation,dt=i.supportsPersistence,Oe=i.supportsHydration,dn=i.getInstanceFromNode,Pn=i.preparePortalMount,Wi=i.getCurrentEventPriority,Ft=i.detachDeletedInstance,Ar=i.supportsMicrotasks,er=i.scheduleMicrotask,Xt=i.supportsTestSelectors,bi=i.findFiberRoot,Yi=i.getBoundingRect,Zi=i.getTextContent,hn=i.isHiddenSubtree,Qi=i.matchAccessibilityRole,Ki=i.setFocusIfFocusable,Ht=i.setupIntersectionObserver,qu=i.appendChild,Ju=i.appendChildToContainer,$u=i.commitTextUpdate,ec=i.commitMount,tc=i.commitUpdate,nc=i.insertBefore,rc=i.insertInContainerBefore,ic=i.removeChild,sc=i.removeChildFromContainer,Qo=i.resetTextContent,oc=i.hideInstance,lc=i.hideTextInstance,ac=i.unhideInstance,uc=i.unhideTextInstance,cc=i.clearContainer,fc=i.cloneInstance,Ko=i.createContainerChildSet,Xo=i.appendChildToContainerChildSet,dc=i.finalizeContainerChildren,qo=i.replaceContainerChildren,Jo=i.cloneHiddenInstance,$o=i.cloneHiddenTextInstance,hc=i.canHydrateInstance,pc=i.canHydrateTextInstance,mc=i.canHydrateSuspenseInstance,el=i.isSuspenseInstancePending,Xi=i.isSuspenseInstanceFallback,vc=i.registerSuspenseInstanceRetry,tr=i.getNextHydratableSibling,gc=i.getFirstHydratableChild,_c=i.getFirstHydratableChildWithinContainer,yc=i.getFirstHydratableChildWithinSuspenseInstance,Ec=i.hydrateInstance,Sc=i.hydrateTextInstance,Tc=i.hydrateSuspenseInstance,xc=i.getNextHydratableInstanceAfterSuspenseInstance,tl=i.commitHydratedContainer,wc=i.commitHydratedSuspenseInstance,Cc=i.clearSuspenseBoundary,Oc=i.clearSuspenseBoundaryFromContainer,Rc=i.shouldDeleteUnhydratedTailInstances,Pc=i.didNotMatchHydratedContainerTextInstance,Mc=i.didNotMatchHydratedTextInstance,qi;function nr(e){if(qi===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);qi=t&&t[1]||""}return`
|
|
26
|
+
`+qi+e}var Ji=!1;function $i(e,t){if(!e||Ji)return"";Ji=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(k){var s=k}Reflect.construct(e,[],t)}else{try{t.call()}catch(k){s=k}e.call(t.prototype)}else{try{throw Error()}catch(k){s=k}e()}}catch(k){if(k&&s&&typeof k.stack=="string"){for(var l=k.stack.split(`
|
|
27
|
+
`),a=s.stack.split(`
|
|
28
|
+
`),p=l.length-1,T=a.length-1;1<=p&&0<=T&&l[p]!==a[T];)T--;for(;1<=p&&0<=T;p--,T--)if(l[p]!==a[T]){if(p!==1||T!==1)do if(p--,T--,0>T||l[p]!==a[T]){var D=`
|
|
29
|
+
`+l[p].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),D}while(1<=p&&0<=T);break}}}finally{Ji=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?nr(e):""}var Uc=Object.prototype.hasOwnProperty,es=[],Mn=-1;function qt(e){return{current:e}}function Te(e){0>Mn||(e.current=es[Mn],es[Mn]=null,Mn--)}function Ee(e,t){Mn++,es[Mn]=e.current,e.current=t}var Jt={},We=qt(Jt),$e=qt(!1),pn=Jt;function Un(e,t){var n=e.type.contextTypes;if(!n)return Jt;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},a;for(a in n)l[a]=t[a];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function et(e){return e=e.childContextTypes,e!=null}function Lr(){Te($e),Te(We)}function nl(e,t,n){if(We.current!==Jt)throw Error(f(168));Ee(We,t),Ee($e,n)}function rl(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(f(108,Y(e)||"Unknown",l));return d({},n,s)}function Nr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jt,pn=We.current,Ee(We,e),Ee($e,$e.current),!0}function il(e,t,n){var s=e.stateNode;if(!s)throw Error(f(169));n?(e=rl(e,t,pn),s.__reactInternalMemoizedMergedChildContext=e,Te($e),Te(We),Ee(We,e)):Te($e),Ee($e,n)}var Tt=Math.clz32?Math.clz32:Ac,Dc=Math.log,zc=Math.LN2;function Ac(e){return e>>>=0,e===0?32:31-(Dc(e)/zc|0)|0}var Ir=64,Br=4194304;function rr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function kr(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,l=e.suspendedLanes,a=e.pingedLanes,p=n&268435455;if(p!==0){var T=p&~l;T!==0?s=rr(T):(a&=p,a!==0&&(s=rr(a)))}else p=n&~l,p!==0?s=rr(p):a!==0&&(s=rr(a));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,a=t&-t,l>=a||l===16&&(a&4194240)!==0))return t;if((s&4)!==0&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Tt(t),l=1<<n,s|=e[n],t&=~l;return s}function Lc(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nc(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,l=e.expirationTimes,a=e.pendingLanes;0<a;){var p=31-Tt(a),T=1<<p,D=l[p];D===-1?((T&n)===0||(T&s)!==0)&&(l[p]=Lc(T,t)):D<=t&&(e.expiredLanes|=T),a&=~T}}function ts(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ns(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ir(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function Ic(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-Tt(n),a=1<<l;t[l]=0,s[l]=-1,e[l]=-1,n&=~a}}function rs(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Tt(n),l=1<<s;l&t|e[s]&t&&(e[s]|=t),n&=~l}}var fe=0;function sl(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var is=c.unstable_scheduleCallback,ol=c.unstable_cancelCallback,Bc=c.unstable_shouldYield,kc=c.unstable_requestPaint,ke=c.unstable_now,ss=c.unstable_ImmediatePriority,Fc=c.unstable_UserBlockingPriority,os=c.unstable_NormalPriority,Hc=c.unstable_IdlePriority,Fr=null,Pt=null;function Gc(e){if(Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(Fr,e,void 0,(e.current.flags&128)===128)}catch{}}function Vc(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mt=typeof Object.is=="function"?Object.is:Vc,Gt=null,Hr=!1,ls=!1;function ll(e){Gt===null?Gt=[e]:Gt.push(e)}function jc(e){Hr=!0,ll(e)}function Ut(){if(!ls&&Gt!==null){ls=!0;var e=0,t=fe;try{var n=Gt;for(fe=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}Gt=null,Hr=!1}catch(l){throw Gt!==null&&(Gt=Gt.slice(e+1)),is(ss,Ut),l}finally{fe=t,ls=!1}}return null}var Wc=g.ReactCurrentBatchConfig;function Gr(e,t){if(Mt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var l=n[s];if(!Uc.call(t,l)||!Mt(e[l],t[l]))return!1}return!0}function bc(e){switch(e.tag){case 5:return nr(e.type);case 16:return nr("Lazy");case 13:return nr("Suspense");case 19:return nr("SuspenseList");case 0:case 2:case 15:return e=$i(e.type,!1),e;case 11:return e=$i(e.type.render,!1),e;case 1:return e=$i(e.type,!0),e;default:return""}}function xt(e,t){if(e&&e.defaultProps){t=d({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}var Vr=qt(null),jr=null,Dn=null,as=null;function us(){as=Dn=jr=null}function al(e,t,n){Be?(Ee(Vr,t._currentValue),t._currentValue=n):(Ee(Vr,t._currentValue2),t._currentValue2=n)}function cs(e){var t=Vr.current;Te(Vr),Be?e._currentValue=t:e._currentValue2=t}function fs(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function zn(e,t){jr=e,as=Dn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ct=!0),e.firstContext=null)}function ht(e){var t=Be?e._currentValue:e._currentValue2;if(as!==e)if(e={context:e,memoizedValue:t,next:null},Dn===null){if(jr===null)throw Error(f(308));Dn=e,jr.dependencies={lanes:0,firstContext:e}}else Dn=Dn.next=e;return t}var Dt=null,$t=!1;function ds(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ul(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t){var n=e.updateQueue;n!==null&&(n=n.shared,ze!==null&&(e.mode&1)!==0&&(se&2)===0?(e=n.interleaved,e===null?(t.next=t,Dt===null?Dt=[n]:Dt.push(n)):(t.next=e.next,e.next=t),n.interleaved=t):(e=n.pending,e===null?t.next=t:(t.next=e.next,e.next=t),n.pending=t))}function Wr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,rs(e,n)}}function cl(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var l=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var p={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?l=a=p:a=a.next=p,n=n.next}while(n!==null);a===null?l=a=t:a=a.next=t}else l=a=t;n={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function br(e,t,n,s){var l=e.updateQueue;$t=!1;var a=l.firstBaseUpdate,p=l.lastBaseUpdate,T=l.shared.pending;if(T!==null){l.shared.pending=null;var D=T,k=D.next;D.next=null,p===null?a=k:p.next=k,p=D;var b=e.alternate;b!==null&&(b=b.updateQueue,T=b.lastBaseUpdate,T!==p&&(T===null?b.firstBaseUpdate=k:T.next=k,b.lastBaseUpdate=D))}if(a!==null){var te=l.baseState;p=0,b=k=D=null,T=a;do{var q=T.lane,ye=T.eventTime;if((s&q)===q){b!==null&&(b=b.next={eventTime:ye,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var K=e,Qe=T;switch(q=t,ye=n,Qe.tag){case 1:if(K=Qe.payload,typeof K=="function"){te=K.call(ye,te,q);break e}te=K;break e;case 3:K.flags=K.flags&-65537|128;case 0:if(K=Qe.payload,q=typeof K=="function"?K.call(ye,te,q):K,q==null)break e;te=d({},te,q);break e;case 2:$t=!0}}T.callback!==null&&T.lane!==0&&(e.flags|=64,q=l.effects,q===null?l.effects=[T]:q.push(T))}else ye={eventTime:ye,lane:q,tag:T.tag,payload:T.payload,callback:T.callback,next:null},b===null?(k=b=ye,D=te):b=b.next=ye,p|=q;if(T=T.next,T===null){if(T=l.shared.pending,T===null)break;q=T,T=q.next,q.next=null,l.lastBaseUpdate=q,l.shared.pending=null}}while(!0);if(b===null&&(D=te),l.baseState=D,l.firstBaseUpdate=k,l.lastBaseUpdate=b,t=l.shared.interleaved,t!==null){l=t;do p|=l.lane,l=l.next;while(l!==t)}else a===null&&(l.shared.lanes=0);Gn|=p,e.lanes=p,e.memoizedState=te}}function fl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],l=s.callback;if(l!==null){if(s.callback=null,s=n,typeof l!="function")throw Error(f(191,l));l.call(s)}}}var dl=new u.Component().refs;function hs(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:d({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Yr={isMounted:function(e){return(e=e._reactInternals)?j(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Je(),l=rn(e),a=Vt(s,l);a.payload=t,n!=null&&(a.callback=n),en(e,a),t=_t(e,l,s),t!==null&&Wr(t,e,l)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Je(),l=rn(e),a=Vt(s,l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),en(e,a),t=_t(e,l,s),t!==null&&Wr(t,e,l)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Je(),s=rn(e),l=Vt(n,s);l.tag=2,t!=null&&(l.callback=t),en(e,l),t=_t(e,s,n),t!==null&&Wr(t,e,s)}};function hl(e,t,n,s,l,a,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,a,p):t.prototype&&t.prototype.isPureReactComponent?!Gr(n,s)||!Gr(l,a):!0}function pl(e,t,n){var s=!1,l=Jt,a=t.contextType;return typeof a=="object"&&a!==null?a=ht(a):(l=et(t)?pn:We.current,s=t.contextTypes,a=(s=s!=null)?Un(e,l):Jt),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Yr,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=a),t}function ml(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Yr.enqueueReplaceState(t,t.state,null)}function ps(e,t,n,s){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs=dl,ds(e);var a=t.contextType;typeof a=="object"&&a!==null?l.context=ht(a):(a=et(t)?pn:We.current,l.context=Un(e,a)),l.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(hs(e,t,a,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&Yr.enqueueReplaceState(l,l.state,null),br(e,n,l,s),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}var An=[],Ln=0,Zr=null,Qr=0,pt=[],mt=0,mn=null,jt=1,Wt="";function vn(e,t){An[Ln++]=Qr,An[Ln++]=Zr,Zr=e,Qr=t}function vl(e,t,n){pt[mt++]=jt,pt[mt++]=Wt,pt[mt++]=mn,mn=e;var s=jt;e=Wt;var l=32-Tt(s)-1;s&=~(1<<l),n+=1;var a=32-Tt(t)+l;if(30<a){var p=l-l%5;a=(s&(1<<p)-1).toString(32),s>>=p,l-=p,jt=1<<32-Tt(t)+l|n<<l|s,Wt=a+e}else jt=1<<a|n<<l|s,Wt=e}function ms(e){e.return!==null&&(vn(e,1),vl(e,1,0))}function vs(e){for(;e===Zr;)Zr=An[--Ln],An[Ln]=null,Qr=An[--Ln],An[Ln]=null;for(;e===mn;)mn=pt[--mt],pt[mt]=null,Wt=pt[--mt],pt[mt]=null,jt=pt[--mt],pt[mt]=null}var at=null,ut=null,we=!1,sr=!1,wt=null;function gl(e,t){var n=yt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function _l(e,t){switch(e.tag){case 5:return t=hc(t,e.type,e.pendingProps),t!==null?(e.stateNode=t,at=e,ut=gc(t),!0):!1;case 6:return t=pc(t,e.pendingProps),t!==null?(e.stateNode=t,at=e,ut=null,!0):!1;case 13:if(t=mc(t),t!==null){var n=mn!==null?{id:jt,overflow:Wt}:null;return e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=yt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,at=e,ut=null,!0}return!1;default:return!1}}function gs(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _s(e){if(we){var t=ut;if(t){var n=t;if(!_l(e,t)){if(gs(e))throw Error(f(418));t=tr(n);var s=at;t&&_l(e,t)?gl(s,n):(e.flags=e.flags&-4097|2,we=!1,at=e)}}else{if(gs(e))throw Error(f(418));e.flags=e.flags&-4097|2,we=!1,at=e}}}function yl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;at=e}function or(e){if(!Oe||e!==at)return!1;if(!we)return yl(e),we=!0,!1;if(e.tag!==3&&(e.tag!==5||Rc(e.type)&&!Ve(e.type,e.memoizedProps))){var t=ut;if(t){if(gs(e)){for(e=ut;e;)e=tr(e);throw Error(f(418))}for(;t;)gl(e,t),t=tr(t)}}if(yl(e),e.tag===13){if(!Oe)throw Error(f(316));if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));ut=xc(e)}else ut=at?tr(e.stateNode):null;return!0}function Nn(){Oe&&(ut=at=null,sr=we=!1)}function ys(e){wt===null?wt=[e]:wt.push(e)}function lr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(f(309));var s=n.stateNode}if(!s)throw Error(f(147,e));var l=s,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(p){var T=l.refs;T===dl&&(T=l.refs={}),p===null?delete T[a]:T[a]=p},t._stringRef=a,t)}if(typeof e!="string")throw Error(f(284));if(!n._owner)throw Error(f(290,e))}return e}function Kr(e,t){throw e=Object.prototype.toString.call(t),Error(f(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function El(e){var t=e._init;return t(e._payload)}function Sl(e){function t(R,w){if(e){var M=R.deletions;M===null?(R.deletions=[w],R.flags|=16):M.push(w)}}function n(R,w){if(!e)return null;for(;w!==null;)t(R,w),w=w.sibling;return null}function s(R,w){for(R=new Map;w!==null;)w.key!==null?R.set(w.key,w):R.set(w.index,w),w=w.sibling;return R}function l(R,w){return R=on(R,w),R.index=0,R.sibling=null,R}function a(R,w,M){return R.index=M,e?(M=R.alternate,M!==null?(M=M.index,M<w?(R.flags|=2,w):M):(R.flags|=2,w)):(R.flags|=1048576,w)}function p(R){return e&&R.alternate===null&&(R.flags|=2),R}function T(R,w,M,V){return w===null||w.tag!==6?(w=no(M,R.mode,V),w.return=R,w):(w=l(w,M),w.return=R,w)}function D(R,w,M,V){var Z=M.type;return Z===h?b(R,w,M.props.children,V,M.key):w!==null&&(w.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===C&&El(Z)===w.type)?(V=l(w,M.props),V.ref=lr(R,w,M),V.return=R,V):(V=Oi(M.type,M.key,M.props,null,R.mode,V),V.ref=lr(R,w,M),V.return=R,V)}function k(R,w,M,V){return w===null||w.tag!==4||w.stateNode.containerInfo!==M.containerInfo||w.stateNode.implementation!==M.implementation?(w=ro(M,R.mode,V),w.return=R,w):(w=l(w,M.children||[]),w.return=R,w)}function b(R,w,M,V,Z){return w===null||w.tag!==7?(w=xn(M,R.mode,V,Z),w.return=R,w):(w=l(w,M),w.return=R,w)}function te(R,w,M){if(typeof w=="string"&&w!==""||typeof w=="number")return w=no(""+w,R.mode,M),w.return=R,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case _:return M=Oi(w.type,w.key,w.props,null,R.mode,M),M.ref=lr(R,null,w),M.return=R,M;case S:return w=ro(w,R.mode,M),w.return=R,w;case C:var V=w._init;return te(R,V(w._payload),M)}if(ce(w)||N(w))return w=xn(w,R.mode,M,null),w.return=R,w;Kr(R,w)}return null}function q(R,w,M,V){var Z=w!==null?w.key:null;if(typeof M=="string"&&M!==""||typeof M=="number")return Z!==null?null:T(R,w,""+M,V);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case _:return M.key===Z?D(R,w,M,V):null;case S:return M.key===Z?k(R,w,M,V):null;case C:return Z=M._init,q(R,w,Z(M._payload),V)}if(ce(M)||N(M))return Z!==null?null:b(R,w,M,V,null);Kr(R,M)}return null}function ye(R,w,M,V,Z){if(typeof V=="string"&&V!==""||typeof V=="number")return R=R.get(M)||null,T(w,R,""+V,Z);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case _:return R=R.get(V.key===null?M:V.key)||null,D(w,R,V,Z);case S:return R=R.get(V.key===null?M:V.key)||null,k(w,R,V,Z);case C:var ie=V._init;return ye(R,w,M,ie(V._payload),Z)}if(ce(V)||N(V))return R=R.get(M)||null,b(w,R,V,Z,null);Kr(w,V)}return null}function K(R,w,M,V){for(var Z=null,ie=null,ne=w,de=w=0,He=null;ne!==null&&de<M.length;de++){ne.index>de?(He=ne,ne=null):He=ne.sibling;var he=q(R,ne,M[de],V);if(he===null){ne===null&&(ne=He);break}e&&ne&&he.alternate===null&&t(R,ne),w=a(he,w,de),ie===null?Z=he:ie.sibling=he,ie=he,ne=He}if(de===M.length)return n(R,ne),we&&vn(R,de),Z;if(ne===null){for(;de<M.length;de++)ne=te(R,M[de],V),ne!==null&&(w=a(ne,w,de),ie===null?Z=ne:ie.sibling=ne,ie=ne);return we&&vn(R,de),Z}for(ne=s(R,ne);de<M.length;de++)He=ye(ne,R,de,M[de],V),He!==null&&(e&&He.alternate!==null&&ne.delete(He.key===null?de:He.key),w=a(He,w,de),ie===null?Z=He:ie.sibling=He,ie=He);return e&&ne.forEach(function(ln){return t(R,ln)}),we&&vn(R,de),Z}function Qe(R,w,M,V){var Z=N(M);if(typeof Z!="function")throw Error(f(150));if(M=Z.call(M),M==null)throw Error(f(151));for(var ie=Z=null,ne=w,de=w=0,He=null,he=M.next();ne!==null&&!he.done;de++,he=M.next()){ne.index>de?(He=ne,ne=null):He=ne.sibling;var ln=q(R,ne,he.value,V);if(ln===null){ne===null&&(ne=He);break}e&&ne&&ln.alternate===null&&t(R,ne),w=a(ln,w,de),ie===null?Z=ln:ie.sibling=ln,ie=ln,ne=He}if(he.done)return n(R,ne),we&&vn(R,de),Z;if(ne===null){for(;!he.done;de++,he=M.next())he=te(R,he.value,V),he!==null&&(w=a(he,w,de),ie===null?Z=he:ie.sibling=he,ie=he);return we&&vn(R,de),Z}for(ne=s(R,ne);!he.done;de++,he=M.next())he=ye(ne,R,de,he.value,V),he!==null&&(e&&he.alternate!==null&&ne.delete(he.key===null?de:he.key),w=a(he,w,de),ie===null?Z=he:ie.sibling=he,ie=he);return e&&ne.forEach(function(Tf){return t(R,Tf)}),we&&vn(R,de),Z}function Et(R,w,M,V){if(typeof M=="object"&&M!==null&&M.type===h&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case _:e:{for(var Z=M.key,ie=w;ie!==null;){if(ie.key===Z){if(Z=M.type,Z===h){if(ie.tag===7){n(R,ie.sibling),w=l(ie,M.props.children),w.return=R,R=w;break e}}else if(ie.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===C&&El(Z)===ie.type){n(R,ie.sibling),w=l(ie,M.props),w.ref=lr(R,ie,M),w.return=R,R=w;break e}n(R,ie);break}else t(R,ie);ie=ie.sibling}M.type===h?(w=xn(M.props.children,R.mode,V,M.key),w.return=R,R=w):(V=Oi(M.type,M.key,M.props,null,R.mode,V),V.ref=lr(R,w,M),V.return=R,R=V)}return p(R);case S:e:{for(ie=M.key;w!==null;){if(w.key===ie)if(w.tag===4&&w.stateNode.containerInfo===M.containerInfo&&w.stateNode.implementation===M.implementation){n(R,w.sibling),w=l(w,M.children||[]),w.return=R,R=w;break e}else{n(R,w);break}else t(R,w);w=w.sibling}w=ro(M,R.mode,V),w.return=R,R=w}return p(R);case C:return ie=M._init,Et(R,w,ie(M._payload),V)}if(ce(M))return K(R,w,M,V);if(N(M))return Qe(R,w,M,V);Kr(R,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,w!==null&&w.tag===6?(n(R,w.sibling),w=l(w,M),w.return=R,R=w):(n(R,w),w=no(M,R.mode,V),w.return=R,R=w),p(R)):n(R,w)}return Et}var In=Sl(!0),Tl=Sl(!1),ar={},vt=qt(ar),ur=qt(ar),Bn=qt(ar);function zt(e){if(e===ar)throw Error(f(174));return e}function Es(e,t){Ee(Bn,t),Ee(ur,e),Ee(vt,ar),e=Ce(t),Te(vt),Ee(vt,e)}function kn(){Te(vt),Te(ur),Te(Bn)}function xl(e){var t=zt(Bn.current),n=zt(vt.current);t=F(n,e.type,t),n!==t&&(Ee(ur,e),Ee(vt,t))}function Ss(e){ur.current===e&&(Te(vt),Te(ur))}var Re=qt(0);function Xr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||el(n)||Xi(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ts=[];function xs(){for(var e=0;e<Ts.length;e++){var t=Ts[e];Be?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}Ts.length=0}var qr=g.ReactCurrentDispatcher,gt=g.ReactCurrentBatchConfig,Fn=0,Me=null,be=null,Fe=null,Jr=!1,cr=!1,fr=0,Yc=0;function Ye(){throw Error(f(321))}function ws(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mt(e[n],t[n]))return!1;return!0}function Cs(e,t,n,s,l,a){if(Fn=a,Me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qr.current=e===null||e.memoizedState===null?Xc:qc,e=n(s,l),cr){a=0;do{if(cr=!1,fr=0,25<=a)throw Error(f(301));a+=1,Fe=be=null,t.updateQueue=null,qr.current=Jc,e=n(s,l)}while(cr)}if(qr.current=ri,t=be!==null&&be.next!==null,Fn=0,Fe=be=Me=null,Jr=!1,t)throw Error(f(300));return e}function Os(){var e=fr!==0;return fr=0,e}function bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fe===null?Me.memoizedState=Fe=e:Fe=Fe.next=e,Fe}function At(){if(be===null){var e=Me.alternate;e=e!==null?e.memoizedState:null}else e=be.next;var t=Fe===null?Me.memoizedState:Fe.next;if(t!==null)Fe=t,be=e;else{if(e===null)throw Error(f(310));be=e,e={memoizedState:be.memoizedState,baseState:be.baseState,baseQueue:be.baseQueue,queue:be.queue,next:null},Fe===null?Me.memoizedState=Fe=e:Fe=Fe.next=e}return Fe}function gn(e,t){return typeof t=="function"?t(e):t}function $r(e){var t=At(),n=t.queue;if(n===null)throw Error(f(311));n.lastRenderedReducer=e;var s=be,l=s.baseQueue,a=n.pending;if(a!==null){if(l!==null){var p=l.next;l.next=a.next,a.next=p}s.baseQueue=l=a,n.pending=null}if(l!==null){a=l.next,s=s.baseState;var T=p=null,D=null,k=a;do{var b=k.lane;if((Fn&b)===b)D!==null&&(D=D.next={lane:0,action:k.action,hasEagerState:k.hasEagerState,eagerState:k.eagerState,next:null}),s=k.hasEagerState?k.eagerState:e(s,k.action);else{var te={lane:b,action:k.action,hasEagerState:k.hasEagerState,eagerState:k.eagerState,next:null};D===null?(T=D=te,p=s):D=D.next=te,Me.lanes|=b,Gn|=b}k=k.next}while(k!==null&&k!==a);D===null?p=s:D.next=T,Mt(s,t.memoizedState)||(ct=!0),t.memoizedState=s,t.baseState=p,t.baseQueue=D,n.lastRenderedState=s}if(e=n.interleaved,e!==null){l=e;do a=l.lane,Me.lanes|=a,Gn|=a,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ei(e){var t=At(),n=t.queue;if(n===null)throw Error(f(311));n.lastRenderedReducer=e;var s=n.dispatch,l=n.pending,a=t.memoizedState;if(l!==null){n.pending=null;var p=l=l.next;do a=e(a,p.action),p=p.next;while(p!==l);Mt(a,t.memoizedState)||(ct=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,s]}function wl(){}function Cl(e,t){var n=Me,s=At(),l=t(),a=!Mt(s.memoizedState,l);if(a&&(s.memoizedState=l,ct=!0),s=s.queue,hr(Pl.bind(null,n,s,e),[e]),s.getSnapshot!==t||a||Fe!==null&&Fe.memoizedState.tag&1){if(n.flags|=2048,dr(9,Rl.bind(null,n,s,l,t),void 0,null),ze===null)throw Error(f(349));(Fn&30)!==0||Ol(n,t,l)}return l}function Ol(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Me.updateQueue,t===null?(t={lastEffect:null,stores:null},Me.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Rl(e,t,n,s){t.value=n,t.getSnapshot=s,Ml(t)&&_t(e,1,-1)}function Pl(e,t,n){return n(function(){Ml(t)&&_t(e,1,-1)})}function Ml(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mt(e,n)}catch{return!0}}function Rs(e){var t=bt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gn,lastRenderedState:e},t.queue=e,e=e.dispatch=Kc.bind(null,Me,e),[t.memoizedState,e]}function dr(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=Me.updateQueue,t===null?(t={lastEffect:null,stores:null},Me.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function Ul(){return At().memoizedState}function ti(e,t,n,s){var l=bt();Me.flags|=e,l.memoizedState=dr(1|t,n,void 0,s===void 0?null:s)}function ni(e,t,n,s){var l=At();s=s===void 0?null:s;var a=void 0;if(be!==null){var p=be.memoizedState;if(a=p.destroy,s!==null&&ws(s,p.deps)){l.memoizedState=dr(t,n,a,s);return}}Me.flags|=e,l.memoizedState=dr(1|t,n,a,s)}function Ps(e,t){return ti(8390656,8,e,t)}function hr(e,t){return ni(2048,8,e,t)}function Dl(e,t){return ni(4,2,e,t)}function zl(e,t){return ni(4,4,e,t)}function Al(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ll(e,t,n){return n=n!=null?n.concat([e]):null,ni(4,4,Al.bind(null,t,e),n)}function Ms(){}function Nl(e,t){var n=At();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&ws(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Il(e,t){var n=At();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&ws(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Zc(e,t){var n=fe;fe=n!==0&&4>n?n:4,e(!0);var s=gt.transition;gt.transition={};try{e(!1),t()}finally{fe=n,gt.transition=s}}function Bl(){return At().memoizedState}function Qc(e,t,n){var s=rn(e);n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},kl(e)?Fl(t,n):(Hl(e,t,n),n=Je(),e=_t(e,s,n),e!==null&&Gl(e,t,s))}function Kc(e,t,n){var s=rn(e),l={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(kl(e))Fl(t,l);else{Hl(e,t,l);var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var p=t.lastRenderedState,T=a(p,n);if(l.hasEagerState=!0,l.eagerState=T,Mt(T,p))return}catch{}finally{}n=Je(),e=_t(e,s,n),e!==null&&Gl(e,t,s)}}function kl(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function Fl(e,t){cr=Jr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hl(e,t,n){ze!==null&&(e.mode&1)!==0&&(se&2)===0?(e=t.interleaved,e===null?(n.next=n,Dt===null?Dt=[t]:Dt.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(e=t.pending,e===null?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function Gl(e,t,n){if((n&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,rs(e,n)}}var ri={readContext:ht,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useInsertionEffect:Ye,useLayoutEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useMutableSource:Ye,useSyncExternalStore:Ye,useId:Ye,unstable_isNewReconciler:!1},Xc={readContext:ht,useCallback:function(e,t){return bt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:Ps,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ti(4194308,4,Al.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ti(4194308,4,e,t)},useInsertionEffect:function(e,t){return ti(4,2,e,t)},useMemo:function(e,t){var n=bt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=bt();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Qc.bind(null,Me,e),[s.memoizedState,e]},useRef:function(e){var t=bt();return e={current:e},t.memoizedState=e},useState:Rs,useDebugValue:Ms,useDeferredValue:function(e){var t=Rs(e),n=t[0],s=t[1];return Ps(function(){var l=gt.transition;gt.transition={};try{s(e)}finally{gt.transition=l}},[e]),n},useTransition:function(){var e=Rs(!1),t=e[0];return e=Zc.bind(null,e[1]),bt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Me,l=bt();if(we){if(n===void 0)throw Error(f(407));n=n()}else{if(n=t(),ze===null)throw Error(f(349));(Fn&30)!==0||Ol(s,t,n)}l.memoizedState=n;var a={value:n,getSnapshot:t};return l.queue=a,Ps(Pl.bind(null,s,a,e),[e]),s.flags|=2048,dr(9,Rl.bind(null,s,a,n,t),void 0,null),n},useId:function(){var e=bt(),t=ze.identifierPrefix;if(we){var n=Wt,s=jt;n=(s&~(1<<32-Tt(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=fr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Yc++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},qc={readContext:ht,useCallback:Nl,useContext:ht,useEffect:hr,useImperativeHandle:Ll,useInsertionEffect:Dl,useLayoutEffect:zl,useMemo:Il,useReducer:$r,useRef:Ul,useState:function(){return $r(gn)},useDebugValue:Ms,useDeferredValue:function(e){var t=$r(gn),n=t[0],s=t[1];return hr(function(){var l=gt.transition;gt.transition={};try{s(e)}finally{gt.transition=l}},[e]),n},useTransition:function(){var e=$r(gn)[0],t=At().memoizedState;return[e,t]},useMutableSource:wl,useSyncExternalStore:Cl,useId:Bl,unstable_isNewReconciler:!1},Jc={readContext:ht,useCallback:Nl,useContext:ht,useEffect:hr,useImperativeHandle:Ll,useInsertionEffect:Dl,useLayoutEffect:zl,useMemo:Il,useReducer:ei,useRef:Ul,useState:function(){return ei(gn)},useDebugValue:Ms,useDeferredValue:function(e){var t=ei(gn),n=t[0],s=t[1];return hr(function(){var l=gt.transition;gt.transition={};try{s(e)}finally{gt.transition=l}},[e]),n},useTransition:function(){var e=ei(gn)[0],t=At().memoizedState;return[e,t]},useMutableSource:wl,useSyncExternalStore:Cl,useId:Bl,unstable_isNewReconciler:!1};function Us(e,t){try{var n="",s=t;do n+=bc(s),s=s.return;while(s);var l=n}catch(a){l=`
|
|
30
|
+
Error generating stack: `+a.message+`
|
|
31
|
+
`+a.stack}return{value:e,source:t,stack:l}}function Ds(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var $c=typeof WeakMap=="function"?WeakMap:Map;function Vl(e,t,n){n=Vt(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){yi||(yi=!0,Ks=s),Ds(e,t)},n}function jl(e,t,n){n=Vt(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;n.payload=function(){return s(l)},n.callback=function(){Ds(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){Ds(e,t),typeof s!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var p=t.stack;this.componentDidCatch(t.value,{componentStack:p!==null?p:""})}),n}function Wl(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new $c;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(n)||(l.add(n),e=pf.bind(null,e,t,n),t.then(e,e))}function bl(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Yl(e,t,n,s,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Vt(-1,1),t.tag=2,en(n,t))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}function Lt(e){e.flags|=4}function Zl(e,t){if(e!==null&&e.child===t.child)return!0;if((t.flags&16)!==0)return!1;for(e=t.child;e!==null;){if((e.flags&12854)!==0||(e.subtreeFlags&12854)!==0)return!1;e=e.sibling}return!0}var pr,mr,ii,si;if(ae)pr=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)le(e,n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},mr=function(){},ii=function(e,t,n,s,l){if(e=e.memoizedProps,e!==s){var a=t.stateNode,p=zt(vt.current);n=Le(a,n,e,s,l,p),(t.updateQueue=n)&&Lt(t)}},si=function(e,t,n,s){n!==s&&Lt(t)};else if(dt){pr=function(e,t,n,s){for(var l=t.child;l!==null;){if(l.tag===5){var a=l.stateNode;n&&s&&(a=Jo(a,l.type,l.memoizedProps,l)),le(e,a)}else if(l.tag===6)a=l.stateNode,n&&s&&(a=$o(a,l.memoizedProps,l)),le(e,a);else if(l.tag!==4){if(l.tag===22&&l.memoizedState!==null)a=l.child,a!==null&&(a.return=l),pr(e,l,!0,!0);else if(l.child!==null){l.child.return=l,l=l.child;continue}}if(l===t)break;for(;l.sibling===null;){if(l.return===null||l.return===t)return;l=l.return}l.sibling.return=l.return,l=l.sibling}};var Ql=function(e,t,n,s){for(var l=t.child;l!==null;){if(l.tag===5){var a=l.stateNode;n&&s&&(a=Jo(a,l.type,l.memoizedProps,l)),Xo(e,a)}else if(l.tag===6)a=l.stateNode,n&&s&&(a=$o(a,l.memoizedProps,l)),Xo(e,a);else if(l.tag!==4){if(l.tag===22&&l.memoizedState!==null)a=l.child,a!==null&&(a.return=l),Ql(e,l,!0,!0);else if(l.child!==null){l.child.return=l,l=l.child;continue}}if(l===t)break;for(;l.sibling===null;){if(l.return===null||l.return===t)return;l=l.return}l.sibling.return=l.return,l=l.sibling}};mr=function(e,t){var n=t.stateNode;if(!Zl(e,t)){e=n.containerInfo;var s=Ko(e);Ql(s,t,!1,!1),n.pendingChildren=s,Lt(t),dc(e,s)}},ii=function(e,t,n,s,l){var a=e.stateNode,p=e.memoizedProps;if((e=Zl(e,t))&&p===s)t.stateNode=a;else{var T=t.stateNode,D=zt(vt.current),k=null;p!==s&&(k=Le(T,n,p,s,l,D)),e&&k===null?t.stateNode=a:(a=fc(a,k,n,p,s,t,e,T),oe(a,n,s,l,D)&&Lt(t),t.stateNode=a,e?Lt(t):pr(a,t,!1,!1))}},si=function(e,t,n,s){n!==s?(e=zt(Bn.current),n=zt(vt.current),t.stateNode=lt(s,e,n,t),Lt(t)):t.stateNode=e.stateNode}}else mr=function(){},ii=function(){},si=function(){};function vr(e,t){if(!we)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function ef(e,t,n){var s=t.pendingProps;switch(vs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return et(t.type)&&Lr(),Ze(t),null;case 3:return s=t.stateNode,kn(),Te($e),Te(We),xs(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(or(t)?Lt(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wt!==null&&(Js(wt),wt=null))),mr(e,t),Ze(t),null;case 5:Ss(t),n=zt(Bn.current);var l=t.type;if(e!==null&&t.stateNode!=null)ii(e,t,l,s,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(f(166));return Ze(t),null}if(e=zt(vt.current),or(t)){if(!Oe)throw Error(f(175));e=Ec(t.stateNode,t.type,t.memoizedProps,n,e,t,!sr),t.updateQueue=e,e!==null&&Lt(t)}else{var a=J(l,s,n,e,t);pr(a,t,!1,!1),t.stateNode=a,oe(a,l,s,n,e)&&Lt(t)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ze(t),null;case 6:if(e&&t.stateNode!=null)si(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(f(166));if(e=zt(Bn.current),n=zt(vt.current),or(t)){if(!Oe)throw Error(f(176));if(e=t.stateNode,s=t.memoizedProps,(n=Sc(e,s,t,!sr))&&(l=at,l!==null))switch(a=(l.mode&1)!==0,l.tag){case 3:Pc(l.stateNode.containerInfo,e,s,a);break;case 5:Mc(l.type,l.memoizedProps,l.stateNode,e,s,a)}n&&Lt(t)}else t.stateNode=lt(s,e,n,t)}return Ze(t),null;case 13:if(Te(Re),s=t.memoizedState,we&&ut!==null&&(t.mode&1)!==0&&(t.flags&128)===0){for(e=ut;e;)e=tr(e);return Nn(),t.flags|=98560,t}if(s!==null&&s.dehydrated!==null){if(s=or(t),e===null){if(!s)throw Error(f(318));if(!Oe)throw Error(f(344));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));Tc(e,t)}else Nn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;return Ze(t),null}return wt!==null&&(Js(wt),wt=null),(t.flags&128)!==0?(t.lanes=n,t):(s=s!==null,n=!1,e===null?or(t):n=e.memoizedState!==null,s&&!n&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Re.current&1)!==0?Ne===0&&(Ne=3):eo())),t.updateQueue!==null&&(t.flags|=4),Ze(t),null);case 4:return kn(),mr(e,t),e===null&&Pn(t.stateNode.containerInfo),Ze(t),null;case 10:return cs(t.type._context),Ze(t),null;case 17:return et(t.type)&&Lr(),Ze(t),null;case 19:if(Te(Re),l=t.memoizedState,l===null)return Ze(t),null;if(s=(t.flags&128)!==0,a=l.rendering,a===null)if(s)vr(l,!1);else{if(Ne!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=Xr(e),a!==null){for(t.flags|=128,vr(l,!1),e=a.updateQueue,e!==null&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,s=t.child;s!==null;)n=s,l=e,n.flags&=14680066,a=n.alternate,a===null?(n.childLanes=0,n.lanes=l,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,l=a.dependencies,n.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s=s.sibling;return Ee(Re,Re.current&1|2),t.child}e=e.sibling}l.tail!==null&&ke()>Qs&&(t.flags|=128,s=!0,vr(l,!1),t.lanes=4194304)}else{if(!s)if(e=Xr(a),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,e!==null&&(t.updateQueue=e,t.flags|=4),vr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!we)return Ze(t),null}else 2*ke()-l.renderingStartTime>Qs&&n!==1073741824&&(t.flags|=128,s=!0,vr(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(e=l.last,e!==null?e.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ke(),t.sibling=null,e=Re.current,Ee(Re,s?e&1|2:e&1),t):(Ze(t),null);case 22:case 23:return $s(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(ft&1073741824)!==0&&(Ze(t),ae&&t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),null;case 24:return null;case 25:return null}throw Error(f(156,t.tag))}var tf=g.ReactCurrentOwner,ct=!1;function qe(e,t,n,s){t.child=e===null?Tl(t,null,n,s):In(t,e.child,n,s)}function Kl(e,t,n,s,l){n=n.render;var a=t.ref;return zn(t,l),s=Cs(e,t,n,s,a,l),n=Os(),e!==null&&!ct?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Yt(e,t,l)):(we&&n&&ms(t),t.flags|=1,qe(e,t,s,l),t.child)}function Xl(e,t,n,s,l){if(e===null){var a=n.type;return typeof a=="function"&&!to(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,ql(e,t,a,s,l)):(e=Oi(n.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&l)===0){var p=a.memoizedProps;if(n=n.compare,n=n!==null?n:Gr,n(p,s)&&e.ref===t.ref)return Yt(e,t,l)}return t.flags|=1,e=on(a,s),e.ref=t.ref,e.return=t,t.child=e}function ql(e,t,n,s,l){if(e!==null&&Gr(e.memoizedProps,s)&&e.ref===t.ref)if(ct=!1,(e.lanes&l)!==0)(e.flags&131072)!==0&&(ct=!0);else return t.lanes=e.lanes,Yt(e,t,l);return zs(e,t,n,s,l)}function Jl(e,t,n){var s=t.pendingProps,l=s.children,a=e!==null?e.memoizedState:null;if(s.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null},Ee(Hn,ft),ft|=n;else if((n&1073741824)!==0)t.memoizedState={baseLanes:0,cachePool:null},s=a!==null?a.baseLanes:n,Ee(Hn,ft),ft|=s;else return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,Ee(Hn,ft),ft|=e,null;else a!==null?(s=a.baseLanes|n,t.memoizedState=null):s=n,Ee(Hn,ft),ft|=s;return qe(e,t,l,n),t.child}function $l(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zs(e,t,n,s,l){var a=et(n)?pn:We.current;return a=Un(t,a),zn(t,l),n=Cs(e,t,n,s,a,l),s=Os(),e!==null&&!ct?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Yt(e,t,l)):(we&&s&&ms(t),t.flags|=1,qe(e,t,n,l),t.child)}function ea(e,t,n,s,l){if(et(n)){var a=!0;Nr(t)}else a=!1;if(zn(t,l),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2),pl(t,n,s),ps(t,n,s,l),s=!0;else if(e===null){var p=t.stateNode,T=t.memoizedProps;p.props=T;var D=p.context,k=n.contextType;typeof k=="object"&&k!==null?k=ht(k):(k=et(n)?pn:We.current,k=Un(t,k));var b=n.getDerivedStateFromProps,te=typeof b=="function"||typeof p.getSnapshotBeforeUpdate=="function";te||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(T!==s||D!==k)&&ml(t,p,s,k),$t=!1;var q=t.memoizedState;p.state=q,br(t,s,p,l),D=t.memoizedState,T!==s||q!==D||$e.current||$t?(typeof b=="function"&&(hs(t,n,b,s),D=t.memoizedState),(T=$t||hl(t,n,T,s,q,D,k))?(te||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=D),p.props=s,p.state=D,p.context=k,s=T):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{p=t.stateNode,ul(e,t),T=t.memoizedProps,k=t.type===t.elementType?T:xt(t.type,T),p.props=k,te=t.pendingProps,q=p.context,D=n.contextType,typeof D=="object"&&D!==null?D=ht(D):(D=et(n)?pn:We.current,D=Un(t,D));var ye=n.getDerivedStateFromProps;(b=typeof ye=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(T!==te||q!==D)&&ml(t,p,s,D),$t=!1,q=t.memoizedState,p.state=q,br(t,s,p,l);var K=t.memoizedState;T!==te||q!==K||$e.current||$t?(typeof ye=="function"&&(hs(t,n,ye,s),K=t.memoizedState),(k=$t||hl(t,n,k,s,q,K,D)||!1)?(b||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(s,K,D),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(s,K,D)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||T===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||T===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=K),p.props=s,p.state=K,p.context=D,s=k):(typeof p.componentDidUpdate!="function"||T===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||T===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),s=!1)}return As(e,t,n,s,a,l)}function As(e,t,n,s,l,a){$l(e,t);var p=(t.flags&128)!==0;if(!s&&!p)return l&&il(t,n,!1),Yt(e,t,a);s=t.stateNode,tf.current=t;var T=p&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&p?(t.child=In(t,e.child,null,a),t.child=In(t,null,T,a)):qe(e,t,T,a),t.memoizedState=s.state,l&&il(t,n,!0),t.child}function ta(e){var t=e.stateNode;t.pendingContext?nl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&nl(e,t.context,!1),Es(e,t.containerInfo)}function na(e,t,n,s,l){return Nn(),ys(l),t.flags|=256,qe(e,t,n,s),t.child}var oi={dehydrated:null,treeContext:null,retryLane:0};function li(e){return{baseLanes:e,cachePool:null}}function ra(e,t,n){var s=t.pendingProps,l=Re.current,a=!1,p=(t.flags&128)!==0,T;if((T=p)||(T=e!==null&&e.memoizedState===null?!1:(l&2)!==0),T?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Ee(Re,l&1),e===null)return _s(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:Xi(e)?t.lanes=8:t.lanes=1073741824,null):(l=s.children,e=s.fallback,a?(s=t.mode,a=t.child,l={mode:"hidden",children:l},(s&1)===0&&a!==null?(a.childLanes=0,a.pendingProps=l):a=Ri(l,s,0,null),e=xn(e,s,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=li(n),t.memoizedState=oi,e):Ls(t,l));if(l=e.memoizedState,l!==null){if(T=l.dehydrated,T!==null){if(p)return t.flags&256?(t.flags&=-257,ai(e,t,n,Error(f(422)))):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=s.fallback,l=t.mode,s=Ri({mode:"visible",children:s.children},l,0,null),a=xn(a,l,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,(t.mode&1)!==0&&In(t,e.child,null,n),t.child.memoizedState=li(n),t.memoizedState=oi,a);if((t.mode&1)===0)t=ai(e,t,n,null);else if(Xi(T))t=ai(e,t,n,Error(f(419)));else if(s=(n&e.childLanes)!==0,ct||s){if(s=ze,s!==null){switch(n&-n){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}s=(a&(s.suspendedLanes|n))!==0?0:a,s!==0&&s!==l.retryLane&&(l.retryLane=s,_t(e,s,-1))}eo(),t=ai(e,t,n,Error(f(421)))}else el(T)?(t.flags|=128,t.child=e.child,t=mf.bind(null,e),vc(T,t),t=null):(n=l.treeContext,Oe&&(ut=yc(T),at=t,we=!0,wt=null,sr=!1,n!==null&&(pt[mt++]=jt,pt[mt++]=Wt,pt[mt++]=mn,jt=n.id,Wt=n.overflow,mn=t)),t=Ls(t,t.pendingProps.children),t.flags|=4096);return t}return a?(s=sa(e,t,s.children,s.fallback,n),a=t.child,l=e.child.memoizedState,a.memoizedState=l===null?li(n):{baseLanes:l.baseLanes|n,cachePool:null},a.childLanes=e.childLanes&~n,t.memoizedState=oi,s):(n=ia(e,t,s.children,n),t.memoizedState=null,n)}return a?(s=sa(e,t,s.children,s.fallback,n),a=t.child,l=e.child.memoizedState,a.memoizedState=l===null?li(n):{baseLanes:l.baseLanes|n,cachePool:null},a.childLanes=e.childLanes&~n,t.memoizedState=oi,s):(n=ia(e,t,s.children,n),t.memoizedState=null,n)}function Ls(e,t){return t=Ri({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ia(e,t,n,s){var l=e.child;return e=l.sibling,n=on(l,{mode:"visible",children:n}),(t.mode&1)===0&&(n.lanes=s),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n}function sa(e,t,n,s,l){var a=t.mode;e=e.child;var p=e.sibling,T={mode:"hidden",children:n};return(a&1)===0&&t.child!==e?(n=t.child,n.childLanes=0,n.pendingProps=T,t.deletions=null):(n=on(e,T),n.subtreeFlags=e.subtreeFlags&14680064),p!==null?s=on(p,s):(s=xn(s,a,l,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,s}function ai(e,t,n,s){return s!==null&&ys(s),In(t,e.child,null,n),e=Ls(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function oa(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),fs(e.return,t,n)}function Ns(e,t,n,s,l){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:l}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=s,a.tail=n,a.tailMode=l)}function la(e,t,n){var s=t.pendingProps,l=s.revealOrder,a=s.tail;if(qe(e,t,s.children,n),s=Re.current,(s&2)!==0)s=s&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&oa(e,n,t);else if(e.tag===19)oa(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Ee(Re,s),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Xr(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Ns(t,!1,l,n,a);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Xr(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Ns(t,!0,n,null,a);break;case"together":Ns(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Yt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gn|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(f(153));if(t.child!==null){for(e=t.child,n=on(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=on(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nf(e,t,n){switch(t.tag){case 3:ta(t),Nn();break;case 5:xl(t);break;case 1:et(t.type)&&Nr(t);break;case 4:Es(t,t.stateNode.containerInfo);break;case 10:al(t,t.type._context,t.memoizedProps.value);break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ee(Re,Re.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?ra(e,t,n):(Ee(Re,Re.current&1),e=Yt(e,t,n),e!==null?e.sibling:null);Ee(Re,Re.current&1);break;case 19:if(s=(n&t.childLanes)!==0,(e.flags&128)!==0){if(s)return la(e,t,n);t.flags|=128}var l=t.memoizedState;if(l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Ee(Re,Re.current),s)break;return null;case 22:case 23:return t.lanes=0,Jl(e,t,n)}return Yt(e,t,n)}function rf(e,t){switch(vs(t),t.tag){case 1:return et(t.type)&&Lr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(),Te($e),Te(We),xs(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ss(t),null;case 13:if(Te(Re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(f(340));Nn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Te(Re),null;case 4:return kn(),null;case 10:return cs(t.type._context),null;case 22:case 23:return $s(),null;case 24:return null;default:return null}}var ui=!1,_n=!1,sf=typeof WeakSet=="function"?WeakSet:Set,G=null;function ci(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){rt(e,t,s)}else n.current=null}function Is(e,t,n){try{n()}catch(s){rt(e,t,s)}}var aa=!1;function of(e,t){for(Q(e.containerInfo),G=t;G!==null;)if(e=G,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,G=t;else for(;G!==null;){e=G;try{var n=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(n!==null){var s=n.memoizedProps,l=n.memoizedState,a=e.stateNode,p=a.getSnapshotBeforeUpdate(e.elementType===e.type?s:xt(e.type,s),l);a.__reactInternalSnapshotBeforeUpdate=p}break;case 3:ae&&cc(e.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(f(163))}}catch(T){rt(e,e.return,T)}if(t=e.sibling,t!==null){t.return=e.return,G=t;break}G=e.return}return n=aa,aa=!1,n}function yn(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var a=l.destroy;l.destroy=void 0,a!==void 0&&Is(t,n,a)}l=l.next}while(l!==s)}}function gr(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Bs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=Ue(n);break;default:e=n}typeof t=="function"?t(e):t.current=e}}function ua(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(Fr,t)}catch{}switch(t.tag){case 0:case 11:case 14:case 15:if(e=t.updateQueue,e!==null&&(e=e.lastEffect,e!==null)){var s=e=e.next;do{var l=s,a=l.destroy;l=l.tag,a!==void 0&&((l&2)!==0||(l&4)!==0)&&Is(t,n,a),s=s.next}while(s!==e)}break;case 1:if(ci(t,n),e=t.stateNode,typeof e.componentWillUnmount=="function")try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(p){rt(t,n,p)}break;case 5:ci(t,n);break;case 4:ae?ma(e,t,n):dt&&dt&&(t=t.stateNode.containerInfo,n=Ko(t),qo(t,n))}}function ca(e,t,n){for(var s=t;;)if(ua(e,s,n),s.child===null||ae&&s.tag===4){if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}else s.child.return=s,s=s.child}function fa(e){var t=e.alternate;t!==null&&(e.alternate=null,fa(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function da(e){return e.tag===5||e.tag===3||e.tag===4}function ha(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||da(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function pa(e){if(ae){e:{for(var t=e.return;t!==null;){if(da(t))break e;t=t.return}throw Error(f(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,n.flags&32&&(Qo(t),n.flags&=-33),n=ha(e),Fs(e,n,t);break;case 3:case 4:t=n.stateNode.containerInfo,n=ha(e),ks(e,n,t);break;default:throw Error(f(161))}}}function ks(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?rc(n,e,t):Ju(n,e);else if(s!==4&&(e=e.child,e!==null))for(ks(e,t,n),e=e.sibling;e!==null;)ks(e,t,n),e=e.sibling}function Fs(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?nc(n,e,t):qu(n,e);else if(s!==4&&(e=e.child,e!==null))for(Fs(e,t,n),e=e.sibling;e!==null;)Fs(e,t,n),e=e.sibling}function ma(e,t,n){for(var s=t,l=!1,a,p;;){if(!l){l=s.return;e:for(;;){if(l===null)throw Error(f(160));switch(a=l.stateNode,l.tag){case 5:p=!1;break e;case 3:a=a.containerInfo,p=!0;break e;case 4:a=a.containerInfo,p=!0;break e}l=l.return}l=!0}if(s.tag===5||s.tag===6)ca(e,s,n),p?sc(a,s.stateNode):ic(a,s.stateNode);else if(s.tag===18)p?Oc(a,s.stateNode):Cc(a,s.stateNode);else if(s.tag===4){if(s.child!==null){a=s.stateNode.containerInfo,p=!0,s.child.return=s,s=s.child;continue}}else if(ua(e,s,n),s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return,s.tag===4&&(l=!1)}s.sibling.return=s.return,s=s.sibling}}function Hs(e,t){if(ae){switch(t.tag){case 0:case 11:case 14:case 15:yn(3,t,t.return),gr(3,t),yn(5,t,t.return);return;case 1:return;case 5:var n=t.stateNode;if(n!=null){var s=t.memoizedProps;e=e!==null?e.memoizedProps:s;var l=t.type,a=t.updateQueue;t.updateQueue=null,a!==null&&tc(n,a,l,e,s,t)}return;case 6:if(t.stateNode===null)throw Error(f(162));n=t.memoizedProps,$u(t.stateNode,e!==null?e.memoizedProps:n,n);return;case 3:Oe&&e!==null&&e.memoizedState.isDehydrated&&tl(t.stateNode.containerInfo);return;case 12:return;case 13:fi(t);return;case 19:fi(t);return;case 17:return}throw Error(f(163))}switch(t.tag){case 0:case 11:case 14:case 15:yn(3,t,t.return),gr(3,t),yn(5,t,t.return);return;case 12:return;case 13:fi(t);return;case 19:fi(t);return;case 3:Oe&&e!==null&&e.memoizedState.isDehydrated&&tl(t.stateNode.containerInfo);break;case 22:case 23:return}e:if(dt){switch(t.tag){case 1:case 5:case 6:break e;case 3:case 4:t=t.stateNode,qo(t.containerInfo,t.pendingChildren);break e}throw Error(f(163))}}function fi(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new sf),t.forEach(function(s){var l=vf.bind(null,e,s);n.has(s)||(n.add(s),s.then(l,l))})}}function lf(e,t){for(G=t;G!==null;){t=G;var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];try{var a=e;ae?ma(a,l,t):ca(a,l,t);var p=l.alternate;p!==null&&(p.return=null),l.return=null}catch(Z){rt(l,t,Z)}}if(n=t.child,(t.subtreeFlags&12854)!==0&&n!==null)n.return=t,G=n;else for(;G!==null;){t=G;try{var T=t.flags;if(T&32&&ae&&Qo(t.stateNode),T&512){var D=t.alternate;if(D!==null){var k=D.ref;k!==null&&(typeof k=="function"?k(null):k.current=null)}}if(T&8192)switch(t.tag){case 13:if(t.memoizedState!==null){var b=t.alternate;(b===null||b.memoizedState===null)&&(Zs=ke())}break;case 22:var te=t.memoizedState!==null,q=t.alternate,ye=q!==null&&q.memoizedState!==null;if(n=t,ae){e:if(s=n,l=te,a=null,ae)for(var K=s;;){if(K.tag===5){if(a===null){a=K;var Qe=K.stateNode;l?oc(Qe):ac(K.stateNode,K.memoizedProps)}}else if(K.tag===6){if(a===null){var Et=K.stateNode;l?lc(Et):uc(Et,K.memoizedProps)}}else if((K.tag!==22&&K.tag!==23||K.memoizedState===null||K===s)&&K.child!==null){K.child.return=K,K=K.child;continue}if(K===s)break;for(;K.sibling===null;){if(K.return===null||K.return===s)break e;a===K&&(a=null),K=K.return}a===K&&(a=null),K.sibling.return=K.return,K=K.sibling}}if(te&&!ye&&(n.mode&1)!==0){G=n;for(var R=n.child;R!==null;){for(n=G=R;G!==null;){s=G;var w=s.child;switch(s.tag){case 0:case 11:case 14:case 15:yn(4,s,s.return);break;case 1:ci(s,s.return);var M=s.stateNode;if(typeof M.componentWillUnmount=="function"){var V=s.return;try{M.props=s.memoizedProps,M.state=s.memoizedState,M.componentWillUnmount()}catch(Z){rt(s,V,Z)}}break;case 5:ci(s,s.return);break;case 22:if(s.memoizedState!==null){_a(n);continue}}w!==null?(w.return=s,G=w):_a(n)}R=R.sibling}}}switch(T&4102){case 2:pa(t),t.flags&=-3;break;case 6:pa(t),t.flags&=-3,Hs(t.alternate,t);break;case 4096:t.flags&=-4097;break;case 4100:t.flags&=-4097,Hs(t.alternate,t);break;case 4:Hs(t.alternate,t)}}catch(Z){rt(t,t.return,Z)}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}}function af(e,t,n){G=e,va(e)}function va(e,t,n){for(var s=(e.mode&1)!==0;G!==null;){var l=G,a=l.child;if(l.tag===22&&s){var p=l.memoizedState!==null||ui;if(!p){var T=l.alternate,D=T!==null&&T.memoizedState!==null||_n;T=ui;var k=_n;if(ui=p,(_n=D)&&!k)for(G=l;G!==null;)p=G,D=p.child,p.tag===22&&p.memoizedState!==null?ya(l):D!==null?(D.return=p,G=D):ya(l);for(;a!==null;)G=a,va(a),a=a.sibling;G=l,ui=T,_n=k}ga(e)}else(l.subtreeFlags&8772)!==0&&a!==null?(a.return=l,G=a):ga(e)}}function ga(e){for(;G!==null;){var t=G;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:_n||gr(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!_n)if(n===null)s.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:xt(t.type,n.memoizedProps);s.componentDidUpdate(l,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&fl(t,a,s);break;case 3:var p=t.updateQueue;if(p!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=Ue(t.child.stateNode);break;case 1:n=t.child.stateNode}fl(t,p,n)}break;case 5:var T=t.stateNode;n===null&&t.flags&4&&ec(T,t.type,t.memoizedProps,t);break;case 6:break;case 4:break;case 12:break;case 13:if(Oe&&t.memoizedState===null){var D=t.alternate;if(D!==null){var k=D.memoizedState;if(k!==null){var b=k.dehydrated;b!==null&&wc(b)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(f(163))}_n||t.flags&512&&Bs(t)}catch(te){rt(t,t.return,te)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function _a(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function ya(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{gr(4,t)}catch(D){rt(t,n,D)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var l=t.return;try{s.componentDidMount()}catch(D){rt(t,l,D)}}var a=t.return;try{Bs(t)}catch(D){rt(t,a,D)}break;case 5:var p=t.return;try{Bs(t)}catch(D){rt(t,p,D)}}}catch(D){rt(t,t.return,D)}if(t===e){G=null;break}var T=t.sibling;if(T!==null){T.return=t.return,G=T;break}G=t.return}}var di=0,hi=1,pi=2,mi=3,vi=4;if(typeof Symbol=="function"&&Symbol.for){var _r=Symbol.for;di=_r("selector.component"),hi=_r("selector.has_pseudo_class"),pi=_r("selector.role"),mi=_r("selector.test_id"),vi=_r("selector.text")}function Gs(e){var t=dn(e);if(t!=null){if(typeof t.memoizedProps["data-testname"]!="string")throw Error(f(364));return t}if(e=bi(e),e===null)throw Error(f(362));return e.stateNode.current}function Vs(e,t){switch(t.$$typeof){case di:if(e.type===t.value)return!0;break;case hi:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var s=e[n++],l=e[n++],a=t[l];if(s.tag!==5||!hn(s)){for(;a!=null&&Vs(s,a);)l++,a=t[l];if(l===t.length){t=!0;break e}else for(s=s.child;s!==null;)e.push(s,l),s=s.sibling}}t=!1}return t;case pi:if(e.tag===5&&Qi(e.stateNode,t.value))return!0;break;case vi:if((e.tag===5||e.tag===6)&&(e=Zi(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case mi:if(e.tag===5&&(e=e.memoizedProps["data-testname"],typeof e=="string"&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(f(365))}return!1}function js(e){switch(e.$$typeof){case di:return"<"+(H(e.value)||"Unknown")+">";case hi:return":has("+(js(e)||"")+")";case pi:return'[role="'+e.value+'"]';case vi:return'"'+e.value+'"';case mi:return'[data-testname="'+e.value+'"]';default:throw Error(f(365))}}function Ea(e,t){var n=[];e=[e,0];for(var s=0;s<e.length;){var l=e[s++],a=e[s++],p=t[a];if(l.tag!==5||!hn(l)){for(;p!=null&&Vs(l,p);)a++,p=t[a];if(a===t.length)n.push(l);else for(l=l.child;l!==null;)e.push(l,a),l=l.sibling}}return n}function Ws(e,t){if(!Xt)throw Error(f(363));e=Gs(e),e=Ea(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var s=e[n++];if(s.tag===5)hn(s)||t.push(s.stateNode);else for(s=s.child;s!==null;)e.push(s),s=s.sibling}return t}var uf=Math.ceil,gi=g.ReactCurrentDispatcher,bs=g.ReactCurrentOwner,De=g.ReactCurrentBatchConfig,se=0,ze=null,Ae=null,je=0,ft=0,Hn=qt(0),Ne=0,yr=null,Gn=0,_i=0,Ys=0,Er=null,tt=null,Zs=0,Qs=1/0;function Vn(){Qs=ke()+500}var yi=!1,Ks=null,tn=null,Ei=!1,nn=null,Si=0,Sr=0,Xs=null,Ti=-1,xi=0;function Je(){return(se&6)!==0?ke():Ti!==-1?Ti:Ti=ke()}function rn(e){return(e.mode&1)===0?1:(se&2)!==0&&je!==0?je&-je:Wc.transition!==null?(xi===0&&(e=Ir,Ir<<=1,(Ir&4194240)===0&&(Ir=64),xi=e),xi):(e=fe,e!==0?e:Wi())}function _t(e,t,n){if(50<Sr)throw Sr=0,Xs=null,Error(f(185));var s=wi(e,t);return s===null?null:(ir(s,t,n),((se&2)===0||s!==ze)&&(s===ze&&((se&2)===0&&(_i|=t),Ne===4&&sn(s,je)),nt(s,n),t===1&&se===0&&(e.mode&1)===0&&(Vn(),Hr&&Ut())),s)}function wi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}function nt(e,t){var n=e.callbackNode;Nc(e,t);var s=kr(e,e===ze?je:0);if(s===0)n!==null&&ol(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&ol(n),t===1)e.tag===0?jc(Ta.bind(null,e)):ll(Ta.bind(null,e)),Ar?er(function(){se===0&&Ut()}):is(ss,Ut),n=null;else{switch(sl(s)){case 1:n=ss;break;case 4:n=Fc;break;case 16:n=os;break;case 536870912:n=Hc;break;default:n=os}n=Da(n,Sa.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sa(e,t){if(Ti=-1,xi=0,(se&6)!==0)throw Error(f(327));var n=e.callbackNode;if(Tn()&&e.callbackNode!==n)return null;var s=kr(e,e===ze?je:0);if(s===0)return null;if((s&30)!==0||(s&e.expiredLanes)!==0||t)t=Ci(e,s);else{t=s;var l=se;se|=2;var a=Ca();(ze!==e||je!==t)&&(Vn(),En(e,t));do try{df();break}catch(T){wa(e,T)}while(!0);us(),gi.current=a,se=l,Ae!==null?t=0:(ze=null,je=0,t=Ne)}if(t!==0){if(t===2&&(l=ts(e),l!==0&&(s=l,t=qs(e,l))),t===1)throw n=yr,En(e,0),sn(e,s),nt(e,ke()),n;if(t===6)sn(e,s);else{if(l=e.current.alternate,(s&30)===0&&!cf(l)&&(t=Ci(e,s),t===2&&(a=ts(e),a!==0&&(s=a,t=qs(e,a))),t===1))throw n=yr,En(e,0),sn(e,s),nt(e,ke()),n;switch(e.finishedWork=l,e.finishedLanes=s,t){case 0:case 1:throw Error(f(345));case 2:Sn(e,tt);break;case 3:if(sn(e,s),(s&130023424)===s&&(t=Zs+500-ke(),10<t)){if(kr(e,0)!==0)break;if(l=e.suspendedLanes,(l&s)!==s){Je(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=kt(Sn.bind(null,e,tt),t);break}Sn(e,tt);break;case 4:if(sn(e,s),(s&4194240)===s)break;for(t=e.eventTimes,l=-1;0<s;){var p=31-Tt(s);a=1<<p,p=t[p],p>l&&(l=p),s&=~a}if(s=l,s=ke()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*uf(s/1960))-s,10<s){e.timeoutHandle=kt(Sn.bind(null,e,tt),s);break}Sn(e,tt);break;case 5:Sn(e,tt);break;default:throw Error(f(329))}}}return nt(e,ke()),e.callbackNode===n?Sa.bind(null,e):null}function qs(e,t){var n=Er;return e.current.memoizedState.isDehydrated&&(En(e,t).flags|=256),e=Ci(e,t),e!==2&&(t=tt,tt=n,t!==null&&Js(t)),e}function Js(e){tt===null?tt=e:tt.push.apply(tt,e)}function cf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var l=n[s],a=l.getSnapshot;l=l.value;try{if(!Mt(a(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function sn(e,t){for(t&=~Ys,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tt(t),s=1<<n;e[n]=-1,t&=~s}}function Ta(e){if((se&6)!==0)throw Error(f(327));Tn();var t=kr(e,0);if((t&1)===0)return nt(e,ke()),null;var n=Ci(e,t);if(e.tag!==0&&n===2){var s=ts(e);s!==0&&(t=s,n=qs(e,s))}if(n===1)throw n=yr,En(e,0),sn(e,t),nt(e,ke()),n;if(n===6)throw Error(f(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Sn(e,tt),nt(e,ke()),null}function xa(e){nn!==null&&nn.tag===0&&(se&6)===0&&Tn();var t=se;se|=1;var n=De.transition,s=fe;try{if(De.transition=null,fe=1,e)return e()}finally{fe=s,De.transition=n,se=t,(se&6)===0&&Ut()}}function $s(){ft=Hn.current,Te(Hn)}function En(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==Rn&&(e.timeoutHandle=Rn,Kt(n)),Ae!==null)for(n=Ae.return;n!==null;){var s=n;switch(vs(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Lr();break;case 3:kn(),Te($e),Te(We),xs();break;case 5:Ss(s);break;case 4:kn();break;case 13:Te(Re);break;case 19:Te(Re);break;case 10:cs(s.type._context);break;case 22:case 23:$s()}n=n.return}if(ze=e,Ae=e=on(e.current,null),je=ft=t,Ne=0,yr=null,Ys=_i=Gn=0,tt=Er=null,Dt!==null){for(t=0;t<Dt.length;t++)if(n=Dt[t],s=n.interleaved,s!==null){n.interleaved=null;var l=s.next,a=n.pending;if(a!==null){var p=a.next;a.next=l,s.next=p}n.pending=s}Dt=null}return e}function wa(e,t){do{var n=Ae;try{if(us(),qr.current=ri,Jr){for(var s=Me.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Jr=!1}if(Fn=0,Fe=be=Me=null,cr=!1,fr=0,bs.current=null,n===null||n.return===null){Ne=1,yr=t,Ae=null;break}e:{var a=e,p=n.return,T=n,D=t;if(t=je,T.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var k=D,b=T,te=b.tag;if((b.mode&1)===0&&(te===0||te===11||te===15)){var q=b.alternate;q?(b.updateQueue=q.updateQueue,b.memoizedState=q.memoizedState,b.lanes=q.lanes):(b.updateQueue=null,b.memoizedState=null)}var ye=bl(p);if(ye!==null){ye.flags&=-257,Yl(ye,p,T,a,t),ye.mode&1&&Wl(a,k,t),t=ye,D=k;var K=t.updateQueue;if(K===null){var Qe=new Set;Qe.add(D),t.updateQueue=Qe}else K.add(D);break e}else{if((t&1)===0){Wl(a,k,t),eo();break e}D=Error(f(426))}}else if(we&&T.mode&1){var Et=bl(p);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),Yl(Et,p,T,a,t),ys(D);break e}}a=D,Ne!==4&&(Ne=2),Er===null?Er=[a]:Er.push(a),D=Us(D,T),T=p;do{switch(T.tag){case 3:T.flags|=65536,t&=-t,T.lanes|=t;var R=Vl(T,D,t);cl(T,R);break e;case 1:a=D;var w=T.type,M=T.stateNode;if((T.flags&128)===0&&(typeof w.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(tn===null||!tn.has(M)))){T.flags|=65536,t&=-t,T.lanes|=t;var V=jl(T,a,t);cl(T,V);break e}}T=T.return}while(T!==null)}Ra(n)}catch(Z){t=Z,Ae===n&&n!==null&&(Ae=n=n.return);continue}break}while(!0)}function Ca(){var e=gi.current;return gi.current=ri,e===null?ri:e}function eo(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),ze===null||(Gn&268435455)===0&&(_i&268435455)===0||sn(ze,je)}function Ci(e,t){var n=se;se|=2;var s=Ca();ze===e&&je===t||En(e,t);do try{ff();break}catch(l){wa(e,l)}while(!0);if(us(),se=n,gi.current=s,Ae!==null)throw Error(f(261));return ze=null,je=0,Ne}function ff(){for(;Ae!==null;)Oa(Ae)}function df(){for(;Ae!==null&&!Bc();)Oa(Ae)}function Oa(e){var t=Ua(e.alternate,e,ft);e.memoizedProps=e.pendingProps,t===null?Ra(e):Ae=t,bs.current=null}function Ra(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=ef(n,t,ft),n!==null){Ae=n;return}}else{if(n=rf(n,t),n!==null){n.flags&=32767,Ae=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ne=6,Ae=null;return}}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);Ne===0&&(Ne=5)}function Sn(e,t){var n=fe,s=De.transition;try{De.transition=null,fe=1,hf(e,t,n)}finally{De.transition=s,fe=n}return null}function hf(e,t,n){do Tn();while(nn!==null);if((se&6)!==0)throw Error(f(327));var s=e.finishedWork,l=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(f(177));e.callbackNode=null,e.callbackPriority=0;var a=s.lanes|s.childLanes;if(Ic(e,a),e===ze&&(Ae=ze=null,je=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Ei||(Ei=!0,Da(os,function(){return Tn(),null})),a=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||a){a=De.transition,De.transition=null;var p=fe;fe=1;var T=se;se|=4,bs.current=null,of(e,s),lf(e,s),W(e.containerInfo),e.current=s,af(s),kc(),se=T,fe=p,De.transition=a}else e.current=s;if(Ei&&(Ei=!1,nn=e,Si=l),a=e.pendingLanes,a===0&&(tn=null),Gc(s.stateNode),nt(e,ke()),t!==null)for(n=e.onRecoverableError,s=0;s<t.length;s++)n(t[s]);if(yi)throw yi=!1,e=Ks,Ks=null,e;return(Si&1)!==0&&e.tag!==0&&Tn(),a=e.pendingLanes,(a&1)!==0?e===Xs?Sr++:(Sr=0,Xs=e):Sr=0,Ut(),null}function Tn(){if(nn!==null){var e=sl(Si),t=De.transition,n=fe;try{if(De.transition=null,fe=16>e?16:e,nn===null)var s=!1;else{if(e=nn,nn=null,Si=0,(se&6)!==0)throw Error(f(331));var l=se;for(se|=4,G=e.current;G!==null;){var a=G,p=a.child;if((G.flags&16)!==0){var T=a.deletions;if(T!==null){for(var D=0;D<T.length;D++){var k=T[D];for(G=k;G!==null;){var b=G;switch(b.tag){case 0:case 11:case 15:yn(8,b,a)}var te=b.child;if(te!==null)te.return=b,G=te;else for(;G!==null;){b=G;var q=b.sibling,ye=b.return;if(fa(b),b===k){G=null;break}if(q!==null){q.return=ye,G=q;break}G=ye}}}var K=a.alternate;if(K!==null){var Qe=K.child;if(Qe!==null){K.child=null;do{var Et=Qe.sibling;Qe.sibling=null,Qe=Et}while(Qe!==null)}}G=a}}if((a.subtreeFlags&2064)!==0&&p!==null)p.return=a,G=p;else e:for(;G!==null;){if(a=G,(a.flags&2048)!==0)switch(a.tag){case 0:case 11:case 15:yn(9,a,a.return)}var R=a.sibling;if(R!==null){R.return=a.return,G=R;break e}G=a.return}}var w=e.current;for(G=w;G!==null;){p=G;var M=p.child;if((p.subtreeFlags&2064)!==0&&M!==null)M.return=p,G=M;else e:for(p=w;G!==null;){if(T=G,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:gr(9,T)}}catch(Z){rt(T,T.return,Z)}if(T===p){G=null;break e}var V=T.sibling;if(V!==null){V.return=T.return,G=V;break e}G=T.return}}if(se=l,Ut(),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(Fr,e)}catch{}s=!0}return s}finally{fe=n,De.transition=t}}return!1}function Pa(e,t,n){t=Us(n,t),t=Vl(e,t,1),en(e,t),t=Je(),e=wi(e,1),e!==null&&(ir(e,1,t),nt(e,t))}function rt(e,t,n){if(e.tag===3)Pa(e,e,n);else for(;t!==null;){if(t.tag===3){Pa(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(tn===null||!tn.has(s))){e=Us(n,e),e=jl(t,e,1),en(t,e),e=Je(),t=wi(t,1),t!==null&&(ir(t,1,e),nt(t,e));break}}t=t.return}}function pf(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=Je(),e.pingedLanes|=e.suspendedLanes&n,ze===e&&(je&n)===n&&(Ne===4||Ne===3&&(je&130023424)===je&&500>ke()-Zs?En(e,0):Ys|=n),nt(e,t)}function Ma(e,t){t===0&&((e.mode&1)===0?t=1:(t=Br,Br<<=1,(Br&130023424)===0&&(Br=4194304)));var n=Je();e=wi(e,t),e!==null&&(ir(e,t,n),nt(e,n))}function mf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ma(e,n)}function vf(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(f(314))}s!==null&&s.delete(t),Ma(e,n)}var Ua;Ua=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$e.current)ct=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ct=!1,nf(e,t,n);ct=(e.flags&131072)!==0}else ct=!1,we&&(t.flags&1048576)!==0&&vl(t,Qr,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps;var l=Un(t,We.current);zn(t,n),l=Cs(null,t,s,e,l,n);var a=Os();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,et(s)?(a=!0,Nr(t)):a=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ds(t),l.updater=Yr,t.stateNode=l,l._reactInternals=t,ps(t,s,e,n),t=As(null,t,s,!0,a,n)):(t.tag=0,we&&a&&ms(t),qe(null,t,l,n),t=t.child),t;case 16:s=t.elementType;e:{switch(e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=_f(s),e=xt(s,e),l){case 0:t=zs(null,t,s,e,n);break e;case 1:t=ea(null,t,s,e,n);break e;case 11:t=Kl(null,t,s,e,n);break e;case 14:t=Xl(null,t,s,xt(s.type,e),n);break e}throw Error(f(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:xt(s,l),zs(e,t,s,l,n);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:xt(s,l),ea(e,t,s,l,n);case 3:e:{if(ta(t),e===null)throw Error(f(387));s=t.pendingProps,a=t.memoizedState,l=a.element,ul(e,t),br(t,s,null,n);var p=t.memoizedState;if(s=p.element,Oe&&a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:p.cache,transitions:p.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){l=Error(f(423)),t=na(e,t,s,n,l);break e}else if(s!==l){l=Error(f(424)),t=na(e,t,s,n,l);break e}else for(Oe&&(ut=_c(t.stateNode.containerInfo),at=t,we=!0,wt=null,sr=!1),n=Tl(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Nn(),s===l){t=Yt(e,t,n);break e}qe(e,t,s,n)}t=t.child}return t;case 5:return xl(t),e===null&&_s(t),s=t.type,l=t.pendingProps,a=e!==null?e.memoizedProps:null,p=l.children,Ve(s,l)?p=null:a!==null&&Ve(s,a)&&(t.flags|=32),$l(e,t),qe(e,t,p,n),t.child;case 6:return e===null&&_s(t),null;case 13:return ra(e,t,n);case 4:return Es(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=In(t,null,s,n):qe(e,t,s,n),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:xt(s,l),Kl(e,t,s,l,n);case 7:return qe(e,t,t.pendingProps,n),t.child;case 8:return qe(e,t,t.pendingProps.children,n),t.child;case 12:return qe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,a=t.memoizedProps,p=l.value,al(t,s,p),a!==null)if(Mt(a.value,p)){if(a.children===l.children&&!$e.current){t=Yt(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var T=a.dependencies;if(T!==null){p=a.child;for(var D=T.firstContext;D!==null;){if(D.context===s){if(a.tag===1){D=Vt(-1,n&-n),D.tag=2;var k=a.updateQueue;if(k!==null){k=k.shared;var b=k.pending;b===null?D.next=D:(D.next=b.next,b.next=D),k.pending=D}}a.lanes|=n,D=a.alternate,D!==null&&(D.lanes|=n),fs(a.return,n,t),T.lanes|=n;break}D=D.next}}else if(a.tag===10)p=a.type===t.type?null:a.child;else if(a.tag===18){if(p=a.return,p===null)throw Error(f(341));p.lanes|=n,T=p.alternate,T!==null&&(T.lanes|=n),fs(p,n,t),p=a.sibling}else p=a.child;if(p!==null)p.return=a;else for(p=a;p!==null;){if(p===t){p=null;break}if(a=p.sibling,a!==null){a.return=p.return,p=a;break}p=p.return}a=p}qe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,zn(t,n),l=ht(l),s=s(l),t.flags|=1,qe(e,t,s,n),t.child;case 14:return s=t.type,l=xt(s,t.pendingProps),l=xt(s.type,l),Xl(e,t,s,l,n);case 15:return ql(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:xt(s,l),e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,et(s)?(e=!0,Nr(t)):e=!1,zn(t,n),pl(t,s,l),ps(t,s,l,n),As(null,t,s,!0,e,n);case 19:return la(e,t,n);case 22:return Jl(e,t,n)}throw Error(f(156,t.tag))};function Da(e,t){return is(e,t)}function gf(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yt(e,t,n,s){return new gf(e,t,n,s)}function to(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _f(e){if(typeof e=="function")return to(e)?1:0;if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===y)return 14}return 2}function on(e,t){var n=e.alternate;return n===null?(n=yt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Oi(e,t,n,s,l,a){var p=2;if(s=e,typeof e=="function")to(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case h:return xn(n.children,l,a,t);case m:p=8,l|=8;break;case x:return e=yt(12,n,t,l|2),e.elementType=x,e.lanes=a,e;case L:return e=yt(13,n,t,l),e.elementType=L,e.lanes=a,e;case v:return e=yt(19,n,t,l),e.elementType=v,e.lanes=a,e;case U:return Ri(n,l,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:p=10;break e;case O:p=9;break e;case A:p=11;break e;case y:p=14;break e;case C:p=16,s=null;break e}throw Error(f(130,e==null?e:typeof e,""))}return t=yt(p,n,t,l),t.elementType=e,t.type=s,t.lanes=a,t}function xn(e,t,n,s){return e=yt(7,e,s,t),e.lanes=n,e}function Ri(e,t,n,s){return e=yt(22,e,s,t),e.elementType=U,e.lanes=n,e.stateNode={},e}function no(e,t,n){return e=yt(6,e,null,t),e.lanes=n,e}function ro(e,t,n){return t=yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function yf(e,t,n,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Rn,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ns(0),this.expirationTimes=ns(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ns(0),this.identifierPrefix=s,this.onRecoverableError=l,Oe&&(this.mutableSourceEagerHydrationData=null)}function za(e,t,n,s,l,a,p,T,D){return e=new yf(e,t,n,T,D),t===1?(t=1,a===!0&&(t|=8)):t=0,a=yt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null},ds(a),e}function Aa(e){if(!e)return Jt;e=e._reactInternals;e:{if(j(e)!==e||e.tag!==1)throw Error(f(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(et(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(f(171))}if(e.tag===1){var n=e.type;if(et(n))return rl(e,n,t)}return t}function La(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(f(188)):(e=Object.keys(e).join(","),Error(f(268,e)));return e=ee(t),e===null?null:e.stateNode}function Na(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function io(e,t){Na(e,t),(e=e.alternate)&&Na(e,t)}function Ef(e){return e=ee(e),e===null?null:e.stateNode}function Sf(){return null}return o.attemptContinuousHydration=function(e){if(e.tag===13){var t=Je();_t(e,134217728,t),io(e,134217728)}},o.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13){var t=Je(),n=rn(e);_t(e,n,t),io(e,n)}},o.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=rr(t.pendingLanes);n!==0&&(rs(t,n|1),nt(t,ke()),(se&6)===0&&(Vn(),Ut()))}break;case 13:var s=Je();xa(function(){return _t(e,1,s)}),io(e,1)}},o.batchedUpdates=function(e,t){var n=se;se|=1;try{return e(t)}finally{se=n,se===0&&(Vn(),Hr&&Ut())}},o.createComponentSelector=function(e){return{$$typeof:di,value:e}},o.createContainer=function(e,t,n,s,l,a,p){return za(e,t,!1,null,n,s,l,a,p)},o.createHasPseudoClassSelector=function(e){return{$$typeof:hi,value:e}},o.createHydrationContainer=function(e,t,n,s,l,a,p,T,D){return e=za(n,s,!0,e,l,a,p,T,D),e.context=Aa(null),n=e.current,s=Je(),l=rn(n),a=Vt(s,l),a.callback=t??null,en(n,a),e.current.lanes=l,ir(e,l,s),nt(e,s),e},o.createPortal=function(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:S,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}},o.createRoleSelector=function(e){return{$$typeof:pi,value:e}},o.createTestNameSelector=function(e){return{$$typeof:mi,value:e}},o.createTextSelector=function(e){return{$$typeof:vi,value:e}},o.deferredUpdates=function(e){var t=fe,n=De.transition;try{return De.transition=null,fe=16,e()}finally{fe=t,De.transition=n}},o.discreteUpdates=function(e,t,n,s,l){var a=fe,p=De.transition;try{return De.transition=null,fe=1,e(t,n,s,l)}finally{fe=a,De.transition=p,se===0&&Vn()}},o.findAllNodes=Ws,o.findBoundingRects=function(e,t){if(!Xt)throw Error(f(363));t=Ws(e,t),e=[];for(var n=0;n<t.length;n++)e.push(Yi(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var s=n.x,l=s+n.width,a=n.y,p=a+n.height,T=t-1;0<=T;T--)if(t!==T){var D=e[T],k=D.x,b=k+D.width,te=D.y,q=te+D.height;if(s>=k&&a>=te&&l<=b&&p<=q){e.splice(t,1);break}else if(s!==k||n.width!==D.width||q<a||te>p){if(!(a!==te||n.height!==D.height||b<s||k>l)){k>s&&(D.width+=k-s,D.x=s),b<l&&(D.width=l-k),e.splice(t,1);break}}else{te>a&&(D.height+=te-a,D.y=a),q<p&&(D.height=p-te),e.splice(t,1);break}}}return e},o.findHostInstance=La,o.findHostInstanceWithNoPortals=function(e){return e=B(e),e=e!==null?Ie(e):null,e===null?null:e.stateNode},o.findHostInstanceWithWarning=function(e){return La(e)},o.flushControlled=function(e){var t=se;se|=1;var n=De.transition,s=fe;try{De.transition=null,fe=1,e()}finally{fe=s,De.transition=n,se=t,se===0&&(Vn(),Ut())}},o.flushPassiveEffects=Tn,o.flushSync=xa,o.focusWithin=function(e,t){if(!Xt)throw Error(f(363));for(e=Gs(e),t=Ea(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!hn(n)){if(n.tag===5&&Ki(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},o.getCurrentUpdatePriority=function(){return fe},o.getFindAllNodesFailureDescription=function(e,t){if(!Xt)throw Error(f(363));var n=0,s=[];e=[Gs(e),0];for(var l=0;l<e.length;){var a=e[l++],p=e[l++],T=t[p];if((a.tag!==5||!hn(a))&&(Vs(a,T)&&(s.push(js(T)),p++,p>n&&(n=p)),p<t.length))for(a=a.child;a!==null;)e.push(a,p),a=a.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(js(t[n]));return`findAllNodes was able to match part of the selector:
|
|
32
|
+
`+(s.join(" > ")+`
|
|
33
|
+
|
|
34
|
+
No matching component was found for:
|
|
35
|
+
`)+e.join(" > ")}return null},o.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return Ue(e.child.stateNode);default:return e.child.stateNode}},o.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:g.ReactCurrentDispatcher,findHostInstanceByFiber:Ef,findFiberByHostInstance:e.findFiberByHostInstance||Sf,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Fr=t.inject(e),Pt=t}catch{}e=!!t.checkDCE}}return e},o.isAlreadyRendering=function(){return!1},o.observeVisibleRects=function(e,t,n,s){if(!Xt)throw Error(f(363));e=Ws(e,t);var l=Ht(e,n,s).disconnect;return{disconnect:function(){l()}}},o.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},o.runWithPriority=function(e,t){var n=fe;try{return fe=e,t()}finally{fe=n}},o.shouldError=function(){return null},o.shouldSuspend=function(){return!1},o.updateContainer=function(e,t,n,s){var l=t.current,a=Je(),p=rn(l);return n=Aa(n),t.context===null?t.context=n:t.pendingContext=n,t=Vt(a,p),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),en(l,t),e=_t(l,p,a),e!==null&&Wr(e,l,p),p},o}),fo}var Wa;function sd(){return Wa||(Wa=1,ao.exports=id()),ao.exports}var od=sd();const ld=Cf(od);var ba=Pu();const jo={},Wo=r=>void Object.assign(jo,r);function ad(r,i){function o(h,{args:m=[],attach:x,...E},O){let A=`${h[0].toUpperCase()}${h.slice(1)}`,L;if(h==="primitive"){if(E.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=E.object;L=Kn(v,{type:h,root:O,attach:x,primitive:!0})}else{const v=jo[A];if(!v)throw new Error(`R3F: ${A} 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(!Array.isArray(m))throw new Error("R3F: The args prop must be an array!");L=Kn(new v(...m),{type:h,root:O,attach:x,memoizedProps:{args:m}})}return L.__r3f.attach===void 0&&(L.isBufferGeometry?L.__r3f.attach="geometry":L.isMaterial&&(L.__r3f.attach="material")),A!=="inject"&&mo(L,E),L}function u(h,m){let x=!1;if(m){var E,O;(E=m.__r3f)!=null&&E.attach?po(h,m,m.__r3f.attach):m.isObject3D&&h.isObject3D&&(h.add(m),x=!0),x||(O=h.__r3f)==null||O.objects.push(m),m.__r3f||Kn(m,{}),m.__r3f.parent=h,No(m),Xn(m)}}function c(h,m,x){let E=!1;if(m){var O,A;if((O=m.__r3f)!=null&&O.attach)po(h,m,m.__r3f.attach);else if(m.isObject3D&&h.isObject3D){m.parent=h,m.dispatchEvent({type:"added"}),h.dispatchEvent({type:"childadded",child:m});const L=h.children.filter(y=>y!==m),v=L.indexOf(x);h.children=[...L.slice(0,v),m,...L.slice(v)],E=!0}E||(A=h.__r3f)==null||A.objects.push(m),m.__r3f||Kn(m,{}),m.__r3f.parent=h,No(m),Xn(m)}}function d(h,m,x=!1){h&&[...h].forEach(E=>f(m,E,x))}function f(h,m,x){if(m){var E,O,A;if(m.__r3f&&(m.__r3f.parent=null),(E=h.__r3f)!=null&&E.objects&&(h.__r3f.objects=h.__r3f.objects.filter(U=>U!==m)),(O=m.__r3f)!=null&&O.attach)Xa(h,m,m.__r3f.attach);else if(m.isObject3D&&h.isObject3D){var L;h.remove(m),(L=m.__r3f)!=null&&L.root&&md(Ii(m),m)}const y=(A=m.__r3f)==null?void 0:A.primitive,C=!y&&(x===void 0?m.dispose!==null:x);if(!y){var v;d((v=m.__r3f)==null?void 0:v.objects,m,C),d(m.children,m,C)}if(delete m.__r3f,C&&m.dispose&&m.type!=="Scene"){const U=()=>{try{m.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?ba.unstable_scheduleCallback(ba.unstable_IdlePriority,U):U()}Xn(h)}}function g(h,m,x,E){var O;const A=(O=h.__r3f)==null?void 0:O.parent;if(!A)return;const L=o(m,x,h.__r3f.root);if(h.children){for(const v of h.children)v.__r3f&&u(L,v);h.children=h.children.filter(v=>!v.__r3f)}h.__r3f.objects.forEach(v=>u(L,v)),h.__r3f.objects=[],h.__r3f.autoRemovedBeforeAppend||f(A,h),L.parent&&(L.__r3f.autoRemovedBeforeAppend=!0),u(A,L),L.raycast&&L.__r3f.eventCount&&Ii(L).getState().internal.interaction.push(L),[E,E.alternate].forEach(v=>{v!==null&&(v.stateNode=L,v.ref&&(typeof v.ref=="function"?v.ref(L):v.ref.current=L))})}const _=()=>{};return{reconciler:ld({createInstance:o,removeChild:f,appendChild:u,appendInitialChild:u,insertBefore:c,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(h,m)=>{if(!m)return;const x=h.getState().scene;x.__r3f&&(x.__r3f.root=h,u(x,m))},removeChildFromContainer:(h,m)=>{m&&f(h.getState().scene,m)},insertInContainerBefore:(h,m,x)=>{if(!m||!x)return;const E=h.getState().scene;E.__r3f&&c(E,m,x)},getRootHostContext:()=>null,getChildHostContext:h=>h,finalizeInitialChildren(h){var m;return!!((m=h?.__r3f)!=null?m:{}).handlers},prepareUpdate(h,m,x,E){var O;if(((O=h?.__r3f)!=null?O:{}).primitive&&E.object&&E.object!==h)return[!0];{const{args:L=[],children:v,...y}=E,{args:C=[],children:U,...z}=x;if(!Array.isArray(L))throw new Error("R3F: the args prop must be an array!");if(L.some((H,Y)=>H!==C[Y]))return[!0];const N=Nu(h,y,z,!0);return N.changes.length?[!1,N]:null}},commitUpdate(h,[m,x],E,O,A,L){m?g(h,E,A,L):mo(h,x)},commitMount(h,m,x,E){var O;const A=(O=h.__r3f)!=null?O:{};h.raycast&&A.handlers&&A.eventCount&&Ii(h).getState().internal.interaction.push(h)},getPublicInstance:h=>h,prepareForCommit:()=>null,preparePortalMount:h=>Kn(h.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(h){var m;const{attach:x,parent:E}=(m=h.__r3f)!=null?m:{};x&&E&&Xa(E,h,x),h.isObject3D&&(h.visible=!1),Xn(h)},unhideInstance(h,m){var x;const{attach:E,parent:O}=(x=h.__r3f)!=null?x:{};E&&O&&po(O,h,E),(h.isObject3D&&m.visible==null||m.visible)&&(h.visible=!0),Xn(h)},createTextInstance:_,hideTextInstance:_,unhideTextInstance:_,getCurrentEventPriority:()=>i?i():qn.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&xe.fun(performance.now)?performance.now:xe.fun(Date.now)?Date.now:()=>0,scheduleTimeout:xe.fun(setTimeout)?setTimeout:void 0,cancelTimeout:xe.fun(clearTimeout)?clearTimeout:void 0}),applyProps:mo}}var Ya,Za;const ho=r=>"colorSpace"in r||"outputColorSpace"in r,Mu=()=>{var r;return(r=jo.ColorManagement)!=null?r:null},Uu=r=>r&&r.isOrthographicCamera,ud=r=>r&&r.hasOwnProperty("current"),Dr=typeof window<"u"&&((Ya=window.document)!=null&&Ya.createElement||((Za=window.navigator)==null?void 0:Za.product)==="ReactNative")?I.useLayoutEffect:I.useEffect;function Du(r){const i=I.useRef(r);return Dr(()=>void(i.current=r),[r]),i}function cd({set:r}){return Dr(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class zu extends I.Component{constructor(...i){super(...i),this.state={error:!1}}componentDidCatch(i){this.props.set(i)}render(){return this.state.error?null:this.props.children}}zu.getDerivedStateFromError=()=>({error:!0});const Au="__default",Qa=new Map,fd=r=>r&&!!r.memoized&&!!r.changes;function Lu(r){var i;const o=typeof window<"u"?(i=window.devicePixelRatio)!=null?i:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],o),r[1]):r}const Tr=r=>{var i;return(i=r.__r3f)==null?void 0:i.root.getState()};function Ii(r){let i=r.__r3f.root;for(;i.getState().previousRoot;)i=i.getState().previousRoot;return i}const xe={obj:r=>r===Object(r)&&!xe.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,i,{arrays:o="shallow",objects:u="reference",strict:c=!0}={}){if(typeof r!=typeof i||!!r!=!!i)return!1;if(xe.str(r)||xe.num(r)||xe.boo(r))return r===i;const d=xe.obj(r);if(d&&u==="reference")return r===i;const f=xe.arr(r);if(f&&o==="reference")return r===i;if((f||d)&&r===i)return!0;let g;for(g in r)if(!(g in i))return!1;if(d&&o==="shallow"&&u==="shallow"){for(g in c?i:r)if(!xe.equ(r[g],i[g],{strict:c,objects:"reference"}))return!1}else for(g in c?i:r)if(r[g]!==i[g])return!1;if(xe.und(g)){if(f&&r.length===0&&i.length===0||d&&Object.keys(r).length===0&&Object.keys(i).length===0)return!0;if(r!==i)return!1}return!0}};function dd(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const i in r)i.dispose==null||i.dispose(),delete r[i]}function Kn(r,i){const o=r;return o.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...i},r}function Lo(r,i){let o=r;if(i.includes("-")){const u=i.split("-"),c=u.pop();return o=u.reduce((d,f)=>d[f],r),{target:o,key:c}}else return{target:o,key:i}}const Ka=/-\d+$/;function po(r,i,o){if(xe.str(o)){if(Ka.test(o)){const d=o.replace(Ka,""),{target:f,key:g}=Lo(r,d);Array.isArray(f[g])||(f[g]=[])}const{target:u,key:c}=Lo(r,o);i.__r3f.previousAttach=u[c],u[c]=i}else i.__r3f.previousAttach=o(r,i)}function Xa(r,i,o){var u,c;if(xe.str(o)){const{target:d,key:f}=Lo(r,o),g=i.__r3f.previousAttach;g===void 0?delete d[f]:d[f]=g}else(u=i.__r3f)==null||u.previousAttach==null||u.previousAttach(r,i);(c=i.__r3f)==null||delete c.previousAttach}function Nu(r,{children:i,key:o,ref:u,...c},{children:d,key:f,ref:g,..._}={},S=!1){const h=r.__r3f,m=Object.entries(c),x=[];if(S){const O=Object.keys(_);for(let A=0;A<O.length;A++)c.hasOwnProperty(O[A])||m.unshift([O[A],Au+"remove"])}m.forEach(([O,A])=>{var L;if((L=r.__r3f)!=null&&L.primitive&&O==="object"||xe.equ(A,_[O]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(O))return x.push([O,A,!0,[]]);let v=[];O.includes("-")&&(v=O.split("-")),x.push([O,A,!1,v]);for(const y in c){const C=c[y];y.startsWith(`${O}-`)&&x.push([y,C,!1,y.split("-")])}});const E={...c};return h!=null&&h.memoizedProps&&h!=null&&h.memoizedProps.args&&(E.args=h.memoizedProps.args),h!=null&&h.memoizedProps&&h!=null&&h.memoizedProps.attach&&(E.attach=h.memoizedProps.attach),{memoized:E,changes:x}}function mo(r,i){var o;const u=r.__r3f,c=u?.root,d=c==null||c.getState==null?void 0:c.getState(),{memoized:f,changes:g}=fd(i)?i:Nu(r,i),_=u?.eventCount;r.__r3f&&(r.__r3f.memoizedProps=f);for(let x=0;x<g.length;x++){let[E,O,A,L]=g[x];if(ho(r)){const U="srgb",z="srgb-linear";E==="encoding"?(E="colorSpace",O=O===3001?U:z):E==="outputEncoding"&&(E="outputColorSpace",O=O===3001?U:z)}let v=r,y=v[E];if(L.length&&(y=L.reduce((C,U)=>C[U],r),!(y&&y.set))){const[C,...U]=L.reverse();v=U.reverse().reduce((z,N)=>z[N],r),E=C}if(O===Au+"remove")if(v.constructor){let C=Qa.get(v.constructor);C||(C=new v.constructor,Qa.set(v.constructor,C)),O=C[E]}else O=0;if(A&&u)O?u.handlers[E]=O:delete u.handlers[E],u.eventCount=Object.keys(u.handlers).length;else if(y&&y.set&&(y.copy||y instanceof oo)){if(Array.isArray(O))y.fromArray?y.fromArray(O):y.set(...O);else if(y.copy&&O&&O.constructor&&y.constructor===O.constructor)y.copy(O);else if(O!==void 0){var S;const C=(S=y)==null?void 0:S.isColor;!C&&y.setScalar?y.setScalar(O):y instanceof oo&&O instanceof oo?y.mask=O.mask:y.set(O),!Mu()&&d&&!d.linear&&C&&y.convertSRGBToLinear()}}else{var h;if(v[E]=O,(h=v[E])!=null&&h.isTexture&&v[E].format===Af&&v[E].type===fn&&d){const C=v[E];ho(C)&&ho(d.gl)?C.colorSpace=d.gl.outputColorSpace:C.encoding=d.gl.outputEncoding}}Xn(r)}if(u&&u.parent&&r.raycast&&_!==u.eventCount){const x=Ii(r).getState().internal,E=x.interaction.indexOf(r);E>-1&&x.interaction.splice(E,1),u.eventCount&&x.interaction.push(r)}return!(g.length===1&&g[0][0]==="onUpdate")&&g.length&&(o=r.__r3f)!=null&&o.parent&&No(r),r}function Xn(r){var i,o;const u=(i=r.__r3f)==null||(o=i.root)==null||o.getState==null?void 0:o.getState();u&&u.internal.frames===0&&u.invalidate()}function No(r){r.onUpdate==null||r.onUpdate(r)}function hd(r,i){r.manual||(Uu(r)?(r.left=i.width/-2,r.right=i.width/2,r.top=i.height/2,r.bottom=i.height/-2):r.aspect=i.width/i.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Ui(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function pd(){var r;const i=typeof self<"u"&&self||typeof window<"u"&&window;if(!i)return qn.DefaultEventPriority;switch((r=i.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return qn.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return qn.ContinuousEventPriority;default:return qn.DefaultEventPriority}}function Iu(r,i,o,u){const c=o.get(i);c&&(o.delete(i),o.size===0&&(r.delete(u),c.target.releasePointerCapture(u)))}function md(r,i){const{internal:o}=r.getState();o.interaction=o.interaction.filter(u=>u!==i),o.initialHits=o.initialHits.filter(u=>u!==i),o.hovered.forEach((u,c)=>{(u.eventObject===i||u.object===i)&&o.hovered.delete(c)}),o.capturedMap.forEach((u,c)=>{Iu(o.capturedMap,i,u,c)})}function vd(r){function i(_){const{internal:S}=r.getState(),h=_.offsetX-S.initialClick[0],m=_.offsetY-S.initialClick[1];return Math.round(Math.sqrt(h*h+m*m))}function o(_){return _.filter(S=>["Move","Over","Enter","Out","Leave"].some(h=>{var m;return(m=S.__r3f)==null?void 0:m.handlers["onPointer"+h]}))}function u(_,S){const h=r.getState(),m=new Set,x=[],E=S?S(h.internal.interaction):h.internal.interaction;for(let v=0;v<E.length;v++){const y=Tr(E[v]);y&&(y.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(_,h);function O(v){const y=Tr(v);if(!y||!y.events.enabled||y.raycaster.camera===null)return[];if(y.raycaster.camera===void 0){var C;y.events.compute==null||y.events.compute(_,y,(C=y.previousRoot)==null?void 0:C.getState()),y.raycaster.camera===void 0&&(y.raycaster.camera=null)}return y.raycaster.camera?y.raycaster.intersectObject(v,!0):[]}let A=E.flatMap(O).sort((v,y)=>{const C=Tr(v.object),U=Tr(y.object);return!C||!U?v.distance-y.distance:U.events.priority-C.events.priority||v.distance-y.distance}).filter(v=>{const y=Ui(v);return m.has(y)?!1:(m.add(y),!0)});h.events.filter&&(A=h.events.filter(A,h));for(const v of A){let y=v.object;for(;y;){var L;(L=y.__r3f)!=null&&L.eventCount&&x.push({...v,eventObject:y}),y=y.parent}}if("pointerId"in _&&h.internal.capturedMap.has(_.pointerId))for(let v of h.internal.capturedMap.get(_.pointerId).values())m.has(Ui(v.intersection))||x.push(v.intersection);return x}function c(_,S,h,m){const x=r.getState();if(_.length){const E={stopped:!1};for(const O of _){const A=Tr(O.object)||x,{raycaster:L,pointer:v,camera:y,internal:C}=A,U=new Bt(v.x,v.y,0).unproject(y),z=X=>{var B,ee;return(B=(ee=C.capturedMap.get(X))==null?void 0:ee.has(O.eventObject))!=null?B:!1},N=X=>{const B={intersection:O,target:S.target};C.capturedMap.has(X)?C.capturedMap.get(X).set(O.eventObject,B):C.capturedMap.set(X,new Map([[O.eventObject,B]])),S.target.setPointerCapture(X)},H=X=>{const B=C.capturedMap.get(X);B&&Iu(C.capturedMap,O.eventObject,B,X)};let Y={};for(let X in S){let B=S[X];typeof B!="function"&&(Y[X]=B)}let j={...O,...Y,pointer:v,intersections:_,stopped:E.stopped,delta:h,unprojectedPoint:U,ray:L.ray,camera:y,stopPropagation(){const X="pointerId"in S&&C.capturedMap.get(S.pointerId);if((!X||X.has(O.eventObject))&&(j.stopped=E.stopped=!0,C.hovered.size&&Array.from(C.hovered.values()).find(B=>B.eventObject===O.eventObject))){const B=_.slice(0,_.indexOf(O));d([...B,O])}},target:{hasPointerCapture:z,setPointerCapture:N,releasePointerCapture:H},currentTarget:{hasPointerCapture:z,setPointerCapture:N,releasePointerCapture:H},nativeEvent:S};if(m(j),E.stopped===!0)break}}return _}function d(_){const{internal:S}=r.getState();for(const h of S.hovered.values())if(!_.length||!_.find(m=>m.object===h.object&&m.index===h.index&&m.instanceId===h.instanceId)){const x=h.eventObject.__r3f,E=x?.handlers;if(S.hovered.delete(Ui(h)),x!=null&&x.eventCount){const O={...h,intersections:_};E.onPointerOut==null||E.onPointerOut(O),E.onPointerLeave==null||E.onPointerLeave(O)}}}function f(_,S){for(let h=0;h<S.length;h++){const m=S[h].__r3f;m==null||m.handlers.onPointerMissed==null||m.handlers.onPointerMissed(_)}}function g(_){switch(_){case"onPointerLeave":case"onPointerCancel":return()=>d([]);case"onLostPointerCapture":return S=>{const{internal:h}=r.getState();"pointerId"in S&&h.capturedMap.has(S.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(S.pointerId)&&(h.capturedMap.delete(S.pointerId),d([]))})}}return function(h){const{onPointerMissed:m,internal:x}=r.getState();x.lastEvent.current=h;const E=_==="onPointerMove",O=_==="onClick"||_==="onContextMenu"||_==="onDoubleClick",L=u(h,E?o:void 0),v=O?i(h):0;_==="onPointerDown"&&(x.initialClick=[h.offsetX,h.offsetY],x.initialHits=L.map(C=>C.eventObject)),O&&!L.length&&v<=2&&(f(h,x.interaction),m&&m(h)),E&&d(L);function y(C){const U=C.eventObject,z=U.__r3f,N=z?.handlers;if(z!=null&&z.eventCount)if(E){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const H=Ui(C),Y=x.hovered.get(H);Y?Y.stopped&&C.stopPropagation():(x.hovered.set(H,C),N.onPointerOver==null||N.onPointerOver(C),N.onPointerEnter==null||N.onPointerEnter(C))}N.onPointerMove==null||N.onPointerMove(C)}else{const H=N[_];H?(!O||x.initialHits.includes(U))&&(f(h,x.interaction.filter(Y=>!x.initialHits.includes(Y))),H(C)):O&&x.initialHits.includes(U)&&f(h,x.interaction.filter(Y=>!x.initialHits.includes(Y)))}}c(L,h,v,y)}}return{handlePointer:g}}const Bu=r=>!!(r!=null&&r.render),ku=I.createContext(null),gd=(r,i)=>{const o=nd((g,_)=>{const S=new Bt,h=new Bt,m=new Bt;function x(v=_().camera,y=h,C=_().size){const{width:U,height:z,top:N,left:H}=C,Y=U/z;y.isVector3?m.copy(y):m.set(...y);const j=v.getWorldPosition(S).distanceTo(m);if(Uu(v))return{width:U/v.zoom,height:z/v.zoom,top:N,left:H,factor:1,distance:j,aspect:Y};{const X=v.fov*Math.PI/180,B=2*Math.tan(X/2)*j,ee=B*(U/z);return{width:ee,height:B,top:N,left:H,factor:U/ee,distance:j,aspect:Y}}}let E;const O=v=>g(y=>({performance:{...y.performance,current:v}})),A=new Ge;return{set:g,get:_,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>r(_(),v),advance:(v,y)=>i(v,y,_()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new zf,pointer:A,mouse:A,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=_();E&&clearTimeout(E),v.performance.current!==v.performance.min&&O(v.performance.min),E=setTimeout(()=>O(_().performance.max),v.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:x},setEvents:v=>g(y=>({...y,events:{...y.events,...v}})),setSize:(v,y,C,U,z)=>{const N=_().camera,H={width:v,height:y,top:U||0,left:z||0,updateStyle:C};g(Y=>({size:H,viewport:{...Y.viewport,...x(N,h,H)}}))},setDpr:v=>g(y=>{const C=Lu(v);return{viewport:{...y.viewport,dpr:C,initialDpr:y.viewport.initialDpr||C}}}),setFrameloop:(v="always")=>{const y=_().clock;y.stop(),y.elapsedTime=0,v!=="never"&&(y.start(),y.elapsedTime=0),g(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:I.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,y,C)=>{const U=_().internal;return U.priority=U.priority+(y>0?1:0),U.subscribers.push({ref:v,priority:y,store:C}),U.subscribers=U.subscribers.sort((z,N)=>z.priority-N.priority),()=>{const z=_().internal;z!=null&&z.subscribers&&(z.priority=z.priority-(y>0?1:0),z.subscribers=z.subscribers.filter(N=>N.ref!==v))}}}}}),u=o.getState();let c=u.size,d=u.viewport.dpr,f=u.camera;return o.subscribe(()=>{const{camera:g,size:_,viewport:S,gl:h,set:m}=o.getState();if(_.width!==c.width||_.height!==c.height||S.dpr!==d){var x;c=_,d=S.dpr,hd(g,_),h.setPixelRatio(S.dpr);const E=(x=_.updateStyle)!=null?x:typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(_.width,_.height,E)}g!==f&&(f=g,m(E=>({viewport:{...E.viewport,...E.viewport.getCurrentViewport(g)}})))}),o.subscribe(g=>r(g)),o};let Di,_d=new Set,yd=new Set,Ed=new Set;function vo(r,i){if(r.size)for(const{callback:o}of r.values())o(i)}function xr(r,i){switch(r){case"before":return vo(_d,i);case"after":return vo(yd,i);case"tail":return vo(Ed,i)}}let go,_o;function yo(r,i,o){let u=i.clock.getDelta();for(i.frameloop==="never"&&typeof r=="number"&&(u=r-i.clock.elapsedTime,i.clock.oldTime=i.clock.elapsedTime,i.clock.elapsedTime=r),go=i.internal.subscribers,Di=0;Di<go.length;Di++)_o=go[Di],_o.ref.current(_o.store.getState(),u,o);return!i.internal.priority&&i.gl.render&&i.gl.render(i.scene,i.camera),i.internal.frames=Math.max(0,i.internal.frames-1),i.frameloop==="always"?1:i.internal.frames}function Sd(r){let i=!1,o=!1,u,c,d;function f(S){c=requestAnimationFrame(f),i=!0,u=0,xr("before",S),o=!0;for(const m of r.values()){var h;d=m.store.getState(),d.internal.active&&(d.frameloop==="always"||d.internal.frames>0)&&!((h=d.gl.xr)!=null&&h.isPresenting)&&(u+=yo(S,d))}if(o=!1,xr("after",S),u===0)return xr("tail",S),i=!1,cancelAnimationFrame(c)}function g(S,h=1){var m;if(!S)return r.forEach(x=>g(x.store.getState(),h));(m=S.gl.xr)!=null&&m.isPresenting||!S.internal.active||S.frameloop==="never"||(h>1?S.internal.frames=Math.min(60,S.internal.frames+h):o?S.internal.frames=2:S.internal.frames=1,i||(i=!0,requestAnimationFrame(f)))}function _(S,h=!0,m,x){if(h&&xr("before",S),m)yo(S,m,x);else for(const E of r.values())yo(S,E.store.getState());h&&xr("after",S)}return{loop:f,invalidate:g,advance:_}}function Fu(){const r=I.useContext(ku);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Ot(r=o=>o,i){return Fu()(r,i)}function ji(r,i=0){const o=Fu(),u=o.getState().internal.subscribe,c=Du(r);return Dr(()=>u(c,i,o),[i,u,o]),null}const Jn=new Map,{invalidate:qa,advance:Ja}=Sd(Jn),{reconciler:Fi,applyProps:jn}=ad(Jn,pd),Wn={objects:"shallow",strict:!1},Td=(r,i)=>{const o=typeof r=="function"?r(i):r;return Bu(o)?o:new Uf({powerPreference:"high-performance",canvas:i,antialias:!0,alpha:!0,...r})};function xd(r,i){const o=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(i){const{width:u,height:c,top:d,left:f,updateStyle:g=o}=i;return{width:u,height:c,top:d,left:f,updateStyle:g}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:u,height:c,top:d,left:f}=r.parentElement.getBoundingClientRect();return{width:u,height:c,top:d,left:f,updateStyle:o}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:o};return{width:0,height:0,top:0,left:0}}function wd(r){const i=Jn.get(r),o=i?.fiber,u=i?.store;i&&console.warn("R3F.createRoot should only be called once!");const c=typeof reportError=="function"?reportError:console.error,d=u||gd(qa,Ja),f=o||Fi.createContainer(d,qn.ConcurrentRoot,null,!1,null,"",c,null);i||Jn.set(r,{fiber:f,store:d});let g,_=!1,S;return{configure(h={}){let{gl:m,size:x,scene:E,events:O,onCreated:A,shadows:L=!1,linear:v=!1,flat:y=!1,legacy:C=!1,orthographic:U=!1,frameloop:z="always",dpr:N=[1,2],performance:H,raycaster:Y,camera:j,onPointerMissed:X}=h,B=d.getState(),ee=B.gl;B.gl||B.set({gl:ee=Td(m,r)});let ge=B.raycaster;ge||B.set({raycaster:ge=new Eu});const{params:Ie,...ce}=Y||{};if(xe.equ(ce,ge,Wn)||jn(ge,{...ce}),xe.equ(Ie,ge.params,Wn)||jn(ge,{params:{...ge.params,...Ie}}),!B.camera||B.camera===S&&!xe.equ(S,j,Wn)){S=j;const W=j instanceof Df,J=W?j:U?new Gi(0,0,0,0,.1,1e3):new Vi(75,0,.1,1e3);W||(J.position.z=5,j&&(jn(J,j),("aspect"in j||"left"in j||"right"in j||"bottom"in j||"top"in j)&&(J.manual=!0,J.updateProjectionMatrix())),!B.camera&&!(j!=null&&j.rotation)&&J.lookAt(0,0,0)),B.set({camera:J}),ge.camera=J}if(!B.scene){let W;E!=null&&E.isScene?W=E:(W=new zo,E&&jn(W,E)),B.set({scene:Kn(W)})}if(!B.xr){var Ue;const W=(oe,Le)=>{const Ve=d.getState();Ve.frameloop!=="never"&&Ja(oe,!0,Ve,Le)},J=()=>{const oe=d.getState();oe.gl.xr.enabled=oe.gl.xr.isPresenting,oe.gl.xr.setAnimationLoop(oe.gl.xr.isPresenting?W:null),oe.gl.xr.isPresenting||qa(oe)},le={connect(){const oe=d.getState().gl;oe.xr.addEventListener("sessionstart",J),oe.xr.addEventListener("sessionend",J)},disconnect(){const oe=d.getState().gl;oe.xr.removeEventListener("sessionstart",J),oe.xr.removeEventListener("sessionend",J)}};typeof((Ue=ee.xr)==null?void 0:Ue.addEventListener)=="function"&&le.connect(),B.set({xr:le})}if(ee.shadowMap){const W=ee.shadowMap.enabled,J=ee.shadowMap.type;if(ee.shadowMap.enabled=!!L,xe.boo(L))ee.shadowMap.type=so;else if(xe.str(L)){var Ce;const le={basic:Pf,percentage:Rf,soft:so,variance:Of};ee.shadowMap.type=(Ce=le[L])!=null?Ce:so}else xe.obj(L)&&Object.assign(ee.shadowMap,L);(W!==ee.shadowMap.enabled||J!==ee.shadowMap.type)&&(ee.shadowMap.needsUpdate=!0)}const F=Mu();F&&("enabled"in F?F.enabled=!C:"legacyMode"in F&&(F.legacyMode=C)),_||jn(ee,{outputEncoding:v?3e3:3001,toneMapping:y?Su:Mf}),B.legacy!==C&&B.set(()=>({legacy:C})),B.linear!==v&&B.set(()=>({linear:v})),B.flat!==y&&B.set(()=>({flat:y})),m&&!xe.fun(m)&&!Bu(m)&&!xe.equ(m,ee,Wn)&&jn(ee,m),O&&!B.events.handlers&&B.set({events:O(d)});const Q=xd(r,x);return xe.equ(Q,B.size,Wn)||B.setSize(Q.width,Q.height,Q.updateStyle,Q.top,Q.left),N&&B.viewport.dpr!==Lu(N)&&B.setDpr(N),B.frameloop!==z&&B.setFrameloop(z),B.onPointerMissed||B.set({onPointerMissed:X}),H&&!xe.equ(H,B.performance,Wn)&&B.set(W=>({performance:{...W.performance,...H}})),g=A,_=!0,this},render(h){return _||this.configure(),Fi.updateContainer(st.jsx(Cd,{store:d,children:h,onCreated:g,rootElement:r}),f,null,()=>{}),d},unmount(){Hu(r)}}}function Cd({store:r,children:i,onCreated:o,rootElement:u}){return Dr(()=>{const c=r.getState();c.set(d=>({internal:{...d.internal,active:!0}})),o&&o(c),r.getState().events.connected||c.events.connect==null||c.events.connect(u)},[]),st.jsx(ku.Provider,{value:r,children:i})}function Hu(r,i){const o=Jn.get(r),u=o?.fiber;if(u){const c=o?.store.getState();c&&(c.internal.active=!1),Fi.updateContainer(null,u,null,()=>{c&&setTimeout(()=>{try{var d,f,g,_;c.events.disconnect==null||c.events.disconnect(),(d=c.gl)==null||(f=d.renderLists)==null||f.dispose==null||f.dispose(),(g=c.gl)==null||g.forceContextLoss==null||g.forceContextLoss(),(_=c.gl)!=null&&_.xr&&c.xr.disconnect(),dd(c),Jn.delete(r)}catch{}},500)})}}Fi.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:I.version});const Eo={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 Od(r){const{handlePointer:i}=vd(r);return{priority:1,enabled:!0,compute(o,u,c){u.pointer.set(o.offsetX/u.size.width*2-1,-(o.offsetY/u.size.height)*2+1),u.raycaster.setFromCamera(u.pointer,u.camera)},connected:void 0,handlers:Object.keys(Eo).reduce((o,u)=>({...o,[u]:i(u)}),{}),update:()=>{var o;const{events:u,internal:c}=r.getState();(o=c.lastEvent)!=null&&o.current&&u.handlers&&u.handlers.onPointerMove(c.lastEvent.current)},connect:o=>{var u;const{set:c,events:d}=r.getState();d.disconnect==null||d.disconnect(),c(f=>({events:{...f.events,connected:o}})),Object.entries((u=d.handlers)!=null?u:[]).forEach(([f,g])=>{const[_,S]=Eo[f];o.addEventListener(_,g,{passive:S})})},disconnect:()=>{const{set:o,events:u}=r.getState();if(u.connected){var c;Object.entries((c=u.handlers)!=null?c:[]).forEach(([d,f])=>{if(u&&u.connected instanceof HTMLElement){const[g]=Eo[d];u.connected.removeEventListener(g,f)}}),o(d=>({events:{...d.events,connected:void 0}}))}}}}function $a(r,i){let o;return(...u)=>{window.clearTimeout(o),o=window.setTimeout(()=>r(...u),i)}}function Rd({debounce:r,scroll:i,polyfill:o,offsetSize:u}={debounce:0,scroll:!1,offsetSize:!1}){const c=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!c)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[d,f]=I.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),g=I.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:d,orientationHandler:null}),_=r?typeof r=="number"?r:r.scroll:null,S=r?typeof r=="number"?r:r.resize:null,h=I.useRef(!1);I.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[m,x,E]=I.useMemo(()=>{const v=()=>{if(!g.current.element)return;const{left:y,top:C,width:U,height:z,bottom:N,right:H,x:Y,y:j}=g.current.element.getBoundingClientRect(),X={left:y,top:C,width:U,height:z,bottom:N,right:H,x:Y,y:j};g.current.element instanceof HTMLElement&&u&&(X.height=g.current.element.offsetHeight,X.width=g.current.element.offsetWidth),Object.freeze(X),h.current&&!Dd(g.current.lastBounds,X)&&f(g.current.lastBounds=X)};return[v,S?$a(v,S):v,_?$a(v,_):v]},[f,u,_,S]);function O(){g.current.scrollContainers&&(g.current.scrollContainers.forEach(v=>v.removeEventListener("scroll",E,!0)),g.current.scrollContainers=null),g.current.resizeObserver&&(g.current.resizeObserver.disconnect(),g.current.resizeObserver=null),g.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",g.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",g.current.orientationHandler))}function A(){g.current.element&&(g.current.resizeObserver=new c(E),g.current.resizeObserver.observe(g.current.element),i&&g.current.scrollContainers&&g.current.scrollContainers.forEach(v=>v.addEventListener("scroll",E,{capture:!0,passive:!0})),g.current.orientationHandler=()=>{E()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",g.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",g.current.orientationHandler))}const L=v=>{!v||v===g.current.element||(O(),g.current.element=v,g.current.scrollContainers=Gu(v),A())};return Md(E,!!i),Pd(x),I.useEffect(()=>{O(),A()},[i,E,x]),I.useEffect(()=>O,[]),[L,d,m]}function Pd(r){I.useEffect(()=>{const i=r;return window.addEventListener("resize",i),()=>void window.removeEventListener("resize",i)},[r])}function Md(r,i){I.useEffect(()=>{if(i){const o=r;return window.addEventListener("scroll",o,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",o,!0)}},[r,i])}function Gu(r){const i=[];if(!r||r===document.body)return i;const{overflow:o,overflowX:u,overflowY:c}=window.getComputedStyle(r);return[o,u,c].some(d=>d==="auto"||d==="scroll")&&i.push(r),[...i,...Gu(r.parentElement)]}const Ud=["x","y","top","bottom","left","right","width","height"],Dd=(r,i)=>Ud.every(o=>r[o]===i[o]);var zd=Object.defineProperty,Ad=Object.defineProperties,Ld=Object.getOwnPropertyDescriptors,eu=Object.getOwnPropertySymbols,Nd=Object.prototype.hasOwnProperty,Id=Object.prototype.propertyIsEnumerable,tu=(r,i,o)=>i in r?zd(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o,nu=(r,i)=>{for(var o in i||(i={}))Nd.call(i,o)&&tu(r,o,i[o]);if(eu)for(var o of eu(i))Id.call(i,o)&&tu(r,o,i[o]);return r},Bd=(r,i)=>Ad(r,Ld(i)),ru,iu;typeof window<"u"&&((ru=window.document)!=null&&ru.createElement||((iu=window.navigator)==null?void 0:iu.product)==="ReactNative")?I.useLayoutEffect:I.useEffect;function Vu(r,i,o){if(!r)return;if(o(r)===!0)return r;let u=r.child;for(;u;){const c=Vu(u,i,o);if(c)return c;u=u.sibling}}function ju(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const su=console.error;console.error=function(){const r=[...arguments].join("");if(r?.startsWith("Warning:")&&r.includes("useContext")){console.error=su;return}return su.apply(this,arguments)};const bo=ju(I.createContext(null));class Wu extends I.Component{render(){return I.createElement(bo.Provider,{value:this._reactInternals},this.props.children)}}function kd(){const r=I.useContext(bo);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const i=I.useId();return I.useMemo(()=>{for(const u of[r,r?.alternate]){if(!u)continue;const c=Vu(u,!1,d=>{let f=d.memoizedState;for(;f;){if(f.memoizedState===i)return!0;f=f.next}});if(c)return c}},[r,i])}function Fd(){const r=kd(),[i]=I.useState(()=>new Map);i.clear();let o=r;for(;o;){if(o.type&&typeof o.type=="object"){const c=o.type._context===void 0&&o.type.Provider===o.type?o.type:o.type._context;c&&c!==bo&&!i.has(c)&&i.set(c,I.useContext(ju(c)))}o=o.return}return i}function Hd(){const r=Fd();return I.useMemo(()=>Array.from(r.keys()).reduce((i,o)=>u=>I.createElement(i,null,I.createElement(o.Provider,Bd(nu({},u),{value:r.get(o)}))),i=>I.createElement(Wu,nu({},i))),[r])}const Gd=I.forwardRef(function({children:i,fallback:o,resize:u,style:c,gl:d,events:f=Od,eventSource:g,eventPrefix:_,shadows:S,linear:h,flat:m,legacy:x,orthographic:E,frameloop:O,dpr:A,performance:L,raycaster:v,camera:y,scene:C,onPointerMissed:U,onCreated:z,...N},H){I.useMemo(()=>Wo(Lf),[]);const Y=Hd(),[j,X]=Rd({scroll:!0,debounce:{scroll:50,resize:0},...u}),B=I.useRef(null),ee=I.useRef(null);I.useImperativeHandle(H,()=>B.current);const ge=Du(U),[Ie,ce]=I.useState(!1),[Ue,Ce]=I.useState(!1);if(Ie)throw Ie;if(Ue)throw Ue;const F=I.useRef(null);Dr(()=>{const W=B.current;X.width>0&&X.height>0&&W&&(F.current||(F.current=wd(W)),F.current.configure({gl:d,events:f,shadows:S,linear:h,flat:m,legacy:x,orthographic:E,frameloop:O,dpr:A,performance:L,raycaster:v,camera:y,scene:C,size:X,onPointerMissed:(...J)=>ge.current==null?void 0:ge.current(...J),onCreated:J=>{J.events.connect==null||J.events.connect(g?ud(g)?g.current:g:ee.current),_&&J.setEvents({compute:(le,oe)=>{const Le=le[_+"X"],Ve=le[_+"Y"];oe.pointer.set(Le/oe.size.width*2-1,-(Ve/oe.size.height)*2+1),oe.raycaster.setFromCamera(oe.pointer,oe.camera)}}),z?.(J)}}),F.current.render(st.jsx(Y,{children:st.jsx(zu,{set:Ce,children:st.jsx(I.Suspense,{fallback:st.jsx(cd,{set:ce}),children:i??null})})})))}),I.useEffect(()=>{const W=B.current;if(W)return()=>Hu(W)},[]);const Q=g?"none":"auto";return st.jsx("div",{ref:ee,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Q,...c},...N,children:st.jsx("div",{ref:j,style:{width:"100%",height:"100%"},children:st.jsx("canvas",{ref:B,style:{display:"block"},children:o})})})}),Op=I.forwardRef(function(i,o){return st.jsx(Wu,{children:st.jsx(Gd,{...i,ref:o})})});function Hi(){return Hi=Object.assign?Object.assign.bind():function(r){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var u in o)({}).hasOwnProperty.call(o,u)&&(r[u]=o[u])}return r},Hi.apply(null,arguments)}const zr=new Bt,Yo=new Bt,Vd=new Bt,ou=new Ge;function jd(r,i,o){const u=zr.setFromMatrixPosition(r.matrixWorld);u.project(i);const c=o.width/2,d=o.height/2;return[u.x*c+c,-(u.y*d)+d]}function Wd(r,i){const o=zr.setFromMatrixPosition(r.matrixWorld),u=Yo.setFromMatrixPosition(i.matrixWorld),c=o.sub(u),d=i.getWorldDirection(Vd);return c.angleTo(d)>Math.PI/2}function bd(r,i,o,u){const c=zr.setFromMatrixPosition(r.matrixWorld),d=c.clone();d.project(i),ou.set(d.x,d.y),o.setFromCamera(ou,i);const f=o.intersectObjects(u,!0);if(f.length){const g=f[0].distance;return c.distanceTo(o.ray.origin)<g}return!0}function Yd(r,i){if(i instanceof Gi)return i.zoom;if(i instanceof Vi){const o=zr.setFromMatrixPosition(r.matrixWorld),u=Yo.setFromMatrixPosition(i.matrixWorld),c=i.fov*Math.PI/180,d=o.distanceTo(u);return 1/(2*Math.tan(c/2)*d)}else return 1}function Zd(r,i,o){if(i instanceof Vi||i instanceof Gi){const u=zr.setFromMatrixPosition(r.matrixWorld),c=Yo.setFromMatrixPosition(i.matrixWorld),d=u.distanceTo(c),f=(o[1]-o[0])/(i.far-i.near),g=o[1]-f*i.far;return Math.round(f*d+g)}}const Io=r=>Math.abs(r)<1e-10?0:r;function bu(r,i,o=""){let u="matrix3d(";for(let c=0;c!==16;c++)u+=Io(i[c]*r.elements[c])+(c!==15?",":")");return o+u}const Qd=(r=>i=>bu(i,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Kd=(r=>(i,o)=>bu(i,r(o),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function Xd(r){return r&&typeof r=="object"&&"current"in r}const Rp=I.forwardRef(({children:r,eps:i=.001,style:o,className:u,prepend:c,center:d,fullscreen:f,portal:g,distanceFactor:_,sprite:S=!1,transform:h=!1,occlude:m,onOcclude:x,castShadow:E,receiveShadow:O,material:A,geometry:L,zIndexRange:v=[16777271,0],calculatePosition:y=jd,as:C="div",wrapperClass:U,pointerEvents:z="auto",...N},H)=>{const{gl:Y,camera:j,scene:X,size:B,raycaster:ee,events:ge,viewport:Ie}=Ot(),[ce]=I.useState(()=>document.createElement(C)),Ue=I.useRef(),Ce=I.useRef(null),F=I.useRef(0),Q=I.useRef([0,0]),W=I.useRef(null),J=I.useRef(null),le=g?.current||ge.connected||Y.domElement.parentNode,oe=I.useRef(null),Le=I.useRef(!1),Ve=I.useMemo(()=>m&&m!=="blending"||Array.isArray(m)&&m.length&&Xd(m[0]),[m]);I.useLayoutEffect(()=>{const Be=Y.domElement;m&&m==="blending"?(Be.style.zIndex=`${Math.floor(v[0]/2)}`,Be.style.position="absolute",Be.style.pointerEvents="none"):(Be.style.zIndex=null,Be.style.position=null,Be.style.pointerEvents=null)},[m]),I.useLayoutEffect(()=>{if(Ce.current){const Be=Ue.current=qf.createRoot(ce);if(X.updateMatrixWorld(),h)ce.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ae=y(Ce.current,j,B);ce.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ae[0]}px,${ae[1]}px,0);transform-origin:0 0;`}return le&&(c?le.prepend(ce):le.appendChild(ce)),()=>{le&&le.removeChild(ce),Be.unmount()}}},[le,h]),I.useLayoutEffect(()=>{U&&(ce.className=U)},[U]);const lt=I.useMemo(()=>h?{position:"absolute",top:0,left:0,width:B.width,height:B.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:d?"translate3d(-50%,-50%,0)":"none",...f&&{top:-B.height/2,left:-B.width/2,width:B.width,height:B.height},...o},[o,d,f,B,h]),kt=I.useMemo(()=>({position:"absolute",pointerEvents:z}),[z]);I.useLayoutEffect(()=>{if(Le.current=!1,h){var Be;(Be=Ue.current)==null||Be.render(I.createElement("div",{ref:W,style:lt},I.createElement("div",{ref:J,style:kt},I.createElement("div",{ref:H,className:u,style:o,children:r}))))}else{var ae;(ae=Ue.current)==null||ae.render(I.createElement("div",{ref:H,style:lt,className:u,children:r}))}});const Kt=I.useRef(!0);ji(Be=>{if(Ce.current){j.updateMatrixWorld(),Ce.current.updateWorldMatrix(!0,!1);const ae=h?Q.current:y(Ce.current,j,B);if(h||Math.abs(F.current-j.zoom)>i||Math.abs(Q.current[0]-ae[0])>i||Math.abs(Q.current[1]-ae[1])>i){const dt=Wd(Ce.current,j);let Oe=!1;Ve&&(Array.isArray(m)?Oe=m.map(Ft=>Ft.current):m!=="blending"&&(Oe=[X]));const dn=Kt.current;if(Oe){const Ft=bd(Ce.current,j,ee,Oe);Kt.current=Ft&&!dt}else Kt.current=!dt;dn!==Kt.current&&(x?x(!Kt.current):ce.style.display=Kt.current?"block":"none");const Pn=Math.floor(v[0]/2),Wi=m?Ve?[v[0],Pn]:[Pn-1,0]:v;if(ce.style.zIndex=`${Zd(Ce.current,j,Wi)}`,h){const[Ft,Ar]=[B.width/2,B.height/2],er=j.projectionMatrix.elements[5]*Ar,{isOrthographicCamera:Xt,top:bi,left:Yi,bottom:Zi,right:hn}=j,Qi=Qd(j.matrixWorldInverse),Ki=Xt?`scale(${er})translate(${Io(-(hn+Yi)/2)}px,${Io((bi+Zi)/2)}px)`:`translateZ(${er}px)`;let Ht=Ce.current.matrixWorld;S&&(Ht=j.matrixWorldInverse.clone().transpose().copyPosition(Ht).scale(Ce.current.scale),Ht.elements[3]=Ht.elements[7]=Ht.elements[11]=0,Ht.elements[15]=1),ce.style.width=B.width+"px",ce.style.height=B.height+"px",ce.style.perspective=Xt?"":`${er}px`,W.current&&J.current&&(W.current.style.transform=`${Ki}${Qi}translate(${Ft}px,${Ar}px)`,J.current.style.transform=Kd(Ht,1/((_||10)/400)))}else{const Ft=_===void 0?1:Yd(Ce.current,j)*_;ce.style.transform=`translate3d(${ae[0]}px,${ae[1]}px,0) scale(${Ft})`}Q.current=ae,F.current=j.zoom}}if(!Ve&&oe.current&&!Le.current)if(h){if(W.current){const ae=W.current.children[0];if(ae!=null&&ae.clientWidth&&ae!=null&&ae.clientHeight){const{isOrthographicCamera:dt}=j;if(dt||L)N.scale&&(Array.isArray(N.scale)?N.scale instanceof Bt?oe.current.scale.copy(N.scale.clone().divideScalar(1)):oe.current.scale.set(1/N.scale[0],1/N.scale[1],1/N.scale[2]):oe.current.scale.setScalar(1/N.scale));else{const Oe=(_||10)/400,dn=ae.clientWidth*Oe,Pn=ae.clientHeight*Oe;oe.current.scale.set(dn,Pn,1)}Le.current=!0}}}else{const ae=ce.children[0];if(ae!=null&&ae.clientWidth&&ae!=null&&ae.clientHeight){const dt=1/Ie.factor,Oe=ae.clientWidth*dt,dn=ae.clientHeight*dt;oe.current.scale.set(Oe,dn,1),Le.current=!0}oe.current.lookAt(Be.camera.position)}});const Rn=I.useMemo(()=>({vertexShader:h?void 0:`
|
|
36
|
+
/*
|
|
37
|
+
This shader is from the THREE's SpriteMaterial.
|
|
38
|
+
We need to turn the backing plane into a Sprite
|
|
39
|
+
(make it always face the camera) if "transfrom"
|
|
40
|
+
is false.
|
|
41
|
+
*/
|
|
42
|
+
#include <common>
|
|
43
|
+
|
|
44
|
+
void main() {
|
|
45
|
+
vec2 center = vec2(0., 1.);
|
|
46
|
+
float rotation = 0.0;
|
|
47
|
+
|
|
48
|
+
// This is somewhat arbitrary, but it seems to work well
|
|
49
|
+
// Need to figure out how to derive this dynamically if it even matters
|
|
50
|
+
float size = 0.03;
|
|
51
|
+
|
|
52
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
53
|
+
vec2 scale;
|
|
54
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
55
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
56
|
+
|
|
57
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
58
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
59
|
+
|
|
60
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
61
|
+
vec2 rotatedPosition;
|
|
62
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
63
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
64
|
+
mvPosition.xy += rotatedPosition;
|
|
65
|
+
|
|
66
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
67
|
+
}
|
|
68
|
+
`,fragmentShader:`
|
|
69
|
+
void main() {
|
|
70
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
71
|
+
}
|
|
72
|
+
`}),[h]);return I.createElement("group",Hi({},N,{ref:Ce}),m&&!Ve&&I.createElement("mesh",{castShadow:E,receiveShadow:O,ref:oe},L||I.createElement("planeGeometry",null),A||I.createElement("shaderMaterial",{side:Ur,vertexShader:Rn.vertexShader,fragmentShader:Rn.fragmentShader})))});let wr;function qd(){var r;if(wr!==void 0)return wr;try{let i;const o=document.createElement("canvas");return wr=!!(window.WebGL2RenderingContext&&(i=o.getContext("webgl2"))),i&&((r=i.getExtension("WEBGL_lose_context"))==null||r.loseContext()),wr}catch{return wr=!1}}const Jd=()=>parseInt(Ho.replace(/\D+/g,"")),$d=Jd();/*!
|
|
73
|
+
* camera-controls
|
|
74
|
+
* https://github.com/yomotsu/camera-controls
|
|
75
|
+
* (c) 2017 @yomotsu
|
|
76
|
+
* Released under the MIT License.
|
|
77
|
+
*/const Pe={LEFT:1,RIGHT:2,MIDDLE:4},P=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),bn={NONE:0,IN:1,OUT:-1};function wn(r){return r.isPerspectiveCamera}function cn(r){return r.isOrthographicCamera}const Yn=Math.PI*2,lu=Math.PI/2,Yu=1e-5,Cr=Math.PI/180;function Ct(r,i,o){return Math.max(i,Math.min(o,r))}function Se(r,i=Yu){return Math.abs(r)<i}function _e(r,i,o=Yu){return Se(r-i,o)}function au(r,i){return Math.round(r/i)*i}function Or(r){return isFinite(r)?r:r<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Rr(r){return Math.abs(r)<Number.MAX_VALUE?r:r*(1/0)}function zi(r,i,o,u,c=1/0,d){u=Math.max(1e-4,u);const f=2/u,g=f*d,_=1/(1+g+.48*g*g+.235*g*g*g);let S=r-i;const h=i,m=c*u;S=Ct(S,-m,m),i=r-S;const x=(o.value+f*S)*d;o.value=(o.value-f*x)*_;let E=i+(S+x)*_;return h-r>0==E>h&&(E=h,o.value=(E-h)/d),E}function uu(r,i,o,u,c=1/0,d,f){u=Math.max(1e-4,u);const g=2/u,_=g*d,S=1/(1+_+.48*_*_+.235*_*_*_);let h=i.x,m=i.y,x=i.z,E=r.x-h,O=r.y-m,A=r.z-x;const L=h,v=m,y=x,C=c*u,U=C*C,z=E*E+O*O+A*A;if(z>U){const ce=Math.sqrt(z);E=E/ce*C,O=O/ce*C,A=A/ce*C}h=r.x-E,m=r.y-O,x=r.z-A;const N=(o.x+g*E)*d,H=(o.y+g*O)*d,Y=(o.z+g*A)*d;o.x=(o.x-g*N)*S,o.y=(o.y-g*H)*S,o.z=(o.z-g*Y)*S,f.x=h+(E+N)*S,f.y=m+(O+H)*S,f.z=x+(A+Y)*S;const j=L-r.x,X=v-r.y,B=y-r.z,ee=f.x-L,ge=f.y-v,Ie=f.z-y;return j*ee+X*ge+B*Ie>0&&(f.x=L,f.y=v,f.z=y,o.x=(f.x-L)/d,o.y=(f.y-v)/d,o.z=(f.z-y)/d),f}function So(r,i){i.set(0,0),r.forEach(o=>{i.x+=o.clientX,i.y+=o.clientY}),i.x/=r.length,i.y/=r.length}function To(r,i){return cn(r)?(console.warn(`${i} is not supported in OrthographicCamera`),!0):!1}class eh{constructor(){this._listeners={}}addEventListener(i,o){const u=this._listeners;u[i]===void 0&&(u[i]=[]),u[i].indexOf(o)===-1&&u[i].push(o)}hasEventListener(i,o){const u=this._listeners;return u[i]!==void 0&&u[i].indexOf(o)!==-1}removeEventListener(i,o){const c=this._listeners[i];if(c!==void 0){const d=c.indexOf(o);d!==-1&&c.splice(d,1)}}removeAllEventListeners(i){if(!i){this._listeners={};return}Array.isArray(this._listeners[i])&&(this._listeners[i].length=0)}dispatchEvent(i){const u=this._listeners[i.type];if(u!==void 0){i.target=this;const c=u.slice(0);for(let d=0,f=c.length;d<f;d++)c[d].call(this,i)}}}var xo;const th="2.10.1",Ai=1/8,nh=/Mac/.test((xo=globalThis?.navigator)===null||xo===void 0?void 0:xo.platform);let $,cu,Li,wo,it,re,pe,Zn,Pr,Nt,It,Cn,fu,du,St,Mr,Qn,hu,Co,pu,Oo,Ro,Ni,Po=class Bo extends eh{static install(i){$=i.THREE,cu=Object.freeze(new $.Vector3(0,0,0)),Li=Object.freeze(new $.Vector3(0,1,0)),wo=Object.freeze(new $.Vector3(0,0,1)),it=new $.Vector2,re=new $.Vector3,pe=new $.Vector3,Zn=new $.Vector3,Pr=new $.Vector3,Nt=new $.Vector3,It=new $.Vector3,Cn=new $.Vector3,fu=new $.Vector3,du=new $.Vector3,St=new $.Spherical,Mr=new $.Spherical,Qn=new $.Box3,hu=new $.Box3,Co=new $.Sphere,pu=new $.Quaternion,Oo=new $.Quaternion,Ro=new $.Matrix4,Ni=new $.Raycaster}static get ACTION(){return P}set verticalDragToForward(i){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(i,o){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=P.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=bn.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new $.Vector3,this._focalOffsetVelocity=new $.Vector3,this._zoomVelocity={value:0},this._truckInternal=(v,y,C,U)=>{let z,N;if(wn(this._camera)){const H=re.copy(this._camera.position).sub(this._target),Y=this._camera.getEffectiveFOV()*Cr,j=H.length()*Math.tan(Y*.5);z=this.truckSpeed*v*j/this._elementRect.height,N=this.truckSpeed*y*j/this._elementRect.height}else if(cn(this._camera)){const H=this._camera;z=this.truckSpeed*v*(H.right-H.left)/H.zoom/this._elementRect.width,N=this.truckSpeed*y*(H.top-H.bottom)/H.zoom/this._elementRect.height}else return;U?(C?this.setFocalOffset(this._focalOffsetEnd.x+z,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(z,0,!0),this.forward(-N,!0)):C?this.setFocalOffset(this._focalOffsetEnd.x+z,this._focalOffsetEnd.y+N,this._focalOffsetEnd.z,!0):this.truck(z,N,!0)},this._rotateInternal=(v,y)=>{const C=Yn*this.azimuthRotateSpeed*v/this._elementRect.height,U=Yn*this.polarRotateSpeed*y/this._elementRect.height;this.rotate(C,U,!0)},this._dollyInternal=(v,y,C)=>{const U=Math.pow(.95,-v*this.dollySpeed),z=this._sphericalEnd.radius,N=this._sphericalEnd.radius*U,H=Ct(N,this.minDistance,this.maxDistance),Y=H-N;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(N,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(Y,!0),this._dollyToNoClamp(H,!0)):this._dollyToNoClamp(H,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?N:H)-z,this._dollyControlCoord.set(y,C)),this._lastDollyDirection=Math.sign(-v)},this._zoomInternal=(v,y,C)=>{const U=Math.pow(.95,v*this.dollySpeed),z=this._zoom,N=this._zoom*U;this.zoomTo(N,!0),this.dollyToCursor&&(this._changedZoom+=N-z,this._dollyControlCoord.set(y,C))},typeof $>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=i,this._yAxisUpSpace=new $.Quaternion().setFromUnitVectors(this._camera.up,Li),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=P.NONE,this._target=new $.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new $.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new $.Spherical().setFromVector3(re.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new $.Vector3,new $.Vector3,new $.Vector3,new $.Vector3],this._updateNearPlaneCorners(),this._boundary=new $.Box3(new $.Vector3(-1/0,-1/0,-1/0),new $.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new $.Vector2,this.mouseButtons={left:P.ROTATE,middle:P.DOLLY,right:P.TRUCK,wheel:wn(this._camera)?P.DOLLY:cn(this._camera)?P.ZOOM:P.NONE},this.touches={one:P.TOUCH_ROTATE,two:wn(this._camera)?P.TOUCH_DOLLY_TRUCK:cn(this._camera)?P.TOUCH_ZOOM_TRUCK:P.NONE,three:P.TOUCH_TRUCK};const u=new $.Vector2,c=new $.Vector2,d=new $.Vector2,f=v=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const U=this._domElement.getBoundingClientRect(),z=v.clientX/U.width,N=v.clientY/U.height;if(z<this._interactiveArea.left||z>this._interactiveArea.right||N<this._interactiveArea.top||N>this._interactiveArea.bottom)return}const y=v.pointerType!=="mouse"?null:(v.buttons&Pe.LEFT)===Pe.LEFT?Pe.LEFT:(v.buttons&Pe.MIDDLE)===Pe.MIDDLE?Pe.MIDDLE:(v.buttons&Pe.RIGHT)===Pe.RIGHT?Pe.RIGHT:null;if(y!==null){const U=this._findPointerByMouseButton(y);U&&this._disposePointer(U)}if((v.buttons&Pe.LEFT)===Pe.LEFT&&this._lockedPointer)return;const C={pointerId:v.pointerId,clientX:v.clientX,clientY:v.clientY,deltaX:0,deltaY:0,mouseButton:y};this._activePointers.push(C),this._domElement.ownerDocument.removeEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",_),this._domElement.ownerDocument.addEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",_),this._isDragging=!0,x(v)},g=v=>{v.cancelable&&v.preventDefault();const y=v.pointerId,C=this._lockedPointer||this._findPointerById(y);if(C){if(C.clientX=v.clientX,C.clientY=v.clientY,C.deltaX=v.movementX,C.deltaY=v.movementY,this._state=0,v.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(v.buttons&Pe.LEFT)===Pe.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(v.buttons&Pe.MIDDLE)===Pe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(v.buttons&Pe.RIGHT)===Pe.RIGHT&&(this._state=this._state|this.mouseButtons.right);E()}},_=v=>{const y=this._findPointerById(v.pointerId);if(!(y&&y===this._lockedPointer)){if(y&&this._disposePointer(y),v.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=P.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=P.NONE;O()}};let S=-1;const h=v=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===P.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const N=this._domElement.getBoundingClientRect(),H=v.clientX/N.width,Y=v.clientY/N.height;if(H<this._interactiveArea.left||H>this._interactiveArea.right||Y<this._interactiveArea.top||Y>this._interactiveArea.bottom)return}if(v.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===P.ROTATE||this.mouseButtons.wheel===P.TRUCK){const N=performance.now();S-N<1e3&&this._getClientRect(this._elementRect),S=N}const y=nh?-1:-3,C=v.deltaMode===1||v.ctrlKey?v.deltaY/y:v.deltaY/(y*10),U=this.dollyToCursor?(v.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,z=this.dollyToCursor?(v.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case P.ROTATE:{this._rotateInternal(v.deltaX,v.deltaY),this._isUserControllingRotate=!0;break}case P.TRUCK:{this._truckInternal(v.deltaX,v.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case P.SCREEN_PAN:{this._truckInternal(v.deltaX,v.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case P.OFFSET:{this._truckInternal(v.deltaX,v.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case P.DOLLY:{this._dollyInternal(-C,U,z),this._isUserControllingDolly=!0;break}case P.ZOOM:{this._zoomInternal(-C,U,z),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},m=v=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Bo.ACTION.NONE){const y=v instanceof PointerEvent?v.pointerId:0,C=this._findPointerById(y);C&&this._disposePointer(C),this._domElement.ownerDocument.removeEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",_);return}v.preventDefault()}},x=v=>{if(!this._enabled)return;if(So(this._activePointers,it),this._getClientRect(this._elementRect),u.copy(it),c.copy(it),this._activePointers.length>=2){const C=it.x-this._activePointers[1].clientX,U=it.y-this._activePointers[1].clientY,z=Math.sqrt(C*C+U*U);d.set(0,z);const N=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,H=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;c.set(N,H)}if(this._state=0,!v)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in v&&v.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(v.buttons&Pe.LEFT)===Pe.LEFT&&(this._state=this._state|this.mouseButtons.left),(v.buttons&Pe.MIDDLE)===Pe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(v.buttons&Pe.RIGHT)===Pe.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&P.TRUCK)===P.TRUCK||(this._state&P.SCREEN_PAN)===P.SCREEN_PAN||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_SCREEN_PAN)===P.TOUCH_SCREEN_PAN||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_ZOOM_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&P.DOLLY)===P.DOLLY||(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&P.ZOOM)===P.ZOOM||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_ZOOM_SCREEN_PAN)===P.TOUCH_ZOOM_SCREEN_PAN||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},E=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,So(this._activePointers,it);const y=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,C=y?-y.deltaX:c.x-it.x,U=y?-y.deltaY:c.y-it.y;if(c.copy(it),((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(C,U),this._isUserControllingRotate=!0),(this._state&P.DOLLY)===P.DOLLY||(this._state&P.ZOOM)===P.ZOOM){const z=this.dollyToCursor?(u.x-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(u.y-this._elementRect.y)/this._elementRect.height*-2+1:0,H=this.dollyDragInverted?-1:1;(this._state&P.DOLLY)===P.DOLLY?(this._dollyInternal(H*U*Ai,z,N),this._isUserControllingDolly=!0):(this._zoomInternal(H*U*Ai,z,N),this._isUserControllingZoom=!0)}if((this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_DOLLY_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN||(this._state&P.TOUCH_ZOOM_SCREEN_PAN)===P.TOUCH_ZOOM_SCREEN_PAN||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE){const z=it.x-this._activePointers[1].clientX,N=it.y-this._activePointers[1].clientY,H=Math.sqrt(z*z+N*N),Y=d.y-H;d.set(0,H);const j=this.dollyToCursor?(c.x-this._elementRect.x)/this._elementRect.width*2-1:0,X=this.dollyToCursor?(c.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET?(this._dollyInternal(Y*Ai,j,X),this._isUserControllingDolly=!0):(this._zoomInternal(Y*Ai,j,X),this._isUserControllingZoom=!0)}((this._state&P.TRUCK)===P.TRUCK||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(C,U,!1,!1),this._isUserControllingTruck=!0),((this._state&P.SCREEN_PAN)===P.SCREEN_PAN||(this._state&P.TOUCH_SCREEN_PAN)===P.TOUCH_SCREEN_PAN||(this._state&P.TOUCH_DOLLY_SCREEN_PAN)===P.TOUCH_DOLLY_SCREEN_PAN||(this._state&P.TOUCH_ZOOM_SCREEN_PAN)===P.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(C,U,!1,!0),this._isUserControllingTruck=!0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(C,U,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},O=()=>{So(this._activePointers,it),c.copy(it),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",_),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",_),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",A),this._domElement.ownerDocument.addEventListener("pointerlockerror",L),this._domElement.ownerDocument.addEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",_),x())},this.unlockPointer=()=>{var v,y,C;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(v=this._domElement)===null||v===void 0||v.ownerDocument.exitPointerLock(),(y=this._domElement)===null||y===void 0||y.ownerDocument.removeEventListener("pointerlockchange",A),(C=this._domElement)===null||C===void 0||C.ownerDocument.removeEventListener("pointerlockerror",L),this.cancel()};const A=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},L=()=>{this.unlockPointer()};this._addAllEventListeners=v=>{this._domElement=v,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",f),this._domElement.addEventListener("pointercancel",_),this._domElement.addEventListener("wheel",h,{passive:!1}),this._domElement.addEventListener("contextmenu",m)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",f),this._domElement.removeEventListener("pointercancel",_),this._domElement.removeEventListener("wheel",h,{passive:!1}),this._domElement.removeEventListener("contextmenu",m),this._domElement.ownerDocument.removeEventListener("pointermove",g,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",_),this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",L))},this.cancel=()=>{this._state!==P.NONE&&(this._state=P.NONE,this._activePointers.length=0,O())},o&&this.connect(o),this.update(0)}get camera(){return this._camera}set camera(i){this._camera=i,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(i){this._enabled=i,this._domElement&&(i?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(i){this._spherical.radius===i&&this._sphericalEnd.radius===i||(this._spherical.radius=i,this._sphericalEnd.radius=i,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(i){this._spherical.theta===i&&this._sphericalEnd.theta===i||(this._spherical.theta=i,this._sphericalEnd.theta=i,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(i){this._spherical.phi===i&&this._sphericalEnd.phi===i||(this._spherical.phi=i,this._sphericalEnd.phi=i,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(i){this._boundaryEnclosesCamera=i,this._needsUpdate=!0}set interactiveArea(i){this._interactiveArea.width=Ct(i.width,0,1),this._interactiveArea.height=Ct(i.height,0,1),this._interactiveArea.x=Ct(i.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Ct(i.y,0,1-this._interactiveArea.height)}addEventListener(i,o){super.addEventListener(i,o)}removeEventListener(i,o){super.removeEventListener(i,o)}rotate(i,o,u=!1){return this.rotateTo(this._sphericalEnd.theta+i,this._sphericalEnd.phi+o,u)}rotateAzimuthTo(i,o=!1){return this.rotateTo(i,this._sphericalEnd.phi,o)}rotatePolarTo(i,o=!1){return this.rotateTo(this._sphericalEnd.theta,i,o)}rotateTo(i,o,u=!1){this._isUserControllingRotate=!1;const c=Ct(i,this.minAzimuthAngle,this.maxAzimuthAngle),d=Ct(o,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=c,this._sphericalEnd.phi=d,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,u||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const f=!u||_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(f)}dolly(i,o=!1){return this.dollyTo(this._sphericalEnd.radius-i,o)}dollyTo(i,o=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=bn.NONE,this._changedDolly=0,this._dollyToNoClamp(Ct(i,this.minDistance,this.maxDistance),o)}_dollyToNoClamp(i,o=!1){const u=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const f=this._collisionTest(),g=_e(f,this._spherical.radius);if(!(u>i)&&g)return Promise.resolve();this._sphericalEnd.radius=Math.min(i,f)}else this._sphericalEnd.radius=i;this._needsUpdate=!0,o||(this._spherical.radius=this._sphericalEnd.radius);const d=!o||_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}dollyInFixed(i,o=!1){this._targetEnd.add(this._getCameraDirection(Pr).multiplyScalar(i)),o||this._target.copy(this._targetEnd);const u=!o||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(u)}zoom(i,o=!1){return this.zoomTo(this._zoomEnd+i,o)}zoomTo(i,o=!1){this._isUserControllingZoom=!1,this._zoomEnd=Ct(i,this.minZoom,this.maxZoom),this._needsUpdate=!0,o||(this._zoom=this._zoomEnd);const u=!o||_e(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(u)}pan(i,o,u=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(i,o,u)}truck(i,o,u=!1){this._camera.updateMatrix(),Nt.setFromMatrixColumn(this._camera.matrix,0),It.setFromMatrixColumn(this._camera.matrix,1),Nt.multiplyScalar(i),It.multiplyScalar(-o);const c=re.copy(Nt).add(It),d=pe.copy(this._targetEnd).add(c);return this.moveTo(d.x,d.y,d.z,u)}forward(i,o=!1){re.setFromMatrixColumn(this._camera.matrix,0),re.crossVectors(this._camera.up,re),re.multiplyScalar(i);const u=pe.copy(this._targetEnd).add(re);return this.moveTo(u.x,u.y,u.z,o)}elevate(i,o=!1){return re.copy(this._camera.up).multiplyScalar(i),this.moveTo(this._targetEnd.x+re.x,this._targetEnd.y+re.y,this._targetEnd.z+re.z,o)}moveTo(i,o,u,c=!1){this._isUserControllingTruck=!1;const d=re.set(i,o,u).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,d,this.boundaryFriction),this._needsUpdate=!0,c||this._target.copy(this._targetEnd);const f=!c||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(f)}lookInDirectionOf(i,o,u,c=!1){const g=re.set(i,o,u).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(g.x,g.y,g.z,c)}fitToBox(i,o,{cover:u=!1,paddingLeft:c=0,paddingRight:d=0,paddingBottom:f=0,paddingTop:g=0}={}){const _=[],S=i.isBox3?Qn.copy(i):Qn.setFromObject(i);S.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=au(this._sphericalEnd.theta,lu),m=au(this._sphericalEnd.phi,lu);_.push(this.rotateTo(h,m,o));const x=re.setFromSpherical(this._sphericalEnd).normalize(),E=pu.setFromUnitVectors(x,wo),O=_e(Math.abs(x.y),1);O&&E.multiply(Oo.setFromAxisAngle(Li,h)),E.multiply(this._yAxisUpSpaceInverse);const A=hu.makeEmpty();pe.copy(S.min).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.min).setX(S.max.x).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.min).setY(S.max.y).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.max).setZ(S.min.z).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.min).setZ(S.max.z).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.max).setY(S.min.y).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.max).setX(S.min.x).applyQuaternion(E),A.expandByPoint(pe),pe.copy(S.max).applyQuaternion(E),A.expandByPoint(pe),A.min.x-=c,A.min.y-=f,A.max.x+=d,A.max.y+=g,E.setFromUnitVectors(wo,x),O&&E.premultiply(Oo.invert()),E.premultiply(this._yAxisUpSpace);const L=A.getSize(re),v=A.getCenter(pe).applyQuaternion(E);if(wn(this._camera)){const y=this.getDistanceToFitBox(L.x,L.y,L.z,u);_.push(this.moveTo(v.x,v.y,v.z,o)),_.push(this.dollyTo(y,o)),_.push(this.setFocalOffset(0,0,0,o))}else if(cn(this._camera)){const y=this._camera,C=y.right-y.left,U=y.top-y.bottom,z=u?Math.max(C/L.x,U/L.y):Math.min(C/L.x,U/L.y);_.push(this.moveTo(v.x,v.y,v.z,o)),_.push(this.zoomTo(z,o)),_.push(this.setFocalOffset(0,0,0,o))}return Promise.all(_)}fitToSphere(i,o){const u=[],d="isObject3D"in i?Bo.createBoundingSphere(i,Co):Co.copy(i);if(u.push(this.moveTo(d.center.x,d.center.y,d.center.z,o)),wn(this._camera)){const f=this.getDistanceToFitSphere(d.radius);u.push(this.dollyTo(f,o))}else if(cn(this._camera)){const f=this._camera.right-this._camera.left,g=this._camera.top-this._camera.bottom,_=2*d.radius,S=Math.min(f/_,g/_);u.push(this.zoomTo(S,o))}return u.push(this.setFocalOffset(0,0,0,o)),Promise.all(u)}setLookAt(i,o,u,c,d,f,g=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=bn.NONE,this._changedDolly=0;const _=pe.set(c,d,f),S=re.set(i,o,u);this._targetEnd.copy(_),this._sphericalEnd.setFromVector3(S.sub(_).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,g||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!g||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold)&&_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(i,o,u,c,d,f,g,_,S,h,m,x,E,O=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=bn.NONE,this._changedDolly=0;const A=re.set(c,d,f),L=pe.set(i,o,u);St.setFromVector3(L.sub(A).applyQuaternion(this._yAxisUpSpace));const v=Zn.set(h,m,x),y=pe.set(g,_,S);Mr.setFromVector3(y.sub(v).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(A.lerp(v,E));const C=Mr.theta-St.theta,U=Mr.phi-St.phi,z=Mr.radius-St.radius;this._sphericalEnd.set(St.radius+z*E,St.phi+U*E,St.theta+C*E),this.normalizeRotations(),this._needsUpdate=!0,O||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const N=!O||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold)&&_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(N)}setPosition(i,o,u,c=!1){return this.setLookAt(i,o,u,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,c)}setTarget(i,o,u,c=!1){const d=this.getPosition(re),f=this.setLookAt(d.x,d.y,d.z,i,o,u,c);return this._sphericalEnd.phi=Ct(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),f}setFocalOffset(i,o,u,c=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(i,o,u),this._needsUpdate=!0,c||this._focalOffset.copy(this._focalOffsetEnd);const d=!c||_e(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&_e(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&_e(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(d)}setOrbitPoint(i,o,u){this._camera.updateMatrixWorld(),Nt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),It.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Cn.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const c=re.set(i,o,u),d=c.distanceTo(this._camera.position),f=c.sub(this._camera.position);Nt.multiplyScalar(f.x),It.multiplyScalar(f.y),Cn.multiplyScalar(f.z),re.copy(Nt).add(It).add(Cn),re.z=re.z+d,this.dollyTo(d,!1),this.setFocalOffset(-re.x,re.y,-re.z,!1),this.moveTo(i,o,u,!1)}setBoundary(i){if(!i){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(i),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(i,o,u,c){if(i===null){this._viewport=null;return}this._viewport=this._viewport||new $.Vector4,typeof i=="number"?this._viewport.set(i,o,u,c):this._viewport.copy(i)}getDistanceToFitBox(i,o,u,c=!1){if(To(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const d=i/o,f=this._camera.getEffectiveFOV()*Cr,g=this._camera.aspect;return((c?d>g:d<g)?o:i/g)*.5/Math.tan(f*.5)+u*.5}getDistanceToFitSphere(i){if(To(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const o=this._camera.getEffectiveFOV()*Cr,u=Math.atan(Math.tan(o*.5)*this._camera.aspect)*2,c=1<this._camera.aspect?o:u;return i/Math.sin(c*.5)}getTarget(i,o=!0){return(i&&i.isVector3?i:new $.Vector3).copy(o?this._targetEnd:this._target)}getPosition(i,o=!0){return(i&&i.isVector3?i:new $.Vector3).setFromSpherical(o?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(o?this._targetEnd:this._target)}getSpherical(i,o=!0){return(i||new $.Spherical).copy(o?this._sphericalEnd:this._spherical)}getFocalOffset(i,o=!0){return(i&&i.isVector3?i:new $.Vector3).copy(o?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Yn,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Yn),this._spherical.theta+=Yn*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Yn)}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(i=!1){if(!_e(this._camera.up.x,this._cameraUp0.x)||!_e(this._camera.up.y,this._cameraUp0.y)||!_e(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const u=this.getPosition(re);this.updateCameraUp(),this.setPosition(u.x,u.y,u.z)}const o=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,i),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,i),this.zoomTo(this._zoom0,i)];return Promise.all(o)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Li),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const i=re.subVectors(this._target,this._camera.position).normalize(),o=pe.crossVectors(i,this._camera.up);this._camera.up.crossVectors(o,i).normalize(),this._camera.updateMatrixWorld();const u=this.getPosition(re);this.updateCameraUp(),this.setPosition(u.x,u.y,u.z)}update(i){const o=this._sphericalEnd.theta-this._spherical.theta,u=this._sphericalEnd.phi-this._spherical.phi,c=this._sphericalEnd.radius-this._spherical.radius,d=fu.subVectors(this._targetEnd,this._target),f=du.subVectors(this._focalOffsetEnd,this._focalOffset),g=this._zoomEnd-this._zoom;if(Se(o))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const m=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=zi(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,m,1/0,i),this._needsUpdate=!0}if(Se(u))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const m=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=zi(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,m,1/0,i),this._needsUpdate=!0}if(Se(c))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const m=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=zi(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,m,this.maxSpeed,i),this._needsUpdate=!0}if(Se(d.x)&&Se(d.y)&&Se(d.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const m=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;uu(this._target,this._targetEnd,this._targetVelocity,m,this.maxSpeed,i,this._target),this._needsUpdate=!0}if(Se(f.x)&&Se(f.y)&&Se(f.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const m=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;uu(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,m,this.maxSpeed,i,this._focalOffset),this._needsUpdate=!0}if(Se(g))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const m=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=zi(this._zoom,this._zoomEnd,this._zoomVelocity,m,1/0,i)}if(this.dollyToCursor){if(wn(this._camera)&&this._changedDolly!==0){const m=this._spherical.radius-this._lastDistance,x=this._camera,E=this._getCameraDirection(Pr),O=re.copy(E).cross(x.up).normalize();O.lengthSq()===0&&(O.x=1);const A=pe.crossVectors(O,E),L=this._sphericalEnd.radius*Math.tan(x.getEffectiveFOV()*Cr*.5),y=(this._sphericalEnd.radius-m-this._sphericalEnd.radius)/this._sphericalEnd.radius,C=Zn.copy(this._targetEnd).add(O.multiplyScalar(this._dollyControlCoord.x*L*x.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y*L)),U=re.copy(this._targetEnd).lerp(C,y),z=this._lastDollyDirection===bn.IN&&this._spherical.radius<=this.minDistance,N=this._lastDollyDirection===bn.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(z||N)){this._sphericalEnd.radius-=m,this._spherical.radius-=m;const Y=pe.copy(E).multiplyScalar(-m);U.add(Y)}this._boundary.clampPoint(U,U);const H=pe.subVectors(U,this._targetEnd);this._targetEnd.copy(U),this._target.add(H),this._changedDolly-=m,Se(this._changedDolly)&&(this._changedDolly=0)}else if(cn(this._camera)&&this._changedZoom!==0){const m=this._zoom-this._lastZoom,x=this._camera,E=re.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(x.near+x.far)/(x.near-x.far)).unproject(x),O=pe.set(0,0,-1).applyQuaternion(x.quaternion),A=Zn.copy(E).add(O.multiplyScalar(-E.dot(x.up))),v=-(this._zoom-m-this._zoom)/this._zoom,y=this._getCameraDirection(Pr),C=this._targetEnd.dot(y),U=re.copy(this._targetEnd).lerp(A,v),z=U.dot(y),N=y.multiplyScalar(z-C);U.sub(N),this._boundary.clampPoint(U,U);const H=pe.subVectors(U,this._targetEnd);this._targetEnd.copy(U),this._target.add(H),this._changedZoom-=m,Se(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const _=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,_),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Se(this._focalOffset.x)||!Se(this._focalOffset.y)||!Se(this._focalOffset.z))&&(Nt.setFromMatrixColumn(this._camera.matrix,0),It.setFromMatrixColumn(this._camera.matrix,1),Cn.setFromMatrixColumn(this._camera.matrix,2),Nt.multiplyScalar(this._focalOffset.x),It.multiplyScalar(-this._focalOffset.y),Cn.multiplyScalar(this._focalOffset.z),re.copy(Nt).add(It).add(Cn),this._camera.position.add(re),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),re.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),Se(o,this.restThreshold)&&Se(u,this.restThreshold)&&Se(c,this.restThreshold)&&Se(d.x,this.restThreshold)&&Se(d.y,this.restThreshold)&&Se(d.z,this.restThreshold)&&Se(f.x,this.restThreshold)&&Se(f.y,this.restThreshold)&&Se(f.z,this.restThreshold)&&Se(g,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Or(this.maxDistance),minZoom:this.minZoom,maxZoom:Or(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Or(this.maxPolarAngle),minAzimuthAngle:Or(this.minAzimuthAngle),maxAzimuthAngle:Or(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:re.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(i,o=!1){const u=JSON.parse(i);this.enabled=u.enabled,this.minDistance=u.minDistance,this.maxDistance=Rr(u.maxDistance),this.minZoom=u.minZoom,this.maxZoom=Rr(u.maxZoom),this.minPolarAngle=u.minPolarAngle,this.maxPolarAngle=Rr(u.maxPolarAngle),this.minAzimuthAngle=Rr(u.minAzimuthAngle),this.maxAzimuthAngle=Rr(u.maxAzimuthAngle),this.smoothTime=u.smoothTime,this.draggingSmoothTime=u.draggingSmoothTime,this.dollySpeed=u.dollySpeed,this.truckSpeed=u.truckSpeed,this.dollyToCursor=u.dollyToCursor,this._target0.fromArray(u.target0),this._position0.fromArray(u.position0),this._zoom0=u.zoom0,this._focalOffset0.fromArray(u.focalOffset0),this.moveTo(u.target[0],u.target[1],u.target[2],o),St.setFromVector3(re.fromArray(u.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(St.theta,St.phi,o),this.dollyTo(St.radius,o),this.zoomTo(u.zoom,o),this.setFocalOffset(u.focalOffset[0],u.focalOffset[1],u.focalOffset[2],o),this._needsUpdate=!0}connect(i){if(this._domElement){console.warn("camera-controls is already connected.");return}i.setAttribute("data-camera-controls-version",th),this._addAllEventListeners(i),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(i){return i.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(i){return this._getTargetDirection(i).negate()}_findPointerById(i){return this._activePointers.find(o=>o.pointerId===i)}_findPointerByMouseButton(i){return this._activePointers.find(o=>o.mouseButton===i)}_disposePointer(i){this._activePointers.splice(this._activePointers.indexOf(i),1)}_encloseToBoundary(i,o,u){const c=o.lengthSq();if(c===0)return i;const d=pe.copy(o).add(i),g=this._boundary.clampPoint(d,Zn).sub(d),_=g.lengthSq();if(_===0)return i.add(o);if(_===c)return i;if(u===0)return i.add(o).add(g);{const S=1+u*_/o.dot(g);return i.add(pe.copy(o).multiplyScalar(S)).add(g.multiplyScalar(1-u))}}_updateNearPlaneCorners(){if(wn(this._camera)){const i=this._camera,o=i.near,u=i.getEffectiveFOV()*Cr,c=Math.tan(u*.5)*o,d=c*i.aspect;this._nearPlaneCorners[0].set(-d,-c,0),this._nearPlaneCorners[1].set(d,-c,0),this._nearPlaneCorners[2].set(d,c,0),this._nearPlaneCorners[3].set(-d,c,0)}else if(cn(this._camera)){const i=this._camera,o=1/i.zoom,u=i.left*o,c=i.right*o,d=i.top*o,f=i.bottom*o;this._nearPlaneCorners[0].set(u,d,0),this._nearPlaneCorners[1].set(c,d,0),this._nearPlaneCorners[2].set(c,f,0),this._nearPlaneCorners[3].set(u,f,0)}}_collisionTest(){let i=1/0;if(!(this.colliderMeshes.length>=1)||To(this._camera,"_collisionTest"))return i;const u=this._getTargetDirection(Pr);Ro.lookAt(cu,u,this._camera.up);for(let c=0;c<4;c++){const d=pe.copy(this._nearPlaneCorners[c]);d.applyMatrix4(Ro);const f=Zn.addVectors(this._target,d);Ni.set(f,u),Ni.far=this._spherical.radius+1;const g=Ni.intersectObjects(this.colliderMeshes);g.length!==0&&g[0].distance<i&&(i=g[0].distance)}return i}_getClientRect(i){if(!this._domElement)return;const o=this._domElement.getBoundingClientRect();return i.x=o.left,i.y=o.top,this._viewport?(i.x+=this._viewport.x,i.y+=o.height-this._viewport.w-this._viewport.y,i.width=this._viewport.z,i.height=this._viewport.w):(i.width=o.width,i.height=o.height),i}_createOnRestPromise(i){return i?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(o=>{const u=()=>{this.removeEventListener("rest",u),o()};this.addEventListener("rest",u)}))}_addAllEventListeners(i){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(i){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(i){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(i,o=new $.Sphere){const u=o,c=u.center;Qn.makeEmpty(),i.traverseVisible(f=>{f.isMesh&&Qn.expandByObject(f)}),Qn.getCenter(c);let d=0;return i.traverseVisible(f=>{if(!f.isMesh)return;const g=f;if(!g.geometry)return;const _=g.geometry.clone();_.applyMatrix4(g.matrixWorld);const h=_.attributes.position;for(let m=0,x=h.count;m<x;m++)re.fromBufferAttribute(h,m),d=Math.max(d,c.distanceToSquared(re))}),u.radius=Math.sqrt(d),u}};const Pp=I.forwardRef((r,i)=>{I.useMemo(()=>{const z={Box3:Ff,MathUtils:{clamp:kf.clamp},Matrix4:Bf,Quaternion:If,Raycaster:Eu,Sphere:Nf,Spherical:Tu,Vector2:Ge,Vector3:Bt,Vector4:Ao};Po.install({THREE:z}),Wo({CameraControlsImpl:Po})},[]);const{camera:o,domElement:u,makeDefault:c,onStart:d,onEnd:f,onChange:g,regress:_,...S}=r,h=Ot(z=>z.camera),m=Ot(z=>z.gl),x=Ot(z=>z.invalidate),E=Ot(z=>z.events),O=Ot(z=>z.setEvents),A=Ot(z=>z.set),L=Ot(z=>z.get),v=Ot(z=>z.performance),y=o||h,C=u||E.connected||m.domElement,U=I.useMemo(()=>new Po(y),[y]);return ji((z,N)=>{U.enabled&&U.update(N)},-1),I.useEffect(()=>(U.connect(C),()=>void U.disconnect()),[C,U]),I.useEffect(()=>{const z=Y=>{x(),_&&v.regress(),g&&g(Y)},N=Y=>{d&&d(Y)},H=Y=>{f&&f(Y)};return U.addEventListener("update",z),U.addEventListener("controlstart",N),U.addEventListener("controlend",H),U.addEventListener("control",z),U.addEventListener("transitionstart",z),U.addEventListener("wake",z),()=>{U.removeEventListener("update",z),U.removeEventListener("controlstart",N),U.removeEventListener("controlend",H),U.removeEventListener("control",z),U.removeEventListener("transitionstart",z),U.removeEventListener("wake",z)}},[U,d,f,x,O,_,g]),I.useEffect(()=>{if(c){const z=L().controls;return A({controls:U}),()=>A({controls:z})}},[c,U]),I.createElement("primitive",Hi({ref:i,object:U},S))});class rh extends Qt{constructor(){super({uniforms:{time:{value:0},fade:{value:1}},vertexShader:`
|
|
78
|
+
uniform float time;
|
|
79
|
+
attribute float size;
|
|
80
|
+
varying vec3 vColor;
|
|
81
|
+
void main() {
|
|
82
|
+
vColor = color;
|
|
83
|
+
vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
|
|
84
|
+
gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
|
|
85
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
86
|
+
}`,fragmentShader:`
|
|
87
|
+
uniform sampler2D pointTexture;
|
|
88
|
+
uniform float fade;
|
|
89
|
+
varying vec3 vColor;
|
|
90
|
+
void main() {
|
|
91
|
+
float opacity = 1.0;
|
|
92
|
+
if (fade == 1.0) {
|
|
93
|
+
float d = distance(gl_PointCoord, vec2(0.5, 0.5));
|
|
94
|
+
opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
|
|
95
|
+
}
|
|
96
|
+
gl_FragColor = vec4(vColor, opacity);
|
|
97
|
+
|
|
98
|
+
#include <tonemapping_fragment>
|
|
99
|
+
#include <${$d>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
100
|
+
}`})}}const ih=r=>new Bt().setFromSpherical(new Tu(r,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)),Mp=I.forwardRef(({radius:r=100,depth:i=50,count:o=5e3,saturation:u=0,factor:c=4,fade:d=!1,speed:f=1},g)=>{const _=I.useRef(),[S,h,m]=I.useMemo(()=>{const E=[],O=[],A=Array.from({length:o},()=>(.5+.5*Math.random())*c),L=new Go;let v=r+i;const y=i/o;for(let C=0;C<o;C++)v-=y*Math.random(),E.push(...ih(v).toArray()),L.setHSL(C/o,u,.9),O.push(L.r,L.g,L.b);return[new Float32Array(E),new Float32Array(O),new Float32Array(A)]},[o,i,c,r,u]);ji(E=>_.current&&(_.current.uniforms.time.value=E.clock.elapsedTime*f));const[x]=I.useState(()=>new rh);return I.createElement("points",{ref:g},I.createElement("bufferGeometry",null,I.createElement("bufferAttribute",{attach:"attributes-position",args:[S,3]}),I.createElement("bufferAttribute",{attach:"attributes-color",args:[h,3]}),I.createElement("bufferAttribute",{attach:"attributes-size",args:[m,1]})),I.createElement("primitive",{ref:_,object:x,attach:"material",blending:Hf,"uniforms-fade-value":d,depthWrite:!1,transparent:!0,vertexColors:!0}))});/**
|
|
101
|
+
* postprocessing v6.39.1 build Fri Apr 17 2026
|
|
102
|
+
* https://github.com/pmndrs/postprocessing
|
|
103
|
+
* Copyright 2015-2026 Raoul van Rüschen
|
|
104
|
+
* @license Zlib
|
|
105
|
+
*/var sh=(()=>{const r=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),i=new Float32Array([0,0,2,0,0,2]),o=new Qf;return o.setAttribute("position",new Ia(r,3)),o.setAttribute("uv",new Ia(i,2)),o})(),ot=class ko{static get fullscreenGeometry(){return sh}constructor(i="Pass",o=new zo,u=new Gi){this.name=i,this.renderer=null,this.scene=o,this.camera=u,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthBlit=!1,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(i){if(this.rtt===i){const o=this.fullscreenMaterial;o!==null&&(o.needsUpdate=!0),this.rtt=!i}}set mainScene(i){}set mainCamera(i){}setRenderer(i){this.renderer=i}isEnabled(){return this.enabled}setEnabled(i){this.enabled=i}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(i){let o=this.screen;o!==null?o.material=i:(o=new bf(ko.fullscreenGeometry,i),o.frustumCulled=!1,this.scene===null&&(this.scene=new zo),this.scene.add(o),this.screen=o)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(i){this.fullscreenMaterial=i}getDepthTexture(){return null}setDepthTexture(i,o=$n){}render(i,o,u,c,d){throw new Error("Render method not implemented!")}setSize(i,o){}initialize(i,o,u){}dispose(){for(const i of Object.keys(this)){const o=this[i];(o instanceof Rt||o instanceof Ou||o instanceof Ru||o instanceof ko)&&this[i].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},oh=class extends ot{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(r,i,o,u,c){const d=r.state.buffers.stencil;d.setLocked(!1),d.setTest(!1)}},lh=`#ifdef COLOR_WRITE
|
|
106
|
+
#include <common>
|
|
107
|
+
#include <dithering_pars_fragment>
|
|
108
|
+
#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
109
|
+
uniform mediump sampler2D inputBuffer;
|
|
110
|
+
#else
|
|
111
|
+
uniform lowp sampler2D inputBuffer;
|
|
112
|
+
#endif
|
|
113
|
+
#endif
|
|
114
|
+
#ifdef DEPTH_WRITE
|
|
115
|
+
#include <packing>
|
|
116
|
+
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
117
|
+
uniform highp sampler2D depthBuffer;
|
|
118
|
+
#else
|
|
119
|
+
uniform mediump sampler2D depthBuffer;
|
|
120
|
+
#endif
|
|
121
|
+
float readDepth(const in vec2 uv){
|
|
122
|
+
#if DEPTH_PACKING == 3201
|
|
123
|
+
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
|
|
124
|
+
#else
|
|
125
|
+
return texture2D(depthBuffer,uv).r;
|
|
126
|
+
#endif
|
|
127
|
+
}
|
|
128
|
+
#endif
|
|
129
|
+
#ifdef USE_WEIGHTS
|
|
130
|
+
uniform vec4 channelWeights;
|
|
131
|
+
#endif
|
|
132
|
+
uniform float opacity;varying vec2 vUv;void main(){
|
|
133
|
+
#ifdef COLOR_WRITE
|
|
134
|
+
vec4 texel=texture2D(inputBuffer,vUv);
|
|
135
|
+
#ifdef USE_WEIGHTS
|
|
136
|
+
texel*=channelWeights;
|
|
137
|
+
#endif
|
|
138
|
+
gl_FragColor=opacity*texel;
|
|
139
|
+
#ifdef COLOR_SPACE_CONVERSION
|
|
140
|
+
#include <colorspace_fragment>
|
|
141
|
+
#endif
|
|
142
|
+
#include <dithering_fragment>
|
|
143
|
+
#else
|
|
144
|
+
gl_FragColor=vec4(0.0);
|
|
145
|
+
#endif
|
|
146
|
+
#ifdef DEPTH_WRITE
|
|
147
|
+
gl_FragDepth=readDepth(vUv);
|
|
148
|
+
#endif
|
|
149
|
+
}`,Zu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Qu=class extends Qt{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new ve(null),depthBuffer:new ve(null),channelWeights:new ve(null),opacity:new ve(1)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:lh,vertexShader:Zu}),this.depthFunc=Zf}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(r){const i=r!==null;this.colorWrite!==i&&(i?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=i,this.needsUpdate=!0),this.uniforms.inputBuffer.value=r}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(r){const i=r!==null;this.depthWrite!==i&&(i?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=i,this.depthWrite=i,this.needsUpdate=!0),this.uniforms.depthBuffer.value=r}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return this.defines.COLOR_SPACE_CONVERSION!==void 0}set colorSpaceConversion(r){this.colorSpaceConversion!==r&&(r?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(r){r!==null?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=r):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(r){this.uniforms.inputBuffer.value=r}getOpacity(r){return this.uniforms.opacity.value}setOpacity(r){this.uniforms.opacity.value=r}},ah=class extends ot{constructor(r,i=!0){super("CopyPass"),this.fullscreenMaterial=new Qu,this.needsSwap=!1,this.renderTarget=r,r===void 0&&(this.renderTarget=new Rt(1,1,{minFilter:Bi,magFilter:Bi,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=i}get resize(){return this.autoResize}set resize(r){this.autoResize=r}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(r){this.autoResize=r}render(r,i,o,u,c){this.fullscreenMaterial.inputBuffer=i.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,i){this.autoResize&&this.renderTarget.setSize(r,i)}initialize(r,i,o){o!==void 0&&(this.renderTarget.texture.type=o,o!==fn?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":r!==null&&r.outputColorSpace===Ke&&(this.renderTarget.texture.colorSpace=Ke))}},mu=new Go,Ku=class extends ot{constructor(r=!0,i=!0,o=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=r,this.depth=i,this.stencil=o,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(r,i,o){this.color=r,this.depth=i,this.stencil=o}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(r){this.overrideClearColor=r}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(r){this.overrideClearAlpha=r}render(r,i,o,u,c){const d=this.overrideClearColor,f=this.overrideClearAlpha,g=r.getClearAlpha(),_=d!==null,S=f>=0;_?(r.getClearColor(mu),r.setClearColor(d,S?f:g)):S&&r.setClearAlpha(f),r.setRenderTarget(this.renderToScreen?null:i),r.clear(this.color,this.depth,this.stencil),_?r.setClearColor(mu,g):S&&r.setClearAlpha(g)}},uh=class extends ot{constructor(r,i){super("MaskPass",r,i),this.needsSwap=!1,this.clearPass=new Ku(!1,!1,!0),this.inverse=!1}set mainScene(r){this.scene=r}set mainCamera(r){this.camera=r}get inverted(){return this.inverse}set inverted(r){this.inverse=r}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(r){this.inverted=r}render(r,i,o,u,c){const d=r.getContext(),f=r.state.buffers,g=this.scene,_=this.camera,S=this.clearPass,h=this.inverted?0:1,m=1-h;f.color.setMask(!1),f.depth.setMask(!1),f.color.setLocked(!0),f.depth.setLocked(!0),f.stencil.setTest(!0),f.stencil.setOp(d.REPLACE,d.REPLACE,d.REPLACE),f.stencil.setFunc(d.ALWAYS,h,4294967295),f.stencil.setClear(m),f.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?S.render(r,null):(S.render(r,i),S.render(r,o))),this.renderToScreen?(r.setRenderTarget(null),r.render(g,_)):(r.setRenderTarget(i),r.render(g,_),r.setRenderTarget(o),r.render(g,_)),f.color.setLocked(!1),f.depth.setLocked(!1),f.stencil.setLocked(!1),f.stencil.setFunc(d.EQUAL,1,4294967295),f.stencil.setOp(d.KEEP,d.KEEP,d.KEEP),f.stencil.setLocked(!0)}},Mo=1/1e3,ch=1e3,fh=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(r){typeof document<"u"&&document.hidden!==void 0&&(r?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=r)}get delta(){return this._delta*Mo}get fixedDelta(){return this._fixedDelta*Mo}set fixedDelta(r){this._fixedDelta=r*ch}get elapsed(){return this._elapsed*Mo}update(r){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(r!==void 0?r:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(r){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},dh=class{constructor(i=null,{depthBuffer:o=!0,stencilBuffer:u=!1,multisampling:c=0,frameBufferType:d}={}){this.renderer=null,this.inputBuffer=this.createBuffer(o,u,d,c),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new ah,this.depthTexture=null,this.depthRenderTarget=null,this.passes=[],this.timer=new fh,this.autoRenderToScreen=!0,this.setRenderer(i)}get multisampling(){return this.inputBuffer.samples}set multisampling(i){const o=this.inputBuffer,u=this.multisampling;u>0&&i>0?(this.inputBuffer.samples=i,this.outputBuffer.samples=i,this.inputBuffer.dispose(),this.outputBuffer.dispose()):u!==i&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(o.depthBuffer,o.stencilBuffer,o.texture.type,i),this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(i){if(this.renderer=i,i!==null){const o=i.getSize(new Ge),u=i.getContext().getContextAttributes().alpha,c=this.inputBuffer.texture.type;c===fn&&i.outputColorSpace===Ke&&(this.inputBuffer.texture.colorSpace=Ke,this.outputBuffer.texture.colorSpace=Ke,this.inputBuffer.dispose(),this.outputBuffer.dispose()),i.autoClear=!1,this.setSize(o.width,o.height);for(const d of this.passes)d.initialize(i,u,c)}}replaceRenderer(i,o=!0){const u=this.renderer,c=u.domElement.parentNode;return this.setRenderer(i),o&&c!==null&&(c.removeChild(u.domElement),c.appendChild(i.domElement)),u}createDepthTexture(){const i=this.inputBuffer,o=new Gf;this.depthTexture=o,i.stencilBuffer?(o.format=Vf,o.type=jf):o.type=xu;const u=o.clone();return u.name="EffectComposer.StableDepth",this.depthRenderTarget=new Rt(i.width,i.height,{depthBuffer:!0,stencilBuffer:i.stencilBuffer,depthTexture:u}),u}blitDepthBuffer(i){const o=this.renderer,u=this.depthRenderTarget,c=o.properties,d=o.getContext();o.setRenderTarget(u);const f=c.get(i).__webglFramebuffer,g=c.get(u).__webglFramebuffer,_=i.stencilBuffer?d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT:d.DEPTH_BUFFER_BIT;d.bindFramebuffer(d.READ_FRAMEBUFFER,f),d.bindFramebuffer(d.DRAW_FRAMEBUFFER,g),d.blitFramebuffer(0,0,i.width,i.height,0,0,u.width,u.height,_,d.NEAREST),d.bindFramebuffer(d.READ_FRAMEBUFFER,null),d.bindFramebuffer(d.DRAW_FRAMEBUFFER,null),o.setRenderTarget(null)}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.depthRenderTarget.dispose(),this.depthRenderTarget=null,this.inputBuffer.depthTexture=null,this.outputBuffer.depthTexture=null;for(const i of this.passes)i.setDepthTexture(null)}}createBuffer(i,o,u,c){const d=this.renderer,f=d===null?new Ge:d.getDrawingBufferSize(new Ge),g={minFilter:Bi,magFilter:Bi,stencilBuffer:o,depthBuffer:i,type:u},_=new Rt(f.width,f.height,g);return c>0&&(_.samples=c),u===fn&&d!==null&&d.outputColorSpace===Ke&&(_.texture.colorSpace=Ke),_.texture.name="EffectComposer.Buffer",_.texture.generateMipmaps=!1,_}setMainScene(i){for(const o of this.passes)o.mainScene=i}setMainCamera(i){for(const o of this.passes)o.mainCamera=i}addPass(i,o){const u=this.passes,c=this.renderer,d=c.getDrawingBufferSize(new Ge),f=c.getContext().getContextAttributes().alpha,g=this.inputBuffer.texture.type;if(i.renderer=c,i.setSize(d.width,d.height),i.initialize(c,f,g),this.autoRenderToScreen&&(u.length>0&&(u[u.length-1].renderToScreen=!1),i.renderToScreen&&(this.autoRenderToScreen=!1)),o!==void 0?u.splice(o,0,i):u.push(i),this.autoRenderToScreen&&(u[u.length-1].renderToScreen=!0),i.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const _=this.createDepthTexture();for(i of u)i.setDepthTexture(_)}else{const _=this.depthRenderTarget.depthTexture;i.setDepthTexture(_)}}removePass(i){const o=this.passes,u=o.indexOf(i);if(u!==-1&&o.splice(u,1).length>0){if(this.depthTexture!==null){const f=(_,S)=>_||S.needsDepthTexture;if(!o.reduce(f,!1)){const _=this.depthRenderTarget.depthTexture;i.getDepthTexture()===_&&i.setDepthTexture(null),this.deleteDepthTexture()}}this.autoRenderToScreen&&u===o.length&&(i.renderToScreen=!1,o.length>0&&(o[o.length-1].renderToScreen=!0))}}removeAllPasses(){const i=this.passes;this.deleteDepthTexture(),i.length>0&&(this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!1),this.passes=[])}render(i){const o=this.renderer,u=this.copyPass;let c=this.inputBuffer,d=this.outputBuffer,f,g=!1;i===void 0&&(this.timer.update(),i=this.timer.getDelta());for(const _ of this.passes)if(_.enabled){if(c.depthTexture=this.depthTexture,d.depthTexture=null,_.render(o,c,d,i,g),_.needsDepthBlit&&this.depthRenderTarget!==null&&this.blitDepthBuffer(c),_.needsSwap){if(g){u.renderToScreen=_.renderToScreen;const S=o.getContext(),h=o.state.buffers.stencil;h.setFunc(S.NOTEQUAL,1,4294967295),u.render(o,c,d,i,g),h.setFunc(S.EQUAL,1,4294967295)}f=c,c=d,d=f}_ instanceof uh?g=!0:_ instanceof oh&&(g=!1)}}setSize(i,o,u){const c=this.renderer,d=c.getSize(new Ge);(i===void 0||o===void 0)&&(i=d.width,o=d.height),(d.width!==i||d.height!==o)&&c.setSize(i,o,u);const f=c.getDrawingBufferSize(new Ge);this.inputBuffer.setSize(f.width,f.height),this.outputBuffer.setSize(f.width,f.height),this.depthRenderTarget!==null&&this.depthRenderTarget.setSize(f.width,f.height);for(const g of this.passes)g.setSize(f.width,f.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const i of this.passes)i.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),ot.fullscreenGeometry.dispose()}},Zt={NONE:0,DEPTH:1,CONVOLUTION:2},me={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},hh=class{constructor(){this.shaderParts=new Map([[me.FRAGMENT_HEAD,null],[me.FRAGMENT_MAIN_UV,null],[me.FRAGMENT_MAIN_IMAGE,null],[me.VERTEX_HEAD,null],[me.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Zt.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=wu}},Uo=!1,vu=class{constructor(r=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(r),this.meshCount=0,this.replaceMaterial=i=>{if(i.isMesh){let o;if(i.material.flatShading)switch(i.material.side){case Ur:o=this.materialsFlatShadedDoubleSide;break;case Pi:o=this.materialsFlatShadedBackSide;break;default:o=this.materialsFlatShaded;break}else switch(i.material.side){case Ur:o=this.materialsDoubleSide;break;case Pi:o=this.materialsBackSide;break;default:o=this.materials;break}this.originalMaterials.set(i,i.material),i.isSkinnedMesh?i.material=o[2]:i.isInstancedMesh?i.material=o[1]:i.material=o[0],++this.meshCount}}}cloneMaterial(r){if(!(r instanceof Qt))return r.clone();const i=r.uniforms,o=new Map;for(const c in i){const d=i[c].value;d.isRenderTargetTexture&&(i[c].value=null,o.set(c,d))}const u=r.clone();for(const c of o)i[c[0]].value=c[1],u.uniforms[c[0]].value=c[1];return u}setMaterial(r){if(this.disposeMaterials(),this.material=r,r!==null){const i=this.materials=[this.cloneMaterial(r),this.cloneMaterial(r),this.cloneMaterial(r)];for(const o of i)o.uniforms=Object.assign({},r.uniforms),o.side=Yf;i[2].skinning=!0,this.materialsBackSide=i.map(o=>{const u=this.cloneMaterial(o);return u.uniforms=Object.assign({},r.uniforms),u.side=Pi,u}),this.materialsDoubleSide=i.map(o=>{const u=this.cloneMaterial(o);return u.uniforms=Object.assign({},r.uniforms),u.side=Ur,u}),this.materialsFlatShaded=i.map(o=>{const u=this.cloneMaterial(o);return u.uniforms=Object.assign({},r.uniforms),u.flatShading=!0,u}),this.materialsFlatShadedBackSide=i.map(o=>{const u=this.cloneMaterial(o);return u.uniforms=Object.assign({},r.uniforms),u.flatShading=!0,u.side=Pi,u}),this.materialsFlatShadedDoubleSide=i.map(o=>{const u=this.cloneMaterial(o);return u.uniforms=Object.assign({},r.uniforms),u.flatShading=!0,u.side=Ur,u})}}render(r,i,o){const u=r.shadowMap.enabled;if(r.shadowMap.enabled=!1,Uo){const c=this.originalMaterials;this.meshCount=0,i.traverse(this.replaceMaterial),r.render(i,o);for(const d of c)d[0].material=d[1];this.meshCount!==c.size&&c.clear()}else{const c=i.overrideMaterial;i.overrideMaterial=this.material,r.render(i,o),i.overrideMaterial=c}r.shadowMap.enabled=u}disposeMaterials(){if(this.material!==null){const r=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const i of r)i.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return Uo}static set workaroundEnabled(r){Uo=r}},un=-1,Xe=class extends Vo{constructor(r=null,i=un,o=un,u=1){super(),r!==null&&this.addEventListener("change",()=>r.setSize(this.baseSize.width,this.baseSize.height)),this.baseSize=new Ge(1,1),this.preferredSize=new Ge(i,o),this.target=this.preferredSize,this.s=u,this.effectiveSize=new Ge,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const r=this.baseSize,i=this.preferredSize,o=this.effectiveSize,u=this.scale;i.width!==un?o.width=i.width:i.height!==un?o.width=Math.round(i.height*(r.width/Math.max(r.height,1))):o.width=Math.round(r.width*u),i.height!==un?o.height=i.height:i.width!==un?o.height=Math.round(i.width/Math.max(r.width/Math.max(r.height,1),1)):o.height=Math.round(r.height*u)}get width(){return this.effectiveSize.width}set width(r){this.preferredWidth=r}get height(){return this.effectiveSize.height}set height(r){this.preferredHeight=r}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(r){this.s!==r&&(this.s=r,this.preferredSize.setScalar(un),this.dispatchEvent({type:"change"}))}getScale(){return this.scale}setScale(r){this.scale=r}get baseWidth(){return this.baseSize.width}set baseWidth(r){this.baseSize.width!==r&&(this.baseSize.width=r,this.dispatchEvent({type:"change"}))}getBaseWidth(){return this.baseWidth}setBaseWidth(r){this.baseWidth=r}get baseHeight(){return this.baseSize.height}set baseHeight(r){this.baseSize.height!==r&&(this.baseSize.height=r,this.dispatchEvent({type:"change"}))}getBaseHeight(){return this.baseHeight}setBaseHeight(r){this.baseHeight=r}setBaseSize(r,i){(this.baseSize.width!==r||this.baseSize.height!==i)&&(this.baseSize.set(r,i),this.dispatchEvent({type:"change"}))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(r){this.preferredSize.width!==r&&(this.preferredSize.width=r,this.dispatchEvent({type:"change"}))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(r){this.preferredWidth=r}get preferredHeight(){return this.preferredSize.height}set preferredHeight(r){this.preferredSize.height!==r&&(this.preferredSize.height=r,this.dispatchEvent({type:"change"}))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(r){this.preferredHeight=r}setPreferredSize(r,i){(this.preferredSize.width!==r||this.preferredSize.height!==i)&&(this.preferredSize.set(r,i),this.dispatchEvent({type:"change"}))}copy(r){this.s=r.scale,this.baseSize.set(r.baseWidth,r.baseHeight),this.preferredSize.set(r.preferredWidth,r.preferredHeight),this.dispatchEvent({type:"change"})}static get AUTO_SIZE(){return un}},ue={ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},ph="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",mh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}",vh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",gh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",_h="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",yh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Eh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Sh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Th="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",xh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",wh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Ch="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Oh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Rh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Ph="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Mh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Uh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Dh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",zh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Ah="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Lh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Nh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Ih="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}",Bh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",kh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Fh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Hh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Gh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Vh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",jh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}",Wh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",bh="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Yh=new Map([[ue.ADD,ph],[ue.ALPHA,mh],[ue.AVERAGE,vh],[ue.COLOR,gh],[ue.COLOR_BURN,_h],[ue.COLOR_DODGE,yh],[ue.DARKEN,Eh],[ue.DIFFERENCE,Sh],[ue.DIVIDE,Th],[ue.DST,null],[ue.EXCLUSION,xh],[ue.HARD_LIGHT,wh],[ue.HARD_MIX,Ch],[ue.HUE,Oh],[ue.INVERT,Rh],[ue.INVERT_RGB,Ph],[ue.LIGHTEN,Mh],[ue.LINEAR_BURN,Uh],[ue.LINEAR_DODGE,Dh],[ue.LINEAR_LIGHT,zh],[ue.LUMINOSITY,Ah],[ue.MULTIPLY,Lh],[ue.NEGATION,Nh],[ue.NORMAL,Ih],[ue.OVERLAY,Bh],[ue.PIN_LIGHT,kh],[ue.REFLECT,Fh],[ue.SATURATION,Hh],[ue.SCREEN,Gh],[ue.SOFT_LIGHT,Vh],[ue.SRC,jh],[ue.SUBTRACT,Wh],[ue.VIVID_LIGHT,bh]]),Zh=class extends Vo{constructor(r,i=1){super(),this._blendFunction=r,this.opacity=new ve(i)}getOpacity(){return this.opacity.value}setOpacity(r){this.opacity.value=r}get blendFunction(){return this._blendFunction}set blendFunction(r){this._blendFunction=r,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(r){this.blendFunction=r}getShaderCode(){return Yh.get(this.blendFunction)}},Fo=class extends Vo{constructor(r,i,{attributes:o=Zt.NONE,blendFunction:u=ue.NORMAL,defines:c=new Map,uniforms:d=new Map,extensions:f=null,vertexShader:g=null}={}){super(),this.name=r,this.renderer=null,this.attributes=o,this.fragmentShader=i,this.vertexShader=g,this.defines=c,this.uniforms=d,this.extensions=f,this.blendMode=new Zh(u),this.blendMode.addEventListener("change",_=>this.setChanged()),this._inputColorSpace=wu,this._outputColorSpace=Cu}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(r){this._inputColorSpace=r,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(r){this._outputColorSpace=r,this.setChanged()}set mainScene(r){}set mainCamera(r){}getName(){return this.name}setRenderer(r){this.renderer=r}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(r){this.attributes=r,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(r){this.fragmentShader=r,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(r){this.vertexShader=r,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(r,i=$n){}update(r,i,o){}setSize(r,i){}initialize(r,i,o){}dispose(){for(const r of Object.keys(this)){const i=this[r];(i instanceof Rt||i instanceof Ou||i instanceof Ru||i instanceof ot)&&this[r].dispose()}}},Zo={MEDIUM:2,LARGE:3},Qh=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
150
|
+
uniform mediump sampler2D inputBuffer;
|
|
151
|
+
#else
|
|
152
|
+
uniform lowp sampler2D inputBuffer;
|
|
153
|
+
#endif
|
|
154
|
+
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;
|
|
155
|
+
#include <colorspace_fragment>
|
|
156
|
+
}`,Kh="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",Xh=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],qh=class extends Qt{constructor(r=new Ao){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ve(null),texelSize:new ve(new Ao),scale:new ve(1),kernel:new ve(0)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Qh,vertexShader:Kh}),this.setTexelSize(r.x,r.y),this.kernelSize=Zo.MEDIUM}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.inputBuffer=r}get kernelSequence(){return Xh[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(r){this.uniforms.scale.value=r}getScale(){return this.uniforms.scale.value}setScale(r){this.uniforms.scale.value=r}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(r){this.uniforms.kernel.value=r}setKernel(r){this.kernel=r}setTexelSize(r,i){this.uniforms.texelSize.value.set(r,i,r*.5,i*.5)}setSize(r,i){const o=1/r,u=1/i;this.uniforms.texelSize.value.set(o,u,o*.5,u*.5)}},Jh=class extends ot{constructor({kernelSize:r=Zo.MEDIUM,resolutionScale:i=.5,width:o=Xe.AUTO_SIZE,height:u=Xe.AUTO_SIZE,resolutionX:c=o,resolutionY:d=u}={}){super("KawaseBlurPass"),this.renderTargetA=new Rt(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const f=this.resolution=new Xe(this,c,d,i);f.addEventListener("change",g=>this.setSize(f.baseWidth,f.baseHeight)),this._blurMaterial=new qh,this._blurMaterial.kernelSize=r,this.copyMaterial=new Qu}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(r){this._blurMaterial=r}get dithering(){return this.copyMaterial.dithering}set dithering(r){this.copyMaterial.dithering=r}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(r){this.blurMaterial.kernelSize=r}get width(){return this.resolution.width}set width(r){this.resolution.preferredWidth=r}get height(){return this.resolution.height}set height(r){this.resolution.preferredHeight=r}get scale(){return this.blurMaterial.scale}set scale(r){this.blurMaterial.scale=r}getScale(){return this.blurMaterial.scale}setScale(r){this.blurMaterial.scale=r}getKernelSize(){return this.kernelSize}setKernelSize(r){this.kernelSize=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}render(r,i,o,u,c){const d=this.scene,f=this.camera,g=this.renderTargetA,_=this.renderTargetB,S=this.blurMaterial,h=S.kernelSequence;let m=i;this.fullscreenMaterial=S;for(let x=0,E=h.length;x<E;++x){const O=(x&1)===0?g:_;S.kernel=h[x],S.inputBuffer=m.texture,r.setRenderTarget(O),r.render(d,f),m=O}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=m.texture,r.setRenderTarget(this.renderToScreen?null:o),r.render(d,f)}setSize(r,i){const o=this.resolution;o.setBaseSize(r,i);const u=o.width,c=o.height;this.renderTargetA.setSize(u,c),this.renderTargetB.setSize(u,c),this.blurMaterial.setSize(r,i)}initialize(r,i,o){o!==void 0&&(this.renderTargetA.texture.type=o,this.renderTargetB.texture.type=o,o!==fn?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):r!==null&&r.outputColorSpace===Ke&&(this.renderTargetA.texture.colorSpace=Ke,this.renderTargetB.texture.colorSpace=Ke))}static get AUTO_SIZE(){return Xe.AUTO_SIZE}},$h=`#include <common>
|
|
157
|
+
#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
158
|
+
uniform mediump sampler2D inputBuffer;
|
|
159
|
+
#else
|
|
160
|
+
uniform lowp sampler2D inputBuffer;
|
|
161
|
+
#endif
|
|
162
|
+
#ifdef RANGE
|
|
163
|
+
uniform vec2 range;
|
|
164
|
+
#elif defined(THRESHOLD)
|
|
165
|
+
uniform float threshold;uniform float smoothing;
|
|
166
|
+
#endif
|
|
167
|
+
varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0;
|
|
168
|
+
#ifdef RANGE
|
|
169
|
+
float low=step(range.x,l);float high=step(l,range.y);mask=low*high;
|
|
170
|
+
#elif defined(THRESHOLD)
|
|
171
|
+
mask=smoothstep(threshold,threshold+smoothing,l);
|
|
172
|
+
#endif
|
|
173
|
+
#ifdef COLOR
|
|
174
|
+
gl_FragColor=texel*mask;
|
|
175
|
+
#else
|
|
176
|
+
gl_FragColor=vec4(l*mask);
|
|
177
|
+
#endif
|
|
178
|
+
}`,ep=class extends Qt{constructor(r=!1,i=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:Ho.replace(/\D+/g,"")},uniforms:{inputBuffer:new ve(null),threshold:new ve(0),smoothing:new ve(1),range:new ve(null)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:$h,vertexShader:Zu}),this.colorOutput=r,this.luminanceRange=i}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.uniforms.inputBuffer.value=r}get threshold(){return this.uniforms.threshold.value}set threshold(r){this.smoothing>0||r>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=r}getThreshold(){return this.threshold}setThreshold(r){this.threshold=r}get smoothing(){return this.uniforms.smoothing.value}set smoothing(r){this.threshold>0||r>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=r}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(r){this.smoothing=r}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(r){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(r){r?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(r){return this.colorOutput}setColorOutputEnabled(r){this.colorOutput=r}get useRange(){return this.luminanceRange!==null}set useRange(r){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(r){r!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=r,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(r){this.luminanceRange=r}},tp=class extends ot{constructor({renderTarget:r,luminanceRange:i,colorOutput:o,resolutionScale:u=1,width:c=Xe.AUTO_SIZE,height:d=Xe.AUTO_SIZE,resolutionX:f=c,resolutionY:g=d}={}){super("LuminancePass"),this.fullscreenMaterial=new ep(o,i),this.needsSwap=!1,this.renderTarget=r,this.renderTarget===void 0&&(this.renderTarget=new Rt(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const _=this.resolution=new Xe(this,f,g,u);_.addEventListener("change",S=>this.setSize(_.baseWidth,_.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(r,i,o,u,c){const d=this.fullscreenMaterial;d.inputBuffer=i.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,i){const o=this.resolution;o.setBaseSize(r,i),this.renderTarget.setSize(o.width,o.height)}initialize(r,i,o){o!==void 0&&o!==fn&&(this.renderTarget.texture.type=o,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},np=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
179
|
+
uniform mediump sampler2D inputBuffer;
|
|
180
|
+
#else
|
|
181
|
+
uniform lowp sampler2D inputBuffer;
|
|
182
|
+
#endif
|
|
183
|
+
#define WEIGHT_INNER 0.125
|
|
184
|
+
#define WEIGHT_OUTER 0.05556
|
|
185
|
+
varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;
|
|
186
|
+
#include <colorspace_fragment>
|
|
187
|
+
}`,rp="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}",ip=class extends Qt{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new ve(null),texelSize:new ve(new Ge)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:np,vertexShader:rp})}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setSize(r,i){this.uniforms.texelSize.value.set(1/r,1/i)}},sp=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
188
|
+
uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;
|
|
189
|
+
#else
|
|
190
|
+
uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;
|
|
191
|
+
#endif
|
|
192
|
+
uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);
|
|
193
|
+
#include <colorspace_fragment>
|
|
194
|
+
}`,op="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}",lp=class extends Qt{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new ve(null),supportBuffer:new ve(null),texelSize:new ve(new Ge),radius:new ve(.85)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:sp,vertexShader:op})}set inputBuffer(r){this.uniforms.inputBuffer.value=r}set supportBuffer(r){this.uniforms.supportBuffer.value=r}get radius(){return this.uniforms.radius.value}set radius(r){this.uniforms.radius.value=r}setSize(r,i){this.uniforms.texelSize.value.set(1/r,1/i)}},ap=class extends ot{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new Rt(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new ip,this.upsamplingMaterial=new lp,this.resolution=new Ge}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(r){if(this.levels!==r){const i=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let o=0;o<r;++o){const u=i.clone();u.texture.name="Downsampling.Mipmap"+o,this.downsamplingMipmaps.push(u)}this.upsamplingMipmaps.push(i);for(let o=1,u=r-1;o<u;++o){const c=i.clone();c.texture.name="Upsampling.Mipmap"+o,this.upsamplingMipmaps.push(c)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(r){this.upsamplingMaterial.radius=r}render(r,i,o,u,c){const{scene:d,camera:f}=this,{downsamplingMaterial:g,upsamplingMaterial:_}=this,{downsamplingMipmaps:S,upsamplingMipmaps:h}=this;let m=i;this.fullscreenMaterial=g;for(let x=0,E=S.length;x<E;++x){const O=S[x];g.setSize(m.width,m.height),g.inputBuffer=m.texture,r.setRenderTarget(O),r.render(d,f),m=O}this.fullscreenMaterial=_;for(let x=h.length-1;x>=0;--x){const E=h[x];_.setSize(m.width,m.height),_.inputBuffer=m.texture,_.supportBuffer=S[x].texture,r.setRenderTarget(E),r.render(d,f),m=E}}setSize(r,i){const o=this.resolution;o.set(r,i);let u=o.width,c=o.height;for(let d=0,f=this.downsamplingMipmaps.length;d<f;++d)u=Math.round(u*.5),c=Math.round(c*.5),this.downsamplingMipmaps[d].setSize(u,c),d<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[d].setSize(u,c)}initialize(r,i,o){if(o!==void 0){const u=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const c of u)c.texture.type=o;if(o!==fn)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(r!==null&&r.outputColorSpace===Ke)for(const c of u)c.texture.colorSpace=Ke}}dispose(){super.dispose();for(const r of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))r.dispose()}},up=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
195
|
+
uniform mediump sampler2D map;
|
|
196
|
+
#else
|
|
197
|
+
uniform lowp sampler2D map;
|
|
198
|
+
#endif
|
|
199
|
+
uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}`,cp=class extends Fo{constructor({blendFunction:r=ue.SCREEN,luminanceThreshold:i=1,luminanceSmoothing:o=.03,mipmapBlur:u=!0,intensity:c=1,radius:d=.85,levels:f=8,kernelSize:g=Zo.LARGE,resolutionScale:_=.5,width:S=Xe.AUTO_SIZE,height:h=Xe.AUTO_SIZE,resolutionX:m=S,resolutionY:x=h}={}){super("BloomEffect",up,{blendFunction:r,uniforms:new Map([["map",new ve(null)],["intensity",new ve(c)]])}),this.renderTarget=new Rt(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new Jh({kernelSize:g}),this.luminancePass=new tp({colorOutput:!0}),this.luminanceMaterial.threshold=i,this.luminanceMaterial.smoothing=o,this.mipmapBlurPass=new ap,this.mipmapBlurPass.enabled=u,this.mipmapBlurPass.radius=d,this.mipmapBlurPass.levels=f,this.uniforms.get("map").value=u?this.mipmapBlurPass.texture:this.renderTarget.texture;const E=this.resolution=new Xe(this,m,x,_);E.addEventListener("change",O=>this.setSize(E.baseWidth,E.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(r){this.resolution.preferredWidth=r}get height(){return this.resolution.height}set height(r){this.resolution.preferredHeight=r}get dithering(){return this.blurPass.dithering}set dithering(r){this.blurPass.dithering=r}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(r){this.blurPass.kernelSize=r}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(r){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(r){this.uniforms.get("intensity").value=r}getIntensity(){return this.intensity}setIntensity(r){this.intensity=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}update(r,i,o){const u=this.renderTarget,c=this.luminancePass;c.enabled?(c.render(r,i),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(r,c.renderTarget):this.blurPass.render(r,c.renderTarget,u)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(r,i):this.blurPass.render(r,i,u)}setSize(r,i){const o=this.resolution;o.setBaseSize(r,i),this.renderTarget.setSize(o.width,o.height),this.blurPass.resolution.copy(o),this.luminancePass.setSize(r,i),this.mipmapBlurPass.setSize(r,i)}initialize(r,i,o){this.blurPass.initialize(r,i,o),this.luminancePass.initialize(r,i,o),this.mipmapBlurPass.initialize(r,i,o),o!==void 0&&(this.renderTarget.texture.type=o,r!==null&&r.outputColorSpace===Ke&&(this.renderTarget.texture.colorSpace=Ke))}},Xu=class extends ot{constructor(r,i,o=null){super("RenderPass",r,i),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new Ku,this.overrideMaterialManager=o===null?null:new vu(o),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(r){this.scene=r}set mainCamera(r){this.camera=r}get renderToScreen(){return super.renderToScreen}set renderToScreen(r){super.renderToScreen=r,this.clearPass.renderToScreen=r}get overrideMaterial(){const r=this.overrideMaterialManager;return r!==null?r.material:null}set overrideMaterial(r){const i=this.overrideMaterialManager;r!==null?i!==null?i.setMaterial(r):this.overrideMaterialManager=new vu(r):i!==null&&(i.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(r){this.overrideMaterial=r}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}getSelection(){return this.selection}setSelection(r){this.selection=r}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(r){this.ignoreBackground=r}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(r){this.skipShadowMapUpdate=r}getClearPass(){return this.clearPass}render(r,i,o,u,c){const d=this.scene,f=this.camera,g=this.selection,_=f.layers.mask,S=d.background,h=r.shadowMap.autoUpdate,m=this.renderToScreen?null:i;g!==null&&f.layers.set(g.getLayer()),this.skipShadowMapUpdate&&(r.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(d.background=null),this.clearPass.enabled&&this.clearPass.render(r,i),r.setRenderTarget(m),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(r,d,f):r.render(d,f),f.layers.mask=_,d.background=S,r.shadowMap.autoUpdate=h}},fp=`#include <packing>
|
|
200
|
+
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
201
|
+
uniform highp sampler2D depthBuffer;
|
|
202
|
+
#else
|
|
203
|
+
uniform mediump sampler2D depthBuffer;
|
|
204
|
+
#endif
|
|
205
|
+
#ifdef DOWNSAMPLE_NORMALS
|
|
206
|
+
uniform lowp sampler2D normalBuffer;
|
|
207
|
+
#endif
|
|
208
|
+
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){
|
|
209
|
+
#if DEPTH_PACKING == 3201
|
|
210
|
+
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
|
|
211
|
+
#else
|
|
212
|
+
return texture2D(depthBuffer,uv).r;
|
|
213
|
+
#endif
|
|
214
|
+
}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[4];d[0]=readDepth(vUv0);d[1]=readDepth(vUv1);d[2]=readDepth(vUv2);d[3]=readDepth(vUv3);int index=findBestDepth(d);
|
|
215
|
+
#ifdef DOWNSAMPLE_NORMALS
|
|
216
|
+
vec3 n[4];n[0]=texture2D(normalBuffer,vUv0).rgb;n[1]=texture2D(normalBuffer,vUv1).rgb;n[2]=texture2D(normalBuffer,vUv2).rgb;n[3]=texture2D(normalBuffer,vUv3).rgb;
|
|
217
|
+
#else
|
|
218
|
+
vec3 n[4];n[0]=vec3(0.0);n[1]=vec3(0.0);n[2]=vec3(0.0);n[3]=vec3(0.0);
|
|
219
|
+
#endif
|
|
220
|
+
gl_FragColor=vec4(n[index],d[index]);}`,dp="uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}",hp=class extends Qt{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new ve(null),normalBuffer:new ve(null),texelSize:new ve(new Ge)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:fp,vertexShader:dp})}set depthBuffer(r){this.uniforms.depthBuffer.value=r}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setDepthBuffer(r,i=$n){this.depthBuffer=r,this.depthPacking=i}set normalBuffer(r){this.uniforms.normalBuffer.value=r,r!==null?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(r){this.normalBuffer=r}setTexelSize(r,i){this.uniforms.texelSize.value.set(r,i)}setSize(r,i){this.uniforms.texelSize.value.set(1/r,1/i)}},pp=class extends ot{constructor({normalBuffer:r=null,resolutionScale:i=.5,width:o=Xe.AUTO_SIZE,height:u=Xe.AUTO_SIZE,resolutionX:c=o,resolutionY:d=u}={}){super("DepthDownsamplingPass");const f=new hp;f.normalBuffer=r,this.fullscreenMaterial=f,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new Rt(1,1,{minFilter:ki,magFilter:ki,depthBuffer:!1,type:xu}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const g=this.resolution=new Xe(this,c,d,i);g.addEventListener("change",_=>this.setSize(g.baseWidth,g.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(r,i=$n){this.fullscreenMaterial.depthBuffer=r,this.fullscreenMaterial.depthPacking=i}render(r,i,o,u,c){r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,i){const o=this.resolution;o.setBaseSize(r,i),this.renderTarget.setSize(o.width,o.height),this.fullscreenMaterial.setSize(r,i)}initialize(r,i,o){const u=r.getContext();if(!(u.getExtension("EXT_color_buffer_float")||u.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}},mp=`#include <common>
|
|
221
|
+
#include <packing>
|
|
222
|
+
#include <dithering_pars_fragment>
|
|
223
|
+
#define packFloatToRGBA(v) packDepthToRGBA(v)
|
|
224
|
+
#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
|
|
225
|
+
#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
226
|
+
uniform mediump sampler2D inputBuffer;
|
|
227
|
+
#else
|
|
228
|
+
uniform lowp sampler2D inputBuffer;
|
|
229
|
+
#endif
|
|
230
|
+
#if DEPTH_PACKING == 3201
|
|
231
|
+
uniform lowp sampler2D depthBuffer;
|
|
232
|
+
#elif defined(GL_FRAGMENT_PRECISION_HIGH)
|
|
233
|
+
uniform highp sampler2D depthBuffer;
|
|
234
|
+
#else
|
|
235
|
+
uniform mediump sampler2D depthBuffer;
|
|
236
|
+
#endif
|
|
237
|
+
uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const 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);}float readDepth(const in vec2 uv){
|
|
238
|
+
#if DEPTH_PACKING == 3201
|
|
239
|
+
float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));
|
|
240
|
+
#else
|
|
241
|
+
float depth=texture2D(depthBuffer,uv).r;
|
|
242
|
+
#endif
|
|
243
|
+
#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)
|
|
244
|
+
float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;
|
|
245
|
+
#elif defined(USE_REVERSED_DEPTH_BUFFER)
|
|
246
|
+
depth=1.0-depth;
|
|
247
|
+
#endif
|
|
248
|
+
return depth;}float getViewZ(const in float depth){
|
|
249
|
+
#ifdef PERSPECTIVE_CAMERA
|
|
250
|
+
return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
|
|
251
|
+
#else
|
|
252
|
+
return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
|
|
253
|
+
#endif
|
|
254
|
+
}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;
|
|
255
|
+
#ifdef ENCODE_OUTPUT
|
|
256
|
+
#include <colorspace_fragment>
|
|
257
|
+
#endif
|
|
258
|
+
#include <dithering_fragment>
|
|
259
|
+
}`,vp="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",gp=class extends Qt{constructor(r,i,o,u,c=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Ho.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ve(null),depthBuffer:new ve(null),resolution:new ve(new Ge),texelSize:new ve(new Ge),cameraNear:new ve(.3),cameraFar:new ve(1e3),aspect:new ve(1),time:new ve(0)},blending:On,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:c}),r&&this.setShaderParts(r),i&&this.setDefines(i),o&&this.setUniforms(o),this.copyCameraSettings(u)}set inputBuffer(r){this.uniforms.inputBuffer.value=r}setInputBuffer(r){this.uniforms.inputBuffer.value=r}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(r){this.uniforms.depthBuffer.value=r}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setDepthBuffer(r,i=$n){this.depthBuffer=r,this.depthPacking=i}setShaderData(r){this.setShaderParts(r.shaderParts),this.setDefines(r.defines),this.setUniforms(r.uniforms),this.setExtensions(r.extensions)}setShaderParts(r){return this.fragmentShader=mp.replace(me.FRAGMENT_HEAD,r.get(me.FRAGMENT_HEAD)||"").replace(me.FRAGMENT_MAIN_UV,r.get(me.FRAGMENT_MAIN_UV)||"").replace(me.FRAGMENT_MAIN_IMAGE,r.get(me.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=vp.replace(me.VERTEX_HEAD,r.get(me.VERTEX_HEAD)||"").replace(me.VERTEX_MAIN_SUPPORT,r.get(me.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(r){for(const i of r.entries())this.defines[i[0]]=i[1];return this.needsUpdate=!0,this}setUniforms(r){for(const i of r.entries())this.uniforms[i[0]]=i[1];return this}setExtensions(r){this.extensions={};for(const i of r)this.extensions[i]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(r){this.encodeOutput!==r&&(r?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(r){return this.encodeOutput}setOutputEncodingEnabled(r){this.encodeOutput=r}get time(){return this.uniforms.time.value}set time(r){this.uniforms.time.value=r}setDeltaTime(r){this.uniforms.time.value+=r}adoptCameraSettings(r){this.copyCameraSettings(r)}copyCameraSettings(r){r&&(this.uniforms.cameraNear.value=r.near,this.uniforms.cameraFar.value=r.far,r instanceof Vi?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(r,i){const o=this.uniforms;o.resolution.value.set(r,i),o.texelSize.value.set(1/r,1/i),o.aspect.value=r/i}static get Section(){return me}};function gu(r,i,o){for(const u of i){const c="$1"+r+u.charAt(0).toUpperCase()+u.slice(1),d=new RegExp("([^\\.])(\\b"+u+"\\b)","g");for(const f of o.entries())f[1]!==null&&o.set(f[0],f[1].replace(d,c))}}function _p(r,i,o){let u=i.getFragmentShader(),c=i.getVertexShader();const d=u!==void 0&&/mainImage/.test(u),f=u!==void 0&&/mainUv/.test(u);if(o.attributes|=i.getAttributes(),u===void 0)throw new Error(`Missing fragment shader (${i.name})`);if(f&&(o.attributes&Zt.CONVOLUTION)!==0)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${i.name})`);if(!d&&!f)throw new Error(`Could not find mainImage or mainUv function (${i.name})`);{const g=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,_=o.shaderParts;let S=_.get(me.FRAGMENT_HEAD)||"",h=_.get(me.FRAGMENT_MAIN_UV)||"",m=_.get(me.FRAGMENT_MAIN_IMAGE)||"",x=_.get(me.VERTEX_HEAD)||"",E=_.get(me.VERTEX_MAIN_SUPPORT)||"";const O=new Set,A=new Set;if(f&&(h+=` ${r}MainUv(UV);
|
|
260
|
+
`,o.uvTransformation=!0),c!==null&&/mainSupport/.test(c)){const y=/mainSupport *\([\w\s]*?uv\s*?\)/.test(c);E+=` ${r}MainSupport(`,E+=y?`vUv);
|
|
261
|
+
`:`);
|
|
262
|
+
`;for(const C of c.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const U of C[1].split(/\s*,\s*/))o.varyings.add(U),O.add(U),A.add(U);for(const C of c.matchAll(g))A.add(C[1])}for(const y of u.matchAll(g))A.add(y[1]);for(const y of i.defines.keys())A.add(y.replace(/\([\w\s,]*\)/g,""));for(const y of i.uniforms.keys())A.add(y);A.delete("while"),A.delete("for"),A.delete("if"),i.uniforms.forEach((y,C)=>o.uniforms.set(r+C.charAt(0).toUpperCase()+C.slice(1),y)),i.defines.forEach((y,C)=>o.defines.set(r+C.charAt(0).toUpperCase()+C.slice(1),y));const L=new Map([["fragment",u],["vertex",c]]);gu(r,A,o.defines),gu(r,A,L),u=L.get("fragment"),c=L.get("vertex");const v=i.blendMode;if(o.blendModes.set(v.blendFunction,v),d){i.inputColorSpace!==null&&i.inputColorSpace!==o.colorSpace&&(m+=i.inputColorSpace===Ke?`color0 = sRGBTransferOETF(color0);
|
|
263
|
+
`:`color0 = sRGBToLinear(color0);
|
|
264
|
+
`),i.outputColorSpace!==Cu?o.colorSpace=i.outputColorSpace:i.inputColorSpace!==null&&(o.colorSpace=i.inputColorSpace);const y=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;m+=`${r}MainImage(color0, UV, `,(o.attributes&Zt.DEPTH)!==0&&y.test(u)&&(m+="depth, ",o.readDepth=!0),m+=`color1);
|
|
265
|
+
`;const C=r+"BlendOpacity";o.uniforms.set(C,v.opacity),m+=`color0 = blend${v.blendFunction}(color0, color1, ${C});
|
|
266
|
+
|
|
267
|
+
`,S+=`uniform float ${C};
|
|
268
|
+
|
|
269
|
+
`}if(S+=u+`
|
|
270
|
+
`,c!==null&&(x+=c+`
|
|
271
|
+
`),_.set(me.FRAGMENT_HEAD,S),_.set(me.FRAGMENT_MAIN_UV,h),_.set(me.FRAGMENT_MAIN_IMAGE,m),_.set(me.VERTEX_HEAD,x),_.set(me.VERTEX_MAIN_SUPPORT,E),i.extensions!==null)for(const y of i.extensions)o.extensions.add(y)}}var yp=class extends ot{constructor(r,...i){super("EffectPass"),this.fullscreenMaterial=new gp(null,null,null,r),this.listener=o=>this.handleEvent(o),this.effects=[],this.setEffects(i),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(r){for(const i of this.effects)i.mainScene=r}set mainCamera(r){this.fullscreenMaterial.copyCameraSettings(r);for(const i of this.effects)i.mainCamera=r}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(r){this.fullscreenMaterial.encodeOutput=r}get dithering(){return this.fullscreenMaterial.dithering}set dithering(r){const i=this.fullscreenMaterial;i.dithering=r,i.needsUpdate=!0}setEffects(r){for(const i of this.effects)i.removeEventListener("change",this.listener);this.effects=r.sort((i,o)=>o.attributes-i.attributes);for(const i of this.effects)i.addEventListener("change",this.listener)}updateMaterial(){const r=new hh;let i=0;for(const f of this.effects)if(f.blendMode.blendFunction===ue.DST)r.attributes|=f.getAttributes()&Zt.DEPTH;else{if((r.attributes&f.getAttributes()&Zt.CONVOLUTION)!==0)throw new Error(`Convolution effects cannot be merged (${f.name})`);_p("e"+i++,f,r)}let o=r.shaderParts.get(me.FRAGMENT_HEAD),u=r.shaderParts.get(me.FRAGMENT_MAIN_IMAGE),c=r.shaderParts.get(me.FRAGMENT_MAIN_UV);const d=/\bblend\b/g;for(const f of r.blendModes.values())o+=f.getShaderCode().replace(d,`blend${f.blendFunction}`)+`
|
|
272
|
+
`;(r.attributes&Zt.DEPTH)!==0?(r.readDepth&&(u=`float depth = readDepth(UV);
|
|
273
|
+
|
|
274
|
+
`+u),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,r.colorSpace===Ke&&(u+=`color0 = sRGBToLinear(color0);
|
|
275
|
+
`),r.uvTransformation?(c=`vec2 transformedUv = vUv;
|
|
276
|
+
`+c,r.defines.set("UV","transformedUv")):r.defines.set("UV","vUv"),r.shaderParts.set(me.FRAGMENT_HEAD,o),r.shaderParts.set(me.FRAGMENT_MAIN_IMAGE,u),r.shaderParts.set(me.FRAGMENT_MAIN_UV,c);for(const[f,g]of r.shaderParts)g!==null&&r.shaderParts.set(f,g.trim().replace(/^#/,`
|
|
277
|
+
#`));this.skipRendering=i===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(r)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(r,i=$n){this.fullscreenMaterial.depthBuffer=r,this.fullscreenMaterial.depthPacking=i;for(const o of this.effects)o.setDepthTexture(r,i)}render(r,i,o,u,c){for(const d of this.effects)d.update(r,i,u);if(!this.skipRendering||this.renderToScreen){const d=this.fullscreenMaterial;d.inputBuffer=i.texture,d.time+=u*this.timeScale,r.setRenderTarget(this.renderToScreen?null:o),r.render(this.scene,this.camera)}}setSize(r,i){this.fullscreenMaterial.setSize(r,i);for(const o of this.effects)o.setSize(r,i)}initialize(r,i,o){this.renderer=r;for(const u of this.effects)u.initialize(r,i,o);this.updateMaterial(),o!==void 0&&o!==fn&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const r of this.effects)r.removeEventListener("change",this.listener),r.dispose()}handleEvent(r){switch(r.type){case"change":this.recompile();break}}},Ep=class extends ot{constructor(r,i,{renderTarget:o,resolutionScale:u=1,width:c=Xe.AUTO_SIZE,height:d=Xe.AUTO_SIZE,resolutionX:f=c,resolutionY:g=d}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new Xu(r,i,new Wf);const _=this.renderPass;_.ignoreBackground=!0,_.skipShadowMapUpdate=!0;const S=_.getClearPass();S.overrideClearColor=new Go(7829503),S.overrideClearAlpha=1,this.renderTarget=o,this.renderTarget===void 0&&(this.renderTarget=new Rt(1,1,{minFilter:ki,magFilter:ki}),this.renderTarget.texture.name="NormalPass.Target");const h=this.resolution=new Xe(this,f,g,u);h.addEventListener("change",m=>this.setSize(h.baseWidth,h.baseHeight))}set mainScene(r){this.renderPass.mainScene=r}set mainCamera(r){this.renderPass.mainCamera=r}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}render(r,i,o,u,c){const d=this.renderToScreen?null:this.renderTarget;this.renderPass.render(r,d,d)}setSize(r,i){const o=this.resolution;o.setBaseSize(r,i),this.renderTarget.setSize(o.width,o.height)}};const Sp=I.createContext(null),_u=r=>(r.getAttributes()&Zt.CONVOLUTION)===Zt.CONVOLUTION,Dp=Do.memo(I.forwardRef(({children:r,camera:i,scene:o,resolutionScale:u,enabled:c=!0,renderPriority:d=1,autoClear:f=!0,depthBuffer:g,enableNormalPass:_,stencilBuffer:S,multisampling:h=8,frameBufferType:m=Kf},x)=>{const{gl:E,scene:O,camera:A,size:L}=Ot(),v=o||O,y=i||A,[C,U,z]=I.useMemo(()=>{const Y=qd(),j=new dh(E,{depthBuffer:g,stencilBuffer:S,multisampling:h>0&&Y?h:0,frameBufferType:m});j.addPass(new Xu(v,y));let X=null,B=null;return _&&(B=new Ep(v,y),B.enabled=!1,j.addPass(B),u!==void 0&&Y&&(X=new pp({normalBuffer:B.texture,resolutionScale:u}),X.enabled=!1,j.addPass(X))),[j,B,X]},[y,E,g,S,h,m,v,_,u]);I.useEffect(()=>C?.setSize(L.width,L.height),[C,L]),ji((Y,j)=>{if(c){const X=E.autoClear;E.autoClear=f,S&&!f&&E.clearStencil(),C.render(j),E.autoClear=X}},c?d:0);const N=I.useRef(null);I.useLayoutEffect(()=>{var Y;const j=[],X=(Y=N.current)==null?void 0:Y.__r3f;if(X&&C){const B=X.objects;for(let ee=0;ee<B.length;ee++){const ge=B[ee];if(ge instanceof Fo){const Ie=[ge];if(!_u(ge)){let Ue=null;for(;(Ue=B[ee+1])instanceof Fo&&!_u(Ue);)Ie.push(Ue),ee++}const ce=new yp(y,...Ie);j.push(ce)}else ge instanceof ot&&j.push(ge)}for(const ee of j)C?.addPass(ee);U&&(U.enabled=!0),z&&(z.enabled=!0)}return()=>{for(const B of j)C?.removePass(B);U&&(U.enabled=!1),z&&(z.enabled=!1)}},[C,r,y,U,z]),I.useEffect(()=>{const Y=E.toneMapping;return E.toneMapping=Su,()=>{E.toneMapping=Y}},[E]);const H=I.useMemo(()=>({composer:C,normalPass:U,downSamplingPass:z,resolutionScale:u,camera:y,scene:v}),[C,U,z,u,y,v]);return I.useImperativeHandle(x,()=>C,[C]),st.jsx(Sp.Provider,{value:H,children:st.jsx("group",{ref:N,children:r})})}));let Tp=0;const yu=new WeakMap,xp=(r,i)=>Do.forwardRef(function({blendFunction:u=i?.blendFunction,opacity:c=i?.opacity,...d},f){let g=yu.get(r);if(!g){const h=`@react-three/postprocessing/${r.name}-${Tp++}`;Wo({[h]:r}),yu.set(r,g=h)}const _=Ot(h=>h.camera),S=Do.useMemo(()=>{var h,m;return[...(h=i?.args)!=null?h:[],...(m=d.args)!=null?m:[{...i,...d}]]},[JSON.stringify(d)]);return st.jsx(g,{camera:_,"blendMode-blendFunction":u,"blendMode-opacity-value":c,...d,ref:f,args:S})}),zp=xp(cp,{blendFunction:ue.ADD});export{zp as B,Pp as C,Dp as E,Rp as H,Mp as S,Ot as a,Op as b,qf as c,ji as u};
|